LLVM
8.0.1
|
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. | |
MachineInstr & | getMI () const |
const InstructionMapping & | getInstrMapping () const |
The final mapping of the instruction. More... | |
MachineRegisterInfo & | getMRI () const |
The MachineRegisterInfo we used to realize the mapping. More... | |
Helper class used to get/create the virtual registers that will be used to replace the MachineOperand when applying a mapping.
Definition at line 278 of file RegisterBankInfo.h.
RegisterBankInfo::OperandsMapper::OperandsMapper | ( | MachineInstr & | MI, |
const InstructionMapping & | InstrMapping, | ||
MachineRegisterInfo & | MRI | ||
) |
Create an OperandsMapper that will hold the information to apply InstrMapping
to MI
.
Definition at line 604 of file RegisterBankInfo.cpp.
References assert(), getInstrMapping(), llvm::RegisterBankInfo::InstructionMapping::getNumOperands(), llvm::RegisterBankInfo::ValueMapping::NumBreakDowns, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorImpl< T >::resize(), llvm::SmallVectorBase::size(), and llvm::RegisterBankInfo::InstructionMapping::verify().
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.
OpIdx-th
operand have been assigned a new virtual register. Definition at line 650 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().
LLVM_DUMP_METHOD void RegisterBankInfo::OperandsMapper::dump | ( | ) | const |
Print this operands mapper on dbgs() stream.
Definition at line 708 of file RegisterBankInfo.cpp.
References llvm::dbgs(), and print().
|
inline |
The final mapping of the instruction.
Definition at line 330 of file RegisterBankInfo.h.
Referenced by llvm::RegisterBankInfo::applyDefaultMapping(), createVRegs(), llvm::AArch64RegisterBankInfo::getInstrAlternativeMappings(), getVRegs(), OperandsMapper(), print(), and setVRegs().
|
inline |
Definition at line 327 of file RegisterBankInfo.h.
References MI.
Referenced by llvm::RegisterBankInfo::applyDefaultMapping(), llvm::AArch64RegisterBankInfo::getInstrAlternativeMappings(), and print().
|
inline |
The MachineRegisterInfo we used to realize the mapping.
Definition at line 333 of file RegisterBankInfo.h.
References llvm::RegisterBankInfo::PartialMapping::dump(), MRI, and llvm::RegisterBankInfo::PartialMapping::print().
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.
Definition at line 685 of file RegisterBankInfo.cpp.
References assert(), llvm::SmallVectorTemplateCommon< T, typename >::end(), getInstrMapping(), llvm::make_range(), and llvm::RegisterBankInfo::ValueMapping::NumBreakDowns.
Referenced by llvm::RegisterBankInfo::applyDefaultMapping(), llvm::RegBankSelect::getAnalysisUsage(), and print().
void RegisterBankInfo::OperandsMapper::print | ( | raw_ostream & | OS, |
bool | ForDebug = false |
||
) | const |
Print this operands mapper on OS
stream.
Definition at line 714 of file RegisterBankInfo.cpp.
References llvm::RegisterBankInfo::InstructionMapping::getID(), getInstrMapping(), llvm::MachineInstr::getMF(), getMI(), llvm::RegisterBankInfo::InstructionMapping::getNumOperands(), llvm::MachineInstr::getParent(), getReg(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), getVRegs(), and llvm::printReg().
Referenced by dump().
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
.
PartialMapIdx-th
register of the value mapping of the OpIdx-th
operand has been set. Definition at line 670 of file RegisterBankInfo.cpp.
References assert(), and getInstrMapping().