LLVM  7.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 printBranchOperand(MCInst const *MI, unsigned OpNo,
48  raw_ostream &O) const;
49  void printCallOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;
50  void printAbsAddrOperand(MCInst const *MI, unsigned OpNo,
51  raw_ostream &O) const;
52  void printPredicateOperand(MCInst const *MI, unsigned OpNo,
53  raw_ostream &O) const;
54  void printGlobalOperand(MCInst const *MI, unsigned OpNo,
55  raw_ostream &O) const;
56  void printJumpTable(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;
57  void printBrtarget(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;
58 
59  void printConstantPool(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;
60 
61  void printSymbolHi(MCInst const *MI, unsigned OpNo, raw_ostream &O) const {
62  printSymbol(MI, OpNo, O, true);
63  }
64  void printSymbolLo(MCInst const *MI, unsigned OpNo, raw_ostream &O) const {
65  printSymbol(MI, OpNo, O, false);
66  }
67 
68  MCAsmInfo const &getMAI() const { return MAI; }
69  MCInstrInfo const &getMII() const { return MII; }
70 
71 protected:
72  void printSymbol(MCInst const *MI, unsigned OpNo, raw_ostream &O,
73  bool hi) const;
74 
75 private:
76  MCInstrInfo const &MII;
77 
78  bool HasExtender;
79  void setExtender(MCInst const &MCI);
80 };
81 
82 } // end namespace llvm
83 
84 #endif
MCAsmInfo const & getMAI() const
void printRegName(raw_ostream &O, unsigned RegNo) const override
Print the assembler register name.
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
void printBrtarget(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
void printNegImmOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
void printUnsignedImmOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
void printGlobalOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
MCInstrInfo const & getMII() const
void printConstantPool(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
void printSymbolLo(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
void printInst(MCInst const *MI, raw_ostream &O, StringRef Annot, const MCSubtargetInfo &STI) override
Print the specified MCInst to the specified raw_ostream.
StringRef getRegName(unsigned RegNo) const
void printCallOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
void printAbsAddrOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
virtual StringRef getOpcodeName(unsigned Opcode) const
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:161
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
void printJumpTable(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
void printExtOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
void printSymbol(MCInst const *MI, unsigned OpNo, raw_ostream &O, bool hi) const
void printPredicateOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:24
void printSymbolHi(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...
void printInstruction(MCInst const *MI, raw_ostream &O)
const MCAsmInfo & MAI
Definition: MCInstPrinter.h:46
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:40
HexagonInstPrinter(MCAsmInfo const &MAI, MCInstrInfo const &MII, MCRegisterInfo const &MRI)
Generic base class for all target subtargets.
void printNOneImmOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) 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:46
IRTranslator LLVM IR MI
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
void printOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
void printBranchOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
const MCRegisterInfo & MRI
Definition: MCInstPrinter.h:48