LLVM  8.0.1
X86IntelInstPrinter.h
Go to the documentation of this file.
1 //= X86IntelInstPrinter.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 Intel style .s file syntax.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_X86_INSTPRINTER_X86INTELINSTPRINTER_H
15 #define LLVM_LIB_TARGET_X86_INSTPRINTER_X86INTELINSTPRINTER_H
16 
17 #include "X86InstPrinterCommon.h"
19 
20 namespace llvm {
21 
23 public:
25  const MCRegisterInfo &MRI)
26  : X86InstPrinterCommon(MAI, MII, MRI) {}
27 
28  void printRegName(raw_ostream &OS, unsigned RegNo) const override;
29  void printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot,
30  const MCSubtargetInfo &STI) override;
31 
32  // Autogenerated by tblgen.
33  void printInstruction(const MCInst *MI, raw_ostream &O);
34  static const char *getRegisterName(unsigned RegNo);
35 
36  void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) override;
37  void printMemReference(const MCInst *MI, unsigned Op, raw_ostream &O);
38  void printMemOffset(const MCInst *MI, unsigned OpNo, raw_ostream &O);
39  void printSrcIdx(const MCInst *MI, unsigned OpNo, raw_ostream &O);
40  void printDstIdx(const MCInst *MI, unsigned OpNo, raw_ostream &O);
41  void printU8Imm(const MCInst *MI, unsigned Op, raw_ostream &O);
42  void printSTiRegOperand(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
43 
44  void printanymem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
45  printMemReference(MI, OpNo, O);
46  }
47 
48  void printopaquemem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
49  printMemReference(MI, OpNo, O);
50  }
51 
52  void printi8mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
53  O << "byte ptr ";
54  printMemReference(MI, OpNo, O);
55  }
56  void printi16mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
57  O << "word ptr ";
58  printMemReference(MI, OpNo, O);
59  }
60  void printi32mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
61  O << "dword ptr ";
62  printMemReference(MI, OpNo, O);
63  }
64  void printi64mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
65  O << "qword ptr ";
66  printMemReference(MI, OpNo, O);
67  }
68  void printi128mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
69  O << "xmmword ptr ";
70  printMemReference(MI, OpNo, O);
71  }
72  void printi256mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
73  O << "ymmword ptr ";
74  printMemReference(MI, OpNo, O);
75  }
76  void printi512mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
77  O << "zmmword ptr ";
78  printMemReference(MI, OpNo, O);
79  }
80  void printf32mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
81  O << "dword ptr ";
82  printMemReference(MI, OpNo, O);
83  }
84  void printf64mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
85  O << "qword ptr ";
86  printMemReference(MI, OpNo, O);
87  }
88  void printf80mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
89  O << "tbyte ptr ";
90  printMemReference(MI, OpNo, O);
91  }
92  void printf128mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
93  O << "xmmword ptr ";
94  printMemReference(MI, OpNo, O);
95  }
96  void printf256mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
97  O << "ymmword ptr ";
98  printMemReference(MI, OpNo, O);
99  }
100  void printf512mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
101  O << "zmmword ptr ";
102  printMemReference(MI, OpNo, O);
103  }
104 
105 
106  void printSrcIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
107  O << "byte ptr ";
108  printSrcIdx(MI, OpNo, O);
109  }
110  void printSrcIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
111  O << "word ptr ";
112  printSrcIdx(MI, OpNo, O);
113  }
114  void printSrcIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
115  O << "dword ptr ";
116  printSrcIdx(MI, OpNo, O);
117  }
118  void printSrcIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
119  O << "qword ptr ";
120  printSrcIdx(MI, OpNo, O);
121  }
122  void printDstIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
123  O << "byte ptr ";
124  printDstIdx(MI, OpNo, O);
125  }
126  void printDstIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
127  O << "word ptr ";
128  printDstIdx(MI, OpNo, O);
129  }
130  void printDstIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
131  O << "dword ptr ";
132  printDstIdx(MI, OpNo, O);
133  }
134  void printDstIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
135  O << "qword ptr ";
136  printDstIdx(MI, OpNo, O);
137  }
138  void printMemOffs8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
139  O << "byte ptr ";
140  printMemOffset(MI, OpNo, O);
141  }
142  void printMemOffs16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
143  O << "word ptr ";
144  printMemOffset(MI, OpNo, O);
145  }
146  void printMemOffs32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
147  O << "dword ptr ";
148  printMemOffset(MI, OpNo, O);
149  }
150  void printMemOffs64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
151  O << "qword ptr ";
152  printMemOffset(MI, OpNo, O);
153  }
154 };
155 
156 } // end namespace llvm
157 
158 #endif // LLVM_LIB_TARGET_X86_INSTPRINTER_X86INTELINSTPRINTER_H
void printSrcIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) override
void printi64mem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot, const MCSubtargetInfo &STI) override
Print the specified MCInst to the specified raw_ostream.
void printi512mem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
This class represents lattice values for constants.
Definition: AllocatorList.h:24
void printSrcIdx(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printMemOffset(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printDstIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printInstruction(const MCInst *MI, raw_ostream &O)
void printSrcIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printi16mem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printRegName(raw_ostream &OS, unsigned RegNo) const override
Print the assembler register name.
void printDstIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printi128mem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printf128mem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printMemOffs32(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printf512mem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:161
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
void printi32mem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printanymem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:24
static const char * getRegisterName(unsigned RegNo)
void printDstIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printf64mem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printMemOffs16(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printf80mem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printU8Imm(const MCInst *MI, unsigned Op, raw_ostream &O)
void printSrcIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printopaquemem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printi8mem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printMemReference(const MCInst *MI, unsigned Op, raw_ostream &O)
void printSTiRegOperand(const MCInst *MI, unsigned OpNo, raw_ostream &OS)
void printMemOffs64(const MCInst *MI, unsigned OpNo, raw_ostream &O)
X86IntelInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
const MCAsmInfo & MAI
Definition: MCInstPrinter.h:46
void printf256mem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Generic base class for all target subtargets.
const MCInstrInfo & MII
Definition: MCInstPrinter.h:47
void printMemOffs8(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printf32mem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printDstIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printSrcIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printDstIdx(const MCInst *MI, unsigned OpNo, raw_ostream &O)
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46
IRTranslator LLVM IR MI
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
const MCRegisterInfo & MRI
Definition: MCInstPrinter.h:48
void printi256mem(const MCInst *MI, unsigned OpNo, raw_ostream &O)