1 //==- SystemZInstPrinter.h - Convert SystemZ MCInst to assembly --*- C++ -*-==//
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
7 //===----------------------------------------------------------------------===//
9 // This class prints a SystemZ MCInst to a .s file.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_TARGET_SYSTEMZ_MCTARGETDESC_SYSTEMZINSTPRINTER_H
14 #define LLVM_LIB_TARGET_SYSTEMZ_MCTARGETDESC_SYSTEMZINSTPRINTER_H
16 #include "SystemZMCAsmInfo.h"
17 #include "llvm/MC/MCInstPrinter.h"
24 class SystemZInstPrinter
: public MCInstPrinter
{
26 SystemZInstPrinter(const MCAsmInfo
&MAI
, const MCInstrInfo
&MII
,
27 const MCRegisterInfo
&MRI
)
28 : MCInstPrinter(MAI
, MII
, MRI
) {}
30 // Automatically generated by tblgen.
31 std::pair
<const char *, uint64_t> getMnemonic(const MCInst
*MI
) override
;
32 void printInstruction(const MCInst
*MI
, uint64_t Address
, raw_ostream
&O
);
33 static const char *getRegisterName(unsigned RegNo
);
35 // Print an address with the given base, displacement and index.
36 static void printAddress(const MCAsmInfo
*MAI
, unsigned Base
, int64_t Disp
,
37 unsigned Index
, raw_ostream
&O
);
39 // Print the given operand.
40 static void printOperand(const MCOperand
&MO
, const MCAsmInfo
*MAI
,
43 static void printFormattedRegName(const MCAsmInfo
*MAI
, unsigned RegNo
,
46 // Override MCInstPrinter.
47 inline void printRegName(raw_ostream
&O
, unsigned RegNo
) const override
{
48 printFormattedRegName(&MAI
, RegNo
, O
);
51 void printInst(const MCInst
*MI
, uint64_t Address
, StringRef Annot
,
52 const MCSubtargetInfo
&STI
, raw_ostream
&O
) override
;
55 // Print various types of operand.
56 void printOperand(const MCInst
*MI
, int OpNum
, raw_ostream
&O
);
57 void printOperand(const MCInst
*MI
, uint64_t /*Address*/, unsigned OpNum
,
59 printOperand(MI
, OpNum
, O
);
61 void printBDAddrOperand(const MCInst
*MI
, int OpNum
, raw_ostream
&O
);
62 void printBDXAddrOperand(const MCInst
*MI
, int OpNum
, raw_ostream
&O
);
63 void printBDLAddrOperand(const MCInst
*MI
, int OpNum
, raw_ostream
&O
);
64 void printBDRAddrOperand(const MCInst
*MI
, int OpNum
, raw_ostream
&O
);
65 void printBDVAddrOperand(const MCInst
*MI
, int OpNum
, raw_ostream
&O
);
66 void printU1ImmOperand(const MCInst
*MI
, int OpNum
, raw_ostream
&O
);
67 void printU2ImmOperand(const MCInst
*MI
, int OpNum
, raw_ostream
&O
);
68 void printU3ImmOperand(const MCInst
*MI
, int OpNum
, raw_ostream
&O
);
69 void printU4ImmOperand(const MCInst
*MI
, int OpNum
, raw_ostream
&O
);
70 void printU6ImmOperand(const MCInst
*MI
, int OpNum
, raw_ostream
&O
);
71 void printS8ImmOperand(const MCInst
*MI
, int OpNum
, raw_ostream
&O
);
72 void printU8ImmOperand(const MCInst
*MI
, int OpNum
, raw_ostream
&O
);
73 void printU12ImmOperand(const MCInst
*MI
, int OpNum
, raw_ostream
&O
);
74 void printS16ImmOperand(const MCInst
*MI
, int OpNum
, raw_ostream
&O
);
75 void printU16ImmOperand(const MCInst
*MI
, int OpNum
, raw_ostream
&O
);
76 void printS32ImmOperand(const MCInst
*MI
, int OpNum
, raw_ostream
&O
);
77 void printU32ImmOperand(const MCInst
*MI
, int OpNum
, raw_ostream
&O
);
78 void printU48ImmOperand(const MCInst
*MI
, int OpNum
, raw_ostream
&O
);
79 void printPCRelOperand(const MCInst
*MI
, int OpNum
, raw_ostream
&O
);
80 void printPCRelOperand(const MCInst
*MI
, uint64_t /*Address*/, int OpNum
,
82 printPCRelOperand(MI
, OpNum
, O
);
84 void printPCRelTLSOperand(const MCInst
*MI
, uint64_t Address
, int OpNum
,
87 // Print the mnemonic for a condition-code mask ("ne", "lh", etc.)
88 // This forms part of the instruction name rather than the operand list.
89 void printCond4Operand(const MCInst
*MI
, int OpNum
, raw_ostream
&O
);
92 } // end namespace llvm
94 #endif // LLVM_LIB_TARGET_SYSTEMZ_MCTARGETDESC_SYSTEMZINSTPRINTER_H