LLVM  6.0.0svn
Public Member Functions | List of all members
InstructionMapping Class Reference

Helper class that represents how the value of an instruction may be mapped and what is the related cost of such mapping. More...

#include "llvm/CodeGen/GlobalISel/RegisterBankInfo.h"

Public Member Functions

 InstructionMapping (unsigned ID, unsigned Cost, const ValueMapping *OperandsMapping, unsigned NumOperands)
 Constructor for the mapping of an instruction. More...
 
 InstructionMapping ()=default
 Default constructor. More...
 
unsigned getCost () const
 Get the cost. More...
 
unsigned getID () const
 Get the ID. More...
 
unsigned getNumOperands () const
 Get the number of operands. More...
 
const ValueMappinggetOperandMapping (unsigned i) const
 Get the value mapping of the ith operand. More...
 
void setOperandsMapping (const ValueMapping *OpdsMapping)
 Set the mapping for all the operands. More...
 
bool isValid () const
 Check whether this object is valid. More...
 
bool verify (const MachineInstr &MI) const
 Verifiy that this mapping makes sense for MI. More...
 
void dump () const
 Print this on dbgs() stream. More...
 
void print (raw_ostream &OS) const
 Print this on OS;. More...
 

Detailed Description

Helper class that represents how the value of an instruction may be mapped and what is the related cost of such mapping.

Definition at line 895 of file RegisterBankInfo.h.

Constructor & Destructor Documentation

◆ InstructionMapping() [1/2]

InstructionMapping::InstructionMapping ( unsigned  ID,
unsigned  Cost,
const ValueMapping OperandsMapping,
unsigned  NumOperands 
)
inline

Constructor for the mapping of an instruction.

NumOperands must be equal to number of all the operands of the related instruction. The rationale is that it is more efficient for the optimizers to be able to assume that the mapping of the ith operand is at the index i.

Precondition
ID != InvalidMappingID

Definition at line 924 of file RegisterBankInfo.h.

◆ InstructionMapping() [2/2]

InstructionMapping::InstructionMapping ( )
default

Default constructor.

Use this constructor to express that the mapping is invalid.

Member Function Documentation

◆ dump()

void InstructionMapping::dump ( ) const

Print this on dbgs() stream.

◆ getCost()

unsigned InstructionMapping::getCost ( ) const
inline

Get the cost.

Definition at line 938 of file RegisterBankInfo.h.

◆ getID()

unsigned InstructionMapping::getID ( ) const
inline

Get the ID.

Definition at line 941 of file RegisterBankInfo.h.

Referenced by llvm::applyMapping().

◆ getNumOperands()

unsigned InstructionMapping::getNumOperands ( ) const
inline

Get the number of operands.

Definition at line 944 of file RegisterBankInfo.h.

◆ getOperandMapping()

const ValueMapping& InstructionMapping::getOperandMapping ( unsigned  i) const
inline

Get the value mapping of the ith operand.

Precondition
The mapping for the ith operand has been set.
The ith operand is a register.

Definition at line 949 of file RegisterBankInfo.h.

◆ isValid()

bool InstructionMapping::isValid ( ) const
inline

Check whether this object is valid.

This is a lightweight check for obvious wrong instance.

Definition at line 964 of file RegisterBankInfo.h.

◆ print()

void InstructionMapping::print ( raw_ostream &  OS) const

Print this on OS;.

◆ setOperandsMapping()

void InstructionMapping::setOperandsMapping ( const ValueMapping OpdsMapping)
inline

Set the mapping for all the operands.

In other words, OpdsMapping should hold at least getNumOperands ValueMapping.

Definition at line 958 of file RegisterBankInfo.h.

◆ verify()

bool InstructionMapping::verify ( const MachineInstr &  MI) const

Verifiy that this mapping makes sense for MI.

Precondition
MI must be connected to a MachineFunction.
Note
This method does not check anything when assertions are disabled.
Returns
True is the check was successful.

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