LLVM API Documentation

SystemZInstPrinter.h
Go to the documentation of this file.
00001 //==- SystemZInstPrinter.h - Convert SystemZ MCInst to assembly --*- C++ -*-==//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This class prints a SystemZ MCInst to a .s file.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_LIB_TARGET_SYSTEMZ_INSTPRINTER_SYSTEMZINSTPRINTER_H
00015 #define LLVM_LIB_TARGET_SYSTEMZ_INSTPRINTER_SYSTEMZINSTPRINTER_H
00016 
00017 #include "llvm/MC/MCInstPrinter.h"
00018 #include "llvm/Support/Compiler.h"
00019 
00020 namespace llvm {
00021 class MCOperand;
00022 
00023 class SystemZInstPrinter : public MCInstPrinter {
00024 public:
00025   SystemZInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
00026                      const MCRegisterInfo &MRI)
00027     : MCInstPrinter(MAI, MII, MRI) {}
00028 
00029   // Automatically generated by tblgen.
00030   void printInstruction(const MCInst *MI, raw_ostream &O);
00031   static const char *getRegisterName(unsigned RegNo);
00032 
00033   // Print an address with the given base, displacement and index.
00034   static void printAddress(unsigned Base, int64_t Disp, unsigned Index,
00035                            raw_ostream &O);
00036 
00037   // Print the given operand.
00038   static void printOperand(const MCOperand &MO, raw_ostream &O);
00039 
00040   // Override MCInstPrinter.
00041   void printRegName(raw_ostream &O, unsigned RegNo) const override;
00042   void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot) override;
00043 
00044 private:
00045   // Print various types of operand.
00046   void printOperand(const MCInst *MI, int OpNum, raw_ostream &O);
00047   void printBDAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);
00048   void printBDXAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);
00049   void printBDLAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);
00050   void printU4ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
00051   void printU6ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
00052   void printS8ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
00053   void printU8ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
00054   void printS16ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
00055   void printU16ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
00056   void printS32ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
00057   void printU32ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
00058   void printPCRelOperand(const MCInst *MI, int OpNum, raw_ostream &O);
00059   void printAccessRegOperand(const MCInst *MI, int OpNum, raw_ostream &O);
00060 
00061   // Print the mnemonic for a condition-code mask ("ne", "lh", etc.)
00062   // This forms part of the instruction name rather than the operand list.
00063   void printCond4Operand(const MCInst *MI, int OpNum, raw_ostream &O);
00064 };
00065 } // end namespace llvm
00066 
00067 #endif