X86ATTInstPrinter.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. #ifndef LLVM_LIB_TARGET_X86_MCTARGETDESC_X86ATTINSTPRINTER_H
  13. #define LLVM_LIB_TARGET_X86_MCTARGETDESC_X86ATTINSTPRINTER_H
  14. #include "X86InstPrinterCommon.h"
  15. namespace llvm {
  16. class X86ATTInstPrinter final : public X86InstPrinterCommon {
  17. public:
  18. X86ATTInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
  19. const MCRegisterInfo &MRI)
  20. : X86InstPrinterCommon(MAI, MII, MRI), HasCustomInstComment(false) {}
  21. void printRegName(raw_ostream &OS, MCRegister Reg) const override;
  22. void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,
  23. const MCSubtargetInfo &STI, raw_ostream &OS) override;
  24. bool printVecCompareInstr(const MCInst *MI, raw_ostream &OS);
  25. // Autogenerated by tblgen, returns true if we successfully printed an
  26. // alias.
  27. bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &OS);
  28. void printCustomAliasOperand(const MCInst *MI, uint64_t Address,
  29. unsigned OpIdx, unsigned PrintMethodIdx,
  30. raw_ostream &O);
  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, raw_ostream &OS);
  34. static const char *getRegisterName(MCRegister Reg);
  35. void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &OS) override;
  36. void printMemReference(const MCInst *MI, unsigned Op, raw_ostream &OS);
  37. void printMemOffset(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
  38. void printSrcIdx(const MCInst *MI, unsigned Op, raw_ostream &O);
  39. void printDstIdx(const MCInst *MI, unsigned Op, raw_ostream &O);
  40. void printU8Imm(const MCInst *MI, unsigned Op, raw_ostream &OS);
  41. void printSTiRegOperand(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
  42. void printbytemem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
  43. printMemReference(MI, OpNo, O);
  44. }
  45. void printwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
  46. printMemReference(MI, OpNo, O);
  47. }
  48. void printdwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
  49. printMemReference(MI, OpNo, O);
  50. }
  51. void printqwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
  52. printMemReference(MI, OpNo, O);
  53. }
  54. void printxmmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
  55. printMemReference(MI, OpNo, O);
  56. }
  57. void printymmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
  58. printMemReference(MI, OpNo, O);
  59. }
  60. void printzmmwordmem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
  61. printMemReference(MI, OpNo, O);
  62. }
  63. void printtbytemem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
  64. printMemReference(MI, OpNo, O);
  65. }
  66. void printSrcIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
  67. printSrcIdx(MI, OpNo, O);
  68. }
  69. void printSrcIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
  70. printSrcIdx(MI, OpNo, O);
  71. }
  72. void printSrcIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
  73. printSrcIdx(MI, OpNo, O);
  74. }
  75. void printSrcIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
  76. printSrcIdx(MI, OpNo, O);
  77. }
  78. void printDstIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
  79. printDstIdx(MI, OpNo, O);
  80. }
  81. void printDstIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
  82. printDstIdx(MI, OpNo, O);
  83. }
  84. void printDstIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
  85. printDstIdx(MI, OpNo, O);
  86. }
  87. void printDstIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
  88. printDstIdx(MI, OpNo, O);
  89. }
  90. void printMemOffs8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
  91. printMemOffset(MI, OpNo, O);
  92. }
  93. void printMemOffs16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
  94. printMemOffset(MI, OpNo, O);
  95. }
  96. void printMemOffs32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
  97. printMemOffset(MI, OpNo, O);
  98. }
  99. void printMemOffs64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
  100. printMemOffset(MI, OpNo, O);
  101. }
  102. private:
  103. bool HasCustomInstComment;
  104. };
  105. } // end namespace llvm
  106. #endif // LLVM_LIB_TARGET_X86_MCTARGETDESC_X86ATTINSTPRINTER_H