• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //==- X86ATTInstPrinter.h - Convert X86 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 X86 MCInst to AT&T style .s file syntax.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_X86_INSTPRINTER_X86ATTINSTPRINTER_H
15 #define LLVM_LIB_TARGET_X86_INSTPRINTER_X86ATTINSTPRINTER_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 X86ATTInstPrinter final : public MCInstPrinter {
25 public:
X86ATTInstPrinter(const MCAsmInfo & MAI,const MCInstrInfo & MII,const MCRegisterInfo & MRI)26   X86ATTInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
27                     const MCRegisterInfo &MRI)
28       : MCInstPrinter(MAI, MII, MRI) {}
29 
30   void printRegName(raw_ostream &OS, unsigned RegNo) const override;
31   void printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot,
32                  const MCSubtargetInfo &STI) override;
33 
34   // Autogenerated by tblgen, returns true if we successfully printed an
35   // alias.
36   bool printAliasInstr(const MCInst *MI, raw_ostream &OS);
37   void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
38                                unsigned PrintMethodIdx, raw_ostream &O);
39 
40   // Autogenerated by tblgen.
41   void printInstruction(const MCInst *MI, raw_ostream &OS);
42   static const char *getRegisterName(unsigned RegNo);
43 
44   void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
45   void printMemReference(const MCInst *MI, unsigned Op, raw_ostream &OS);
46   void printSSEAVXCC(const MCInst *MI, unsigned Op, raw_ostream &OS);
47   void printXOPCC(const MCInst *MI, unsigned Op, raw_ostream &OS);
48   void printPCRelImm(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
49   void printSrcIdx(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
50   void printDstIdx(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
51   void printMemOffset(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
52   void printRoundingControl(const MCInst *MI, unsigned Op, raw_ostream &OS);
53   void printU8Imm(const MCInst *MI, unsigned Op, raw_ostream &OS);
54 
printanymem(const MCInst * MI,unsigned OpNo,raw_ostream & O)55   void printanymem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
56     printMemReference(MI, OpNo, O);
57   }
58 
printopaquemem(const MCInst * MI,unsigned OpNo,raw_ostream & O)59   void printopaquemem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
60     printMemReference(MI, OpNo, O);
61   }
62 
printi8mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)63   void printi8mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
64     printMemReference(MI, OpNo, O);
65   }
printi16mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)66   void printi16mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
67     printMemReference(MI, OpNo, O);
68   }
printi32mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)69   void printi32mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
70     printMemReference(MI, OpNo, O);
71   }
printi64mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)72   void printi64mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
73     printMemReference(MI, OpNo, O);
74   }
printi128mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)75   void printi128mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
76     printMemReference(MI, OpNo, O);
77   }
printi256mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)78   void printi256mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
79     printMemReference(MI, OpNo, O);
80   }
printi512mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)81   void printi512mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
82     printMemReference(MI, OpNo, O);
83   }
printf32mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)84   void printf32mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
85     printMemReference(MI, OpNo, O);
86   }
printf64mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)87   void printf64mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
88     printMemReference(MI, OpNo, O);
89   }
printf80mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)90   void printf80mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
91     printMemReference(MI, OpNo, O);
92   }
printf128mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)93   void printf128mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
94     printMemReference(MI, OpNo, O);
95   }
printf256mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)96   void printf256mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
97     printMemReference(MI, OpNo, O);
98   }
printf512mem(const MCInst * MI,unsigned OpNo,raw_ostream & O)99   void printf512mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
100     printMemReference(MI, OpNo, O);
101   }
102 
printSrcIdx8(const MCInst * MI,unsigned OpNo,raw_ostream & O)103   void printSrcIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
104     printSrcIdx(MI, OpNo, O);
105   }
printSrcIdx16(const MCInst * MI,unsigned OpNo,raw_ostream & O)106   void printSrcIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
107     printSrcIdx(MI, OpNo, O);
108   }
printSrcIdx32(const MCInst * MI,unsigned OpNo,raw_ostream & O)109   void printSrcIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
110     printSrcIdx(MI, OpNo, O);
111   }
printSrcIdx64(const MCInst * MI,unsigned OpNo,raw_ostream & O)112   void printSrcIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
113     printSrcIdx(MI, OpNo, O);
114   }
printDstIdx8(const MCInst * MI,unsigned OpNo,raw_ostream & O)115   void printDstIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
116     printDstIdx(MI, OpNo, O);
117   }
printDstIdx16(const MCInst * MI,unsigned OpNo,raw_ostream & O)118   void printDstIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
119     printDstIdx(MI, OpNo, O);
120   }
printDstIdx32(const MCInst * MI,unsigned OpNo,raw_ostream & O)121   void printDstIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
122     printDstIdx(MI, OpNo, O);
123   }
printDstIdx64(const MCInst * MI,unsigned OpNo,raw_ostream & O)124   void printDstIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
125     printDstIdx(MI, OpNo, O);
126   }
printMemOffs8(const MCInst * MI,unsigned OpNo,raw_ostream & O)127   void printMemOffs8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
128     printMemOffset(MI, OpNo, O);
129   }
printMemOffs16(const MCInst * MI,unsigned OpNo,raw_ostream & O)130   void printMemOffs16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
131     printMemOffset(MI, OpNo, O);
132   }
printMemOffs32(const MCInst * MI,unsigned OpNo,raw_ostream & O)133   void printMemOffs32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
134     printMemOffset(MI, OpNo, O);
135   }
printMemOffs64(const MCInst * MI,unsigned OpNo,raw_ostream & O)136   void printMemOffs64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
137     printMemOffset(MI, OpNo, O);
138   }
139 
140 private:
141   bool HasCustomInstComment;
142 };
143 }
144 
145 #endif
146