LLVM 20.0.0git
|
Helper class that represents how the value of an instruction may be mapped and what is the related cost of such mapping. More...
#include "llvm/CodeGen/RegisterBankInfo.h"
Public Member Functions | |
InstructionMapping (unsigned ID, unsigned Cost, const ValueMapping *OperandsMapping, unsigned NumOperands) | |
Constructor for the mapping of an instruction. | |
InstructionMapping ()=default | |
Default constructor. | |
unsigned | getCost () const |
Get the cost. | |
unsigned | getID () const |
Get the ID. | |
unsigned | getNumOperands () const |
Get the number of operands. | |
const ValueMapping & | getOperandMapping (unsigned i) const |
Get the value mapping of the ith operand. | |
void | setOperandsMapping (const ValueMapping *OpdsMapping) |
Set the mapping for all the operands. | |
bool | isValid () const |
Check whether this object is valid. | |
bool | verify (const MachineInstr &MI) const |
Verifiy that this mapping makes sense for MI . | |
void | dump () const |
Print this on dbgs() stream. | |
void | print (raw_ostream &OS) const |
Print this on OS ;. | |
Helper class that represents how the value of an instruction may be mapped and what is the related cost of such mapping.
Definition at line 191 of file RegisterBankInfo.h.
|
inline |
Constructor for the mapping of an instruction.
NumOperands
must be equal to number of all the operands of the related instruction. The rationale is that it is more efficient for the optimizers to be able to assume that the mapping of the ith operand is at the index i.
Definition at line 218 of file RegisterBankInfo.h.
|
default |
Default constructor.
Use this constructor to express that the mapping is invalid.
LLVM_DUMP_METHOD void RegisterBankInfo::InstructionMapping::dump | ( | ) | const |
Print this on dbgs() stream.
Definition at line 646 of file RegisterBankInfo.cpp.
References llvm::dbgs(), and llvm::print().
|
inline |
Get the cost.
Definition at line 229 of file RegisterBankInfo.h.
Referenced by llvm::RegBankSelect::computeMapping().
|
inline |
Get the ID.
Definition at line 232 of file RegisterBankInfo.h.
Referenced by llvm::RegisterBankInfo::applyMapping(), isValid(), and llvm::RegisterBankInfo::OperandsMapper::print().
|
inline |
Get the number of operands.
Definition at line 235 of file RegisterBankInfo.h.
Referenced by llvm::RegisterBankInfo::applyDefaultMapping(), llvm::RegBankSelect::computeMapping(), llvm::RegisterBankInfo::OperandsMapper::OperandsMapper(), and llvm::RegisterBankInfo::OperandsMapper::print().
|
inline |
Get the value mapping of the ith operand.
Definition at line 240 of file RegisterBankInfo.h.
|
inline |
Check whether this object is valid.
This is a lightweight check for obvious wrong instance.
Definition at line 255 of file RegisterBankInfo.h.
References getID(), and llvm::RegisterBankInfo::InvalidMappingID.
Referenced by llvm::RegBankSelect::computeMapping(), llvm::RegisterBankInfo::getInstrMapping(), llvm::AArch64RegisterBankInfo::getInstrMapping(), llvm::AMDGPURegisterBankInfo::getInstrMapping(), llvm::ARMRegisterBankInfo::getInstrMapping(), llvm::M68kRegisterBankInfo::getInstrMapping(), llvm::MipsRegisterBankInfo::getInstrMapping(), llvm::PPCRegisterBankInfo::getInstrMapping(), llvm::RISCVRegisterBankInfo::getInstrMapping(), and llvm::X86RegisterBankInfo::getInstrMapping().
void RegisterBankInfo::InstructionMapping::print | ( | raw_ostream & | OS | ) | const |
Print this on OS
;.
Definition at line 652 of file RegisterBankInfo.cpp.
References OS.
Referenced by llvm::operator<<().
|
inline |
Set the mapping for all the operands.
In other words, OpdsMapping should hold at least getNumOperands ValueMapping.
Definition at line 249 of file RegisterBankInfo.h.
bool RegisterBankInfo::InstructionMapping::verify | ( | const MachineInstr & | MI | ) | const |
Verifiy that this mapping makes sense for MI
.
MI
must be connected to a MachineFunction.Definition at line 604 of file RegisterBankInfo.cpp.
References assert(), llvm::MachineOperand::getReg(), llvm::TargetSubtargetInfo::getRegBankInfo(), llvm::MachineFunction::getRegInfo(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::RegisterBankInfo::getSizeInBits(), llvm::MachineFunction::getSubtarget(), Idx, isCopyLike(), llvm::MachineOperand::isReg(), llvm::LLT::isValid(), isValid(), MI, MRI, and llvm::RegisterBankInfo::ValueMapping::verify().
Referenced by llvm::RegBankSelect::assignInstr(), and llvm::RegisterBankInfo::OperandsMapper::OperandsMapper().