| 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 | |
| 20 | class X86ATTInstPrinter final : public X86InstPrinterCommon { |
| 21 | public: |
| 22 | X86ATTInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, |
| 23 | const MCRegisterInfo &MRI) |
| 24 | : X86InstPrinterCommon(MAI, MII, MRI), HasCustomInstComment(false) {} |
| 25 | |
| 26 | void printRegName(raw_ostream &OS, MCRegister Reg) 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> |
| 40 | getMnemonic(const MCInst &MI) const override; |
| 41 | void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &OS); |
| 42 | static const char *getRegisterName(MCRegister Reg); |
| 43 | |
| 44 | void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &OS) override; |
| 45 | void printMemReference(const MCInst *MI, unsigned Op, raw_ostream &OS); |
| 46 | void printMemOffset(const MCInst *MI, unsigned OpNo, raw_ostream &OS); |
| 47 | void printSrcIdx(const MCInst *MI, unsigned Op, raw_ostream &O); |
| 48 | void printDstIdx(const MCInst *MI, unsigned Op, raw_ostream &O); |
| 49 | void printU8Imm(const MCInst *MI, unsigned Op, raw_ostream &OS); |
| 50 | void printSTiRegOperand(const MCInst *MI, unsigned OpNo, raw_ostream &OS); |
| 51 | |
| 52 | void printbytemem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { |
| 53 | printMemReference(MI, Op: OpNo, OS&: O); |
| 54 | } |
| 55 | void printwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { |
| 56 | printMemReference(MI, Op: OpNo, OS&: O); |
| 57 | } |
| 58 | void printdwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { |
| 59 | printMemReference(MI, Op: OpNo, OS&: O); |
| 60 | } |
| 61 | void printqwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { |
| 62 | printMemReference(MI, Op: OpNo, OS&: O); |
| 63 | } |
| 64 | void printxmmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { |
| 65 | printMemReference(MI, Op: OpNo, OS&: O); |
| 66 | } |
| 67 | void printymmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { |
| 68 | printMemReference(MI, Op: OpNo, OS&: O); |
| 69 | } |
| 70 | void printzmmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { |
| 71 | printMemReference(MI, Op: OpNo, OS&: O); |
| 72 | } |
| 73 | void printtbytemem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { |
| 74 | printMemReference(MI, Op: OpNo, OS&: O); |
| 75 | } |
| 76 | |
| 77 | void printSrcIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) { |
| 78 | printSrcIdx(MI, Op: OpNo, O); |
| 79 | } |
| 80 | void printSrcIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) { |
| 81 | printSrcIdx(MI, Op: OpNo, O); |
| 82 | } |
| 83 | void printSrcIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) { |
| 84 | printSrcIdx(MI, Op: OpNo, O); |
| 85 | } |
| 86 | void printSrcIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) { |
| 87 | printSrcIdx(MI, Op: OpNo, O); |
| 88 | } |
| 89 | void printDstIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) { |
| 90 | printDstIdx(MI, Op: OpNo, O); |
| 91 | } |
| 92 | void printDstIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) { |
| 93 | printDstIdx(MI, Op: OpNo, O); |
| 94 | } |
| 95 | void printDstIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) { |
| 96 | printDstIdx(MI, Op: OpNo, O); |
| 97 | } |
| 98 | void printDstIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) { |
| 99 | printDstIdx(MI, Op: OpNo, O); |
| 100 | } |
| 101 | void printMemOffs8(const MCInst *MI, unsigned OpNo, raw_ostream &O) { |
| 102 | printMemOffset(MI, OpNo, OS&: O); |
| 103 | } |
| 104 | void printMemOffs16(const MCInst *MI, unsigned OpNo, raw_ostream &O) { |
| 105 | printMemOffset(MI, OpNo, OS&: O); |
| 106 | } |
| 107 | void printMemOffs32(const MCInst *MI, unsigned OpNo, raw_ostream &O) { |
| 108 | printMemOffset(MI, OpNo, OS&: O); |
| 109 | } |
| 110 | void printMemOffs64(const MCInst *MI, unsigned OpNo, raw_ostream &O) { |
| 111 | printMemOffset(MI, OpNo, OS&: O); |
| 112 | } |
| 113 | |
| 114 | private: |
| 115 | bool ; |
| 116 | }; |
| 117 | |
| 118 | } // end namespace llvm |
| 119 | |
| 120 | #endif // LLVM_LIB_TARGET_X86_MCTARGETDESC_X86ATTINSTPRINTER_H |
| 121 | |