• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- ARMInstPrinter.h - Convert ARM 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 ARM MCInst to a .s file.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef ARMINSTPRINTER_H
15 #define ARMINSTPRINTER_H
16 
17 #include "llvm/MC/MCInstPrinter.h"
18 #include "llvm/MC/MCSubtargetInfo.h"
19 
20 namespace llvm {
21 
22 class MCOperand;
23 
24 class ARMInstPrinter : public MCInstPrinter {
25 public:
26     ARMInstPrinter(const MCAsmInfo &MAI, const MCSubtargetInfo &STI);
27 
28   virtual void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot);
29   virtual StringRef getOpcodeName(unsigned Opcode) const;
30   virtual void printRegName(raw_ostream &OS, unsigned RegNo) const;
31 
32   static const char *getInstructionName(unsigned Opcode);
33 
34   // Autogenerated by tblgen.
35   void printInstruction(const MCInst *MI, raw_ostream &O);
36   static const char *getRegisterName(unsigned RegNo);
37 
38 
39   void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
40 
41   void printSORegRegOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
42   void printSORegImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
43 
44   void printAddrModeTBB(const MCInst *MI, unsigned OpNum, raw_ostream &O);
45   void printAddrModeTBH(const MCInst *MI, unsigned OpNum, raw_ostream &O);
46   void printAddrMode2Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
47   void printAM2PostIndexOp(const MCInst *MI, unsigned OpNum, raw_ostream &O);
48   void printAM2PreOrOffsetIndexOp(const MCInst *MI, unsigned OpNum,
49                                   raw_ostream &O);
50   void printAddrMode2OffsetOperand(const MCInst *MI, unsigned OpNum,
51                                    raw_ostream &O);
52 
53   void printAddrMode3Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
54   void printAddrMode3OffsetOperand(const MCInst *MI, unsigned OpNum,
55                                    raw_ostream &O);
56   void printAM3PostIndexOp(const MCInst *MI, unsigned Op, raw_ostream &O);
57   void printAM3PreOrOffsetIndexOp(const MCInst *MI, unsigned Op,raw_ostream &O);
58   void printPostIdxImm8Operand(const MCInst *MI, unsigned OpNum,
59                                raw_ostream &O);
60   void printPostIdxRegOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
61   void printPostIdxImm8s4Operand(const MCInst *MI, unsigned OpNum,
62                                raw_ostream &O);
63 
64   void printLdStmModeOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
65   void printAddrMode5Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
66   void printAddrMode6Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
67   void printAddrMode7Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
68   void printAddrMode6OffsetOperand(const MCInst *MI, unsigned OpNum,
69                                    raw_ostream &O);
70 
71   void printBitfieldInvMaskImmOperand(const MCInst *MI, unsigned OpNum,
72                                       raw_ostream &O);
73   void printMemBOption(const MCInst *MI, unsigned OpNum, raw_ostream &O);
74   void printShiftImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
75   void printPKHLSLShiftImm(const MCInst *MI, unsigned OpNum, raw_ostream &O);
76   void printPKHASRShiftImm(const MCInst *MI, unsigned OpNum, raw_ostream &O);
77 
78   void printThumbS4ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
79   void printThumbSRImm(const MCInst *MI, unsigned OpNum, raw_ostream &O);
80   void printThumbITMask(const MCInst *MI, unsigned OpNum, raw_ostream &O);
81   void printThumbAddrModeRROperand(const MCInst *MI, unsigned OpNum,
82                                    raw_ostream &O);
83   void printThumbAddrModeImm5SOperand(const MCInst *MI, unsigned OpNum,
84                                       raw_ostream &O, unsigned Scale);
85   void printThumbAddrModeImm5S1Operand(const MCInst *MI, unsigned OpNum,
86                                        raw_ostream &O);
87   void printThumbAddrModeImm5S2Operand(const MCInst *MI, unsigned OpNum,
88                                        raw_ostream &O);
89   void printThumbAddrModeImm5S4Operand(const MCInst *MI, unsigned OpNum,
90                                        raw_ostream &O);
91   void printThumbAddrModeSPOperand(const MCInst *MI, unsigned OpNum,
92                                    raw_ostream &O);
93 
94   void printT2SOOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
95   void printAddrModeImm12Operand(const MCInst *MI, unsigned OpNum,
96                                  raw_ostream &O);
97   void printT2AddrModeImm8Operand(const MCInst *MI, unsigned OpNum,
98                                   raw_ostream &O);
99   void printT2AddrModeImm8s4Operand(const MCInst *MI, unsigned OpNum,
100                                     raw_ostream &O);
101   void printT2AddrModeImm0_1020s4Operand(const MCInst *MI, unsigned OpNum,
102                                     raw_ostream &O);
103   void printT2AddrModeImm8OffsetOperand(const MCInst *MI, unsigned OpNum,
104                                         raw_ostream &O);
105   void printT2AddrModeImm8s4OffsetOperand(const MCInst *MI, unsigned OpNum,
106                                           raw_ostream &O);
107   void printT2AddrModeSoRegOperand(const MCInst *MI, unsigned OpNum,
108                                    raw_ostream &O);
109 
110   void printSetendOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
111   void printCPSIMod(const MCInst *MI, unsigned OpNum, raw_ostream &O);
112   void printCPSIFlag(const MCInst *MI, unsigned OpNum, raw_ostream &O);
113   void printMSRMaskOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
114   void printPredicateOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
115   void printMandatoryPredicateOperand(const MCInst *MI, unsigned OpNum,
116                                       raw_ostream &O);
117   void printSBitModifierOperand(const MCInst *MI, unsigned OpNum,
118                                 raw_ostream &O);
119   void printRegisterList(const MCInst *MI, unsigned OpNum, raw_ostream &O);
120   void printNoHashImmediate(const MCInst *MI, unsigned OpNum, raw_ostream &O);
121   void printPImmediate(const MCInst *MI, unsigned OpNum, raw_ostream &O);
122   void printCImmediate(const MCInst *MI, unsigned OpNum, raw_ostream &O);
123   void printCoprocOptionImm(const MCInst *MI, unsigned OpNum, raw_ostream &O);
124   void printFPImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
125   void printNEONModImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
126   void printImmPlusOneOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
127   void printRotImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
128 
129   void printPCLabel(const MCInst *MI, unsigned OpNum, raw_ostream &O);
130   void printT2LdrLabelOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
131   void printVectorIndex(const MCInst *MI, unsigned OpNum, raw_ostream &O);
132 };
133 
134 } // end namespace llvm
135 
136 #endif
137