LLVM  8.0.1
Public Member Functions | List of all members
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.

MachineInstr & getMI () const
 
const InstructionMappinggetInstrMapping () const
 The final mapping of the instruction. More...
 
MachineRegisterInfo & getMRI () 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 994 of file RegisterBankInfo.h.

Constructor & Destructor Documentation

◆ OperandsMapper()

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)

Member Function Documentation

◆ createVRegs()

void 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.

◆ dump()

void OperandsMapper::dump ( ) const

Print this operands mapper on dbgs() stream.

◆ getInstrMapping()

const InstructionMapping& OperandsMapper::getInstrMapping ( ) const
inline

The final mapping of the instruction.

Definition at line 1046 of file RegisterBankInfo.h.

Referenced by llvm::applyMapping().

◆ getMI()

MachineInstr& OperandsMapper::getMI ( ) const
inline

Definition at line 1043 of file RegisterBankInfo.h.

◆ getMRI()

MachineRegisterInfo& OperandsMapper::getMRI ( ) const
inline

The MachineRegisterInfo we used to realize the mapping.

Definition at line 1049 of file RegisterBankInfo.h.

◆ getVRegs()

iterator_range<SmallVectorImpl<unsigned>::const_iterator> 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

◆ print()

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

Print this operands mapper on OS stream.

◆ setVRegs()

void 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.

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