LLVM  14.0.0git
HexagonInstPrinter.h
Go to the documentation of this file.
1 //===-- HexagonInstPrinter.h - Convert Hexagon MCInst to assembly syntax --===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 //
10 //===----------------------------------------------------------------------===//
11 
12 #ifndef LLVM_LIB_TARGET_HEXAGON_INSTPRINTER_HEXAGONINSTPRINTER_H
13 #define LLVM_LIB_TARGET_HEXAGON_INSTPRINTER_HEXAGONINSTPRINTER_H
14 
15 #include "llvm/MC/MCInstPrinter.h"
16 
17 namespace llvm {
18 /// Prints bundles as a newline separated list of individual instructions
19 /// Duplexes are separated by a vertical tab \v character
20 /// A trailing line includes bundle properties such as endloop0/1
21 ///
22 /// r0 = add(r1, r2)
23 /// r0 = #0 \v jump 0x0
24 /// :endloop0 :endloop1
26 public:
27  explicit HexagonInstPrinter(MCAsmInfo const &MAI, MCInstrInfo const &MII,
28  MCRegisterInfo const &MRI)
29  : MCInstPrinter(MAI, MII, MRI), MII(MII) {}
30 
31  void printInst(MCInst const *MI, uint64_t Address, StringRef Annot,
32  const MCSubtargetInfo &STI, raw_ostream &O) override;
33  void printRegName(raw_ostream &O, unsigned RegNo) const override;
34 
35  static char const *getRegisterName(unsigned RegNo);
36 
37  std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
38  void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
39  void printOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;
40  void printBrtarget(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;
41 
42  MCAsmInfo const &getMAI() const { return MAI; }
43  MCInstrInfo const &getMII() const { return MII; }
44 
45 private:
46  MCInstrInfo const &MII;
47  bool HasExtender = false;
48 };
49 
50 } // end namespace llvm
51 
52 #endif
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:102
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::MCAsmInfo
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
llvm::HexagonInstPrinter::printRegName
void printRegName(raw_ostream &O, unsigned RegNo) const override
Print the assembler register name.
Definition: HexagonInstPrinter.cpp:29
llvm::HexagonInstPrinter
Prints bundles as a newline separated list of individual instructions Duplexes are separated by a ver...
Definition: HexagonInstPrinter.h:25
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
llvm::HexagonInstPrinter::getMnemonic
std::pair< const char *, uint64_t > getMnemonic(const MCInst *MI) override
Returns a pair containing the mnemonic for MI and the number of bits left for further processing by p...
llvm::HexagonInstPrinter::getRegisterName
static const char * getRegisterName(unsigned RegNo)
llvm::MCInstPrinter::MRI
const MCRegisterInfo & MRI
Definition: MCInstPrinter.h:51
llvm::HexagonInstPrinter::HexagonInstPrinter
HexagonInstPrinter(MCAsmInfo const &MAI, MCInstrInfo const &MII, MCRegisterInfo const &MRI)
Definition: HexagonInstPrinter.h:27
llvm::HexagonInstPrinter::printOperand
void printOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
Definition: HexagonInstPrinter.cpp:62
llvm::HexagonInstPrinter::getMAI
const MCAsmInfo & getMAI() const
Definition: HexagonInstPrinter.h:42
llvm::HexagonInstPrinter::printInstruction
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O)
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
MCInstPrinter.h
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:179
llvm::MCInstPrinter
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:43
llvm::HexagonInstPrinter::getMII
const MCInstrInfo & getMII() const
Definition: HexagonInstPrinter.h:43
llvm::HexagonInstPrinter::printInst
void printInst(MCInst const *MI, uint64_t Address, StringRef Annot, const MCSubtargetInfo &STI, raw_ostream &O) override
Print the specified MCInst to the specified raw_ostream.
Definition: HexagonInstPrinter.cpp:33
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::MCRegisterInfo
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Definition: MCRegisterInfo.h:135
llvm::MCInstrInfo
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:25
llvm::MCInstPrinter::MAI
const MCAsmInfo & MAI
Definition: MCInstPrinter.h:49
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:75
llvm::HexagonInstPrinter::printBrtarget
void printBrtarget(MCInst const *MI, unsigned OpNo, raw_ostream &O) const
Definition: HexagonInstPrinter.cpp:81