LLVM 22.0.0git
llvm::MIRFormatter Class Reference

MIRFormater - Interface to format MIR operand based on target. More...

#include "llvm/CodeGen/MIRFormatter.h"

Inheritance diagram for llvm::MIRFormatter:
[legend]

Public Types

typedef function_ref< bool(StringRef::iterator Loc, const Twine &)> ErrorCallbackType

Public Member Functions

 MIRFormatter ()=default
virtual ~MIRFormatter ()=default
virtual void printImm (raw_ostream &OS, const MachineInstr &MI, std::optional< unsigned > OpIdx, int64_t Imm) const
 Implement target specific printing for machine operand immediate value, so that we can have more meaningful mnemonic than a 64-bit integer.
virtual bool parseImmMnemonic (const unsigned OpCode, const unsigned OpIdx, StringRef Src, int64_t &Imm, ErrorCallbackType ErrorCallback) const
 Implement target specific parsing of immediate mnemonics.
virtual void printCustomPseudoSourceValue (raw_ostream &OS, ModuleSlotTracker &MST, const PseudoSourceValue &PSV) const
 Implement target specific printing of target custom pseudo source value.
virtual bool parseCustomPseudoSourceValue (StringRef Src, MachineFunction &MF, PerFunctionMIParsingState &PFS, const PseudoSourceValue *&PSV, ErrorCallbackType ErrorCallback) const
 Implement target specific parsing of target custom pseudo source value.

Static Public Member Functions

static LLVM_ABI void printIRValue (raw_ostream &OS, const Value &V, ModuleSlotTracker &MST)
 Helper functions to print IR value as MIR serialization format which will be useful for target specific printer, e.g.
static LLVM_ABI bool parseIRValue (StringRef Src, MachineFunction &MF, PerFunctionMIParsingState &PFS, const Value *&V, ErrorCallbackType ErrorCallback)
 Helper functions to parse IR value from MIR serialization format which will be useful for target specific parser, e.g.

Detailed Description

MIRFormater - Interface to format MIR operand based on target.

Definition at line 33 of file MIRFormatter.h.

Member Typedef Documentation

◆ ErrorCallbackType

Constructor & Destructor Documentation

◆ MIRFormatter()

llvm::MIRFormatter::MIRFormatter ( )
default

◆ ~MIRFormatter()

virtual llvm::MIRFormatter::~MIRFormatter ( )
virtualdefault

Member Function Documentation

◆ parseCustomPseudoSourceValue()

virtual bool llvm::MIRFormatter::parseCustomPseudoSourceValue ( StringRef Src,
MachineFunction & MF,
PerFunctionMIParsingState & PFS,
const PseudoSourceValue *& PSV,
ErrorCallbackType ErrorCallback ) const
inlinevirtual

Implement target specific parsing of target custom pseudo source value.

Reimplemented in llvm::AMDGPUMIRFormatter.

Definition at line 67 of file MIRFormatter.h.

References llvm_unreachable.

◆ parseImmMnemonic()

virtual bool llvm::MIRFormatter::parseImmMnemonic ( const unsigned OpCode,
const unsigned OpIdx,
StringRef Src,
int64_t & Imm,
ErrorCallbackType ErrorCallback ) const
inlinevirtual

Implement target specific parsing of immediate mnemonics.

The mnemonic is dot separated strings.

Reimplemented in llvm::AMDGPUMIRFormatter.

Definition at line 51 of file MIRFormatter.h.

References llvm_unreachable, and OpIdx.

◆ parseIRValue()

bool MIRFormatter::parseIRValue ( StringRef Src,
MachineFunction & MF,
PerFunctionMIParsingState & PFS,
const Value *& V,
ErrorCallbackType ErrorCallback )
static

Helper functions to parse IR value from MIR serialization format which will be useful for target specific parser, e.g.

for parsing IR value for custom pseudo source value.

Definition at line 3666 of file MIParser.cpp.

References llvm::lexMIToken().

◆ printCustomPseudoSourceValue()

virtual void llvm::MIRFormatter::printCustomPseudoSourceValue ( raw_ostream & OS,
ModuleSlotTracker & MST,
const PseudoSourceValue & PSV ) const
inlinevirtual

Implement target specific printing of target custom pseudo source value.

Default implementation is not necessarily the correct MIR serialization format.

Definition at line 61 of file MIRFormatter.h.

Referenced by llvm::MachineMemOperand::print().

◆ printImm()

virtual void llvm::MIRFormatter::printImm ( raw_ostream & OS,
const MachineInstr & MI,
std::optional< unsigned > OpIdx,
int64_t Imm ) const
inlinevirtual

Implement target specific printing for machine operand immediate value, so that we can have more meaningful mnemonic than a 64-bit integer.

Passing std::nullopt to OpIdx means the index is unknown.

Reimplemented in llvm::AMDGPUMIRFormatter.

Definition at line 44 of file MIRFormatter.h.

References MI, and OpIdx.

Referenced by llvm::MachineOperand::print(), and llvm::AMDGPUMIRFormatter::printImm().

◆ printIRValue()

void MIRFormatter::printIRValue ( raw_ostream & OS,
const Value & V,
ModuleSlotTracker & MST )
static

Helper functions to print IR value as MIR serialization format which will be useful for target specific printer, e.g.

for printing IR value in custom pseudo source value.

Definition at line 971 of file MIRPrinter.cpp.

References llvm::ModuleSlotTracker::getCurrentFunction(), llvm::ModuleSlotTracker::getLocalSlot(), llvm::isa(), llvm::MachineOperand::printIRSlotNumber(), and llvm::printLLVMNameWithoutPrefix().

Referenced by llvm::MachineMemOperand::print().


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