LLVM  4.0.0
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 <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. More...
 
void createVRegs (unsigned OpIdx)
 Create as many new virtual registers as needed for the mapping of the OpIdx-th operand. More...
 
void setVRegs (unsigned OpIdx, unsigned PartialMapIdx, unsigned NewVReg)
 Set the virtual register of the PartialMapIdx-th partial mapping of the OpIdx-th operand to NewVReg. More...
 
iterator_range
< SmallVectorImpl< unsigned >
::const_iterator > 
getVRegs (unsigned OpIdx, bool ForDebug=false) const
 Get all the virtual registers required to map the OpIdx-th operand of the instruction. More...
 
void dump () const
 Print this operands mapper on dbgs() stream. More...
 
void print (raw_ostream &OS, bool ForDebug=false) const
 Print this operands mapper on OS stream. More...
 
MachineInstrgetMI () const
 Getters. More...
 
const InstructionMappinggetInstrMapping () const
 The final mapping of the instruction. More...
 

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 271 of file RegisterBankInfo.h.

Constructor & Destructor Documentation

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 524 of file RegisterBankInfo.cpp.

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

Member Function Documentation

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.

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 570 of file RegisterBankInfo.cpp.

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

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

Print this operands mapper on dbgs() stream.

Definition at line 622 of file RegisterBankInfo.cpp.

References llvm::dbgs().

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

The final mapping of the instruction.

Definition at line 319 of file RegisterBankInfo.h.

Referenced by llvm::RegisterBankInfo::applyDefaultMapping().

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

Getters.

The MachineInstr being remapped.

Definition at line 316 of file RegisterBankInfo.h.

Referenced by llvm::RegisterBankInfo::applyDefaultMapping().

iterator_range< SmallVectorImpl< unsigned >::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 600 of file RegisterBankInfo.cpp.

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

Referenced by llvm::RegisterBankInfo::applyDefaultMapping().

void RegisterBankInfo::OperandsMapper::print ( raw_ostream OS,
bool  ForDebug = false 
) const
void RegisterBankInfo::OperandsMapper::setVRegs ( unsigned  OpIdx,
unsigned  PartialMapIdx,
unsigned  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 585 of file RegisterBankInfo.cpp.

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


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