]>
Commit | Line | Data |
---|---|---|
223e47cc LB |
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 | // This class prints an Hexagon MCInst to a .s file. | |
11 | // | |
12 | //===----------------------------------------------------------------------===// | |
13 | ||
1a4d82fc JJ |
14 | #ifndef LLVM_LIB_TARGET_HEXAGON_INSTPRINTER_HEXAGONINSTPRINTER_H |
15 | #define LLVM_LIB_TARGET_HEXAGON_INSTPRINTER_HEXAGONINSTPRINTER_H | |
223e47cc | 16 | |
223e47cc | 17 | #include "llvm/MC/MCInstPrinter.h" |
970d7e83 | 18 | #include "llvm/MC/MCInstrInfo.h" |
223e47cc LB |
19 | |
20 | namespace llvm { | |
970d7e83 LB |
21 | class HexagonMCInst; |
22 | ||
223e47cc LB |
23 | class HexagonInstPrinter : public MCInstPrinter { |
24 | public: | |
25 | explicit HexagonInstPrinter(const MCAsmInfo &MAI, | |
26 | const MCInstrInfo &MII, | |
27 | const MCRegisterInfo &MRI) | |
970d7e83 | 28 | : MCInstPrinter(MAI, MII, MRI), MII(MII) {} |
223e47cc | 29 | |
1a4d82fc | 30 | void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot) override; |
223e47cc LB |
31 | void printInst(const HexagonMCInst *MI, raw_ostream &O, StringRef Annot); |
32 | virtual StringRef getOpcodeName(unsigned Opcode) const; | |
33 | void printInstruction(const MCInst *MI, raw_ostream &O); | |
34 | StringRef getRegName(unsigned RegNo) const; | |
35 | static const char *getRegisterName(unsigned RegNo); | |
36 | ||
37 | void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) const; | |
38 | void printImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) const; | |
39 | void printExtOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) const; | |
40 | void printUnsignedImmOperand(const MCInst *MI, unsigned OpNo, | |
41 | raw_ostream &O) const; | |
42 | void printNegImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) | |
43 | const; | |
44 | void printNOneImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) | |
45 | const; | |
46 | void printMEMriOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) | |
47 | const; | |
48 | void printFrameIndexOperand(const MCInst *MI, unsigned OpNo, | |
49 | raw_ostream &O) const; | |
50 | void printBranchOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) | |
51 | const; | |
52 | void printCallOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) | |
53 | const; | |
54 | void printAbsAddrOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) | |
55 | const; | |
56 | void printPredicateOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) | |
57 | const; | |
58 | void printGlobalOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) | |
59 | const; | |
60 | void printJumpTable(const MCInst *MI, unsigned OpNo, raw_ostream &O) const; | |
61 | ||
62 | void printConstantPool(const MCInst *MI, unsigned OpNo, | |
63 | raw_ostream &O) const; | |
64 | ||
65 | void printSymbolHi(const MCInst *MI, unsigned OpNo, raw_ostream &O) const | |
66 | { printSymbol(MI, OpNo, O, true); } | |
67 | void printSymbolLo(const MCInst *MI, unsigned OpNo, raw_ostream &O) const | |
68 | { printSymbol(MI, OpNo, O, false); } | |
69 | ||
970d7e83 LB |
70 | const MCInstrInfo &getMII() const { |
71 | return MII; | |
72 | } | |
73 | ||
223e47cc LB |
74 | protected: |
75 | void printSymbol(const MCInst *MI, unsigned OpNo, raw_ostream &O, bool hi) | |
76 | const; | |
970d7e83 LB |
77 | |
78 | static const char PacketPadding; | |
79 | ||
80 | private: | |
81 | const MCInstrInfo &MII; | |
82 | ||
223e47cc LB |
83 | }; |
84 | ||
85 | } // end namespace llvm | |
86 | ||
87 | #endif |