LoongArchInstPrinter.h 2.2 KB

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