LLVM  mainline
Public Member Functions | Protected Member Functions | Protected Attributes
llvm::MCInstPrinter Class Reference

This is an instance of a target assembly language printer that converts an MCInst to valid target assembly syntax. More...

#include <MCInstPrinter.h>

Inheritance diagram for llvm::MCInstPrinter:
Inheritance graph
[legend]
Collaboration diagram for llvm::MCInstPrinter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 MCInstPrinter (const MCAsmInfo &mai, const MCInstrInfo &mii, const MCRegisterInfo &mri)
virtual ~MCInstPrinter ()
void setCommentStream (raw_ostream &OS)
 Specify a stream to emit comments to.
virtual void printInst (const MCInst *MI, raw_ostream &OS, StringRef Annot, const MCSubtargetInfo &STI)=0
 Print the specified MCInst to the specified raw_ostream.
StringRef getOpcodeName (unsigned Opcode) const
 Return the name of the specified opcode enum (e.g.
virtual void printRegName (raw_ostream &OS, unsigned RegNo) const
 Print the assembler register name.
bool getUseMarkup () const
void setUseMarkup (bool Value)
StringRef markup (StringRef s) const
 Utility functions to make adding mark ups simpler.
StringRef markup (StringRef a, StringRef b) const
bool getPrintImmHex () const
void setPrintImmHex (bool Value)
HexStyle::Style getPrintHexStyle () const
void setPrintHexStyle (HexStyle::Style Value)
format_object< int64_t > formatImm (int64_t Value) const
 Utility function to print immediates in decimal or hex.
format_object< int64_t > formatDec (int64_t Value) const
 Utility functions to print decimal/hexadecimal values.
format_object< int64_t > formatHex (int64_t Value) const
format_object< uint64_t > formatHex (uint64_t Value) const

Protected Member Functions

void printAnnotation (raw_ostream &OS, StringRef Annot)
 Utility function for printing annotations.

Protected Attributes

raw_ostreamCommentStream
 A stream that comments can be emitted to if desired.
const MCAsmInfoMAI
const MCInstrInfoMII
const MCRegisterInfoMRI
bool UseMarkup
 True if we are printing marked up assembly.
bool PrintImmHex
 True if we are printing immediates as hex.
HexStyle::Style PrintHexStyle
 Which style to use for printing hexadecimal values.

Detailed Description

This is an instance of a target assembly language printer that converts an MCInst to valid target assembly syntax.

Definition at line 38 of file MCInstPrinter.h.


Constructor & Destructor Documentation

Definition at line 61 of file MCInstPrinter.h.

Definition at line 28 of file MCInstPrinter.cpp.


Member Function Documentation

format_object< int64_t > MCInstPrinter::formatDec ( int64_t  Value) const

Utility functions to print decimal/hexadecimal values.

Definition at line 81 of file MCInstPrinter.cpp.

References llvm::format().

Referenced by formatImm(), and llvm::BPFInstPrinter::printMemOperand().

format_object< int64_t > MCInstPrinter::formatHex ( int64_t  Value) const
format_object< uint64_t > MCInstPrinter::formatHex ( uint64_t  Value) const
format_object<int64_t> llvm::MCInstPrinter::formatImm ( int64_t  Value) const [inline]

Return the name of the specified opcode enum (e.g.

getOpcodeName - Return the name of the specified opcode enum (e.g.

"MOV32ri") or empty if we can't resolve it.

Reimplemented in llvm::HexagonInstPrinter.

Definition at line 33 of file MCInstPrinter.cpp.

References llvm::MCInstrInfo::getName(), and MII.

Referenced by llvm::MCInst::dump_pretty().

Definition at line 92 of file MCInstPrinter.h.

References PrintHexStyle.

Definition at line 89 of file MCInstPrinter.h.

References PrintImmHex.

Definition at line 82 of file MCInstPrinter.h.

References UseMarkup.

Referenced by markup().

Utility functions to make adding mark ups simpler.

Definition at line 55 of file MCInstPrinter.cpp.

References getUseMarkup().

Referenced by llvm::ARMInstPrinter::printAddrMode2OffsetOperand(), llvm::ARMInstPrinter::printAddrMode3OffsetOperand(), llvm::ARMInstPrinter::printAddrMode5Operand(), llvm::ARMInstPrinter::printAddrMode6Operand(), llvm::ARMInstPrinter::printAddrMode7Operand(), llvm::ARMInstPrinter::printAddrModeImm12Operand(), llvm::ARMInstPrinter::printAddrModeTBB(), llvm::ARMInstPrinter::printAddrModeTBH(), llvm::ARMInstPrinter::printAdrLabelOperand(), llvm::ARMInstPrinter::printAM2PreOrOffsetIndexOp(), llvm::ARMInstPrinter::printAM3PreOrOffsetIndexOp(), llvm::ARMInstPrinter::printBitfieldInvMaskImmOperand(), llvm::ARMInstPrinter::printFBits16(), llvm::ARMInstPrinter::printFBits32(), llvm::ARMInstPrinter::printFPImmOperand(), llvm::ARMInstPrinter::printImmPlusOneOperand(), llvm::ARMInstPrinter::printInst(), llvm::ARMInstPrinter::printModImmOperand(), llvm::ARMInstPrinter::printNEONModImmOperand(), llvm::NVPTXInstPrinter::printOperand(), llvm::ARMInstPrinter::printOperand(), llvm::ARMInstPrinter::printPKHASRShiftImm(), llvm::ARMInstPrinter::printPKHLSLShiftImm(), llvm::ARMInstPrinter::printPostIdxImm8Operand(), llvm::ARMInstPrinter::printPostIdxImm8s4Operand(), llvm::ARMInstPrinter::printRegName(), llvm::ARMInstPrinter::printRotImmOperand(), llvm::ARMInstPrinter::printShiftImmOperand(), llvm::ARMInstPrinter::printT2AddrModeImm0_1020s4Operand(), llvm::ARMInstPrinter::printT2AddrModeImm8OffsetOperand(), llvm::ARMInstPrinter::printT2AddrModeImm8Operand(), llvm::ARMInstPrinter::printT2AddrModeImm8s4OffsetOperand(), llvm::ARMInstPrinter::printT2AddrModeImm8s4Operand(), llvm::ARMInstPrinter::printT2AddrModeSoRegOperand(), llvm::ARMInstPrinter::printThumbAddrModeImm5SOperand(), llvm::ARMInstPrinter::printThumbAddrModeRROperand(), llvm::ARMInstPrinter::printThumbLdrLabelOperand(), llvm::ARMInstPrinter::printThumbS4ImmOperand(), and llvm::ARMInstPrinter::printThumbSRImm().

Definition at line 61 of file MCInstPrinter.cpp.

References getUseMarkup().

void MCInstPrinter::printAnnotation ( raw_ostream OS,
StringRef  Annot 
) [protected]
virtual void llvm::MCInstPrinter::printInst ( const MCInst MI,
raw_ostream OS,
StringRef  Annot,
const MCSubtargetInfo STI 
) [pure virtual]
void MCInstPrinter::printRegName ( raw_ostream OS,
unsigned  RegNo 
) const [virtual]

Specify a stream to emit comments to.

Definition at line 69 of file MCInstPrinter.h.

References CommentStream.

Referenced by LLVMSetDisasmOptions().

Definition at line 93 of file MCInstPrinter.h.

References PrintHexStyle.

void llvm::MCInstPrinter::setPrintImmHex ( bool  Value) [inline]

Definition at line 90 of file MCInstPrinter.h.

References PrintImmHex.

Referenced by LLVMSetDisasmOptions().

void llvm::MCInstPrinter::setUseMarkup ( bool  Value) [inline]

Definition at line 83 of file MCInstPrinter.h.

References UseMarkup.

Referenced by LLVMSetDisasmOptions().


Member Data Documentation

A stream that comments can be emitted to if desired.

Each comment must end with a newline. This will be null if verbose assembly emission is disable.

Definition at line 43 of file MCInstPrinter.h.

Referenced by llvm::AArch64InstPrinter::printAddSubImm(), printAnnotation(), and setCommentStream().

Definition at line 45 of file MCInstPrinter.h.

Referenced by getOpcodeName().

Which style to use for printing hexadecimal values.

Definition at line 55 of file MCInstPrinter.h.

Referenced by formatHex(), getPrintHexStyle(), and setPrintHexStyle().

True if we are printing immediates as hex.

Definition at line 52 of file MCInstPrinter.h.

Referenced by formatImm(), getPrintImmHex(), and setPrintImmHex().


The documentation for this class was generated from the following files: