LLVM  13.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 ()
 
virtual ~MIRFormatter ()=default
 
virtual void printImm (raw_ostream &OS, const MachineInstr &MI, 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. More...
 
virtual bool parseImmMnemonic (const unsigned OpCode, const unsigned OpIdx, StringRef Src, int64_t &Imm, ErrorCallbackType ErrorCallback) const
 Implement target specific parsing of immediate mnemonics. More...
 
virtual void printCustomPseudoSourceValue (raw_ostream &OS, ModuleSlotTracker &MST, const PseudoSourceValue &PSV) const
 Implement target specific printing of target custom pseudo source value. More...
 
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. More...
 

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. More...
 
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. More...
 

Detailed Description

MIRFormater - Interface to format MIR operand based on target.

Definition at line 30 of file MIRFormatter.h.

Member Typedef Documentation

◆ ErrorCallbackType

Definition at line 33 of file MIRFormatter.h.

Constructor & Destructor Documentation

◆ MIRFormatter()

llvm::MIRFormatter::MIRFormatter ( )
inline

Definition at line 35 of file MIRFormatter.h.

◆ ~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 64 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 48 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 3261 of file MIParser.cpp.

References llvm::lexMIToken(), and parseIRValue().

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

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

◆ printImm()

virtual void llvm::MIRFormatter::printImm ( raw_ostream OS,
const MachineInstr MI,
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 None to OpIdx means the index is unknown.

Definition at line 41 of file MIRFormatter.h.

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

References llvm::ModuleSlotTracker::getCurrentFunction(), llvm::ModuleSlotTracker::getLocalSlot(), llvm::Value::getName(), llvm::Value::hasName(), llvm::Value::printAsOperand(), llvm::MachineOperand::printIRSlotNumber(), and llvm::printLLVMNameWithoutPrefix().

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


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