1234285Sdim//===-- HexagonInstPrinter.h - Convert Hexagon MCInst to assembly syntax --===// 2234285Sdim// 3234285Sdim// The LLVM Compiler Infrastructure 4234285Sdim// 5234285Sdim// This file is distributed under the University of Illinois Open Source 6234285Sdim// License. See LICENSE.TXT for details. 7234285Sdim// 8234285Sdim//===----------------------------------------------------------------------===// 9234285Sdim// 10234285Sdim// This class prints an Hexagon MCInst to a .s file. 11234285Sdim// 12234285Sdim//===----------------------------------------------------------------------===// 13234285Sdim 14234285Sdim#ifndef HEXAGONINSTPRINTER_H 15234285Sdim#define HEXAGONINSTPRINTER_H 16234285Sdim 17234285Sdim#include "llvm/MC/MCInstPrinter.h" 18252723Sdim#include "llvm/MC/MCInstrInfo.h" 19234285Sdim 20234285Sdimnamespace llvm { 21252723Sdim class HexagonMCInst; 22252723Sdim 23234285Sdim class HexagonInstPrinter : public MCInstPrinter { 24234285Sdim public: 25234285Sdim explicit HexagonInstPrinter(const MCAsmInfo &MAI, 26234285Sdim const MCInstrInfo &MII, 27234285Sdim const MCRegisterInfo &MRI) 28252723Sdim : MCInstPrinter(MAI, MII, MRI), MII(MII) {} 29234285Sdim 30234285Sdim virtual void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot); 31245431Sdim void printInst(const HexagonMCInst *MI, raw_ostream &O, StringRef Annot); 32234285Sdim virtual StringRef getOpcodeName(unsigned Opcode) const; 33234285Sdim void printInstruction(const MCInst *MI, raw_ostream &O); 34234285Sdim StringRef getRegName(unsigned RegNo) const; 35234285Sdim static const char *getRegisterName(unsigned RegNo); 36234285Sdim 37234285Sdim void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) const; 38234285Sdim void printImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) const; 39234285Sdim void printExtOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) const; 40245431Sdim void printUnsignedImmOperand(const MCInst *MI, unsigned OpNo, 41245431Sdim raw_ostream &O) const; 42234285Sdim void printNegImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) 43234285Sdim const; 44234285Sdim void printNOneImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) 45234285Sdim const; 46234285Sdim void printMEMriOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) 47234285Sdim const; 48245431Sdim void printFrameIndexOperand(const MCInst *MI, unsigned OpNo, 49245431Sdim raw_ostream &O) const; 50234285Sdim void printBranchOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) 51234285Sdim const; 52234285Sdim void printCallOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) 53234285Sdim const; 54234285Sdim void printAbsAddrOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) 55234285Sdim const; 56234285Sdim void printPredicateOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) 57234285Sdim const; 58234285Sdim void printGlobalOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) 59234285Sdim const; 60234285Sdim void printJumpTable(const MCInst *MI, unsigned OpNo, raw_ostream &O) const; 61234285Sdim 62245431Sdim void printConstantPool(const MCInst *MI, unsigned OpNo, 63245431Sdim raw_ostream &O) const; 64234285Sdim 65234285Sdim void printSymbolHi(const MCInst *MI, unsigned OpNo, raw_ostream &O) const 66234285Sdim { printSymbol(MI, OpNo, O, true); } 67234285Sdim void printSymbolLo(const MCInst *MI, unsigned OpNo, raw_ostream &O) const 68234285Sdim { printSymbol(MI, OpNo, O, false); } 69234285Sdim 70252723Sdim const MCInstrInfo &getMII() const { 71252723Sdim return MII; 72252723Sdim } 73252723Sdim 74234285Sdim protected: 75234285Sdim void printSymbol(const MCInst *MI, unsigned OpNo, raw_ostream &O, bool hi) 76234285Sdim const; 77252723Sdim 78252723Sdim static const char PacketPadding; 79252723Sdim 80252723Sdim private: 81252723Sdim const MCInstrInfo &MII; 82252723Sdim 83234285Sdim }; 84234285Sdim 85234285Sdim} // end namespace llvm 86234285Sdim 87234285Sdim#endif 88