1 //= X86IntelInstPrinter.h - Convert X86 MCInst to assembly syntax -*- C++ -*-=//
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
7 //===----------------------------------------------------------------------===//
9 // This class prints an X86 MCInst to Intel style .s file syntax.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_TARGET_X86_MCTARGETDESC_X86INTELINSTPRINTER_H
14 #define LLVM_LIB_TARGET_X86_MCTARGETDESC_X86INTELINSTPRINTER_H
16 #include "X86InstPrinterCommon.h"
17 #include "llvm/Support/raw_ostream.h"
21 class X86IntelInstPrinter final
: public X86InstPrinterCommon
{
23 X86IntelInstPrinter(const MCAsmInfo
&MAI
, const MCInstrInfo
&MII
,
24 const MCRegisterInfo
&MRI
)
25 : X86InstPrinterCommon(MAI
, MII
, MRI
) {}
27 void printRegName(raw_ostream
&OS
, MCRegister Reg
) 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
);
32 // Autogenerated by tblgen, returns true if we successfully printed an
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
,
39 // Autogenerated by tblgen.
40 std::pair
<const char *, uint64_t>
41 getMnemonic(const MCInst
&MI
) const override
;
42 void printInstruction(const MCInst
*MI
, uint64_t Address
, raw_ostream
&O
);
43 static const char *getRegisterName(MCRegister Reg
);
45 void printOperand(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
) override
;
46 void printMemReference(const MCInst
*MI
, unsigned Op
, raw_ostream
&O
);
47 void printMemOffset(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
48 void printSrcIdx(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
49 void printDstIdx(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
50 void printU8Imm(const MCInst
*MI
, unsigned Op
, raw_ostream
&O
);
51 void printSTiRegOperand(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&OS
);
53 void printbytemem(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
) {
55 printMemReference(MI
, OpNo
, O
);
57 void printwordmem(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
) {
59 printMemReference(MI
, OpNo
, O
);
61 void printdwordmem(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
) {
63 printMemReference(MI
, OpNo
, O
);
65 void printqwordmem(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
) {
67 printMemReference(MI
, OpNo
, O
);
69 void printxmmwordmem(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
) {
71 printMemReference(MI
, OpNo
, O
);
73 void printymmwordmem(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
) {
75 printMemReference(MI
, OpNo
, O
);
77 void printzmmwordmem(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
) {
79 printMemReference(MI
, OpNo
, O
);
81 void printtbytemem(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
) {
83 printMemReference(MI
, OpNo
, O
);
87 void printSrcIdx8(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
) {
89 printSrcIdx(MI
, OpNo
, O
);
91 void printSrcIdx16(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
) {
93 printSrcIdx(MI
, OpNo
, O
);
95 void printSrcIdx32(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
) {
97 printSrcIdx(MI
, OpNo
, O
);
99 void printSrcIdx64(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
) {
101 printSrcIdx(MI
, OpNo
, O
);
103 void printDstIdx8(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
) {
105 printDstIdx(MI
, OpNo
, O
);
107 void printDstIdx16(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
) {
109 printDstIdx(MI
, OpNo
, O
);
111 void printDstIdx32(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
) {
113 printDstIdx(MI
, OpNo
, O
);
115 void printDstIdx64(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
) {
117 printDstIdx(MI
, OpNo
, O
);
119 void printMemOffs8(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
) {
121 printMemOffset(MI
, OpNo
, O
);
123 void printMemOffs16(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
) {
125 printMemOffset(MI
, OpNo
, O
);
127 void printMemOffs32(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
) {
129 printMemOffset(MI
, OpNo
, O
);
131 void printMemOffs64(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
) {
133 printMemOffset(MI
, OpNo
, O
);
137 } // end namespace llvm
139 #endif // LLVM_LIB_TARGET_X86_MCTARGETDESC_X86INTELINSTPRINTER_H