xref: /aosp_15_r20/external/llvm/lib/Target/SystemZ/InstPrinter/SystemZInstPrinter.h (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker //==- SystemZInstPrinter.h - Convert SystemZ MCInst to assembly --*- C++ -*-==//
2*9880d681SAndroid Build Coastguard Worker //
3*9880d681SAndroid Build Coastguard Worker //                     The LLVM Compiler Infrastructure
4*9880d681SAndroid Build Coastguard Worker //
5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker //
8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker //
10*9880d681SAndroid Build Coastguard Worker // This class prints a SystemZ MCInst to a .s file.
11*9880d681SAndroid Build Coastguard Worker //
12*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
13*9880d681SAndroid Build Coastguard Worker 
14*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_LIB_TARGET_SYSTEMZ_INSTPRINTER_SYSTEMZINSTPRINTER_H
15*9880d681SAndroid Build Coastguard Worker #define LLVM_LIB_TARGET_SYSTEMZ_INSTPRINTER_SYSTEMZINSTPRINTER_H
16*9880d681SAndroid Build Coastguard Worker 
17*9880d681SAndroid Build Coastguard Worker #include "llvm/MC/MCInstPrinter.h"
18*9880d681SAndroid Build Coastguard Worker 
19*9880d681SAndroid Build Coastguard Worker namespace llvm {
20*9880d681SAndroid Build Coastguard Worker class MCOperand;
21*9880d681SAndroid Build Coastguard Worker 
22*9880d681SAndroid Build Coastguard Worker class SystemZInstPrinter : public MCInstPrinter {
23*9880d681SAndroid Build Coastguard Worker public:
SystemZInstPrinter(const MCAsmInfo & MAI,const MCInstrInfo & MII,const MCRegisterInfo & MRI)24*9880d681SAndroid Build Coastguard Worker   SystemZInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
25*9880d681SAndroid Build Coastguard Worker                      const MCRegisterInfo &MRI)
26*9880d681SAndroid Build Coastguard Worker     : MCInstPrinter(MAI, MII, MRI) {}
27*9880d681SAndroid Build Coastguard Worker 
28*9880d681SAndroid Build Coastguard Worker   // Automatically generated by tblgen.
29*9880d681SAndroid Build Coastguard Worker   void printInstruction(const MCInst *MI, raw_ostream &O);
30*9880d681SAndroid Build Coastguard Worker   static const char *getRegisterName(unsigned RegNo);
31*9880d681SAndroid Build Coastguard Worker 
32*9880d681SAndroid Build Coastguard Worker   // Print an address with the given base, displacement and index.
33*9880d681SAndroid Build Coastguard Worker   static void printAddress(unsigned Base, int64_t Disp, unsigned Index,
34*9880d681SAndroid Build Coastguard Worker                            raw_ostream &O);
35*9880d681SAndroid Build Coastguard Worker 
36*9880d681SAndroid Build Coastguard Worker   // Print the given operand.
37*9880d681SAndroid Build Coastguard Worker   static void printOperand(const MCOperand &MO, const MCAsmInfo *MAI,
38*9880d681SAndroid Build Coastguard Worker                            raw_ostream &O);
39*9880d681SAndroid Build Coastguard Worker 
40*9880d681SAndroid Build Coastguard Worker   // Override MCInstPrinter.
41*9880d681SAndroid Build Coastguard Worker   void printRegName(raw_ostream &O, unsigned RegNo) const override;
42*9880d681SAndroid Build Coastguard Worker   void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot,
43*9880d681SAndroid Build Coastguard Worker                  const MCSubtargetInfo &STI) override;
44*9880d681SAndroid Build Coastguard Worker 
45*9880d681SAndroid Build Coastguard Worker private:
46*9880d681SAndroid Build Coastguard Worker   // Print various types of operand.
47*9880d681SAndroid Build Coastguard Worker   void printOperand(const MCInst *MI, int OpNum, raw_ostream &O);
48*9880d681SAndroid Build Coastguard Worker   void printBDAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);
49*9880d681SAndroid Build Coastguard Worker   void printBDXAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);
50*9880d681SAndroid Build Coastguard Worker   void printBDLAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);
51*9880d681SAndroid Build Coastguard Worker   void printBDVAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);
52*9880d681SAndroid Build Coastguard Worker   void printU1ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
53*9880d681SAndroid Build Coastguard Worker   void printU2ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
54*9880d681SAndroid Build Coastguard Worker   void printU3ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
55*9880d681SAndroid Build Coastguard Worker   void printU4ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
56*9880d681SAndroid Build Coastguard Worker   void printU6ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
57*9880d681SAndroid Build Coastguard Worker   void printS8ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
58*9880d681SAndroid Build Coastguard Worker   void printU8ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
59*9880d681SAndroid Build Coastguard Worker   void printU12ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
60*9880d681SAndroid Build Coastguard Worker   void printS16ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
61*9880d681SAndroid Build Coastguard Worker   void printU16ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
62*9880d681SAndroid Build Coastguard Worker   void printS32ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
63*9880d681SAndroid Build Coastguard Worker   void printU32ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
64*9880d681SAndroid Build Coastguard Worker   void printPCRelOperand(const MCInst *MI, int OpNum, raw_ostream &O);
65*9880d681SAndroid Build Coastguard Worker   void printPCRelTLSOperand(const MCInst *MI, int OpNum, raw_ostream &O);
66*9880d681SAndroid Build Coastguard Worker   void printAccessRegOperand(const MCInst *MI, int OpNum, raw_ostream &O);
67*9880d681SAndroid Build Coastguard Worker 
68*9880d681SAndroid Build Coastguard Worker   // Print the mnemonic for a condition-code mask ("ne", "lh", etc.)
69*9880d681SAndroid Build Coastguard Worker   // This forms part of the instruction name rather than the operand list.
70*9880d681SAndroid Build Coastguard Worker   void printCond4Operand(const MCInst *MI, int OpNum, raw_ostream &O);
71*9880d681SAndroid Build Coastguard Worker };
72*9880d681SAndroid Build Coastguard Worker } // end namespace llvm
73*9880d681SAndroid Build Coastguard Worker 
74*9880d681SAndroid Build Coastguard Worker #endif
75