1 //===- ARMInstPrinter.h - Convert ARM MCInst to assembly syntax -*- C++ -*-===// 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 LLVM_LIB_TARGET_ARM_INSTPRINTER_ARMINSTPRINTER_H 15 #define LLVM_LIB_TARGET_ARM_INSTPRINTER_ARMINSTPRINTER_H 16 17 #include "llvm/MC/MCInstPrinter.h" 18 19 namespace llvm { 20 21 class ARMInstPrinter : public MCInstPrinter { 22 public: 23 ARMInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, 24 const MCRegisterInfo &MRI); 25 26 void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot, 27 const MCSubtargetInfo &STI) override; 28 void printRegName(raw_ostream &OS, unsigned RegNo) const override; 29 30 // Autogenerated by tblgen. 31 void printInstruction(const MCInst *MI, const MCSubtargetInfo &STI, 32 raw_ostream &O); 33 virtual bool printAliasInstr(const MCInst *MI, const MCSubtargetInfo &STI, 34 raw_ostream &O); 35 virtual void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx, 36 unsigned PrintMethodIdx, 37 const MCSubtargetInfo &STI, 38 raw_ostream &O); 39 static const char *getRegisterName(unsigned RegNo); 40 41 void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, 42 raw_ostream &O); 43 44 void printSORegRegOperand(const MCInst *MI, unsigned OpNum, 45 const MCSubtargetInfo &STI, raw_ostream &O); 46 void printSORegImmOperand(const MCInst *MI, unsigned OpNum, 47 const MCSubtargetInfo &STI, raw_ostream &O); 48 49 void printAddrModeTBB(const MCInst *MI, unsigned OpNum, 50 const MCSubtargetInfo &STI, raw_ostream &O); 51 void printAddrModeTBH(const MCInst *MI, unsigned OpNum, 52 const MCSubtargetInfo &STI, raw_ostream &O); 53 void printAddrMode2Operand(const MCInst *MI, unsigned OpNum, 54 const MCSubtargetInfo &STI, raw_ostream &O); 55 void printAM2PostIndexOp(const MCInst *MI, unsigned OpNum, 56 const MCSubtargetInfo &STI, raw_ostream &O); 57 void printAM2PreOrOffsetIndexOp(const MCInst *MI, unsigned OpNum, 58 const MCSubtargetInfo &STI, raw_ostream &O); 59 void printAddrMode2OffsetOperand(const MCInst *MI, unsigned OpNum, 60 const MCSubtargetInfo &STI, raw_ostream &O); 61 template <bool AlwaysPrintImm0> 62 void printAddrMode3Operand(const MCInst *MI, unsigned OpNum, 63 const MCSubtargetInfo &STI, raw_ostream &O); 64 void printAddrMode3OffsetOperand(const MCInst *MI, unsigned OpNum, 65 const MCSubtargetInfo &STI, raw_ostream &O); 66 void printAM3PreOrOffsetIndexOp(const MCInst *MI, unsigned Op, raw_ostream &O, 67 bool AlwaysPrintImm0); 68 void printPostIdxImm8Operand(const MCInst *MI, unsigned OpNum, 69 const MCSubtargetInfo &STI, raw_ostream &O); 70 void printPostIdxRegOperand(const MCInst *MI, unsigned OpNum, 71 const MCSubtargetInfo &STI, raw_ostream &O); 72 void printPostIdxImm8s4Operand(const MCInst *MI, unsigned OpNum, 73 const MCSubtargetInfo &STI, raw_ostream &O); 74 75 void printLdStmModeOperand(const MCInst *MI, unsigned OpNum, 76 const MCSubtargetInfo &STI, raw_ostream &O); 77 template <bool AlwaysPrintImm0> 78 void printAddrMode5Operand(const MCInst *MI, unsigned OpNum, 79 const MCSubtargetInfo &STI, raw_ostream &O); 80 template <bool AlwaysPrintImm0> 81 void printAddrMode5FP16Operand(const MCInst *MI, unsigned OpNum, 82 const MCSubtargetInfo &STI, raw_ostream &O); 83 void printAddrMode6Operand(const MCInst *MI, unsigned OpNum, 84 const MCSubtargetInfo &STI, raw_ostream &O); 85 void printAddrMode7Operand(const MCInst *MI, unsigned OpNum, 86 const MCSubtargetInfo &STI, raw_ostream &O); 87 void printAddrMode6OffsetOperand(const MCInst *MI, unsigned OpNum, 88 const MCSubtargetInfo &STI, raw_ostream &O); 89 90 void printBitfieldInvMaskImmOperand(const MCInst *MI, unsigned OpNum, 91 const MCSubtargetInfo &STI, 92 raw_ostream &O); 93 void printMemBOption(const MCInst *MI, unsigned OpNum, 94 const MCSubtargetInfo &STI, raw_ostream &O); 95 void printInstSyncBOption(const MCInst *MI, unsigned OpNum, 96 const MCSubtargetInfo &STI, raw_ostream &O); 97 void printShiftImmOperand(const MCInst *MI, unsigned OpNum, 98 const MCSubtargetInfo &STI, raw_ostream &O); 99 void printPKHLSLShiftImm(const MCInst *MI, unsigned OpNum, 100 const MCSubtargetInfo &STI, raw_ostream &O); 101 void printPKHASRShiftImm(const MCInst *MI, unsigned OpNum, 102 const MCSubtargetInfo &STI, raw_ostream &O); 103 104 template <unsigned scale> 105 void printAdrLabelOperand(const MCInst *MI, unsigned OpNum, 106 const MCSubtargetInfo &STI, raw_ostream &O); 107 void printThumbS4ImmOperand(const MCInst *MI, unsigned OpNum, 108 const MCSubtargetInfo &STI, raw_ostream &O); 109 void printThumbSRImm(const MCInst *MI, unsigned OpNum, 110 const MCSubtargetInfo &STI, raw_ostream &O); 111 void printThumbITMask(const MCInst *MI, unsigned OpNum, 112 const MCSubtargetInfo &STI, raw_ostream &O); 113 void printThumbAddrModeRROperand(const MCInst *MI, unsigned OpNum, 114 const MCSubtargetInfo &STI, raw_ostream &O); 115 void printThumbAddrModeImm5SOperand(const MCInst *MI, unsigned OpNum, 116 const MCSubtargetInfo &STI, 117 raw_ostream &O, unsigned Scale); 118 void printThumbAddrModeImm5S1Operand(const MCInst *MI, unsigned OpNum, 119 const MCSubtargetInfo &STI, 120 raw_ostream &O); 121 void printThumbAddrModeImm5S2Operand(const MCInst *MI, unsigned OpNum, 122 const MCSubtargetInfo &STI, 123 raw_ostream &O); 124 void printThumbAddrModeImm5S4Operand(const MCInst *MI, unsigned OpNum, 125 const MCSubtargetInfo &STI, 126 raw_ostream &O); 127 void printThumbAddrModeSPOperand(const MCInst *MI, unsigned OpNum, 128 const MCSubtargetInfo &STI, raw_ostream &O); 129 130 void printT2SOOperand(const MCInst *MI, unsigned OpNum, 131 const MCSubtargetInfo &STI, raw_ostream &O); 132 template <bool AlwaysPrintImm0> 133 void printAddrModeImm12Operand(const MCInst *MI, unsigned OpNum, 134 const MCSubtargetInfo &STI, raw_ostream &O); 135 template <bool AlwaysPrintImm0> 136 void printT2AddrModeImm8Operand(const MCInst *MI, unsigned OpNum, 137 const MCSubtargetInfo &STI, raw_ostream &O); 138 template <bool AlwaysPrintImm0> 139 void printT2AddrModeImm8s4Operand(const MCInst *MI, unsigned OpNum, 140 const MCSubtargetInfo &STI, raw_ostream &O); 141 void printT2AddrModeImm0_1020s4Operand(const MCInst *MI, unsigned OpNum, 142 const MCSubtargetInfo &STI, 143 raw_ostream &O); 144 void printT2AddrModeImm8OffsetOperand(const MCInst *MI, unsigned OpNum, 145 const MCSubtargetInfo &STI, 146 raw_ostream &O); 147 void printT2AddrModeImm8s4OffsetOperand(const MCInst *MI, unsigned OpNum, 148 const MCSubtargetInfo &STI, 149 raw_ostream &O); 150 void printT2AddrModeSoRegOperand(const MCInst *MI, unsigned OpNum, 151 const MCSubtargetInfo &STI, raw_ostream &O); 152 153 void printSetendOperand(const MCInst *MI, unsigned OpNum, 154 const MCSubtargetInfo &STI, raw_ostream &O); 155 void printCPSIMod(const MCInst *MI, unsigned OpNum, 156 const MCSubtargetInfo &STI, raw_ostream &O); 157 void printCPSIFlag(const MCInst *MI, unsigned OpNum, 158 const MCSubtargetInfo &STI, raw_ostream &O); 159 void printMSRMaskOperand(const MCInst *MI, unsigned OpNum, 160 const MCSubtargetInfo &STI, raw_ostream &O); 161 void printBankedRegOperand(const MCInst *MI, unsigned OpNum, 162 const MCSubtargetInfo &STI, raw_ostream &O); 163 void printPredicateOperand(const MCInst *MI, unsigned OpNum, 164 const MCSubtargetInfo &STI, raw_ostream &O); 165 void printMandatoryPredicateOperand(const MCInst *MI, unsigned OpNum, 166 const MCSubtargetInfo &STI, 167 raw_ostream &O); 168 void printSBitModifierOperand(const MCInst *MI, unsigned OpNum, 169 const MCSubtargetInfo &STI, raw_ostream &O); 170 void printRegisterList(const MCInst *MI, unsigned OpNum, 171 const MCSubtargetInfo &STI, raw_ostream &O); 172 void printNoHashImmediate(const MCInst *MI, unsigned OpNum, 173 const MCSubtargetInfo &STI, raw_ostream &O); 174 void printPImmediate(const MCInst *MI, unsigned OpNum, 175 const MCSubtargetInfo &STI, raw_ostream &O); 176 void printCImmediate(const MCInst *MI, unsigned OpNum, 177 const MCSubtargetInfo &STI, raw_ostream &O); 178 void printCoprocOptionImm(const MCInst *MI, unsigned OpNum, 179 const MCSubtargetInfo &STI, raw_ostream &O); 180 void printFPImmOperand(const MCInst *MI, unsigned OpNum, 181 const MCSubtargetInfo &STI, raw_ostream &O); 182 void printNEONModImmOperand(const MCInst *MI, unsigned OpNum, 183 const MCSubtargetInfo &STI, raw_ostream &O); 184 void printImmPlusOneOperand(const MCInst *MI, unsigned OpNum, 185 const MCSubtargetInfo &STI, raw_ostream &O); 186 void printRotImmOperand(const MCInst *MI, unsigned OpNum, 187 const MCSubtargetInfo &STI, raw_ostream &O); 188 void printModImmOperand(const MCInst *MI, unsigned OpNum, 189 const MCSubtargetInfo &STI, raw_ostream &O); 190 void printGPRPairOperand(const MCInst *MI, unsigned OpNum, 191 const MCSubtargetInfo &STI, raw_ostream &O); 192 193 void printPCLabel(const MCInst *MI, unsigned OpNum, 194 const MCSubtargetInfo &STI, raw_ostream &O); 195 void printThumbLdrLabelOperand(const MCInst *MI, unsigned OpNum, 196 const MCSubtargetInfo &STI, raw_ostream &O); 197 void printFBits16(const MCInst *MI, unsigned OpNum, 198 const MCSubtargetInfo &STI, raw_ostream &O); 199 void printFBits32(const MCInst *MI, unsigned OpNum, 200 const MCSubtargetInfo &STI, raw_ostream &O); 201 void printVectorIndex(const MCInst *MI, unsigned OpNum, 202 const MCSubtargetInfo &STI, raw_ostream &O); 203 void printVectorListOne(const MCInst *MI, unsigned OpNum, 204 const MCSubtargetInfo &STI, raw_ostream &O); 205 void printVectorListTwo(const MCInst *MI, unsigned OpNum, 206 const MCSubtargetInfo &STI, raw_ostream &O); 207 void printVectorListTwoSpaced(const MCInst *MI, unsigned OpNum, 208 const MCSubtargetInfo &STI, raw_ostream &O); 209 void printVectorListThree(const MCInst *MI, unsigned OpNum, 210 const MCSubtargetInfo &STI, raw_ostream &O); 211 void printVectorListFour(const MCInst *MI, unsigned OpNum, 212 const MCSubtargetInfo &STI, raw_ostream &O); 213 void printVectorListOneAllLanes(const MCInst *MI, unsigned OpNum, 214 const MCSubtargetInfo &STI, raw_ostream &O); 215 void printVectorListTwoAllLanes(const MCInst *MI, unsigned OpNum, 216 const MCSubtargetInfo &STI, raw_ostream &O); 217 void printVectorListThreeAllLanes(const MCInst *MI, unsigned OpNum, 218 const MCSubtargetInfo &STI, raw_ostream &O); 219 void printVectorListFourAllLanes(const MCInst *MI, unsigned OpNum, 220 const MCSubtargetInfo &STI, raw_ostream &O); 221 void printVectorListTwoSpacedAllLanes(const MCInst *MI, unsigned OpNum, 222 const MCSubtargetInfo &STI, 223 raw_ostream &O); 224 void printVectorListThreeSpacedAllLanes(const MCInst *MI, unsigned OpNum, 225 const MCSubtargetInfo &STI, 226 raw_ostream &O); 227 void printVectorListFourSpacedAllLanes(const MCInst *MI, unsigned OpNum, 228 const MCSubtargetInfo &STI, 229 raw_ostream &O); 230 void printVectorListThreeSpaced(const MCInst *MI, unsigned OpNum, 231 const MCSubtargetInfo &STI, raw_ostream &O); 232 void printVectorListFourSpaced(const MCInst *MI, unsigned OpNum, 233 const MCSubtargetInfo &STI, raw_ostream &O); 234 }; 235 236 } // end namespace llvm 237 238 #endif 239