1 //===-- HexagonInstPrinter.h - Convert Hexagon MCInst to assembly syntax --===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This class prints an Hexagon MCInst to a .s file.
12 //===----------------------------------------------------------------------===//
14 #ifndef HEXAGONINSTPRINTER_H
15 #define HEXAGONINSTPRINTER_H
17 #include "llvm/MC/MCInstPrinter.h"
18 #include "llvm/MC/MCInstrInfo.h"
23 class HexagonInstPrinter : public MCInstPrinter {
25 explicit HexagonInstPrinter(const MCAsmInfo &MAI,
26 const MCInstrInfo &MII,
27 const MCRegisterInfo &MRI)
28 : MCInstPrinter(MAI, MII, MRI), MII(MII) {}
30 virtual void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot);
31 void printInst(const HexagonMCInst *MI, raw_ostream &O, StringRef Annot);
32 virtual StringRef getOpcodeName(unsigned Opcode) const;
33 void printInstruction(const MCInst *MI, raw_ostream &O);
34 StringRef getRegName(unsigned RegNo) const;
35 static const char *getRegisterName(unsigned RegNo);
37 void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) const;
38 void printImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) const;
39 void printExtOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) const;
40 void printUnsignedImmOperand(const MCInst *MI, unsigned OpNo,
41 raw_ostream &O) const;
42 void printNegImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
44 void printNOneImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
46 void printMEMriOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
48 void printFrameIndexOperand(const MCInst *MI, unsigned OpNo,
49 raw_ostream &O) const;
50 void printBranchOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
52 void printCallOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
54 void printAbsAddrOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
56 void printPredicateOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
58 void printGlobalOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
60 void printJumpTable(const MCInst *MI, unsigned OpNo, raw_ostream &O) const;
62 void printConstantPool(const MCInst *MI, unsigned OpNo,
63 raw_ostream &O) const;
65 void printSymbolHi(const MCInst *MI, unsigned OpNo, raw_ostream &O) const
66 { printSymbol(MI, OpNo, O, true); }
67 void printSymbolLo(const MCInst *MI, unsigned OpNo, raw_ostream &O) const
68 { printSymbol(MI, OpNo, O, false); }
70 const MCInstrInfo &getMII() const {
75 void printSymbol(const MCInst *MI, unsigned OpNo, raw_ostream &O, bool hi)
78 static const char PacketPadding;
81 const MCInstrInfo &MII;
85 } // end namespace llvm