LLVM 19.0.0git
Public Types | Public Member Functions | Static Public Member Functions | List of all members
llvm::MIRFormatter Class Reference

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

#include "llvm/CodeGen/MIRFormatter.h"

Inheritance diagram for llvm::MIRFormatter:
Inheritance graph
[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 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 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 32 of file MIRFormatter.h.

Member Typedef Documentation

◆ ErrorCallbackType

Definition at line 35 of file MIRFormatter.h.

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 66 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 seperated strings.

Definition at line 50 of file MIRFormatter.h.

References llvm_unreachable.

◆ 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 3659 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 60 of file MIRFormatter.h.

References OS.

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.

Definition at line 43 of file MIRFormatter.h.

References OS.

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

◆ 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 968 of file MIRPrinter.cpp.

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

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


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