1234353Sdim//===- ARMInstPrinter.h - Convert ARM MCInst to assembly syntax -*- C++ -*-===// 2218885Sdim// 3218885Sdim// The LLVM Compiler Infrastructure 4218885Sdim// 5218885Sdim// This file is distributed under the University of Illinois Open Source 6218885Sdim// License. See LICENSE.TXT for details. 7218885Sdim// 8218885Sdim//===----------------------------------------------------------------------===// 9218885Sdim// 10218885Sdim// This class prints an ARM MCInst to a .s file. 11218885Sdim// 12218885Sdim//===----------------------------------------------------------------------===// 13218885Sdim 14218885Sdim#ifndef ARMINSTPRINTER_H 15218885Sdim#define ARMINSTPRINTER_H 16218885Sdim 17218885Sdim#include "llvm/MC/MCInstPrinter.h" 18226633Sdim#include "llvm/MC/MCSubtargetInfo.h" 19218885Sdim 20218885Sdimnamespace llvm { 21218885Sdim 22221345Sdimclass MCOperand; 23221345Sdim 24218885Sdimclass ARMInstPrinter : public MCInstPrinter { 25218885Sdimpublic: 26234353Sdim ARMInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, 27234353Sdim const MCRegisterInfo &MRI, const MCSubtargetInfo &STI); 28218885Sdim 29226633Sdim virtual void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot); 30223017Sdim virtual void printRegName(raw_ostream &OS, unsigned RegNo) const; 31218885Sdim 32218885Sdim // Autogenerated by tblgen. 33218885Sdim void printInstruction(const MCInst *MI, raw_ostream &O); 34218885Sdim static const char *getRegisterName(unsigned RegNo); 35218885Sdim 36218885Sdim 37218885Sdim void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); 38218885Sdim 39226633Sdim void printSORegRegOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 40226633Sdim void printSORegImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 41221345Sdim 42226633Sdim void printAddrModeTBB(const MCInst *MI, unsigned OpNum, raw_ostream &O); 43226633Sdim void printAddrModeTBH(const MCInst *MI, unsigned OpNum, raw_ostream &O); 44218885Sdim void printAddrMode2Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 45221345Sdim void printAM2PostIndexOp(const MCInst *MI, unsigned OpNum, raw_ostream &O); 46221345Sdim void printAM2PreOrOffsetIndexOp(const MCInst *MI, unsigned OpNum, 47221345Sdim raw_ostream &O); 48218885Sdim void printAddrMode2OffsetOperand(const MCInst *MI, unsigned OpNum, 49218885Sdim raw_ostream &O); 50251662Sdim template <bool AlwaysPrintImm0> 51218885Sdim void printAddrMode3Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 52218885Sdim void printAddrMode3OffsetOperand(const MCInst *MI, unsigned OpNum, 53218885Sdim raw_ostream &O); 54226633Sdim void printAM3PostIndexOp(const MCInst *MI, unsigned Op, raw_ostream &O); 55251662Sdim void printAM3PreOrOffsetIndexOp(const MCInst *MI, unsigned Op, raw_ostream &O, 56251662Sdim bool AlwaysPrintImm0); 57226633Sdim void printPostIdxImm8Operand(const MCInst *MI, unsigned OpNum, 58226633Sdim raw_ostream &O); 59226633Sdim void printPostIdxRegOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 60226633Sdim void printPostIdxImm8s4Operand(const MCInst *MI, unsigned OpNum, 61226633Sdim raw_ostream &O); 62221345Sdim 63218885Sdim void printLdStmModeOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 64251662Sdim template <bool AlwaysPrintImm0> 65218885Sdim void printAddrMode5Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 66218885Sdim void printAddrMode6Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 67221345Sdim void printAddrMode7Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 68218885Sdim void printAddrMode6OffsetOperand(const MCInst *MI, unsigned OpNum, 69218885Sdim raw_ostream &O); 70218885Sdim 71218885Sdim void printBitfieldInvMaskImmOperand(const MCInst *MI, unsigned OpNum, 72218885Sdim raw_ostream &O); 73218885Sdim void printMemBOption(const MCInst *MI, unsigned OpNum, raw_ostream &O); 74263508Sdim void printInstSyncBOption(const MCInst *MI, unsigned OpNum, raw_ostream &O); 75218885Sdim void printShiftImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 76226633Sdim void printPKHLSLShiftImm(const MCInst *MI, unsigned OpNum, raw_ostream &O); 77226633Sdim void printPKHASRShiftImm(const MCInst *MI, unsigned OpNum, raw_ostream &O); 78218885Sdim 79263508Sdim template <unsigned scale> 80239462Sdim void printAdrLabelOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 81218885Sdim void printThumbS4ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 82226633Sdim void printThumbSRImm(const MCInst *MI, unsigned OpNum, raw_ostream &O); 83218885Sdim void printThumbITMask(const MCInst *MI, unsigned OpNum, raw_ostream &O); 84218885Sdim void printThumbAddrModeRROperand(const MCInst *MI, unsigned OpNum, 85218885Sdim raw_ostream &O); 86218885Sdim void printThumbAddrModeImm5SOperand(const MCInst *MI, unsigned OpNum, 87218885Sdim raw_ostream &O, unsigned Scale); 88218885Sdim void printThumbAddrModeImm5S1Operand(const MCInst *MI, unsigned OpNum, 89218885Sdim raw_ostream &O); 90218885Sdim void printThumbAddrModeImm5S2Operand(const MCInst *MI, unsigned OpNum, 91218885Sdim raw_ostream &O); 92218885Sdim void printThumbAddrModeImm5S4Operand(const MCInst *MI, unsigned OpNum, 93218885Sdim raw_ostream &O); 94218885Sdim void printThumbAddrModeSPOperand(const MCInst *MI, unsigned OpNum, 95218885Sdim raw_ostream &O); 96218885Sdim 97218885Sdim void printT2SOOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 98251662Sdim template<bool AlwaysPrintImm0> 99218885Sdim void printAddrModeImm12Operand(const MCInst *MI, unsigned OpNum, 100218885Sdim raw_ostream &O); 101263508Sdim template<bool AlwaysPrintImm0> 102218885Sdim void printT2AddrModeImm8Operand(const MCInst *MI, unsigned OpNum, 103218885Sdim raw_ostream &O); 104263508Sdim template<bool AlwaysPrintImm0> 105218885Sdim void printT2AddrModeImm8s4Operand(const MCInst *MI, unsigned OpNum, 106218885Sdim raw_ostream &O); 107226633Sdim void printT2AddrModeImm0_1020s4Operand(const MCInst *MI, unsigned OpNum, 108226633Sdim raw_ostream &O); 109218885Sdim void printT2AddrModeImm8OffsetOperand(const MCInst *MI, unsigned OpNum, 110218885Sdim raw_ostream &O); 111218885Sdim void printT2AddrModeImm8s4OffsetOperand(const MCInst *MI, unsigned OpNum, 112218885Sdim raw_ostream &O); 113218885Sdim void printT2AddrModeSoRegOperand(const MCInst *MI, unsigned OpNum, 114218885Sdim raw_ostream &O); 115218885Sdim 116218885Sdim void printSetendOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 117218885Sdim void printCPSIMod(const MCInst *MI, unsigned OpNum, raw_ostream &O); 118218885Sdim void printCPSIFlag(const MCInst *MI, unsigned OpNum, raw_ostream &O); 119218885Sdim void printMSRMaskOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 120218885Sdim void printPredicateOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 121218885Sdim void printMandatoryPredicateOperand(const MCInst *MI, unsigned OpNum, 122218885Sdim raw_ostream &O); 123218885Sdim void printSBitModifierOperand(const MCInst *MI, unsigned OpNum, 124218885Sdim raw_ostream &O); 125218885Sdim void printRegisterList(const MCInst *MI, unsigned OpNum, raw_ostream &O); 126218885Sdim void printNoHashImmediate(const MCInst *MI, unsigned OpNum, raw_ostream &O); 127218885Sdim void printPImmediate(const MCInst *MI, unsigned OpNum, raw_ostream &O); 128218885Sdim void printCImmediate(const MCInst *MI, unsigned OpNum, raw_ostream &O); 129226633Sdim void printCoprocOptionImm(const MCInst *MI, unsigned OpNum, raw_ostream &O); 130226633Sdim void printFPImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 131218885Sdim void printNEONModImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 132226633Sdim void printImmPlusOneOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 133226633Sdim void printRotImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 134249423Sdim void printGPRPairOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); 135218885Sdim 136218885Sdim void printPCLabel(const MCInst *MI, unsigned OpNum, raw_ostream &O); 137243830Sdim void printThumbLdrLabelOperand(const MCInst *MI, unsigned OpNum, 138243830Sdim raw_ostream &O); 139234353Sdim void printFBits16(const MCInst *MI, unsigned OpNum, raw_ostream &O); 140234353Sdim void printFBits32(const MCInst *MI, unsigned OpNum, raw_ostream &O); 141226633Sdim void printVectorIndex(const MCInst *MI, unsigned OpNum, raw_ostream &O); 142234353Sdim void printVectorListOne(const MCInst *MI, unsigned OpNum, raw_ostream &O); 143234353Sdim void printVectorListTwo(const MCInst *MI, unsigned OpNum, raw_ostream &O); 144234353Sdim void printVectorListTwoSpaced(const MCInst *MI, unsigned OpNum, 145234353Sdim raw_ostream &O); 146234353Sdim void printVectorListThree(const MCInst *MI, unsigned OpNum, raw_ostream &O); 147234353Sdim void printVectorListFour(const MCInst *MI, unsigned OpNum, raw_ostream &O); 148234353Sdim void printVectorListOneAllLanes(const MCInst *MI, unsigned OpNum, 149234353Sdim raw_ostream &O); 150234353Sdim void printVectorListTwoAllLanes(const MCInst *MI, unsigned OpNum, 151234353Sdim raw_ostream &O); 152234353Sdim void printVectorListThreeAllLanes(const MCInst *MI, unsigned OpNum, 153234353Sdim raw_ostream &O); 154234353Sdim void printVectorListFourAllLanes(const MCInst *MI, unsigned OpNum, 155234353Sdim raw_ostream &O); 156234353Sdim void printVectorListTwoSpacedAllLanes(const MCInst *MI, unsigned OpNum, 157234353Sdim raw_ostream &O); 158234353Sdim void printVectorListThreeSpacedAllLanes(const MCInst *MI, unsigned OpNum, 159234353Sdim raw_ostream &O); 160234353Sdim void printVectorListFourSpacedAllLanes(const MCInst *MI, unsigned OpNum, 161234353Sdim raw_ostream &O); 162234353Sdim void printVectorListThreeSpaced(const MCInst *MI, unsigned OpNum, 163234353Sdim raw_ostream &O); 164234353Sdim void printVectorListFourSpaced(const MCInst *MI, unsigned OpNum, 165234353Sdim raw_ostream &O); 166218885Sdim}; 167218885Sdim 168218885Sdim} // end namespace llvm 169218885Sdim 170218885Sdim#endif 171