LLVM  4.0.0
HexagonInstPrinter.h
Go to the documentation of this file.
1 //===-- HexagonInstPrinter.h - Convert Hexagon MCInst to assembly syntax --===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_HEXAGON_INSTPRINTER_HEXAGONINSTPRINTER_H
14 #define LLVM_LIB_TARGET_HEXAGON_INSTPRINTER_HEXAGONINSTPRINTER_H
15 
16 #include "llvm/MC/MCInstPrinter.h"
17 
18 namespace llvm {
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
22 ///
23 /// r0 = add(r1, r2)
24 /// r0 = #0 \v jump 0x0
25 /// :endloop0 :endloop1
27 public:
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);
34 
35  StringRef getRegName(unsigned RegNo) const;
36  static char const *getRegisterName(unsigned RegNo);
37  void printRegName(raw_ostream &O, unsigned RegNo) const override;
38 
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;
66 
67  void printConstantPool(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;
68 
69  void printSymbolHi(MCInst const *MI, unsigned OpNo, raw_ostream &O) const {
70  printSymbol(MI, OpNo, O, true);
71  }
72  void printSymbolLo(MCInst const *MI, unsigned OpNo, raw_ostream &O) const {
73  printSymbol(MI, OpNo, O, false);
74  }
75 
76  MCAsmInfo const &getMAI() const { return MAI; }
77  MCInstrInfo const &getMII() const { return MII; }
78 
79 protected:
80  void printSymbol(MCInst const *MI, unsigned OpNo, raw_ostream &O,
81  bool hi) const;
82 
83 private:
84  MCInstrInfo const &MII;
85 
86  bool HasExtender;
87  void setExtender(MCInst const &MCI);
88 };
89 
90 } // end namespace llvm
91 
92 #endif
void printRegName(raw_ostream &O, unsigned RegNo) const override
Print the assembler register name.
void printSymbol(MCInst const *MI, unsigned OpNo, raw_ostream &O, bool hi) const
void printSymbolHi(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
void printBrtarget(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
MCInstrInfo const & getMII() const
void printInst(MCInst const *MI, raw_ostream &O, StringRef Annot, const MCSubtargetInfo &STI) override
Print the specified MCInst to the specified raw_ostream.
void prints3_6ImmOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
void printConstantPool(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
void printExtOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
void prints3_7ImmOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:150
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
void prints4_7ImmOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:57
void prints4_6ImmOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:24
void printPredicateOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
void printBranchOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
void printGlobalOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
void printAbsAddrOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
void printOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
Prints bundles as a newline separated list of individual instructions Duplexes are separated by a ver...
StringRef getRegName(unsigned RegNo) const
void printSymbolLo(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
MCAsmInfo const & getMAI() const
void printInstruction(MCInst const *MI, raw_ostream &O)
const MCAsmInfo & MAI
Definition: MCInstPrinter.h:47
void printUnsignedImmOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:41
void printNOneImmOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
HexagonInstPrinter(MCAsmInfo const &MAI, MCInstrInfo const &MII, MCRegisterInfo const &MRI)
MCSubtargetInfo - Generic base class for all target subtargets.
void printNegImmOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
virtual StringRef getOpcodeName(unsigned Opcode) const
static char const * getRegisterName(unsigned RegNo)
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:44
IRTranslator LLVM IR MI
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:47
void printJumpTable(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
void printCallOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
const MCRegisterInfo & MRI
Definition: MCInstPrinter.h:49