PPCInstPrinter.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. //===- PPCInstPrinter.h - Convert PPC 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 PPC MCInst to a .s file.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef LLVM_LIB_TARGET_POWERPC_MCTARGETDESC_PPCINSTPRINTER_H
  13. #define LLVM_LIB_TARGET_POWERPC_MCTARGETDESC_PPCINSTPRINTER_H
  14. #include "llvm/ADT/Triple.h"
  15. #include "llvm/MC/MCInstPrinter.h"
  16. namespace llvm {
  17. class PPCInstPrinter : public MCInstPrinter {
  18. Triple TT;
  19. private:
  20. bool showRegistersWithPercentPrefix(const char *RegName) const;
  21. bool showRegistersWithPrefix() const;
  22. const char *getVerboseConditionRegName(unsigned RegNum,
  23. unsigned RegEncoding) const;
  24. public:
  25. PPCInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
  26. const MCRegisterInfo &MRI, Triple T)
  27. : MCInstPrinter(MAI, MII, MRI), TT(T) {}
  28. void printRegName(raw_ostream &OS, unsigned RegNo) const override;
  29. void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,
  30. const MCSubtargetInfo &STI, raw_ostream &O) override;
  31. // Autogenerated by tblgen.
  32. std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
  33. void printInstruction(const MCInst *MI, uint64_t Address,
  34. const MCSubtargetInfo &STI, raw_ostream &O);
  35. static const char *getRegisterName(unsigned RegNo);
  36. bool printAliasInstr(const MCInst *MI, uint64_t Address,
  37. const MCSubtargetInfo &STI, raw_ostream &OS);
  38. void printCustomAliasOperand(const MCInst *MI, uint64_t Address,
  39. unsigned OpIdx, unsigned PrintMethodIdx,
  40. const MCSubtargetInfo &STI, raw_ostream &OS);
  41. void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
  42. raw_ostream &O);
  43. void printPredicateOperand(const MCInst *MI, unsigned OpNo,
  44. const MCSubtargetInfo &STI, raw_ostream &O,
  45. const char *Modifier = nullptr);
  46. void printATBitsAsHint(const MCInst *MI, unsigned OpNo,
  47. const MCSubtargetInfo &STI, raw_ostream &O);
  48. void printU1ImmOperand(const MCInst *MI, unsigned OpNo,
  49. const MCSubtargetInfo &STI, raw_ostream &O);
  50. void printU2ImmOperand(const MCInst *MI, unsigned OpNo,
  51. const MCSubtargetInfo &STI, raw_ostream &O);
  52. void printU3ImmOperand(const MCInst *MI, unsigned OpNo,
  53. const MCSubtargetInfo &STI, raw_ostream &O);
  54. void printU4ImmOperand(const MCInst *MI, unsigned OpNo,
  55. const MCSubtargetInfo &STI, raw_ostream &O);
  56. void printS5ImmOperand(const MCInst *MI, unsigned OpNo,
  57. const MCSubtargetInfo &STI, raw_ostream &O);
  58. void printU5ImmOperand(const MCInst *MI, unsigned OpNo,
  59. const MCSubtargetInfo &STI, raw_ostream &O);
  60. void printU6ImmOperand(const MCInst *MI, unsigned OpNo,
  61. const MCSubtargetInfo &STI, raw_ostream &O);
  62. void printU7ImmOperand(const MCInst *MI, unsigned OpNo,
  63. const MCSubtargetInfo &STI, raw_ostream &O);
  64. void printU8ImmOperand(const MCInst *MI, unsigned OpNo,
  65. const MCSubtargetInfo &STI, raw_ostream &O);
  66. void printU10ImmOperand(const MCInst *MI, unsigned OpNo,
  67. const MCSubtargetInfo &STI, raw_ostream &O);
  68. void printU12ImmOperand(const MCInst *MI, unsigned OpNo,
  69. const MCSubtargetInfo &STI, raw_ostream &O);
  70. void printS16ImmOperand(const MCInst *MI, unsigned OpNo,
  71. const MCSubtargetInfo &STI, raw_ostream &O);
  72. void printS34ImmOperand(const MCInst *MI, unsigned OpNo,
  73. const MCSubtargetInfo &STI, raw_ostream &O);
  74. void printU16ImmOperand(const MCInst *MI, unsigned OpNo,
  75. const MCSubtargetInfo &STI, raw_ostream &O);
  76. void printImmZeroOperand(const MCInst *MI, unsigned OpNo,
  77. const MCSubtargetInfo &STI, raw_ostream &O);
  78. void printBranchOperand(const MCInst *MI, uint64_t Address, unsigned OpNo,
  79. const MCSubtargetInfo &STI, raw_ostream &O);
  80. void printAbsBranchOperand(const MCInst *MI, unsigned OpNo,
  81. const MCSubtargetInfo &STI, raw_ostream &O);
  82. void printTLSCall(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
  83. raw_ostream &O);
  84. void printcrbitm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
  85. raw_ostream &O);
  86. void printMemRegImm(const MCInst *MI, unsigned OpNo,
  87. const MCSubtargetInfo &STI, raw_ostream &O);
  88. void printMemRegImmHash(const MCInst *MI, unsigned OpNo,
  89. const MCSubtargetInfo &STI, raw_ostream &O);
  90. void printMemRegImm34PCRel(const MCInst *MI, unsigned OpNo,
  91. const MCSubtargetInfo &STI, raw_ostream &O);
  92. void printMemRegImm34(const MCInst *MI, unsigned OpNo,
  93. const MCSubtargetInfo &STI, raw_ostream &O);
  94. void printMemRegReg(const MCInst *MI, unsigned OpNo,
  95. const MCSubtargetInfo &STI, raw_ostream &O);
  96. };
  97. } // end namespace llvm
  98. #endif