1*9880d681SAndroid Build Coastguard Worker //==- X86ATTInstPrinter.h - Convert X86 MCInst to assembly syntax -*- C++ -*-=// 2*9880d681SAndroid Build Coastguard Worker // 3*9880d681SAndroid Build Coastguard Worker // The LLVM Compiler Infrastructure 4*9880d681SAndroid Build Coastguard Worker // 5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source 6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details. 7*9880d681SAndroid Build Coastguard Worker // 8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===// 9*9880d681SAndroid Build Coastguard Worker // 10*9880d681SAndroid Build Coastguard Worker // This class prints an X86 MCInst to AT&T style .s file syntax. 11*9880d681SAndroid Build Coastguard Worker // 12*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===// 13*9880d681SAndroid Build Coastguard Worker 14*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_LIB_TARGET_X86_INSTPRINTER_X86ATTINSTPRINTER_H 15*9880d681SAndroid Build Coastguard Worker #define LLVM_LIB_TARGET_X86_INSTPRINTER_X86ATTINSTPRINTER_H 16*9880d681SAndroid Build Coastguard Worker 17*9880d681SAndroid Build Coastguard Worker #include "llvm/MC/MCInstPrinter.h" 18*9880d681SAndroid Build Coastguard Worker 19*9880d681SAndroid Build Coastguard Worker namespace llvm { 20*9880d681SAndroid Build Coastguard Worker 21*9880d681SAndroid Build Coastguard Worker class X86ATTInstPrinter final : public MCInstPrinter { 22*9880d681SAndroid Build Coastguard Worker public: X86ATTInstPrinter(const MCAsmInfo & MAI,const MCInstrInfo & MII,const MCRegisterInfo & MRI)23*9880d681SAndroid Build Coastguard Worker X86ATTInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, 24*9880d681SAndroid Build Coastguard Worker const MCRegisterInfo &MRI) 25*9880d681SAndroid Build Coastguard Worker : MCInstPrinter(MAI, MII, MRI) {} 26*9880d681SAndroid Build Coastguard Worker 27*9880d681SAndroid Build Coastguard Worker void printRegName(raw_ostream &OS, unsigned RegNo) const override; 28*9880d681SAndroid Build Coastguard Worker void printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot, 29*9880d681SAndroid Build Coastguard Worker const MCSubtargetInfo &STI) override; 30*9880d681SAndroid Build Coastguard Worker 31*9880d681SAndroid Build Coastguard Worker // Autogenerated by tblgen, returns true if we successfully printed an 32*9880d681SAndroid Build Coastguard Worker // alias. 33*9880d681SAndroid Build Coastguard Worker bool printAliasInstr(const MCInst *MI, raw_ostream &OS); 34*9880d681SAndroid Build Coastguard Worker void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx, 35*9880d681SAndroid Build Coastguard Worker unsigned PrintMethodIdx, raw_ostream &O); 36*9880d681SAndroid Build Coastguard Worker 37*9880d681SAndroid Build Coastguard Worker // Autogenerated by tblgen. 38*9880d681SAndroid Build Coastguard Worker void printInstruction(const MCInst *MI, raw_ostream &OS); 39*9880d681SAndroid Build Coastguard Worker static const char *getRegisterName(unsigned RegNo); 40*9880d681SAndroid Build Coastguard Worker 41*9880d681SAndroid Build Coastguard Worker void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &OS); 42*9880d681SAndroid Build Coastguard Worker void printMemReference(const MCInst *MI, unsigned Op, raw_ostream &OS); 43*9880d681SAndroid Build Coastguard Worker void printSSEAVXCC(const MCInst *MI, unsigned Op, raw_ostream &OS); 44*9880d681SAndroid Build Coastguard Worker void printXOPCC(const MCInst *MI, unsigned Op, raw_ostream &OS); 45*9880d681SAndroid Build Coastguard Worker void printPCRelImm(const MCInst *MI, unsigned OpNo, raw_ostream &OS); 46*9880d681SAndroid Build Coastguard Worker void printSrcIdx(const MCInst *MI, unsigned OpNo, raw_ostream &OS); 47*9880d681SAndroid Build Coastguard Worker void printDstIdx(const MCInst *MI, unsigned OpNo, raw_ostream &OS); 48*9880d681SAndroid Build Coastguard Worker void printMemOffset(const MCInst *MI, unsigned OpNo, raw_ostream &OS); 49*9880d681SAndroid Build Coastguard Worker void printRoundingControl(const MCInst *MI, unsigned Op, raw_ostream &OS); 50*9880d681SAndroid Build Coastguard Worker void printU8Imm(const MCInst *MI, unsigned Op, raw_ostream &OS); 51*9880d681SAndroid Build Coastguard Worker printanymem(const MCInst * MI,unsigned OpNo,raw_ostream & O)52*9880d681SAndroid Build Coastguard Worker void printanymem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 53*9880d681SAndroid Build Coastguard Worker printMemReference(MI, OpNo, O); 54*9880d681SAndroid Build Coastguard Worker } 55*9880d681SAndroid Build Coastguard Worker printopaquemem(const MCInst * MI,unsigned OpNo,raw_ostream & O)56*9880d681SAndroid Build Coastguard Worker void printopaquemem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 57*9880d681SAndroid Build Coastguard Worker printMemReference(MI, OpNo, O); 58*9880d681SAndroid Build Coastguard Worker } 59*9880d681SAndroid Build Coastguard Worker printi8mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)60*9880d681SAndroid Build Coastguard Worker void printi8mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 61*9880d681SAndroid Build Coastguard Worker printMemReference(MI, OpNo, O); 62*9880d681SAndroid Build Coastguard Worker } printi16mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)63*9880d681SAndroid Build Coastguard Worker void printi16mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 64*9880d681SAndroid Build Coastguard Worker printMemReference(MI, OpNo, O); 65*9880d681SAndroid Build Coastguard Worker } printi32mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)66*9880d681SAndroid Build Coastguard Worker void printi32mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 67*9880d681SAndroid Build Coastguard Worker printMemReference(MI, OpNo, O); 68*9880d681SAndroid Build Coastguard Worker } printi64mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)69*9880d681SAndroid Build Coastguard Worker void printi64mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 70*9880d681SAndroid Build Coastguard Worker printMemReference(MI, OpNo, O); 71*9880d681SAndroid Build Coastguard Worker } printi128mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)72*9880d681SAndroid Build Coastguard Worker void printi128mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 73*9880d681SAndroid Build Coastguard Worker printMemReference(MI, OpNo, O); 74*9880d681SAndroid Build Coastguard Worker } printi256mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)75*9880d681SAndroid Build Coastguard Worker void printi256mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 76*9880d681SAndroid Build Coastguard Worker printMemReference(MI, OpNo, O); 77*9880d681SAndroid Build Coastguard Worker } printi512mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)78*9880d681SAndroid Build Coastguard Worker void printi512mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 79*9880d681SAndroid Build Coastguard Worker printMemReference(MI, OpNo, O); 80*9880d681SAndroid Build Coastguard Worker } printf32mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)81*9880d681SAndroid Build Coastguard Worker void printf32mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 82*9880d681SAndroid Build Coastguard Worker printMemReference(MI, OpNo, O); 83*9880d681SAndroid Build Coastguard Worker } printf64mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)84*9880d681SAndroid Build Coastguard Worker void printf64mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 85*9880d681SAndroid Build Coastguard Worker printMemReference(MI, OpNo, O); 86*9880d681SAndroid Build Coastguard Worker } printf80mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)87*9880d681SAndroid Build Coastguard Worker void printf80mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 88*9880d681SAndroid Build Coastguard Worker printMemReference(MI, OpNo, O); 89*9880d681SAndroid Build Coastguard Worker } printf128mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)90*9880d681SAndroid Build Coastguard Worker void printf128mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 91*9880d681SAndroid Build Coastguard Worker printMemReference(MI, OpNo, O); 92*9880d681SAndroid Build Coastguard Worker } printf256mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)93*9880d681SAndroid Build Coastguard Worker void printf256mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 94*9880d681SAndroid Build Coastguard Worker printMemReference(MI, OpNo, O); 95*9880d681SAndroid Build Coastguard Worker } printf512mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)96*9880d681SAndroid Build Coastguard Worker void printf512mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 97*9880d681SAndroid Build Coastguard Worker printMemReference(MI, OpNo, O); 98*9880d681SAndroid Build Coastguard Worker } 99*9880d681SAndroid Build Coastguard Worker printSrcIdx8(const MCInst * MI,unsigned OpNo,raw_ostream & O)100*9880d681SAndroid Build Coastguard Worker void printSrcIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 101*9880d681SAndroid Build Coastguard Worker printSrcIdx(MI, OpNo, O); 102*9880d681SAndroid Build Coastguard Worker } printSrcIdx16(const MCInst * MI,unsigned OpNo,raw_ostream & O)103*9880d681SAndroid Build Coastguard Worker void printSrcIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 104*9880d681SAndroid Build Coastguard Worker printSrcIdx(MI, OpNo, O); 105*9880d681SAndroid Build Coastguard Worker } printSrcIdx32(const MCInst * MI,unsigned OpNo,raw_ostream & O)106*9880d681SAndroid Build Coastguard Worker void printSrcIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 107*9880d681SAndroid Build Coastguard Worker printSrcIdx(MI, OpNo, O); 108*9880d681SAndroid Build Coastguard Worker } printSrcIdx64(const MCInst * MI,unsigned OpNo,raw_ostream & O)109*9880d681SAndroid Build Coastguard Worker void printSrcIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 110*9880d681SAndroid Build Coastguard Worker printSrcIdx(MI, OpNo, O); 111*9880d681SAndroid Build Coastguard Worker } printDstIdx8(const MCInst * MI,unsigned OpNo,raw_ostream & O)112*9880d681SAndroid Build Coastguard Worker void printDstIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 113*9880d681SAndroid Build Coastguard Worker printDstIdx(MI, OpNo, O); 114*9880d681SAndroid Build Coastguard Worker } printDstIdx16(const MCInst * MI,unsigned OpNo,raw_ostream & O)115*9880d681SAndroid Build Coastguard Worker void printDstIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 116*9880d681SAndroid Build Coastguard Worker printDstIdx(MI, OpNo, O); 117*9880d681SAndroid Build Coastguard Worker } printDstIdx32(const MCInst * MI,unsigned OpNo,raw_ostream & O)118*9880d681SAndroid Build Coastguard Worker void printDstIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 119*9880d681SAndroid Build Coastguard Worker printDstIdx(MI, OpNo, O); 120*9880d681SAndroid Build Coastguard Worker } printDstIdx64(const MCInst * MI,unsigned OpNo,raw_ostream & O)121*9880d681SAndroid Build Coastguard Worker void printDstIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 122*9880d681SAndroid Build Coastguard Worker printDstIdx(MI, OpNo, O); 123*9880d681SAndroid Build Coastguard Worker } printMemOffs8(const MCInst * MI,unsigned OpNo,raw_ostream & O)124*9880d681SAndroid Build Coastguard Worker void printMemOffs8(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 125*9880d681SAndroid Build Coastguard Worker printMemOffset(MI, OpNo, O); 126*9880d681SAndroid Build Coastguard Worker } printMemOffs16(const MCInst * MI,unsigned OpNo,raw_ostream & O)127*9880d681SAndroid Build Coastguard Worker void printMemOffs16(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 128*9880d681SAndroid Build Coastguard Worker printMemOffset(MI, OpNo, O); 129*9880d681SAndroid Build Coastguard Worker } printMemOffs32(const MCInst * MI,unsigned OpNo,raw_ostream & O)130*9880d681SAndroid Build Coastguard Worker void printMemOffs32(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 131*9880d681SAndroid Build Coastguard Worker printMemOffset(MI, OpNo, O); 132*9880d681SAndroid Build Coastguard Worker } printMemOffs64(const MCInst * MI,unsigned OpNo,raw_ostream & O)133*9880d681SAndroid Build Coastguard Worker void printMemOffs64(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 134*9880d681SAndroid Build Coastguard Worker printMemOffset(MI, OpNo, O); 135*9880d681SAndroid Build Coastguard Worker } 136*9880d681SAndroid Build Coastguard Worker 137*9880d681SAndroid Build Coastguard Worker private: 138*9880d681SAndroid Build Coastguard Worker bool HasCustomInstComment; 139*9880d681SAndroid Build Coastguard Worker }; 140*9880d681SAndroid Build Coastguard Worker } 141*9880d681SAndroid Build Coastguard Worker 142*9880d681SAndroid Build Coastguard Worker #endif 143