LLVM  10.0.0svn
X86IntelInstPrinter.h
Go to the documentation of this file.
1 //= X86IntelInstPrinter.h - Convert X86 MCInst to assembly syntax -*- C++ -*-=//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This class prints an X86 MCInst to Intel style .s file syntax.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_X86_MCTARGETDESC_X86INTELINSTPRINTER_H
14 #define LLVM_LIB_TARGET_X86_MCTARGETDESC_X86INTELINSTPRINTER_H
15 
16 #include "X86InstPrinterCommon.h"
18 
19 namespace llvm {
20 
22 public:
24  const MCRegisterInfo &MRI)
25  : X86InstPrinterCommon(MAI, MII, MRI) {}
26 
27  void printRegName(raw_ostream &OS, unsigned RegNo) const override;
28  void printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot,
29  const MCSubtargetInfo &STI) override;
30  bool printVecCompareInstr(const MCInst *MI, raw_ostream &OS);
31 
32  // Autogenerated by tblgen, returns true if we successfully printed an
33  // alias.
34  bool printAliasInstr(const MCInst *MI, raw_ostream &OS);
35  void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
36  unsigned PrintMethodIdx, raw_ostream &O);
37 
38  // Autogenerated by tblgen.
39  void printInstruction(const MCInst *MI, raw_ostream &O);
40  static const char *getRegisterName(unsigned RegNo);
41 
42  void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) override;
43  void printMemReference(const MCInst *MI, unsigned Op, raw_ostream &O);
44  void printMemOffset(const MCInst *MI, unsigned OpNo, raw_ostream &O);
45  void printSrcIdx(const MCInst *MI, unsigned OpNo, raw_ostream &O);
46  void printDstIdx(const MCInst *MI, unsigned OpNo, raw_ostream &O);
47  void printU8Imm(const MCInst *MI, unsigned Op, raw_ostream &O);
48  void printSTiRegOperand(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
49 
50  void printanymem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
51  printMemReference(MI, OpNo, O);
52  }
53 
54  void printopaquemem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
55  printMemReference(MI, OpNo, O);
56  }
57 
58  void printbytemem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
59  O << "byte ptr ";
60  printMemReference(MI, OpNo, O);
61  }
62  void printwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
63  O << "word ptr ";
64  printMemReference(MI, OpNo, O);
65  }
66  void printdwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
67  O << "dword ptr ";
68  printMemReference(MI, OpNo, O);
69  }
70  void printqwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
71  O << "qword ptr ";
72  printMemReference(MI, OpNo, O);
73  }
74  void printxmmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
75  O << "xmmword ptr ";
76  printMemReference(MI, OpNo, O);
77  }
78  void printymmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
79  O << "ymmword ptr ";
80  printMemReference(MI, OpNo, O);
81  }
82  void printzmmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
83  O << "zmmword ptr ";
84  printMemReference(MI, OpNo, O);
85  }
86  void printtbytemem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
87  O << "tbyte ptr ";
88  printMemReference(MI, OpNo, O);
89  }
90 
91 
92  void printSrcIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
93  O << "byte ptr ";
94  printSrcIdx(MI, OpNo, O);
95  }
96  void printSrcIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
97  O << "word ptr ";
98  printSrcIdx(MI, OpNo, O);
99  }
100  void printSrcIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
101  O << "dword ptr ";
102  printSrcIdx(MI, OpNo, O);
103  }
104  void printSrcIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
105  O << "qword ptr ";
106  printSrcIdx(MI, OpNo, O);
107  }
108  void printDstIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
109  O << "byte ptr ";
110  printDstIdx(MI, OpNo, O);
111  }
112  void printDstIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
113  O << "word ptr ";
114  printDstIdx(MI, OpNo, O);
115  }
116  void printDstIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
117  O << "dword ptr ";
118  printDstIdx(MI, OpNo, O);
119  }
120  void printDstIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
121  O << "qword ptr ";
122  printDstIdx(MI, OpNo, O);
123  }
124  void printMemOffs8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
125  O << "byte ptr ";
126  printMemOffset(MI, OpNo, O);
127  }
128  void printMemOffs16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
129  O << "word ptr ";
130  printMemOffset(MI, OpNo, O);
131  }
132  void printMemOffs32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
133  O << "dword ptr ";
134  printMemOffset(MI, OpNo, O);
135  }
136  void printMemOffs64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
137  O << "qword ptr ";
138  printMemOffset(MI, OpNo, O);
139  }
140 };
141 
142 } // end namespace llvm
143 
144 #endif // LLVM_LIB_TARGET_X86_MCTARGETDESC_X86INTELINSTPRINTER_H
void printSrcIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx, unsigned PrintMethodIdx, raw_ostream &O)
void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) override
void printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot, const MCSubtargetInfo &STI) override
Print the specified MCInst to the specified raw_ostream.
void printtbytemem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printdwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
This class represents lattice values for constants.
Definition: AllocatorList.h:23
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 printRegName(raw_ostream &OS, unsigned RegNo) const override
Print the assembler register name.
void printDstIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O)
bool printVecCompareInstr(const MCInst *MI, raw_ostream &OS)
void printbytemem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printymmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printMemOffs32(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:158
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 printqwordmem(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:23
static const char * getRegisterName(unsigned RegNo)
void printDstIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printMemOffs16(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printU8Imm(const MCInst *MI, unsigned Op, raw_ostream &O)
void printzmmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printSrcIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printopaquemem(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:45
Generic base class for all target subtargets.
const MCInstrInfo & MII
Definition: MCInstPrinter.h:46
void printMemOffs8(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:45
IRTranslator LLVM IR MI
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
bool printAliasInstr(const MCInst *MI, raw_ostream &OS)
void printxmmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
const MCRegisterInfo & MRI
Definition: MCInstPrinter.h:47