LLVM  14.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)
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  std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
41  void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
42  static const char *getRegisterName(unsigned RegNo);
43 
44  void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) override;
45  void printMemReference(const MCInst *MI, unsigned Op, raw_ostream &O);
46  void printMemOffset(const MCInst *MI, unsigned OpNo, raw_ostream &O);
47  void printSrcIdx(const MCInst *MI, unsigned OpNo, raw_ostream &O);
48  void printDstIdx(const MCInst *MI, unsigned OpNo, raw_ostream &O);
49  void printU8Imm(const MCInst *MI, unsigned Op, raw_ostream &O);
50  void printSTiRegOperand(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
51 
52  void printbytemem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
53  O << "byte ptr ";
54  printMemReference(MI, OpNo, O);
55  }
56  void printwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
57  O << "word ptr ";
58  printMemReference(MI, OpNo, O);
59  }
60  void printdwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
61  O << "dword ptr ";
62  printMemReference(MI, OpNo, O);
63  }
64  void printqwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
65  O << "qword ptr ";
66  printMemReference(MI, OpNo, O);
67  }
68  void printxmmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
69  O << "xmmword ptr ";
70  printMemReference(MI, OpNo, O);
71  }
72  void printymmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
73  O << "ymmword ptr ";
74  printMemReference(MI, OpNo, O);
75  }
76  void printzmmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
77  O << "zmmword ptr ";
78  printMemReference(MI, OpNo, O);
79  }
80  void printtbytemem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
81  O << "tbyte ptr ";
82  printMemReference(MI, OpNo, O);
83  }
84 
85 
86  void printSrcIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
87  O << "byte ptr ";
88  printSrcIdx(MI, OpNo, O);
89  }
90  void printSrcIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
91  O << "word ptr ";
92  printSrcIdx(MI, OpNo, O);
93  }
94  void printSrcIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
95  O << "dword ptr ";
96  printSrcIdx(MI, OpNo, O);
97  }
98  void printSrcIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
99  O << "qword ptr ";
100  printSrcIdx(MI, OpNo, O);
101  }
102  void printDstIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
103  O << "byte ptr ";
104  printDstIdx(MI, OpNo, O);
105  }
106  void printDstIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
107  O << "word ptr ";
108  printDstIdx(MI, OpNo, O);
109  }
110  void printDstIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
111  O << "dword ptr ";
112  printDstIdx(MI, OpNo, O);
113  }
114  void printDstIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
115  O << "qword ptr ";
116  printDstIdx(MI, OpNo, O);
117  }
118  void printMemOffs8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
119  O << "byte ptr ";
120  printMemOffset(MI, OpNo, O);
121  }
122  void printMemOffs16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
123  O << "word ptr ";
124  printMemOffset(MI, OpNo, O);
125  }
126  void printMemOffs32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
127  O << "dword ptr ";
128  printMemOffset(MI, OpNo, O);
129  }
130  void printMemOffs64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
131  O << "qword ptr ";
132  printMemOffset(MI, OpNo, O);
133  }
134 };
135 
136 } // end namespace llvm
137 
138 #endif // LLVM_LIB_TARGET_X86_MCTARGETDESC_X86INTELINSTPRINTER_H
llvm::X86IntelInstPrinter::printDstIdx64
void printDstIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86IntelInstPrinter.h:114
llvm::MCInstPrinter::MII
const MCInstrInfo & MII
Definition: MCInstPrinter.h:50
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:105
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::X86IntelInstPrinter::printymmwordmem
void printymmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86IntelInstPrinter.h:72
llvm::X86IntelInstPrinter::printSrcIdx64
void printSrcIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86IntelInstPrinter.h:98
llvm::MCAsmInfo
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
llvm::X86IntelInstPrinter::printDstIdx
void printDstIdx(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86IntelInstPrinter.cpp:438
llvm::X86IntelInstPrinter::printSrcIdx
void printSrcIdx(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86IntelInstPrinter.cpp:429
llvm::X86IntelInstPrinter::printDstIdx32
void printDstIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86IntelInstPrinter.h:110
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
llvm::X86IntelInstPrinter::printSTiRegOperand
void printSTiRegOperand(const MCInst *MI, unsigned OpNo, raw_ostream &OS)
Definition: X86IntelInstPrinter.cpp:473
llvm::X86IntelInstPrinter::printwordmem
void printwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86IntelInstPrinter.h:56
llvm::MCInstPrinter::MRI
const MCRegisterInfo & MRI
Definition: MCInstPrinter.h:51
llvm::X86IntelInstPrinter::printMemOffs8
void printMemOffs8(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86IntelInstPrinter.h:118
llvm::X86IntelInstPrinter::printRegName
void printRegName(raw_ostream &OS, unsigned RegNo) const override
Print the assembler register name.
Definition: X86IntelInstPrinter.cpp:36
llvm::X86IntelInstPrinter::printbytemem
void printbytemem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86IntelInstPrinter.h:52
llvm::X86IntelInstPrinter::printU8Imm
void printU8Imm(const MCInst *MI, unsigned Op, raw_ostream &O)
Definition: X86IntelInstPrinter.cpp:465
llvm::X86InstPrinterCommon
Definition: X86InstPrinterCommon.h:21
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::X86IntelInstPrinter::X86IntelInstPrinter
X86IntelInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
Definition: X86IntelInstPrinter.h:23
llvm::X86IntelInstPrinter::printxmmwordmem
void printxmmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86IntelInstPrinter.h:68
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:206
llvm::X86IntelInstPrinter::printMemOffs16
void printMemOffs16(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86IntelInstPrinter.h:122
uint64_t
llvm::X86IntelInstPrinter::printOperand
void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) override
Definition: X86IntelInstPrinter.cpp:358
llvm::X86IntelInstPrinter::printSrcIdx8
void printSrcIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86IntelInstPrinter.h:86
llvm::X86IntelInstPrinter::printDstIdx16
void printDstIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86IntelInstPrinter.h:106
llvm::X86IntelInstPrinter::printVecCompareInstr
bool printVecCompareInstr(const MCInst *MI, raw_ostream &OS)
Definition: X86IntelInstPrinter.cpp:60
llvm::X86IntelInstPrinter::printInstruction
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O)
llvm::X86IntelInstPrinter
Definition: X86IntelInstPrinter.h:21
llvm::X86IntelInstPrinter::printtbytemem
void printtbytemem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86IntelInstPrinter.h:80
llvm::X86IntelInstPrinter::printSrcIdx32
void printSrcIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86IntelInstPrinter.h:94
llvm::X86IntelInstPrinter::printAliasInstr
bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &OS)
llvm::X86IntelInstPrinter::printMemReference
void printMemReference(const MCInst *MI, unsigned Op, raw_ostream &O)
Definition: X86IntelInstPrinter.cpp:372
llvm::X86IntelInstPrinter::printMemOffs64
void printMemOffs64(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86IntelInstPrinter.h:130
llvm::X86IntelInstPrinter::getRegisterName
static const char * getRegisterName(unsigned RegNo)
llvm::X86IntelInstPrinter::printInst
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.
Definition: X86IntelInstPrinter.cpp:40
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::X86IntelInstPrinter::printMemOffs32
void printMemOffs32(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86IntelInstPrinter.h:126
llvm::MCRegisterInfo
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Definition: MCRegisterInfo.h:135
X86InstPrinterCommon.h
llvm::X86IntelInstPrinter::printSrcIdx16
void printSrcIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86IntelInstPrinter.h:90
llvm::MCInstrInfo
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:25
llvm::X86IntelInstPrinter::printqwordmem
void printqwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86IntelInstPrinter.h:64
llvm::AMDGPU::SendMsg::Op
Op
Definition: SIDefines.h:325
llvm::X86IntelInstPrinter::printzmmwordmem
void printzmmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86IntelInstPrinter.h:76
llvm::X86IntelInstPrinter::getMnemonic
std::pair< const char *, uint64_t > getMnemonic(const MCInst *MI) override
Returns a pair containing the mnemonic for MI and the number of bits left for further processing by p...
llvm::MCInstPrinter::MAI
const MCAsmInfo & MAI
Definition: MCInstPrinter.h:49
llvm::X86IntelInstPrinter::printCustomAliasOperand
void printCustomAliasOperand(const MCInst *MI, uint64_t Address, unsigned OpIdx, unsigned PrintMethodIdx, raw_ostream &O)
raw_ostream.h
llvm::X86IntelInstPrinter::printDstIdx8
void printDstIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86IntelInstPrinter.h:102
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:75
llvm::X86IntelInstPrinter::printdwordmem
void printdwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86IntelInstPrinter.h:60
llvm::X86IntelInstPrinter::printMemOffset
void printMemOffset(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86IntelInstPrinter.cpp:446