class MCInstPrinter

Declaration

class MCInstPrinter { /* full declaration omitted */ };

Description

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

Declared at: llvm/include/llvm/MC/MCInstPrinter.h:42

Member Variables

protected llvm::raw_ostream* CommentStream = nullptr
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 disabled.
protected const llvm::MCAsmInfo& MAI
protected const llvm::MCInstrInfo& MII
protected const llvm::MCRegisterInfo& MRI
protected bool UseMarkup = false
True if we are printing marked up assembly.
protected bool PrintImmHex = false
True if we are printing immediates as hex.
protected HexStyle::Style PrintHexStyle = HexStyle::C
Which style to use for printing hexadecimal values.

Method Overview

  • public MCInstPrinter(const llvm::MCAsmInfo & mai, const llvm::MCInstrInfo & mii, const llvm::MCRegisterInfo & mri)
  • public virtual bool applyTargetSpecificCLOption(llvm::StringRef Opt)
  • public format_object<int64_t> formatDec(int64_t Value) const
  • public format_object<uint64_t> formatHex(uint64_t Value) const
  • public format_object<int64_t> formatHex(int64_t Value) const
  • public format_object<int64_t> formatImm(int64_t Value) const
  • public llvm::StringRef getOpcodeName(unsigned int Opcode) const
  • public bool getPrintImmHex() const
  • public bool getUseMarkup() const
  • public llvm::StringRef markup(llvm::StringRef s) const
  • protected const char * matchAliasPatterns(const llvm::MCInst * MI, const llvm::MCSubtargetInfo * STI, const llvm::AliasMatchingData & M)
  • protected void printAnnotation(llvm::raw_ostream & OS, llvm::StringRef Annot)
  • public virtual void printInst(const llvm::MCInst * MI, uint64_t Address, llvm::StringRef Annot, const llvm::MCSubtargetInfo & STI, llvm::raw_ostream & OS)
  • public virtual void printRegName(llvm::raw_ostream & OS, unsigned int RegNo) const
  • public void setCommentStream(llvm::raw_ostream & OS)
  • public void setPrintHexStyle(HexStyle::Style Value)
  • public void setPrintImmHex(bool Value)
  • public void setUseMarkup(bool Value)
  • public virtual ~MCInstPrinter()

Methods

MCInstPrinter(const llvm::MCAsmInfo& mai,
              const llvm::MCInstrInfo& mii,
              const llvm::MCRegisterInfo& mri)

Declared at: llvm/include/llvm/MC/MCInstPrinter.h:69

Parameters

const llvm::MCAsmInfo& mai
const llvm::MCInstrInfo& mii
const llvm::MCRegisterInfo& mri

virtual bool applyTargetSpecificCLOption(
    llvm::StringRef Opt)

Description

Customize the printer according to a command line option.

Declared at: llvm/include/llvm/MC/MCInstPrinter.h:76

Parameters

llvm::StringRef Opt

Returns

true if the option is recognized and applied.

format_object<int64_t> formatDec(
    int64_t Value) const

Description

Utility functions to print decimal/hexadecimal values.

Declared at: llvm/include/llvm/MC/MCInstPrinter.h:109

Parameters

int64_t Value

format_object<uint64_t> formatHex(
    uint64_t Value) const

Declared at: llvm/include/llvm/MC/MCInstPrinter.h:111

Parameters

uint64_t Value

format_object<int64_t> formatHex(
    int64_t Value) const

Declared at: llvm/include/llvm/MC/MCInstPrinter.h:110

Parameters

int64_t Value

format_object<int64_t> formatImm(
    int64_t Value) const

Description

Utility function to print immediates in decimal or hex.

Declared at: llvm/include/llvm/MC/MCInstPrinter.h:104

Parameters

int64_t Value

llvm::StringRef getOpcodeName(
    unsigned int Opcode) const

Description

Return the name of the specified opcode enum (e.g. "MOV32ri") or empty if we can't resolve it.

Declared at: llvm/include/llvm/MC/MCInstPrinter.h:87

Parameters

unsigned int Opcode

bool getPrintImmHex() const

Declared at: llvm/include/llvm/MC/MCInstPrinter.h:98

bool getUseMarkup() const

Declared at: llvm/include/llvm/MC/MCInstPrinter.h:92

llvm::StringRef markup(llvm::StringRef s) const

Description

Utility functions to make adding mark ups simpler.

Declared at: llvm/include/llvm/MC/MCInstPrinter.h:96

Parameters

llvm::StringRef s

const char* matchAliasPatterns(
    const llvm::MCInst* MI,
    const llvm::MCSubtargetInfo* STI,
    const llvm::AliasMatchingData& M)

Description

Helper for matching MCInsts to alias patterns when printing instructions.

Declared at: llvm/include/llvm/MC/MCInstPrinter.h:65

Parameters

const llvm::MCInst* MI
const llvm::MCSubtargetInfo* STI
const llvm::AliasMatchingData& M

void printAnnotation(llvm::raw_ostream& OS,
                     llvm::StringRef Annot)

Description

Utility function for printing annotations.

Declared at: llvm/include/llvm/MC/MCInstPrinter.h:62

Parameters

llvm::raw_ostream& OS
llvm::StringRef Annot

virtual void printInst(
    const llvm::MCInst* MI,
    uint64_t Address,
    llvm::StringRef Annot,
    const llvm::MCSubtargetInfo& STI,
    llvm::raw_ostream& OS)

Description

Print the specified MCInst to the specified raw_ostream.

Declared at: llvm/include/llvm/MC/MCInstPrinter.h:82

Parameters

const llvm::MCInst* MI
uint64_t Address
llvm::StringRef Annot
const llvm::MCSubtargetInfo& STI
llvm::raw_ostream& OS

virtual void printRegName(
    llvm::raw_ostream& OS,
    unsigned int RegNo) const

Description

Print the assembler register name.

Declared at: llvm/include/llvm/MC/MCInstPrinter.h:90

Parameters

llvm::raw_ostream& OS
unsigned int RegNo

void setCommentStream(llvm::raw_ostream& OS)

Description

Specify a stream to emit comments to.

Declared at: llvm/include/llvm/MC/MCInstPrinter.h:79

Parameters

llvm::raw_ostream& OS

void setPrintHexStyle(HexStyle::Style Value)

Declared at: llvm/include/llvm/MC/MCInstPrinter.h:101

Parameters

HexStyle::Style Value

void setPrintImmHex(bool Value)

Declared at: llvm/include/llvm/MC/MCInstPrinter.h:99

Parameters

bool Value

void setUseMarkup(bool Value)

Declared at: llvm/include/llvm/MC/MCInstPrinter.h:93

Parameters

bool Value

virtual ~MCInstPrinter()

Declared at: llvm/include/llvm/MC/MCInstPrinter.h:72