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 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 MCInstrInfo &MII, 27 const MCRegisterInfo &MRI, const MCSubtargetInfo &STI); 28 29 virtual void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot); 30 virtual void printRegName(raw_ostream &OS, unsigned RegNo) const; 31 32 // Autogenerated by tblgen. 33 void printInstruction(const MCInst *MI, raw_ostream &O); 34 static const char *getRegisterName(unsigned RegNo); 35 36 37 void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); 38 39 void printSORegRegOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 40 void printSORegImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 41 42 void printAddrModeTBB(const MCInst *MI, unsigned OpNum, raw_ostream &O); 43 void printAddrModeTBH(const MCInst *MI, unsigned OpNum, raw_ostream &O); 44 void printAddrMode2Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 45 void printAM2PostIndexOp(const MCInst *MI, unsigned OpNum, raw_ostream &O); 46 void printAM2PreOrOffsetIndexOp(const MCInst *MI, unsigned OpNum, 47 raw_ostream &O); 48 void printAddrMode2OffsetOperand(const MCInst *MI, unsigned OpNum, 49 raw_ostream &O); 50 template <bool AlwaysPrintImm0> 51 void printAddrMode3Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 52 void printAddrMode3OffsetOperand(const MCInst *MI, unsigned OpNum, 53 raw_ostream &O); 54 void printAM3PostIndexOp(const MCInst *MI, unsigned Op, raw_ostream &O); 55 void printAM3PreOrOffsetIndexOp(const MCInst *MI, unsigned Op, raw_ostream &O, 56 bool AlwaysPrintImm0); 57 void printPostIdxImm8Operand(const MCInst *MI, unsigned OpNum, 58 raw_ostream &O); 59 void printPostIdxRegOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 60 void printPostIdxImm8s4Operand(const MCInst *MI, unsigned OpNum, 61 raw_ostream &O); 62 63 void printLdStmModeOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 64 template <bool AlwaysPrintImm0> 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 printInstSyncBOption(const MCInst *MI, unsigned OpNum, raw_ostream &O); 75 void printShiftImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 76 void printPKHLSLShiftImm(const MCInst *MI, unsigned OpNum, raw_ostream &O); 77 void printPKHASRShiftImm(const MCInst *MI, unsigned OpNum, raw_ostream &O); 78 79 template <unsigned scale> 80 void printAdrLabelOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 81 void printThumbS4ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 82 void printThumbSRImm(const MCInst *MI, unsigned OpNum, raw_ostream &O); 83 void printThumbITMask(const MCInst *MI, unsigned OpNum, raw_ostream &O); 84 void printThumbAddrModeRROperand(const MCInst *MI, unsigned OpNum, 85 raw_ostream &O); 86 void printThumbAddrModeImm5SOperand(const MCInst *MI, unsigned OpNum, 87 raw_ostream &O, unsigned Scale); 88 void printThumbAddrModeImm5S1Operand(const MCInst *MI, unsigned OpNum, 89 raw_ostream &O); 90 void printThumbAddrModeImm5S2Operand(const MCInst *MI, unsigned OpNum, 91 raw_ostream &O); 92 void printThumbAddrModeImm5S4Operand(const MCInst *MI, unsigned OpNum, 93 raw_ostream &O); 94 void printThumbAddrModeSPOperand(const MCInst *MI, unsigned OpNum, 95 raw_ostream &O); 96 97 void printT2SOOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 98 template<bool AlwaysPrintImm0> 99 void printAddrModeImm12Operand(const MCInst *MI, unsigned OpNum, 100 raw_ostream &O); 101 template<bool AlwaysPrintImm0> 102 void printT2AddrModeImm8Operand(const MCInst *MI, unsigned OpNum, 103 raw_ostream &O); 104 template<bool AlwaysPrintImm0> 105 void printT2AddrModeImm8s4Operand(const MCInst *MI, unsigned OpNum, 106 raw_ostream &O); 107 void printT2AddrModeImm0_1020s4Operand(const MCInst *MI, unsigned OpNum, 108 raw_ostream &O); 109 void printT2AddrModeImm8OffsetOperand(const MCInst *MI, unsigned OpNum, 110 raw_ostream &O); 111 void printT2AddrModeImm8s4OffsetOperand(const MCInst *MI, unsigned OpNum, 112 raw_ostream &O); 113 void printT2AddrModeSoRegOperand(const MCInst *MI, unsigned OpNum, 114 raw_ostream &O); 115 116 void printSetendOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 117 void printCPSIMod(const MCInst *MI, unsigned OpNum, raw_ostream &O); 118 void printCPSIFlag(const MCInst *MI, unsigned OpNum, raw_ostream &O); 119 void printMSRMaskOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 120 void printPredicateOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 121 void printMandatoryPredicateOperand(const MCInst *MI, unsigned OpNum, 122 raw_ostream &O); 123 void printSBitModifierOperand(const MCInst *MI, unsigned OpNum, 124 raw_ostream &O); 125 void printRegisterList(const MCInst *MI, unsigned OpNum, raw_ostream &O); 126 void printNoHashImmediate(const MCInst *MI, unsigned OpNum, raw_ostream &O); 127 void printPImmediate(const MCInst *MI, unsigned OpNum, raw_ostream &O); 128 void printCImmediate(const MCInst *MI, unsigned OpNum, raw_ostream &O); 129 void printCoprocOptionImm(const MCInst *MI, unsigned OpNum, raw_ostream &O); 130 void printFPImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 131 void printNEONModImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 132 void printImmPlusOneOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 133 void printRotImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 134 void printGPRPairOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 135 136 void printPCLabel(const MCInst *MI, unsigned OpNum, raw_ostream &O); 137 void printThumbLdrLabelOperand(const MCInst *MI, unsigned OpNum, 138 raw_ostream &O); 139 void printFBits16(const MCInst *MI, unsigned OpNum, raw_ostream &O); 140 void printFBits32(const MCInst *MI, unsigned OpNum, raw_ostream &O); 141 void printVectorIndex(const MCInst *MI, unsigned OpNum, raw_ostream &O); 142 void printVectorListOne(const MCInst *MI, unsigned OpNum, raw_ostream &O); 143 void printVectorListTwo(const MCInst *MI, unsigned OpNum, raw_ostream &O); 144 void printVectorListTwoSpaced(const MCInst *MI, unsigned OpNum, 145 raw_ostream &O); 146 void printVectorListThree(const MCInst *MI, unsigned OpNum, raw_ostream &O); 147 void printVectorListFour(const MCInst *MI, unsigned OpNum, raw_ostream &O); 148 void printVectorListOneAllLanes(const MCInst *MI, unsigned OpNum, 149 raw_ostream &O); 150 void printVectorListTwoAllLanes(const MCInst *MI, unsigned OpNum, 151 raw_ostream &O); 152 void printVectorListThreeAllLanes(const MCInst *MI, unsigned OpNum, 153 raw_ostream &O); 154 void printVectorListFourAllLanes(const MCInst *MI, unsigned OpNum, 155 raw_ostream &O); 156 void printVectorListTwoSpacedAllLanes(const MCInst *MI, unsigned OpNum, 157 raw_ostream &O); 158 void printVectorListThreeSpacedAllLanes(const MCInst *MI, unsigned OpNum, 159 raw_ostream &O); 160 void printVectorListFourSpacedAllLanes(const MCInst *MI, unsigned OpNum, 161 raw_ostream &O); 162 void printVectorListThreeSpaced(const MCInst *MI, unsigned OpNum, 163 raw_ostream &O); 164 void printVectorListFourSpaced(const MCInst *MI, unsigned OpNum, 165 raw_ostream &O); 166 }; 167 168 } // end namespace llvm 169 170 #endif 171