LLVM 20.0.0git
Public Member Functions | Static Public Member Functions | List of all members
llvm::RISCVInstPrinter Class Reference

#include "Target/RISCV/MCTargetDesc/RISCVInstPrinter.h"

Inheritance diagram for llvm::RISCVInstPrinter:
Inheritance graph
[legend]

Public Member Functions

 RISCVInstPrinter (const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
 
bool applyTargetSpecificCLOption (StringRef Opt) override
 Customize the printer according to a command line option.
 
void printInst (const MCInst *MI, uint64_t Address, StringRef Annot, const MCSubtargetInfo &STI, raw_ostream &O) override
 Print the specified MCInst to the specified raw_ostream.
 
void printRegName (raw_ostream &O, MCRegister Reg) const override
 Print the assembler register name.
 
void printOperand (const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O, const char *Modifier=nullptr)
 
void printBranchOperand (const MCInst *MI, uint64_t Address, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
 
void printCSRSystemRegister (const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
 
void printFenceArg (const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
 
void printFRMArg (const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
 
void printFRMArgLegacy (const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
 
void printFPImmOperand (const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
 
void printZeroOffsetMemOp (const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
 
void printVTypeI (const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
 
void printVMaskReg (const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
 
void printRlist (const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
 
void printStackAdj (const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O, bool Negate=false)
 
void printNegStackAdj (const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
 
void printRegReg (const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
 
std::pair< const char *, uint64_tgetMnemonic (const MCInst *MI) override
 Returns a pair containing the mnemonic for MI and the number of bits left for further processing by printInstruction (generated by tablegen).
 
void printInstruction (const MCInst *MI, uint64_t Address, const MCSubtargetInfo &STI, raw_ostream &O)
 
bool printAliasInstr (const MCInst *MI, uint64_t Address, const MCSubtargetInfo &STI, raw_ostream &O)
 
void printCustomAliasOperand (const MCInst *MI, uint64_t Address, unsigned OpIdx, unsigned PrintMethodIdx, const MCSubtargetInfo &STI, raw_ostream &O)
 
- Public Member Functions inherited from llvm::MCInstPrinter
 MCInstPrinter (const MCAsmInfo &mai, const MCInstrInfo &mii, const MCRegisterInfo &mri)
 
virtual ~MCInstPrinter ()
 
virtual bool applyTargetSpecificCLOption (StringRef Opt)
 Customize the printer according to a command line option.
 
void setCommentStream (raw_ostream &OS)
 Specify a stream to emit comments to.
 
virtual std::pair< const char *, uint64_tgetMnemonic (const MCInst *MI)=0
 Returns a pair containing the mnemonic for MI and the number of bits left for further processing by printInstruction (generated by tablegen).
 
virtual void printInst (const MCInst *MI, uint64_t Address, StringRef Annot, const MCSubtargetInfo &STI, raw_ostream &OS)=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, MCRegister Reg) const
 Print the assembler register name.
 
bool getUseMarkup () const
 
void setUseMarkup (bool Value)
 
bool getUseColor () const
 
void setUseColor (bool Value)
 
WithMarkup markup (raw_ostream &OS, Markup M) const
 
bool getPrintImmHex () const
 
void setPrintImmHex (bool Value)
 
void setPrintHexStyle (HexStyle::Style Value)
 
void setPrintBranchImmAsAddress (bool Value)
 
void setSymbolizeOperands (bool Value)
 
void setMCInstrAnalysis (const MCInstrAnalysis *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_tformatHex (uint64_t Value) const
 

Static Public Member Functions

static const chargetRegisterName (MCRegister Reg)
 
static const chargetRegisterName (MCRegister Reg, unsigned AltIdx)
 

Additional Inherited Members

- Public Types inherited from llvm::MCInstPrinter
enum class  Markup { Immediate , Register , Target , Memory }
 
- Protected Member Functions inherited from llvm::MCInstPrinter
void printAnnotation (raw_ostream &OS, StringRef Annot)
 Utility function for printing annotations.
 
const charmatchAliasPatterns (const MCInst *MI, const MCSubtargetInfo *STI, const AliasMatchingData &M)
 Helper for matching MCInsts to alias patterns when printing instructions.
 
- Protected Attributes inherited from llvm::MCInstPrinter
raw_ostreamCommentStream = nullptr
 A stream that comments can be emitted to if desired.
 
const MCAsmInfoMAI
 
const MCInstrInfoMII
 
const MCRegisterInfoMRI
 
const MCInstrAnalysisMIA = nullptr
 
bool UseMarkup = false
 True if we are printing marked up assembly.
 
bool UseColor = false
 True if we are printing colored assembly.
 
bool PrintAliases = true
 True if we prefer aliases (e.g. nop) to raw mnemonics.
 
bool PrintImmHex = false
 True if we are printing immediates as hex.
 
HexStyle::Style PrintHexStyle = HexStyle::C
 Which style to use for printing hexadecimal values.
 
bool PrintBranchImmAsAddress = false
 If true, a branch immediate (e.g.
 
bool SymbolizeOperands = false
 If true, symbolize branch target and memory reference operands.
 

Detailed Description

Definition at line 21 of file RISCVInstPrinter.h.

Constructor & Destructor Documentation

◆ RISCVInstPrinter()

llvm::RISCVInstPrinter::RISCVInstPrinter ( const MCAsmInfo MAI,
const MCInstrInfo MII,
const MCRegisterInfo MRI 
)
inline

Definition at line 23 of file RISCVInstPrinter.h.

Member Function Documentation

◆ applyTargetSpecificCLOption()

bool RISCVInstPrinter::applyTargetSpecificCLOption ( StringRef  Opt)
overridevirtual

Customize the printer according to a command line option.

Returns
true if the option is recognized and applied.

Reimplemented from llvm::MCInstPrinter.

Definition at line 50 of file RISCVInstPrinter.cpp.

References ArchRegNames, and llvm::MCInstPrinter::PrintAliases.

◆ getMnemonic()

std::pair< const char *, uint64_t > llvm::RISCVInstPrinter::getMnemonic ( const MCInst MI)
overridevirtual

Returns a pair containing the mnemonic for MI and the number of bits left for further processing by printInstruction (generated by tablegen).

Implements llvm::MCInstPrinter.

◆ getRegisterName() [1/2]

const char * RISCVInstPrinter::getRegisterName ( MCRegister  Reg)
static

Definition at line 312 of file RISCVInstPrinter.cpp.

References ArchRegNames, and getRegisterName().

Referenced by getRegisterName(), and printRegName().

◆ getRegisterName() [2/2]

static const char * llvm::RISCVInstPrinter::getRegisterName ( MCRegister  Reg,
unsigned  AltIdx 
)
static

◆ printAliasInstr()

bool llvm::RISCVInstPrinter::printAliasInstr ( const MCInst MI,
uint64_t  Address,
const MCSubtargetInfo STI,
raw_ostream O 
)

Referenced by printInst().

◆ printBranchOperand()

void RISCVInstPrinter::printBranchOperand ( const MCInst MI,
uint64_t  Address,
unsigned  OpNo,
const MCSubtargetInfo STI,
raw_ostream O 
)

◆ printCSRSystemRegister()

void RISCVInstPrinter::printCSRSystemRegister ( const MCInst MI,
unsigned  OpNo,
const MCSubtargetInfo STI,
raw_ostream O 
)

◆ printCustomAliasOperand()

void llvm::RISCVInstPrinter::printCustomAliasOperand ( const MCInst MI,
uint64_t  Address,
unsigned  OpIdx,
unsigned  PrintMethodIdx,
const MCSubtargetInfo STI,
raw_ostream O 
)

◆ printFenceArg()

void RISCVInstPrinter::printFenceArg ( const MCInst MI,
unsigned  OpNo,
const MCSubtargetInfo STI,
raw_ostream O 
)

◆ printFPImmOperand()

void RISCVInstPrinter::printFPImmOperand ( const MCInst MI,
unsigned  OpNo,
const MCSubtargetInfo STI,
raw_ostream O 
)

◆ printFRMArg()

void RISCVInstPrinter::printFRMArg ( const MCInst MI,
unsigned  OpNo,
const MCSubtargetInfo STI,
raw_ostream O 
)

◆ printFRMArgLegacy()

void RISCVInstPrinter::printFRMArgLegacy ( const MCInst MI,
unsigned  OpNo,
const MCSubtargetInfo STI,
raw_ostream O 
)

◆ printInst()

void RISCVInstPrinter::printInst ( const MCInst MI,
uint64_t  Address,
StringRef  Annot,
const MCSubtargetInfo STI,
raw_ostream OS 
)
overridevirtual

Print the specified MCInst to the specified raw_ostream.

Address the address of current instruction on most targets, used to print a PC relative immediate as the target address. On targets where a PC relative immediate is relative to the next instruction and the length of a MCInst is difficult to measure (e.g. x86), this is the address of the next instruction. If Address is 0, the immediate will be printed.

Implements llvm::MCInstPrinter.

Definition at line 63 of file RISCVInstPrinter.cpp.

References llvm::Address, MI, NoAliases, llvm::MCInstPrinter::PrintAliases, printAliasInstr(), llvm::MCInstPrinter::printAnnotation(), printInstruction(), and llvm::RISCVRVC::uncompress().

◆ printInstruction()

void llvm::RISCVInstPrinter::printInstruction ( const MCInst MI,
uint64_t  Address,
const MCSubtargetInfo STI,
raw_ostream O 
)

Referenced by printInst().

◆ printNegStackAdj()

void llvm::RISCVInstPrinter::printNegStackAdj ( const MCInst MI,
unsigned  OpNo,
const MCSubtargetInfo STI,
raw_ostream O 
)
inline

Definition at line 58 of file RISCVInstPrinter.h.

References MI, and printStackAdj().

◆ printOperand()

void RISCVInstPrinter::printOperand ( const MCInst MI,
unsigned  OpNo,
const MCSubtargetInfo STI,
raw_ostream O,
const char Modifier = nullptr 
)

◆ printRegName()

void RISCVInstPrinter::printRegName ( raw_ostream OS,
MCRegister  Reg 
) const
overridevirtual

Print the assembler register name.

Reimplemented from llvm::MCInstPrinter.

Definition at line 78 of file RISCVInstPrinter.cpp.

References getRegisterName(), llvm::MCInstPrinter::markup(), and llvm::MCInstPrinter::Register.

Referenced by printOperand(), printRegReg(), printRlist(), printVMaskReg(), and printZeroOffsetMemOp().

◆ printRegReg()

void RISCVInstPrinter::printRegReg ( const MCInst MI,
unsigned  OpNo,
const MCSubtargetInfo STI,
raw_ostream O 
)

◆ printRlist()

void RISCVInstPrinter::printRlist ( const MCInst MI,
unsigned  OpNo,
const MCSubtargetInfo STI,
raw_ostream O 
)

◆ printStackAdj()

void RISCVInstPrinter::printStackAdj ( const MCInst MI,
unsigned  OpNo,
const MCSubtargetInfo STI,
raw_ostream O,
bool  Negate = false 
)

◆ printVMaskReg()

void RISCVInstPrinter::printVMaskReg ( const MCInst MI,
unsigned  OpNo,
const MCSubtargetInfo STI,
raw_ostream O 
)

◆ printVTypeI()

void RISCVInstPrinter::printVTypeI ( const MCInst MI,
unsigned  OpNo,
const MCSubtargetInfo STI,
raw_ostream O 
)

◆ printZeroOffsetMemOp()

void RISCVInstPrinter::printZeroOffsetMemOp ( const MCInst MI,
unsigned  OpNo,
const MCSubtargetInfo STI,
raw_ostream O 
)

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