LLVM  14.0.0git
X86ATTInstPrinter.h
Go to the documentation of this file.
1 //=- X86ATTInstPrinter.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 AT&T style .s file syntax.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_X86_MCTARGETDESC_X86ATTINSTPRINTER_H
14 #define LLVM_LIB_TARGET_X86_MCTARGETDESC_X86ATTINSTPRINTER_H
15 
16 #include "X86InstPrinterCommon.h"
17 
18 namespace llvm {
19 
21 public:
23  const MCRegisterInfo &MRI)
24  : X86InstPrinterCommon(MAI, MII, MRI), HasCustomInstComment(false) {}
25 
26  void printRegName(raw_ostream &OS, unsigned RegNo) const override;
27  void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,
28  const MCSubtargetInfo &STI, raw_ostream &OS) override;
29  bool printVecCompareInstr(const MCInst *MI, raw_ostream &OS);
30 
31  // Autogenerated by tblgen, returns true if we successfully printed an
32  // alias.
33  bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &OS);
34  void printCustomAliasOperand(const MCInst *MI, uint64_t Address,
35  unsigned OpIdx, unsigned PrintMethodIdx,
36  raw_ostream &O);
37 
38  // Autogenerated by tblgen.
39  std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
40  void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &OS);
41  static const char *getRegisterName(unsigned RegNo);
42 
43  void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &OS) override;
44  void printMemReference(const MCInst *MI, unsigned Op, raw_ostream &OS);
45  void printMemOffset(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
46  void printSrcIdx(const MCInst *MI, unsigned Op, raw_ostream &O);
47  void printDstIdx(const MCInst *MI, unsigned Op, raw_ostream &O);
48  void printU8Imm(const MCInst *MI, unsigned Op, raw_ostream &OS);
49  void printSTiRegOperand(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
50 
51  void printbytemem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
52  printMemReference(MI, OpNo, O);
53  }
54  void printwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
55  printMemReference(MI, OpNo, O);
56  }
57  void printdwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
58  printMemReference(MI, OpNo, O);
59  }
60  void printqwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
61  printMemReference(MI, OpNo, O);
62  }
63  void printxmmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
64  printMemReference(MI, OpNo, O);
65  }
66  void printymmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
67  printMemReference(MI, OpNo, O);
68  }
69  void printzmmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
70  printMemReference(MI, OpNo, O);
71  }
72  void printtbytemem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
73  printMemReference(MI, OpNo, O);
74  }
75 
76  void printSrcIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
77  printSrcIdx(MI, OpNo, O);
78  }
79  void printSrcIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
80  printSrcIdx(MI, OpNo, O);
81  }
82  void printSrcIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
83  printSrcIdx(MI, OpNo, O);
84  }
85  void printSrcIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
86  printSrcIdx(MI, OpNo, O);
87  }
88  void printDstIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
89  printDstIdx(MI, OpNo, O);
90  }
91  void printDstIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
92  printDstIdx(MI, OpNo, O);
93  }
94  void printDstIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
95  printDstIdx(MI, OpNo, O);
96  }
97  void printDstIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
98  printDstIdx(MI, OpNo, O);
99  }
100  void printMemOffs8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
101  printMemOffset(MI, OpNo, O);
102  }
103  void printMemOffs16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
104  printMemOffset(MI, OpNo, O);
105  }
106  void printMemOffs32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
107  printMemOffset(MI, OpNo, O);
108  }
109  void printMemOffs64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
110  printMemOffset(MI, OpNo, O);
111  }
112 
113 private:
114  bool HasCustomInstComment;
115 };
116 
117 } // end namespace llvm
118 
119 #endif // LLVM_LIB_TARGET_X86_MCTARGETDESC_X86ATTINSTPRINTER_H
llvm::MCInstPrinter::MII
const MCInstrInfo & MII
Definition: MCInstPrinter.h:50
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:103
llvm::X86ATTInstPrinter::printDstIdx16
void printDstIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86ATTInstPrinter.h:91
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::X86ATTInstPrinter::printOperand
void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &OS) override
Definition: X86ATTInstPrinter.cpp:381
llvm::X86ATTInstPrinter::printSrcIdx32
void printSrcIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86ATTInstPrinter.h:82
llvm::X86ATTInstPrinter::printSrcIdx
void printSrcIdx(const MCInst *MI, unsigned Op, raw_ostream &O)
Definition: X86ATTInstPrinter.cpp:464
llvm::X86ATTInstPrinter::printVecCompareInstr
bool printVecCompareInstr(const MCInst *MI, raw_ostream &OS)
Definition: X86ATTInstPrinter.cpp:79
llvm::X86ATTInstPrinter::printMemOffs16
void printMemOffs16(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86ATTInstPrinter.h:103
llvm::X86ATTInstPrinter::printqwordmem
void printqwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86ATTInstPrinter.h:60
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::X86ATTInstPrinter::printSTiRegOperand
void printSTiRegOperand(const MCInst *MI, unsigned OpNo, raw_ostream &OS)
Definition: X86ATTInstPrinter.cpp:517
llvm::X86ATTInstPrinter::printxmmwordmem
void printxmmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86ATTInstPrinter.h:63
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
llvm::X86ATTInstPrinter::printtbytemem
void printtbytemem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86ATTInstPrinter.h:72
llvm::X86ATTInstPrinter::printzmmwordmem
void printzmmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86ATTInstPrinter.h:69
llvm::MCInstPrinter::MRI
const MCRegisterInfo & MRI
Definition: MCInstPrinter.h:51
llvm::X86ATTInstPrinter::X86ATTInstPrinter
X86ATTInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
Definition: X86ATTInstPrinter.h:22
llvm::X86ATTInstPrinter::printSrcIdx8
void printSrcIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86ATTInstPrinter.h:76
llvm::X86ATTInstPrinter::printMemOffs8
void printMemOffs8(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86ATTInstPrinter.h:100
false
Definition: StackSlotColoring.cpp:142
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::X86ATTInstPrinter::printwordmem
void printwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86ATTInstPrinter.h:54
llvm::X86ATTInstPrinter
Definition: X86ATTInstPrinter.h:20
llvm::X86ATTInstPrinter::printSrcIdx16
void printSrcIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86ATTInstPrinter.h:79
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:197
uint64_t
llvm::X86ATTInstPrinter::printMemOffset
void printMemOffset(const MCInst *MI, unsigned OpNo, raw_ostream &OS)
Definition: X86ATTInstPrinter.cpp:489
llvm::X86ATTInstPrinter::printRegName
void printRegName(raw_ostream &OS, unsigned RegNo) const override
Print the assembler register name.
Definition: X86ATTInstPrinter.cpp:38
llvm::X86ATTInstPrinter::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: X86ATTInstPrinter.cpp:42
llvm::X86ATTInstPrinter::printMemReference
void printMemReference(const MCInst *MI, unsigned Op, raw_ostream &OS)
Definition: X86ATTInstPrinter.cpp:414
llvm::X86ATTInstPrinter::getRegisterName
static const char * getRegisterName(unsigned RegNo)
llvm::X86ATTInstPrinter::printU8Imm
void printU8Imm(const MCInst *MI, unsigned Op, raw_ostream &OS)
Definition: X86ATTInstPrinter.cpp:508
llvm::X86ATTInstPrinter::printSrcIdx64
void printSrcIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86ATTInstPrinter.h:85
llvm::X86ATTInstPrinter::printDstIdx
void printDstIdx(const MCInst *MI, unsigned Op, raw_ostream &O)
Definition: X86ATTInstPrinter.cpp:478
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::X86ATTInstPrinter::printDstIdx32
void printDstIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86ATTInstPrinter.h:94
llvm::MCRegisterInfo
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Definition: MCRegisterInfo.h:135
llvm::X86ATTInstPrinter::printDstIdx64
void printDstIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86ATTInstPrinter.h:97
llvm::X86ATTInstPrinter::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::X86ATTInstPrinter::printAliasInstr
bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &OS)
X86InstPrinterCommon.h
llvm::MCInstrInfo
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:25
llvm::AMDGPU::SendMsg::Op
Op
Definition: SIDefines.h:321
llvm::X86ATTInstPrinter::printInstruction
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &OS)
llvm::X86ATTInstPrinter::printMemOffs64
void printMemOffs64(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86ATTInstPrinter.h:109
llvm::X86ATTInstPrinter::printbytemem
void printbytemem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86ATTInstPrinter.h:51
llvm::MCInstPrinter::MAI
const MCAsmInfo & MAI
Definition: MCInstPrinter.h:49
llvm::X86ATTInstPrinter::printDstIdx8
void printDstIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86ATTInstPrinter.h:88
llvm::X86ATTInstPrinter::printymmwordmem
void printymmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86ATTInstPrinter.h:66
llvm::X86ATTInstPrinter::printMemOffs32
void printMemOffs32(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86ATTInstPrinter.h:106
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:75
llvm::X86ATTInstPrinter::printCustomAliasOperand
void printCustomAliasOperand(const MCInst *MI, uint64_t Address, unsigned OpIdx, unsigned PrintMethodIdx, raw_ostream &O)
llvm::X86ATTInstPrinter::printdwordmem
void printdwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: X86ATTInstPrinter.h:57