LLVM  6.0.0svn
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/GlobalISel/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...
 
Getters.

The MachineInstr being remapped.

MachineInstrgetMI () const
 
const InstructionMappinggetInstrMapping () const
 The final mapping of the instruction. More...
 
MachineRegisterInfogetMRI () const
 The MachineRegisterInfo we used to realize the mapping. 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 277 of file RegisterBankInfo.h.

Constructor & Destructor Documentation

◆ OperandsMapper()

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

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

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

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

◆ dump()

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

Print this operands mapper on dbgs() stream.

Definition at line 716 of file RegisterBankInfo.cpp.

References llvm::dbgs(), and 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< 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 693 of file RegisterBankInfo.cpp.

References assert(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::WebAssembly::End, getInstrMapping(), llvm::make_range(), and llvm::RegisterBankInfo::ValueMapping::NumBreakDowns.

Referenced by llvm::RegisterBankInfo::applyDefaultMapping(), llvm::RegBankSelect::getAnalysisUsage(), and print().

◆ print()

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

◆ setVRegs()

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

References assert(), and getInstrMapping().


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