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 LLVM_LIB_TARGET_HEXAGON_INSTPRINTER_HEXAGONINSTPRINTER_H
15 #define LLVM_LIB_TARGET_HEXAGON_INSTPRINTER_HEXAGONINSTPRINTER_H
17 #include "llvm/MC/MCInstPrinter.h"
18 #include "llvm/MC/MCInstrInfo.h"
21 class HexagonInstPrinter : public MCInstPrinter {
23 explicit HexagonInstPrinter(MCAsmInfo const &MAI,
24 MCInstrInfo const &MII,
25 MCRegisterInfo const &MRI)
26 : MCInstPrinter(MAI, MII, MRI), MII(MII) {}
28 void printInst(MCInst const *MI, raw_ostream &O, StringRef Annot,
29 const MCSubtargetInfo &STI) override;
30 virtual StringRef getOpcodeName(unsigned Opcode) const;
31 void printInstruction(const MCInst *MI, raw_ostream &O);
32 StringRef getRegName(unsigned RegNo) const;
33 static const char *getRegisterName(unsigned RegNo);
35 void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) const;
36 void printImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) const;
37 void printExtOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) const;
38 void printUnsignedImmOperand(const MCInst *MI, unsigned OpNo,
39 raw_ostream &O) const;
40 void printNegImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
42 void printNOneImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
44 void printMEMriOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
46 void printFrameIndexOperand(const MCInst *MI, unsigned OpNo,
47 raw_ostream &O) const;
48 void printBranchOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
50 void printCallOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
52 void printAbsAddrOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
54 void printPredicateOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
56 void printGlobalOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
58 void printJumpTable(const MCInst *MI, unsigned OpNo, raw_ostream &O) const;
60 void printConstantPool(const MCInst *MI, unsigned OpNo,
61 raw_ostream &O) const;
63 void printSymbolHi(const MCInst *MI, unsigned OpNo, raw_ostream &O) const
64 { printSymbol(MI, OpNo, O, true); }
65 void printSymbolLo(const MCInst *MI, unsigned OpNo, raw_ostream &O) const
66 { printSymbol(MI, OpNo, O, false); }
68 const MCInstrInfo &getMII() const {
73 void printSymbol(const MCInst *MI, unsigned OpNo, raw_ostream &O, bool hi)
76 static const char PacketPadding;
79 const MCInstrInfo &MII;
83 } // end namespace llvm