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 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 void printPostIdxImm8Operand(const MCInst *MI, unsigned OpNum, 57 raw_ostream &O); 58 void printPostIdxRegOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 59 void printPostIdxImm8s4Operand(const MCInst *MI, unsigned OpNum, 60 raw_ostream &O); 61 62 void printLdStmModeOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 63 void printAddrMode5Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 64 void printAddrMode6Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 65 void printAddrMode7Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 66 void printAddrMode6OffsetOperand(const MCInst *MI, unsigned OpNum, 67 raw_ostream &O); 68 69 void printBitfieldInvMaskImmOperand(const MCInst *MI, unsigned OpNum, 70 raw_ostream &O); 71 void printMemBOption(const MCInst *MI, unsigned OpNum, raw_ostream &O); 72 void printShiftImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 73 void printPKHLSLShiftImm(const MCInst *MI, unsigned OpNum, raw_ostream &O); 74 void printPKHASRShiftImm(const MCInst *MI, unsigned OpNum, raw_ostream &O); 75 76 void printAdrLabelOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 77 void printThumbS4ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 78 void printThumbSRImm(const MCInst *MI, unsigned OpNum, raw_ostream &O); 79 void printThumbITMask(const MCInst *MI, unsigned OpNum, raw_ostream &O); 80 void printThumbAddrModeRROperand(const MCInst *MI, unsigned OpNum, 81 raw_ostream &O); 82 void printThumbAddrModeImm5SOperand(const MCInst *MI, unsigned OpNum, 83 raw_ostream &O, unsigned Scale); 84 void printThumbAddrModeImm5S1Operand(const MCInst *MI, unsigned OpNum, 85 raw_ostream &O); 86 void printThumbAddrModeImm5S2Operand(const MCInst *MI, unsigned OpNum, 87 raw_ostream &O); 88 void printThumbAddrModeImm5S4Operand(const MCInst *MI, unsigned OpNum, 89 raw_ostream &O); 90 void printThumbAddrModeSPOperand(const MCInst *MI, unsigned OpNum, 91 raw_ostream &O); 92 93 void printT2SOOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 94 void printAddrModeImm12Operand(const MCInst *MI, unsigned OpNum, 95 raw_ostream &O); 96 void printT2AddrModeImm8Operand(const MCInst *MI, unsigned OpNum, 97 raw_ostream &O); 98 void printT2AddrModeImm8s4Operand(const MCInst *MI, unsigned OpNum, 99 raw_ostream &O); 100 void printT2AddrModeImm0_1020s4Operand(const MCInst *MI, unsigned OpNum, 101 raw_ostream &O); 102 void printT2AddrModeImm8OffsetOperand(const MCInst *MI, unsigned OpNum, 103 raw_ostream &O); 104 void printT2AddrModeImm8s4OffsetOperand(const MCInst *MI, unsigned OpNum, 105 raw_ostream &O); 106 void printT2AddrModeSoRegOperand(const MCInst *MI, unsigned OpNum, 107 raw_ostream &O); 108 109 void printSetendOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 110 void printCPSIMod(const MCInst *MI, unsigned OpNum, raw_ostream &O); 111 void printCPSIFlag(const MCInst *MI, unsigned OpNum, raw_ostream &O); 112 void printMSRMaskOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 113 void printPredicateOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 114 void printMandatoryPredicateOperand(const MCInst *MI, unsigned OpNum, 115 raw_ostream &O); 116 void printSBitModifierOperand(const MCInst *MI, unsigned OpNum, 117 raw_ostream &O); 118 void printRegisterList(const MCInst *MI, unsigned OpNum, raw_ostream &O); 119 void printNoHashImmediate(const MCInst *MI, unsigned OpNum, raw_ostream &O); 120 void printPImmediate(const MCInst *MI, unsigned OpNum, raw_ostream &O); 121 void printCImmediate(const MCInst *MI, unsigned OpNum, raw_ostream &O); 122 void printCoprocOptionImm(const MCInst *MI, unsigned OpNum, raw_ostream &O); 123 void printFPImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 124 void printNEONModImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 125 void printImmPlusOneOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 126 void printRotImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 127 void printGPRPairOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 128 129 void printPCLabel(const MCInst *MI, unsigned OpNum, raw_ostream &O); 130 void printThumbLdrLabelOperand(const MCInst *MI, unsigned OpNum, 131 raw_ostream &O); 132 void printFBits16(const MCInst *MI, unsigned OpNum, raw_ostream &O); 133 void printFBits32(const MCInst *MI, unsigned OpNum, raw_ostream &O); 134 void printVectorIndex(const MCInst *MI, unsigned OpNum, raw_ostream &O); 135 void printVectorListOne(const MCInst *MI, unsigned OpNum, raw_ostream &O); 136 void printVectorListTwo(const MCInst *MI, unsigned OpNum, raw_ostream &O); 137 void printVectorListTwoSpaced(const MCInst *MI, unsigned OpNum, 138 raw_ostream &O); 139 void printVectorListThree(const MCInst *MI, unsigned OpNum, raw_ostream &O); 140 void printVectorListFour(const MCInst *MI, unsigned OpNum, raw_ostream &O); 141 void printVectorListOneAllLanes(const MCInst *MI, unsigned OpNum, 142 raw_ostream &O); 143 void printVectorListTwoAllLanes(const MCInst *MI, unsigned OpNum, 144 raw_ostream &O); 145 void printVectorListThreeAllLanes(const MCInst *MI, unsigned OpNum, 146 raw_ostream &O); 147 void printVectorListFourAllLanes(const MCInst *MI, unsigned OpNum, 148 raw_ostream &O); 149 void printVectorListTwoSpacedAllLanes(const MCInst *MI, unsigned OpNum, 150 raw_ostream &O); 151 void printVectorListThreeSpacedAllLanes(const MCInst *MI, unsigned OpNum, 152 raw_ostream &O); 153 void printVectorListFourSpacedAllLanes(const MCInst *MI, unsigned OpNum, 154 raw_ostream &O); 155 void printVectorListThreeSpaced(const MCInst *MI, unsigned OpNum, 156 raw_ostream &O); 157 void printVectorListFourSpaced(const MCInst *MI, unsigned OpNum, 158 raw_ostream &O); 159 }; 160 161 } // end namespace llvm 162 163 #endif 164