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 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_TARGET_HEXAGON_INSTPRINTER_HEXAGONINSTPRINTER_H
14 #define LLVM_LIB_TARGET_HEXAGON_INSTPRINTER_HEXAGONINSTPRINTER_H
16 #include "llvm/MC/MCInstPrinter.h"
19 /// Prints bundles as a newline separated list of individual instructions
20 /// Duplexes are separated by a vertical tab \v character
21 /// A trailing line includes bundle properties such as endloop0/1
24 /// r0 = #0 \v jump 0x0
25 /// :endloop0 :endloop1
26 class HexagonInstPrinter : public MCInstPrinter {
28 explicit HexagonInstPrinter(MCAsmInfo const &MAI, MCInstrInfo const &MII,
29 MCRegisterInfo const &MRI);
30 void printInst(MCInst const *MI, raw_ostream &O, StringRef Annot,
31 const MCSubtargetInfo &STI) override;
32 virtual StringRef getOpcodeName(unsigned Opcode) const;
33 void printInstruction(MCInst const *MI, raw_ostream &O);
35 StringRef getRegName(unsigned RegNo) const;
36 static char const *getRegisterName(unsigned RegNo);
37 void printRegName(raw_ostream &O, unsigned RegNo) const override;
39 void printOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;
40 void printExtOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;
41 void printUnsignedImmOperand(MCInst const *MI, unsigned OpNo,
42 raw_ostream &O) const;
43 void printNegImmOperand(MCInst const *MI, unsigned OpNo,
44 raw_ostream &O) const;
45 void printNOneImmOperand(MCInst const *MI, unsigned OpNo,
46 raw_ostream &O) const;
47 void prints3_6ImmOperand(MCInst const *MI, unsigned OpNo,
48 raw_ostream &O) const;
49 void prints3_7ImmOperand(MCInst const *MI, unsigned OpNo,
50 raw_ostream &O) const;
51 void prints4_6ImmOperand(MCInst const *MI, unsigned OpNo,
52 raw_ostream &O) const;
53 void prints4_7ImmOperand(MCInst const *MI, unsigned OpNo,
54 raw_ostream &O) const;
55 void printBranchOperand(MCInst const *MI, unsigned OpNo,
56 raw_ostream &O) const;
57 void printCallOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;
58 void printAbsAddrOperand(MCInst const *MI, unsigned OpNo,
59 raw_ostream &O) const;
60 void printPredicateOperand(MCInst const *MI, unsigned OpNo,
61 raw_ostream &O) const;
62 void printGlobalOperand(MCInst const *MI, unsigned OpNo,
63 raw_ostream &O) const;
64 void printJumpTable(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;
65 void printBrtarget(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;
67 void printConstantPool(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;
69 void printSymbolHi(MCInst const *MI, unsigned OpNo, raw_ostream &O) const {
70 printSymbol(MI, OpNo, O, true);
72 void printSymbolLo(MCInst const *MI, unsigned OpNo, raw_ostream &O) const {
73 printSymbol(MI, OpNo, O, false);
76 MCAsmInfo const &getMAI() const { return MAI; }
77 MCInstrInfo const &getMII() const { return MII; }
80 void printSymbol(MCInst const *MI, unsigned OpNo, raw_ostream &O,
84 MCInstrInfo const &MII;
87 void setExtender(MCInst const &MCI);
90 } // end namespace llvm