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