| 1 | //===-- LoongArchInstPrinter.h - Convert LoongArch MCInst to asm syntax ---===// |
| 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 a LoongArch MCInst to a .s file. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #ifndef LLVM_LIB_TARGET_LOONGARCH_MCTARGETDESC_LOONGARCHINSTPRINTER_H |
| 14 | #define LLVM_LIB_TARGET_LOONGARCH_MCTARGETDESC_LOONGARCHINSTPRINTER_H |
| 15 | |
| 16 | #include "MCTargetDesc/LoongArchMCTargetDesc.h" |
| 17 | #include "llvm/MC/MCInstPrinter.h" |
| 18 | |
| 19 | namespace llvm { |
| 20 | |
| 21 | class LoongArchInstPrinter : public MCInstPrinter { |
| 22 | public: |
| 23 | LoongArchInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, |
| 24 | const MCRegisterInfo &MRI) |
| 25 | : MCInstPrinter(MAI, MII, MRI) {} |
| 26 | |
| 27 | bool applyTargetSpecificCLOption(StringRef Opt) override; |
| 28 | |
| 29 | void printInst(const MCInst *MI, uint64_t Address, StringRef Annot, |
| 30 | const MCSubtargetInfo &STI, raw_ostream &O) override; |
| 31 | void printRegName(raw_ostream &O, MCRegister Reg) override; |
| 32 | void printAtomicMemOp(const MCInst *MI, unsigned OpNo, |
| 33 | const MCSubtargetInfo &STI, raw_ostream &O); |
| 34 | |
| 35 | // Autogenerated by tblgen. |
| 36 | std::pair<const char *, uint64_t> |
| 37 | getMnemonic(const MCInst &MI) const override; |
| 38 | void printInstruction(const MCInst *MI, uint64_t Address, |
| 39 | const MCSubtargetInfo &STI, raw_ostream &O); |
| 40 | bool printAliasInstr(const MCInst *MI, uint64_t Address, |
| 41 | const MCSubtargetInfo &STI, raw_ostream &O); |
| 42 | void printCustomAliasOperand(const MCInst *MI, uint64_t Address, |
| 43 | unsigned OpIdx, unsigned PrintMethodIdx, |
| 44 | const MCSubtargetInfo &STI, raw_ostream &O); |
| 45 | static const char *getRegisterName(MCRegister Reg); |
| 46 | static const char *getRegisterName(MCRegister Reg, unsigned AltIdx); |
| 47 | |
| 48 | private: |
| 49 | void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, |
| 50 | raw_ostream &O); |
| 51 | }; |
| 52 | } // end namespace llvm |
| 53 | |
| 54 | #endif // LLVM_LIB_TARGET_LOONGARCH_MCTARGETDESC_LOONGARCHINSTPRINTER_H |
| 55 | |