LLVM 19.0.0git
Public Member Functions | List of all members
llvm::RegisterBankInfo::OperandsMapper Class Reference

Helper class used to get/create the virtual registers that will be used to replace the MachineOperand when applying a mapping. More...

#include "llvm/CodeGen/RegisterBankInfo.h"

Public Member Functions

 OperandsMapper (MachineInstr &MI, const InstructionMapping &InstrMapping, MachineRegisterInfo &MRI)
 Create an OperandsMapper that will hold the information to apply InstrMapping to MI.
 
void createVRegs (unsigned OpIdx)
 Create as many new virtual registers as needed for the mapping of the OpIdx-th operand.
 
void setVRegs (unsigned OpIdx, unsigned PartialMapIdx, Register NewVReg)
 Set the virtual register of the PartialMapIdx-th partial mapping of the OpIdx-th operand to NewVReg.
 
iterator_range< SmallVectorImpl< Register >::const_iteratorgetVRegs (unsigned OpIdx, bool ForDebug=false) const
 Get all the virtual registers required to map the OpIdx-th operand of the instruction.
 
void dump () const
 Print this operands mapper on dbgs() stream.
 
void print (raw_ostream &OS, bool ForDebug=false) const
 Print this operands mapper on OS stream.
 
Getters.

The MachineInstr being remapped.

MachineInstrgetMI () const
 
const InstructionMappinggetInstrMapping () const
 The final mapping of the instruction.
 
MachineRegisterInfogetMRI () const
 The MachineRegisterInfo we used to realize the mapping.
 

Detailed Description

Helper class used to get/create the virtual registers that will be used to replace the MachineOperand when applying a mapping.

Definition at line 281 of file RegisterBankInfo.h.

Constructor & Destructor Documentation

◆ OperandsMapper()

RegisterBankInfo::OperandsMapper::OperandsMapper ( MachineInstr MI,
const InstructionMapping InstrMapping,
MachineRegisterInfo MRI 
)

Create an OperandsMapper that will hold the information to apply InstrMapping to MI.

Precondition
InstrMapping.verify(MI)

Definition at line 666 of file RegisterBankInfo.cpp.

References assert(), llvm::RegisterBankInfo::InstructionMapping::getNumOperands(), MI, llvm::SmallVectorImpl< T >::resize(), and llvm::RegisterBankInfo::InstructionMapping::verify().

Member Function Documentation

◆ createVRegs()

void RegisterBankInfo::OperandsMapper::createVRegs ( unsigned  OpIdx)

Create as many new virtual registers as needed for the mapping of the OpIdx-th operand.

The number of registers is determined by the number of breakdown for the related operand in the instruction mapping. The type of the new registers is a plain scalar of the right size. The proper type is expected to be set when the mapping is applied to the instruction(s) that realizes the mapping.

Precondition
getMI().getOperand(OpIdx).isReg()
Postcondition
All the partial mapping of the OpIdx-th operand have been assigned a new virtual register.

Definition at line 712 of file RegisterBankInfo.cpp.

References assert(), llvm::RegisterBankInfo::ValueMapping::begin(), llvm::RegisterBankInfo::ValueMapping::end(), llvm::RegisterBankInfo::getInstrMapping(), llvm::RegisterBankInfo::PartialMapping::Length, MRI, llvm::RegisterBankInfo::PartialMapping::RegBank, and llvm::LLT::scalar().

Referenced by llvm::RegBankSelect::applyMapping().

◆ dump()

LLVM_DUMP_METHOD void RegisterBankInfo::OperandsMapper::dump ( ) const

Print this operands mapper on dbgs() stream.

Definition at line 770 of file RegisterBankInfo.cpp.

References llvm::dbgs(), and llvm::print().

◆ getInstrMapping()

const InstructionMapping & llvm::RegisterBankInfo::OperandsMapper::getInstrMapping ( ) const
inline

◆ getMI()

MachineInstr & llvm::RegisterBankInfo::OperandsMapper::getMI ( ) const
inline

◆ getMRI()

MachineRegisterInfo & llvm::RegisterBankInfo::OperandsMapper::getMRI ( ) const
inline

◆ getVRegs()

iterator_range< SmallVectorImpl< Register >::const_iterator > RegisterBankInfo::OperandsMapper::getVRegs ( unsigned  OpIdx,
bool  ForDebug = false 
) const

Get all the virtual registers required to map the OpIdx-th operand of the instruction.

This return an empty range when createVRegs or setVRegs has not been called. The iterator may be invalidated by a call to setVRegs or createVRegs.

When ForDebug is true, we will not check that the list of new virtual registers does not contain uninitialized values.

Precondition
getMI().getOperand(OpIdx).isReg()
ForDebug || All partial mappings have been set a register

Definition at line 747 of file RegisterBankInfo.cpp.

References assert(), End, llvm::RegisterBankInfo::getInstrMapping(), llvm::make_range(), and llvm::RegisterBankInfo::ValueMapping::NumBreakDowns.

Referenced by llvm::RegisterBankInfo::applyDefaultMapping(), llvm::RegBankSelect::applyMapping(), llvm::AMDGPURegisterBankInfo::applyMappingImpl(), llvm::AMDGPURegisterBankInfo::applyMappingLoad(), llvm::AMDGPURegisterBankInfo::applyMappingSMULU64(), and substituteSimpleCopyRegs().

◆ print()

void RegisterBankInfo::OperandsMapper::print ( raw_ostream OS,
bool  ForDebug = false 
) const

◆ setVRegs()

void RegisterBankInfo::OperandsMapper::setVRegs ( unsigned  OpIdx,
unsigned  PartialMapIdx,
Register  NewVReg 
)

Set the virtual register of the PartialMapIdx-th partial mapping of the OpIdx-th operand to NewVReg.

Precondition
getMI().getOperand(OpIdx).isReg()
getInstrMapping().getOperandMapping(OpIdx).BreakDown.size() > PartialMapIdx
NewReg != 0
Postcondition
the PartialMapIdx-th register of the value mapping of the OpIdx-th operand has been set.

Definition at line 732 of file RegisterBankInfo.cpp.

References assert(), and llvm::RegisterBankInfo::getInstrMapping().


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