LLVM  8.0.1
HexagonInstPrinter.h
Go to the documentation of this file.
1 //===-- HexagonInstPrinter.h - Convert Hexagon MCInst to assembly syntax --===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_HEXAGON_INSTPRINTER_HEXAGONINSTPRINTER_H
14 #define LLVM_LIB_TARGET_HEXAGON_INSTPRINTER_HEXAGONINSTPRINTER_H
15 
16 #include "llvm/MC/MCInstPrinter.h"
17 
18 namespace llvm {
19 /// Prints bundles as a newline separated list of individual instructions
20 /// Duplexes are separated by a vertical tab \v character
21 /// A trailing line includes bundle properties such as endloop0/1
22 ///
23 /// r0 = add(r1, r2)
24 /// r0 = #0 \v jump 0x0
25 /// :endloop0 :endloop1
27 public:
28  explicit HexagonInstPrinter(MCAsmInfo const &MAI, MCInstrInfo const &MII,
29  MCRegisterInfo const &MRI)
30  : MCInstPrinter(MAI, MII, MRI), MII(MII) {}
31 
32  void printInst(MCInst const *MI, raw_ostream &O, StringRef Annot,
33  const MCSubtargetInfo &STI) override;
34  void printRegName(raw_ostream &O, unsigned RegNo) const override;
35 
36  static char const *getRegisterName(unsigned RegNo);
37 
38  void printInstruction(MCInst const *MI, raw_ostream &O);
39  void printOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;
40  void printBrtarget(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;
41 
42  MCAsmInfo const &getMAI() const { return MAI; }
43  MCInstrInfo const &getMII() const { return MII; }
44 
45 private:
46  MCInstrInfo const &MII;
47  bool HasExtender = false;
48 };
49 
50 } // end namespace llvm
51 
52 #endif
MCAsmInfo const & getMAI() const
void printRegName(raw_ostream &O, unsigned RegNo) const override
Print the assembler register name.
This class represents lattice values for constants.
Definition: AllocatorList.h:24
void printBrtarget(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
MCInstrInfo const & getMII() const
void printInst(MCInst const *MI, raw_ostream &O, StringRef Annot, const MCSubtargetInfo &STI) override
Print the specified MCInst to the specified raw_ostream.
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:161
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:24
Prints bundles as a newline separated list of individual instructions Duplexes are separated by a ver...
void printInstruction(MCInst const *MI, raw_ostream &O)
const MCAsmInfo & MAI
Definition: MCInstPrinter.h:46
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:40
Generic base class for all target subtargets.
static char const * getRegisterName(unsigned RegNo)
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46
HexagonInstPrinter(MCAsmInfo const &MAI, MCInstrInfo const &MII, MCRegisterInfo const &MRI)
IRTranslator LLVM IR MI
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
void printOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
const MCRegisterInfo & MRI
Definition: MCInstPrinter.h:48