LLVM  12.0.0git
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, uint64_t Address, StringRef Annot,
29  const MCSubtargetInfo &STI, raw_ostream &OS) 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, uint64_t Address, raw_ostream &OS);
35  void printCustomAliasOperand(const MCInst *MI, uint64_t Address,
36  unsigned OpIdx, unsigned PrintMethodIdx,
37  raw_ostream &O);
38 
39  // Autogenerated by tblgen.
40  void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
41  static const char *getRegisterName(unsigned RegNo);
42 
43  void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) override;
44  void printMemReference(const MCInst *MI, unsigned Op, raw_ostream &O);
45  void printMemOffset(const MCInst *MI, unsigned OpNo, raw_ostream &O);
46  void printSrcIdx(const MCInst *MI, unsigned OpNo, raw_ostream &O);
47  void printDstIdx(const MCInst *MI, unsigned OpNo, raw_ostream &O);
48  void printU8Imm(const MCInst *MI, unsigned Op, raw_ostream &O);
49  void printSTiRegOperand(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
50 
51  void printbytemem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
52  O << "byte ptr ";
53  printMemReference(MI, OpNo, O);
54  }
55  void printwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
56  O << "word ptr ";
57  printMemReference(MI, OpNo, O);
58  }
59  void printdwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
60  O << "dword ptr ";
61  printMemReference(MI, OpNo, O);
62  }
63  void printqwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
64  O << "qword ptr ";
65  printMemReference(MI, OpNo, O);
66  }
67  void printxmmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
68  O << "xmmword ptr ";
69  printMemReference(MI, OpNo, O);
70  }
71  void printymmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
72  O << "ymmword ptr ";
73  printMemReference(MI, OpNo, O);
74  }
75  void printzmmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
76  O << "zmmword ptr ";
77  printMemReference(MI, OpNo, O);
78  }
79  void printtbytemem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
80  O << "tbyte ptr ";
81  printMemReference(MI, OpNo, O);
82  }
83 
84 
85  void printSrcIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
86  O << "byte ptr ";
87  printSrcIdx(MI, OpNo, O);
88  }
89  void printSrcIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
90  O << "word ptr ";
91  printSrcIdx(MI, OpNo, O);
92  }
93  void printSrcIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
94  O << "dword ptr ";
95  printSrcIdx(MI, OpNo, O);
96  }
97  void printSrcIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
98  O << "qword ptr ";
99  printSrcIdx(MI, OpNo, O);
100  }
101  void printDstIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
102  O << "byte ptr ";
103  printDstIdx(MI, OpNo, O);
104  }
105  void printDstIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
106  O << "word ptr ";
107  printDstIdx(MI, OpNo, O);
108  }
109  void printDstIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
110  O << "dword ptr ";
111  printDstIdx(MI, OpNo, O);
112  }
113  void printDstIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
114  O << "qword ptr ";
115  printDstIdx(MI, OpNo, O);
116  }
117  void printMemOffs8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
118  O << "byte ptr ";
119  printMemOffset(MI, OpNo, O);
120  }
121  void printMemOffs16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
122  O << "word ptr ";
123  printMemOffset(MI, OpNo, O);
124  }
125  void printMemOffs32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
126  O << "dword ptr ";
127  printMemOffset(MI, OpNo, O);
128  }
129  void printMemOffs64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
130  O << "qword ptr ";
131  printMemOffset(MI, OpNo, O);
132  }
133 };
134 
135 } // end namespace llvm
136 
137 #endif // LLVM_LIB_TARGET_X86_MCTARGETDESC_X86INTELINSTPRINTER_H
void printSrcIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) override
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 printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O)
void printSrcIdx(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printMemOffset(const MCInst *MI, unsigned OpNo, raw_ostream &O)
bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &OS)
void printDstIdx32(const MCInst *MI, unsigned OpNo, 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)
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:25
void printInst(const MCInst *MI, uint64_t Address, StringRef Annot, const MCSubtargetInfo &STI, raw_ostream &OS) override
Print the specified MCInst to the specified raw_ostream.
static const char * getRegisterName(unsigned RegNo)
void printDstIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printCustomAliasOperand(const MCInst *MI, uint64_t Address, unsigned OpIdx, unsigned PrintMethodIdx, 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 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:48
Generic base class for all target subtargets.
const MCInstrInfo & MII
Definition: MCInstPrinter.h:49
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:46
IRTranslator LLVM IR MI
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
void printxmmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
const MCRegisterInfo & MRI
Definition: MCInstPrinter.h:50