LLVM API Documentation

HexagonInstPrinter.h
Go to the documentation of this file.
00001 //===-- HexagonInstPrinter.h - Convert Hexagon MCInst to assembly syntax --===//
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 an Hexagon MCInst to a .s file.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_LIB_TARGET_HEXAGON_INSTPRINTER_HEXAGONINSTPRINTER_H
00015 #define LLVM_LIB_TARGET_HEXAGON_INSTPRINTER_HEXAGONINSTPRINTER_H
00016 
00017 #include "llvm/MC/MCInstPrinter.h"
00018 #include "llvm/MC/MCInstrInfo.h"
00019 
00020 namespace llvm {
00021   class HexagonMCInst;
00022 
00023   class HexagonInstPrinter : public MCInstPrinter {
00024   public:
00025     explicit HexagonInstPrinter(const MCAsmInfo &MAI,
00026                                 const MCInstrInfo &MII,
00027                                 const MCRegisterInfo &MRI)
00028       : MCInstPrinter(MAI, MII, MRI), MII(MII) {}
00029 
00030     void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot) override;
00031     void printInst(const HexagonMCInst *MI, raw_ostream &O, StringRef Annot);
00032     virtual StringRef getOpcodeName(unsigned Opcode) const;
00033     void printInstruction(const MCInst *MI, raw_ostream &O);
00034     StringRef getRegName(unsigned RegNo) const;
00035     static const char *getRegisterName(unsigned RegNo);
00036 
00037     void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) const;
00038     void printImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) const;
00039     void printExtOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) const;
00040     void printUnsignedImmOperand(const MCInst *MI, unsigned OpNo,
00041                                  raw_ostream &O) const;
00042     void printNegImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
00043            const;
00044     void printNOneImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
00045            const;
00046     void printMEMriOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
00047            const;
00048     void printFrameIndexOperand(const MCInst *MI, unsigned OpNo,
00049                                 raw_ostream &O) const;
00050     void printBranchOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
00051            const;
00052     void printCallOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
00053            const;
00054     void printAbsAddrOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
00055            const;
00056     void printPredicateOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
00057            const;
00058     void printGlobalOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
00059            const;
00060     void printJumpTable(const MCInst *MI, unsigned OpNo, raw_ostream &O) const;
00061 
00062     void printConstantPool(const MCInst *MI, unsigned OpNo,
00063                            raw_ostream &O) const;
00064 
00065     void printSymbolHi(const MCInst *MI, unsigned OpNo, raw_ostream &O) const
00066       { printSymbol(MI, OpNo, O, true); }
00067     void printSymbolLo(const MCInst *MI, unsigned OpNo, raw_ostream &O) const
00068       { printSymbol(MI, OpNo, O, false); }
00069 
00070     const MCInstrInfo &getMII() const {
00071       return MII;
00072     }
00073 
00074   protected:
00075     void printSymbol(const MCInst *MI, unsigned OpNo, raw_ostream &O, bool hi)
00076            const;
00077 
00078     static const char PacketPadding;
00079 
00080   private:
00081     const MCInstrInfo &MII;
00082 
00083   };
00084 
00085 } // end namespace llvm
00086 
00087 #endif