Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
Classes |Public Types |Public Member Functions |Static Public Member Functions |Static Public Attributes |Protected Member Functions |Protected Attributes |List of all members
llvm::RegisterBankInfo Class Reference

Holds all the information related to register banks.More...

#include "llvm/CodeGen/RegisterBankInfo.h"

Inheritance diagram for llvm::RegisterBankInfo:
Inheritance graph
[legend]

Classes

class  InstructionMapping
 Helper class that represents how the value of an instruction may be mapped and what is the related cost of such mapping.More...
 
class  OperandsMapper
 Helper class used to get/create the virtual registers that will be used to replace theMachineOperand when applying a mapping.More...
 
struct  PartialMapping
 Helper struct that represents how a value is partially mapped into a register.More...
 
struct  ValueMapping
 Helper struct that represents how a value is mapped through different register banks.More...
 

Public Types

using InstructionMappings =SmallVector<constInstructionMapping *, 4 >
 Convenient type to represent the alternatives for mapping an instruction.
 

Public Member Functions

constRegisterBankgetRegBankFromConstraints (constMachineInstr &MI,unsigned OpIdx,constTargetInstrInfo &TII,constMachineRegisterInfo &MRI)const
 Get the register bank for theOpIdx-th operand ofMI form the encoding constraints, if any.
 
virtual void applyMappingImpl (MachineIRBuilder &Builder,constOperandsMapper &OpdMapper)const
 SeeapplyMapping.
 
virtual ~RegisterBankInfo ()=default
 
constRegisterBankgetRegBank (unsignedID)const
 Get the register bank identified byID.
 
unsigned getMaximumSize (unsigned RegBankID)const
 Get the maximum size in bits that fits in the given register bank.
 
constRegisterBankgetRegBank (RegisterReg,constMachineRegisterInfo &MRI,constTargetRegisterInfo &TRI)const
 Get the register bank ofReg.
 
unsigned getNumRegBanks ()const
 Get the total number of register banks.
 
virtualbool isDivergentRegBank (constRegisterBank *RB)const
 Returns true if the register bank is considered divergent.
 
virtualconstRegisterBankgetRegBankFromRegClass (constTargetRegisterClass &RC,LLT Ty)const
 Get a register bank that coversRC.
 
virtualunsigned copyCost (constRegisterBank &A,constRegisterBank &B,TypeSizeSize)const
 Get the cost of a copy fromB toA, or put differently, get the cost of A = COPY B.
 
bool cannotCopy (constRegisterBank &Dst,constRegisterBank &Src,TypeSizeSize)const
 
virtualunsigned getBreakDownCost (constValueMapping &ValMapping,constRegisterBank *CurBank=nullptr)const
 Get the cost of usingValMapping to decompose a register.
 
virtualconstInstructionMappinggetInstrMapping (constMachineInstr &MI)const
 Get the mapping of the different operands ofMI on the register bank.
 
virtualInstructionMappings getInstrAlternativeMappings (constMachineInstr &MI)const
 Get the alternative mappings forMI.
 
InstructionMappings getInstrPossibleMappings (constMachineInstr &MI)const
 Get the possible mapping forMI.
 
void applyMapping (MachineIRBuilder &Builder,constOperandsMapper &OpdMapper)const
 ApplyOpdMapper.getInstrMapping() toOpdMapper.getMI().
 
TypeSize getSizeInBits (RegisterReg,constMachineRegisterInfo &MRI,constTargetRegisterInfo &TRI)const
 Get the size in bits ofReg.
 
bool verify (constTargetRegisterInfo &TRI)const
 Check that information hold by this instance make sense for the givenTRI.
 

Static Public Member Functions

static void applyDefaultMapping (constOperandsMapper &OpdMapper)
 Helper method to apply something that is like the default mapping.
 
staticconstTargetRegisterClassconstrainGenericRegister (RegisterReg,constTargetRegisterClass &RC,MachineRegisterInfo &MRI)
 Constrain the (possibly generic) virtual registerReg toRC.
 

Static Public Attributes

staticconstunsigned DefaultMappingID = UINT_MAX
 Identifier used when the related instruction mapping instance is generated by target independent code.
 
staticconstunsigned InvalidMappingID = UINT_MAX - 1
 Identifier used when the related instruction mapping instance is generated by the default constructor.
 

Protected Member Functions

 RegisterBankInfo (constRegisterBank **RegBanks,unsignedNumRegBanks,constunsigned *Sizes,unsignedHwMode)
 Create aRegisterBankInfo that can accommodate up toNumRegBanksRegisterBank instances.
 
 RegisterBankInfo ()
 This constructor is meaningless.
 
constRegisterBankgetRegBank (unsignedID)
 Get the register bank identified byID.
 
constTargetRegisterClassgetMinimalPhysRegClass (RegisterReg,constTargetRegisterInfo &TRI)const
 Get the MinimalPhysRegClass for Reg.
 
constInstructionMappinggetInstrMappingImpl (constMachineInstr &MI)const
 Try to get the mapping ofMI.
 
constPartialMappinggetPartialMapping (unsigned StartIdx,unsignedLength,constRegisterBank &RegBank)const
 Get the uniquely generatedPartialMapping for the given arguments.
 
Methods to get a uniquely generated ValueMapping.
constValueMappinggetValueMapping (unsigned StartIdx,unsignedLength,constRegisterBank &RegBank)const
 The most commonValueMapping consists of a singlePartialMapping.
 
constValueMappinggetValueMapping (constPartialMapping *BreakDown,unsigned NumBreakDowns)const
 Get theValueMapping for the given arguments.
 
Methods to get a uniquely generated array of ValueMapping.
template<typename Iterator >
constValueMappinggetOperandsMapping (Iterator Begin, IteratorEnd)const
 Get the uniquely generated array ofValueMapping for the elements of betweenBegin andEnd.
 
constValueMappinggetOperandsMapping (constSmallVectorImpl<constValueMapping * > &OpdsMapping)const
 Get the uniquely generated array ofValueMapping for the elements ofOpdsMapping.
 
constValueMappinggetOperandsMapping (std::initializer_list<constValueMapping * > OpdsMapping)const
 Get the uniquely generated array ofValueMapping for the given arguments.
 

Protected Attributes

constRegisterBank ** RegBanks
 Hold the set of supported register banks.
 
unsigned NumRegBanks
 Total number of register banks.
 
constunsignedSizes
 Hold the sizes of the register banks for all HwModes.
 
unsigned HwMode
 Current HwMode for the target.
 
DenseMap<hash_code, std::unique_ptr<constPartialMapping > > MapOfPartialMappings
 Keep dynamically allocatedPartialMapping in a separate map.
 
DenseMap<hash_code, std::unique_ptr<constValueMapping > > MapOfValueMappings
 Keep dynamically allocatedValueMapping in a separate map.
 
DenseMap<hash_code, std::unique_ptr<ValueMapping[]> > MapOfOperandsMappings
 Keep dynamically allocated array ofValueMapping in a separate map.
 
DenseMap<hash_code, std::unique_ptr<constInstructionMapping > > MapOfInstructionMappings
 Keep dynamically allocatedInstructionMapping in a separate map.
 
DenseMap<unsigned,constTargetRegisterClass * > PhysRegMinimalRCs
 Getting the minimal register class of a physreg is expensive.
 

Methods to get a uniquely generated InstructionMapping.

constInstructionMappinggetInstructionMapping (unsignedID,unsignedCost,constValueMapping *OperandsMapping,unsigned NumOperands)const
 Method to get a uniquely generatedInstructionMapping.
 
constInstructionMappinggetInvalidInstructionMapping ()const
 Method to get a uniquely generated invalidInstructionMapping.
 

Detailed Description

Holds all the information related to register banks.

Definition at line40 of fileRegisterBankInfo.h.

Member Typedef Documentation

◆ InstructionMappings

usingllvm::RegisterBankInfo::InstructionMappings =SmallVector<constInstructionMapping *, 4>

Convenient type to represent the alternatives for mapping an instruction.

Todo:
When we move toTableGen this should be an array ref.

Definition at line277 of fileRegisterBankInfo.h.

Constructor & Destructor Documentation

◆ RegisterBankInfo()[1/2]

RegisterBankInfo::RegisterBankInfo(constRegisterBank ** RegBanks,
unsigned NumRegBanks,
constunsignedSizes,
unsigned HwMode 
)
protected

Create aRegisterBankInfo that can accommodate up toNumRegBanksRegisterBank instances.

Definition at line56 of fileRegisterBankInfo.cpp.

Referencesassert(),End,getNumRegBanks(),Idx, andRegBanks.

◆ RegisterBankInfo()[2/2]

llvm::RegisterBankInfo::RegisterBankInfo()
inlineprotected

This constructor is meaningless.

It just provides a default constructor that can be used at link time when GlobalISel is not built. That way, targets can still inherit from this class without doing crazy gymnastic to avoid link time failures.

Note
That works because the constructor is inlined.

Definition at line435 of fileRegisterBankInfo.h.

Referencesllvm_unreachable.

◆ ~RegisterBankInfo()

virtual llvm::RegisterBankInfo::~RegisterBankInfo()
virtualdefault

Member Function Documentation

◆ applyDefaultMapping()

void RegisterBankInfo::applyDefaultMapping(constOperandsMapperOpdMapper)
static

Helper method to apply something that is like the default mapping.

Basically, that means thatOpdMapper.getMI() is left untouched aside from the reassignment of the register operand that have been remapped.

The type of all the new registers that have been created by the mapper are properly remapped to the type of the original registers they replace. In other words, the semantic of the instruction does not change, only the register banks.

If the mapping of one of the operand spans several registers, this method will abort as this is not like a default mapping anymore.

Precondition
For OpIdx in {0..OpdMapper.getMI().getNumOperands()) the range OpdMapper.getVRegs(OpIdx) is empty or of size 1.

Definition at line439 of fileRegisterBankInfo.cpp.

Referencesassert(),llvm::iterator_range< IteratorT >::begin(),llvm::dbgs(),llvm::iterator_range< IteratorT >::empty(),llvm::RegisterBankInfo::OperandsMapper::getInstrMapping(),llvm::RegisterBankInfo::OperandsMapper::getMI(),llvm::RegisterBankInfo::OperandsMapper::getMRI(),llvm::RegisterBankInfo::InstructionMapping::getNumOperands(),llvm::MachineOperand::getReg(),llvm::LLT::getSizeInBits(),llvm::RegisterBankInfo::OperandsMapper::getVRegs(),llvm::details::FixedOrScalableQuantity< TypeSize, uint64_t >::isKnownLE(),llvm::MachineOperand::isReg(),llvm::LLT::isValid(),LLVM_DEBUG,MI,MRI,llvm::RegisterBankInfo::ValueMapping::NumBreakDowns,llvm::printReg(), andllvm::MachineOperand::setReg().

Referenced byapplyMapping(),llvm::AMDGPURegisterBankInfo::applyMappingBFE(),llvm::AMDGPURegisterBankInfo::applyMappingImage(),llvm::AMDGPURegisterBankInfo::applyMappingImpl(),llvm::MipsRegisterBankInfo::applyMappingImpl(),llvm::X86RegisterBankInfo::applyMappingImpl(),llvm::AMDGPURegisterBankInfo::applyMappingMAD_64_32(), andllvm::AMDGPURegisterBankInfo::applyMappingSMULU64().

◆ applyMapping()

void llvm::RegisterBankInfo::applyMapping(MachineIRBuilderBuilder,
constOperandsMapperOpdMapper 
) const
inline

ApplyOpdMapper.getInstrMapping() toOpdMapper.getMI().

After this callOpdMapper.getMI() may not be valid anymore.OpdMapper.getInstrMapping().getID() carries the information of what has been chosen to mapOpdMapper.getMI(). This ID is set by the various getInstrXXXMapping method.

Therefore, getting the mapping and applying it should be kept in sync.

Definition at line735 of fileRegisterBankInfo.h.

ReferencesapplyDefaultMapping(),applyMappingImpl(),DefaultMappingID,llvm::RegisterBankInfo::InstructionMapping::getID(), andllvm::RegisterBankInfo::OperandsMapper::getInstrMapping().

Referenced byllvm::RegBankSelect::applyMapping().

◆ applyMappingImpl()

virtual void llvm::RegisterBankInfo::applyMappingImpl(MachineIRBuilderBuilder,
constOperandsMapperOpdMapper 
) const
inlinevirtual

SeeapplyMapping.

Reimplemented inllvm::AMDGPURegisterBankInfo,llvm::MipsRegisterBankInfo, andllvm::X86RegisterBankInfo.

Definition at line576 of fileRegisterBankInfo.h.

Referencesllvm_unreachable.

Referenced byapplyMapping().

◆ cannotCopy()

bool llvm::RegisterBankInfo::cannotCopy(constRegisterBankDst,
constRegisterBankSrc,
TypeSize Size 
) const
inline
Returns
true if emitting a copy fromSrc toDst is impossible.

Definition at line643 of fileRegisterBankInfo.h.

ReferencescopyCost(), andSize.

Referenced byllvm::AMDGPURegisterBankInfo::getInstrMapping(), andgetInstrMappingImpl().

◆ constrainGenericRegister()

constTargetRegisterClass * RegisterBankInfo::constrainGenericRegister(Register Reg,
constTargetRegisterClassRC,
MachineRegisterInfoMRI 
)
static

Constrain the (possibly generic) virtual registerReg toRC.

Precondition
Reg is a virtual register that either has a bank or a class.
Returns
The constrained register class, or nullptr if there is none.
Note
This is a generic variant ofMachineRegisterInfo::constrainRegClass
UseMachineRegisterInfo::constrainRegAttrs instead for any non-isel purpose, including non-select passes of GlobalISel

Definition at line132 of fileRegisterBankInfo.cpp.

Referencesllvm::RegisterBank::covers(), andMRI.

Referenced byllvm::AMDGPURegisterBankInfo::buildReadFirstLane(),llvm::AMDGPURegisterBankInfo::buildVCopy(),llvm::constrainRegToClass(),copySubReg(),selectCopy(), andselectDebugInstr().

◆ copyCost()

virtualunsigned llvm::RegisterBankInfo::copyCost(constRegisterBankA,
constRegisterBankB,
TypeSize Size 
) const
inlinevirtual

Get the cost of a copy fromB toA, or put differently, get the cost of A = COPY B.

Since register banks may cover different size,Size specifies what will be the size in bits that will be copied around.

Note
Since this is a copy, both registers have the same size.

Reimplemented inllvm::AArch64RegisterBankInfo, andllvm::AMDGPURegisterBankInfo.

Definition at line633 of fileRegisterBankInfo.h.

ReferencesA, andB.

Referenced bycannotCopy(),llvm::AArch64RegisterBankInfo::copyCost(),llvm::AMDGPURegisterBankInfo::copyCost(), andllvm::RegBankSelect::getRepairCost().

◆ getBreakDownCost()

virtualunsigned llvm::RegisterBankInfo::getBreakDownCost(constValueMappingValMapping,
constRegisterBankCurBank =nullptr 
) const
inlinevirtual

Get the cost of usingValMapping to decompose a register.

This is similar tocopyCost, except for cases where multiple copy-like operations need to be inserted. If the register is used as a source operand and already has a bank assigned,CurBank is non-null.

Reimplemented inllvm::AMDGPURegisterBankInfo.

Definition at line653 of fileRegisterBankInfo.h.

Referenced byllvm::RegBankSelect::getRepairCost().

◆ getInstrAlternativeMappings()

RegisterBankInfo::InstructionMappings RegisterBankInfo::getInstrAlternativeMappings(constMachineInstrMI) const
virtual

Get the alternative mappings forMI.

Alternative in the sense different from getInstrMapping.

Reimplemented inllvm::AArch64RegisterBankInfo,llvm::AMDGPURegisterBankInfo,llvm::PPCRegisterBankInfo, andllvm::X86RegisterBankInfo.

Definition at line434 of fileRegisterBankInfo.cpp.

Referenced byllvm::AArch64RegisterBankInfo::getInstrAlternativeMappings(),llvm::AMDGPURegisterBankInfo::getInstrAlternativeMappings(),llvm::PPCRegisterBankInfo::getInstrAlternativeMappings(),llvm::X86RegisterBankInfo::getInstrAlternativeMappings(),llvm::AMDGPURegisterBankInfo::getInstrAlternativeMappingsIntrinsic(),llvm::AMDGPURegisterBankInfo::getInstrAlternativeMappingsIntrinsicWSideEffects(), andgetInstrPossibleMappings().

◆ getInstrMapping()

constRegisterBankInfo::InstructionMapping & RegisterBankInfo::getInstrMapping(constMachineInstrMI) const
virtual

Get the mapping of the different operands ofMI on the register bank.

This mapping should be the direct translation ofMI. In other words, whenMI is mapped with the returned mapping, only the register banks of the operands ofMI need to be updated. In particular, neither the opcode nor the type ofMI needs to be updated for this direct mapping.

The target independent implementation gives a mapping based on the register classes for the target specific opcode. It uses the IDRegisterBankInfo::DefaultMappingID for that mapping. Make sure you do not use that ID for the alternative mapping for MI. See getInstrAlternativeMappings for the alternative mappings.

For instance, ifMI is a vector add, the mapping should not be a scalarization of the add.

Postcondition
returnedVal.verify(MI).
Note
If returnedVal does not verify MI, this would probably mean that the target does not support that instruction.

Reimplemented inllvm::AArch64RegisterBankInfo,llvm::AMDGPURegisterBankInfo,llvm::ARMRegisterBankInfo,llvm::M68kRegisterBankInfo,llvm::MipsRegisterBankInfo,llvm::PPCRegisterBankInfo,llvm::RISCVRegisterBankInfo, andllvm::X86RegisterBankInfo.

Definition at line407 of fileRegisterBankInfo.cpp.

ReferencesgetInstrMappingImpl(),llvm::RegisterBankInfo::InstructionMapping::isValid(),llvm_unreachable, andMI.

Referenced byllvm::RegBankSelect::assignInstr(),llvm::RegisterBankInfo::OperandsMapper::createVRegs(),getInstrPossibleMappings(),llvm::RegisterBankInfo::OperandsMapper::getVRegs(),llvm::RegisterBankInfo::OperandsMapper::print(), andllvm::RegisterBankInfo::OperandsMapper::setVRegs().

◆ getInstrMappingImpl()

constRegisterBankInfo::InstructionMapping & RegisterBankInfo::getInstrMappingImpl(constMachineInstrMI) const
protected

Try to get the mapping ofMI.

See getInstrMapping for more details on what a mapping represents.

Unlike getInstrMapping the returnedInstructionMapping may be invalid (isValid() == false). This means that the target independent code is not smart enough to get the mapping ofMI and thus, the target has to provide the information forMI.

This implementation is able to get the mapping of:

  • Target specific instructions by looking at the encoding constraints.
  • Any instruction if all the register operands have already been assigned a register, a register class, or a register bank.
  • Copies and phis if at least one of the operands has been assigned a register, a register class, or a register bank. In other words, this method will likely fail to find a mapping for any generic opcode that has not been lowered by target specific code.

Definition at line162 of fileRegisterBankInfo.cpp.

Referencesassert(),cannotCopy(),DefaultMappingID,llvm::TargetSubtargetInfo::getInstrInfo(),getInstructionMapping(),getInvalidInstructionMapping(),getOperandsMapping(),llvm::MachineOperand::getReg(),getRegBank(),getRegBankFromConstraints(),llvm::MachineFunction::getRegInfo(),llvm::TargetSubtargetInfo::getRegisterInfo(),getSizeInBits(),llvm::MachineFunction::getSubtarget(),getValueMapping(),isCopyLike(),llvm::MachineOperand::isReg(),MI,MRI,Size,TII, andTRI.

Referenced bygetInstrMapping(),llvm::AArch64RegisterBankInfo::getInstrMapping(),llvm::AMDGPURegisterBankInfo::getInstrMapping(),llvm::ARMRegisterBankInfo::getInstrMapping(),llvm::M68kRegisterBankInfo::getInstrMapping(),llvm::MipsRegisterBankInfo::getInstrMapping(),llvm::PPCRegisterBankInfo::getInstrMapping(),llvm::RISCVRegisterBankInfo::getInstrMapping(), andllvm::X86RegisterBankInfo::getInstrMapping().

◆ getInstrPossibleMappings()

RegisterBankInfo::InstructionMappings RegisterBankInfo::getInstrPossibleMappings(constMachineInstrMI) const

Get the possible mapping forMI.

A mapping defines where the different operands may live and at what cost. For instance, let us consider: v0(16) = G_ADD <2 x i8> v1, v2 The possible mapping could be:

{/*ID*‍/VectorAdd, /*Cost*‍/1, /*v0*‍/{(0xFFFF, VPR)}, /*v1*‍/{(0xFFFF, VPR)}, /*v2*‍/{(0xFFFF, VPR)}} {/*ID*‍/ScalarAddx2, /*Cost*‍/2, /*v0*‍/{(0x00FF, GPR),(0xFF00, GPR)}, /*v1*‍/{(0x00FF, GPR),(0xFF00, GPR)}, /*v2*‍/{(0x00FF, GPR),(0xFF00, GPR)}}

Note
The first alternative of the returned mapping should be the direct translation ofMI current form.
Postcondition
!returnedVal.empty().

Definition at line415 of fileRegisterBankInfo.cpp.

Referencesllvm::append_range(),assert(),getInstrAlternativeMappings(),getInstrMapping(),MI, andllvm::SmallVectorTemplateBase< T, bool >::push_back().

Referenced byllvm::RegBankSelect::assignInstr().

◆ getInstructionMapping()

constInstructionMapping & llvm::RegisterBankInfo::getInstructionMapping(unsigned ID,
unsigned Cost,
constValueMappingOperandsMapping,
unsigned NumOperands 
) const
inline

Method to get a uniquely generatedInstructionMapping.

Definition at line534 of fileRegisterBankInfo.h.

Referenced byllvm::AMDGPURegisterBankInfo::addMappingFromTable(),llvm::AMDGPURegisterBankInfo::getDefaultMappingAllVGPR(),llvm::AMDGPURegisterBankInfo::getDefaultMappingSOP(),llvm::AMDGPURegisterBankInfo::getDefaultMappingVOP(),llvm::AMDGPURegisterBankInfo::getImageMapping(),llvm::AArch64RegisterBankInfo::getInstrAlternativeMappings(),llvm::AMDGPURegisterBankInfo::getInstrAlternativeMappings(),llvm::X86RegisterBankInfo::getInstrAlternativeMappings(),llvm::AArch64RegisterBankInfo::getInstrMapping(),llvm::AMDGPURegisterBankInfo::getInstrMapping(),llvm::ARMRegisterBankInfo::getInstrMapping(),llvm::M68kRegisterBankInfo::getInstrMapping(),llvm::MipsRegisterBankInfo::getInstrMapping(),llvm::PPCRegisterBankInfo::getInstrMapping(),llvm::RISCVRegisterBankInfo::getInstrMapping(),llvm::X86RegisterBankInfo::getInstrMapping(),llvm::AMDGPURegisterBankInfo::getInstrMappingForLoad(), andgetInstrMappingImpl().

◆ getInvalidInstructionMapping()

constInstructionMapping & llvm::RegisterBankInfo::getInvalidInstructionMapping() const
inline

Method to get a uniquely generated invalidInstructionMapping.

Definition at line542 of fileRegisterBankInfo.h.

Referenced byllvm::AArch64RegisterBankInfo::getInstrMapping(),llvm::AMDGPURegisterBankInfo::getInstrMapping(),llvm::ARMRegisterBankInfo::getInstrMapping(),llvm::M68kRegisterBankInfo::getInstrMapping(),llvm::MipsRegisterBankInfo::getInstrMapping(),llvm::PPCRegisterBankInfo::getInstrMapping(),llvm::X86RegisterBankInfo::getInstrMapping(), andgetInstrMappingImpl().

◆ getMaximumSize()

unsigned llvm::RegisterBankInfo::getMaximumSize(unsigned RegBankID) const
inline

Get the maximum size in bits that fits in the given register bank.

Definition at line590 of fileRegisterBankInfo.h.

ReferencesHwMode,NumRegBanks, andSizes.

Referenced byllvm::AArch64RegisterBankInfo::AArch64RegisterBankInfo(),llvm::ARMRegisterBankInfo::ARMRegisterBankInfo(),llvm::RISCVRegisterBankInfo::getInstrMapping(),llvm::RegisterBankInfo::PartialMapping::verify(),llvm::RegisterBank::verify(), andllvm::X86RegisterBankInfo::X86RegisterBankInfo().

◆ getMinimalPhysRegClass()

constTargetRegisterClass * RegisterBankInfo::getMinimalPhysRegClass(Register Reg,
constTargetRegisterInfoTRI 
) const
protected

Get the MinimalPhysRegClass for Reg.

Precondition
Reg is a physical register.

Definition at line103 of fileRegisterBankInfo.cpp.

Referencesassert(),PhysRegMinimalRCs, andTRI.

Referenced bygetRegBank(), andgetSizeInBits().

◆ getNumRegBanks()

unsigned llvm::RegisterBankInfo::getNumRegBanks() const
inline

Get the total number of register banks.

Definition at line603 of fileRegisterBankInfo.h.

ReferencesNumRegBanks.

Referenced bygetRegBank(),RegisterBankInfo(), andverify().

◆ getOperandsMapping()[1/3]

constRegisterBankInfo::ValueMapping * RegisterBankInfo::getOperandsMapping(constSmallVectorImpl<constValueMapping * > & OpdsMapping) const
protected

Get the uniquely generated array ofValueMapping for the elements ofOpdsMapping.

Elements ofOpdsMapping that are nullptr will be replaced by invalidValueMapping (ValueMapping::isValid == false).

Definition at line362 of fileRegisterBankInfo.cpp.

Referencesllvm::SmallVectorTemplateCommon< T, typename >::begin(),llvm::SmallVectorTemplateCommon< T, typename >::end(), andgetOperandsMapping().

◆ getOperandsMapping()[2/3]

template<typename Iterator >
constRegisterBankInfo::ValueMapping * RegisterBankInfo::getOperandsMapping(Iterator Begin,
Iterator End 
) const
protected

Get the uniquely generated array ofValueMapping for the elements of betweenBegin andEnd.

Elements that are nullptr will be replaced by invalidValueMapping (ValueMapping::isValid == false).

Precondition
The pointers onValueMapping betweenBegin andEnd must uniquely identify aValueMapping. Otherwise, there is no guarantee that the return instance will be unique, i.e., another OperandsMapping could have the same content.

Definition at line333 of fileRegisterBankInfo.cpp.

ReferencesEnd,llvm::hash_combine_range(),Idx, andMapOfOperandsMappings.

Referenced byllvm::AMDGPURegisterBankInfo::addMappingFromTable(),llvm::AMDGPURegisterBankInfo::getDefaultMappingAllVGPR(),llvm::AMDGPURegisterBankInfo::getDefaultMappingSOP(),llvm::AMDGPURegisterBankInfo::getDefaultMappingVOP(),llvm::AMDGPURegisterBankInfo::getImageMapping(),llvm::AArch64RegisterBankInfo::getInstrAlternativeMappings(),llvm::AMDGPURegisterBankInfo::getInstrAlternativeMappings(),llvm::X86RegisterBankInfo::getInstrAlternativeMappings(),llvm::AArch64RegisterBankInfo::getInstrMapping(),llvm::AMDGPURegisterBankInfo::getInstrMapping(),llvm::ARMRegisterBankInfo::getInstrMapping(),llvm::M68kRegisterBankInfo::getInstrMapping(),llvm::MipsRegisterBankInfo::getInstrMapping(),llvm::PPCRegisterBankInfo::getInstrMapping(),llvm::RISCVRegisterBankInfo::getInstrMapping(),llvm::X86RegisterBankInfo::getInstrMapping(),llvm::AMDGPURegisterBankInfo::getInstrMappingForLoad(),getInstrMappingImpl(), andgetOperandsMapping().

◆ getOperandsMapping()[3/3]

constValueMapping * llvm::RegisterBankInfo::getOperandsMapping(std::initializer_list<constValueMapping * > OpdsMapping) const
protected

Get the uniquely generated array ofValueMapping for the given arguments.

Arguments that are nullptr will be replaced by invalidValueMapping (ValueMapping::isValid == false).

◆ getPartialMapping()

constRegisterBankInfo::PartialMapping & RegisterBankInfo::getPartialMapping(unsigned StartIdx,
unsigned Length,
constRegisterBankRegBank 
) const
protected

Get the uniquely generatedPartialMapping for the given arguments.

Definition at line281 of fileRegisterBankInfo.cpp.

ReferenceshashPartialMapping(),llvm::Length, andMapOfPartialMappings.

Referenced bygetValueMapping().

◆ getRegBank()[1/3]

constRegisterBank * RegisterBankInfo::getRegBank(Register Reg,
constMachineRegisterInfoMRI,
constTargetRegisterInfoTRI 
) const

Get the register bank ofReg.

If Reg has not been assigned a register, a register class, or a register bank, then this returns nullptr.

Precondition
Reg != 0 (NoRegister)

Definition at line84 of fileRegisterBankInfo.cpp.

ReferencesgetMinimalPhysRegClass(),getRegBankFromRegClass(),MRI, andTRI.

◆ getRegBank()[2/3]

constRegisterBank & llvm::RegisterBankInfo::getRegBank(unsigned ID)
inlineprotected

Get the register bank identified byID.

Definition at line440 of fileRegisterBankInfo.h.

Referencesassert(),getNumRegBanks(), andRegBanks.

Referenced byllvm::AArch64RegisterBankInfo::AArch64RegisterBankInfo(),llvm::AMDGPURegisterBankInfo::AMDGPURegisterBankInfo(),llvm::AMDGPURegisterBankInfo::applyMappingDynStackAlloc(),llvm::AMDGPURegisterBankInfo::applyMappingImpl(),llvm::ARMRegisterBankInfo::ARMRegisterBankInfo(),llvm::RegBankSelect::assignInstr(),llvm::RegBankSelect::assignmentMatch(),buildReadAnyLane(),llvm::AMDGPURegisterBankInfo::buildReadFirstLane(),llvm::AMDGPURegisterBankInfo::collectWaterfallOperands(),llvm::AMDGPURegisterBankInfo::constrainOpWithReadfirstlane(),llvm::AMDGPURegisterBankInfo::executeInWaterfallLoop(),llvm::GIMatchTableExecutor::executeMatchTable(),llvm::AArch64RegisterBankInfo::getInstrMapping(),llvm::AMDGPURegisterBankInfo::getInstrMapping(),llvm::RISCVRegisterBankInfo::getInstrMapping(),llvm::AMDGPURegisterBankInfo::getInstrMappingForLoad(),getInstrMappingImpl(),llvm::SIInstrInfo::getInstructionUniformity(),llvm::AMDGPURegisterBankInfo::getMappingType(),llvm::CombinerHelper::getRegBank(),getRegBank(),llvm::AArch64RegisterBankInfo::getRegBankFromRegClass(),llvm::PPCRegisterBankInfo::getRegBankFromRegClass(),llvm::AMDGPURegisterBankInfo::getRegBankID(),getRegClassesForCopy(),llvm::RegBankSelect::getRepairCost(),llvm::AMDGPURegisterBankInfo::getValueMappingForPtr(),llvm::AMDGPURegisterBankInfo::isSALUMapping(),llvm::SIRegisterInfo::isUniformReg(),selectCopy(),selectMergeValues(),selectUnmergeValues(),llvm::AMDGPURegisterBankInfo::setBufferOffsets(),llvm::MipsRegisterBankInfo::setRegBank(),llvm::AMDGPURegisterBankInfo::split64BitValueForMapping(),unmergeReadAnyLane(),unsupportedBinOp(),verify(), andllvm::X86RegisterBankInfo::X86RegisterBankInfo().

◆ getRegBank()[3/3]

constRegisterBank & llvm::RegisterBankInfo::getRegBank(unsigned ID) const
inline

Get the register bank identified byID.

Definition at line585 of fileRegisterBankInfo.h.

ReferencesgetRegBank().

◆ getRegBankFromConstraints()

constRegisterBank * RegisterBankInfo::getRegBankFromConstraints(constMachineInstrMI,
unsigned OpIdx,
constTargetInstrInfoTII,
constMachineRegisterInfoMRI 
) const

Get the register bank for theOpIdx-th operand ofMI form the encoding constraints, if any.

Returns
A register bank that covers the register class of the related encoding constraints or nullptr ifMI did not provide enough information to deduce it.

Definition at line112 of fileRegisterBankInfo.cpp.

Referencesassert(),llvm::RegisterBank::covers(),getRegBankFromRegClass(),MI,MRI,TII, andTRI.

Referenced bygetInstrMappingImpl().

◆ getRegBankFromRegClass()

virtualconstRegisterBank & llvm::RegisterBankInfo::getRegBankFromRegClass(constTargetRegisterClassRC,
LLT Ty 
) const
inlinevirtual

Get a register bank that coversRC.

Precondition
RC is a user-defined register class (as opposed as one generated byTableGen).
Note
The mapping RC -> RegBank could be built while adding the coverage for the register banks. However, we do not do it, because, at least for now, we only need this information for register classes that are used in the description of instruction. In other words, there are just a handful of them and we do not want to waste space.
Todo:
This should beTableGen'ed.

Reimplemented inllvm::AArch64RegisterBankInfo,llvm::PPCRegisterBankInfo,llvm::SPIRVRegisterBankInfo, andllvm::AMDGPURegisterBankInfo.

Definition at line623 of fileRegisterBankInfo.h.

Referencesllvm_unreachable.

Referenced byllvm::GIMatchTableExecutor::executeMatchTable(),getRegBank(),getRegBankFromConstraints(),llvm::AArch64RegisterBankInfo::getRegBankFromRegClass(), andllvm::PPCRegisterBankInfo::getRegBankFromRegClass().

◆ getSizeInBits()

TypeSize RegisterBankInfo::getSizeInBits(Register Reg,
constMachineRegisterInfoMRI,
constTargetRegisterInfoTRI 
) const

Get the size in bits ofReg.

Utility method to get the size of any registers. Unlike MachineRegisterInfo::getSize, the register does not need to be a virtual register.

Precondition
Reg != 0 (NoRegister).

Definition at line498 of fileRegisterBankInfo.cpp.

Referencesassert(),getMinimalPhysRegClass(),MRI, andTRI.

Referenced byllvm::AMDGPURegisterBankInfo::addMappingFromTable(),llvm::AMDGPURegisterBankInfo::getAGPROpMapping(),llvm::AMDGPURegisterBankInfo::getDefaultMappingAllVGPR(),llvm::AMDGPURegisterBankInfo::getDefaultMappingSOP(),llvm::AMDGPURegisterBankInfo::getDefaultMappingVOP(),llvm::AMDGPURegisterBankInfo::getImageMapping(),llvm::AArch64RegisterBankInfo::getInstrAlternativeMappings(),llvm::AMDGPURegisterBankInfo::getInstrAlternativeMappings(),llvm::X86RegisterBankInfo::getInstrAlternativeMappings(),llvm::AArch64RegisterBankInfo::getInstrMapping(),llvm::AMDGPURegisterBankInfo::getInstrMapping(),llvm::MipsRegisterBankInfo::getInstrMapping(),llvm::PPCRegisterBankInfo::getInstrMapping(),llvm::AMDGPURegisterBankInfo::getInstrMappingForLoad(),getInstrMappingImpl(),getRegClassesForCopy(),llvm::RegBankSelect::getRepairCost(),llvm::AMDGPURegisterBankInfo::getSGPROpMapping(),llvm::AMDGPURegisterBankInfo::getVGPROpMapping(),selectCopy(), andllvm::RegisterBankInfo::InstructionMapping::verify().

◆ getValueMapping()[1/2]

constRegisterBankInfo::ValueMapping & RegisterBankInfo::getValueMapping(constPartialMappingBreakDown,
unsigned NumBreakDowns 
) const
protected

Get theValueMapping for the given arguments.

Definition at line315 of fileRegisterBankInfo.cpp.

ReferenceshashValueMapping(), andMapOfValueMappings.

◆ getValueMapping()[2/2]

constRegisterBankInfo::ValueMapping & RegisterBankInfo::getValueMapping(unsigned StartIdx,
unsigned Length,
constRegisterBankRegBank 
) const
protected

The most commonValueMapping consists of a singlePartialMapping.

Feature a method for that.

Definition at line298 of fileRegisterBankInfo.cpp.

ReferencesgetPartialMapping(),getValueMapping(), andllvm::Length.

Referenced byllvm::AMDGPURegisterBankInfo::getInstrMapping(),getInstrMappingImpl(), andgetValueMapping().

◆ isDivergentRegBank()

virtualbool llvm::RegisterBankInfo::isDivergentRegBank(constRegisterBankRB) const
inlinevirtual

Returns true if the register bank is considered divergent.

Reimplemented inllvm::AMDGPURegisterBankInfo.

Definition at line606 of fileRegisterBankInfo.h.

Referenced byllvm::SIRegisterInfo::isUniformReg().

◆ verify()

bool RegisterBankInfo::verify(constTargetRegisterInfoTRI) const

Check that information hold by this instance make sense for the givenTRI.

Note
This method does not check anything when assertions are disabled.
Returns
True is the check was successful.

Definition at line70 of fileRegisterBankInfo.cpp.

Referencesassert(),llvm::dbgs(),End,llvm::RegisterBank::getID(),getNumRegBanks(),getRegBank(),Idx,LLVM_DEBUG,TRI, andllvm::RegisterBank::verify().

Member Data Documentation

◆ DefaultMappingID

constunsigned RegisterBankInfo::DefaultMappingID = UINT_MAX
static

Identifier used when the related instruction mapping instance is generated by target independent code.

Make sure not to use that identifier to avoid possible collision.

Definition at line672 of fileRegisterBankInfo.h.

Referenced byapplyMapping(),llvm::AArch64RegisterBankInfo::getInstrMapping(),llvm::ARMRegisterBankInfo::getInstrMapping(),llvm::M68kRegisterBankInfo::getInstrMapping(),llvm::MipsRegisterBankInfo::getInstrMapping(),llvm::PPCRegisterBankInfo::getInstrMapping(),llvm::RISCVRegisterBankInfo::getInstrMapping(),llvm::X86RegisterBankInfo::getInstrMapping(), andgetInstrMappingImpl().

◆ HwMode

unsigned llvm::RegisterBankInfo::HwMode
protected

Current HwMode for the target.

Definition at line398 of fileRegisterBankInfo.h.

Referenced bygetMaximumSize().

◆ InvalidMappingID

constunsigned RegisterBankInfo::InvalidMappingID = UINT_MAX - 1
static

Identifier used when the related instruction mapping instance is generated by the default constructor.

Make sure not to use that identifier.

Definition at line677 of fileRegisterBankInfo.h.

Referenced byllvm::RegisterBankInfo::InstructionMapping::isValid().

◆ MapOfInstructionMappings

DenseMap<hash_code, std::unique_ptr<constInstructionMapping> > llvm::RegisterBankInfo::MapOfInstructionMappings
mutableprotected

Keep dynamically allocatedInstructionMapping in a separate map.

This shouldn't be needed when everything getsTableGen'ed.

Definition at line418 of fileRegisterBankInfo.h.

◆ MapOfOperandsMappings

DenseMap<hash_code, std::unique_ptr<ValueMapping[]> > llvm::RegisterBankInfo::MapOfOperandsMappings
mutableprotected

Keep dynamically allocated array ofValueMapping in a separate map.

This shouldn't be needed when everything getsTableGen'ed.

Definition at line413 of fileRegisterBankInfo.h.

Referenced bygetOperandsMapping().

◆ MapOfPartialMappings

DenseMap<hash_code, std::unique_ptr<constPartialMapping> > llvm::RegisterBankInfo::MapOfPartialMappings
mutableprotected

Keep dynamically allocatedPartialMapping in a separate map.

This shouldn't be needed when everything getsTableGen'ed.

Definition at line403 of fileRegisterBankInfo.h.

Referenced bygetPartialMapping().

◆ MapOfValueMappings

DenseMap<hash_code, std::unique_ptr<constValueMapping> > llvm::RegisterBankInfo::MapOfValueMappings
mutableprotected

Keep dynamically allocatedValueMapping in a separate map.

This shouldn't be needed when everything getsTableGen'ed.

Definition at line408 of fileRegisterBankInfo.h.

Referenced bygetValueMapping().

◆ NumRegBanks

unsigned llvm::RegisterBankInfo::NumRegBanks
protected

Total number of register banks.

Definition at line392 of fileRegisterBankInfo.h.

Referenced bygetMaximumSize(), andgetNumRegBanks().

◆ PhysRegMinimalRCs

DenseMap<unsigned,constTargetRegisterClass *> llvm::RegisterBankInfo::PhysRegMinimalRCs
mutableprotected

Getting the minimal register class of a physreg is expensive.

Cache this information as we get it.

Definition at line422 of fileRegisterBankInfo.h.

Referenced bygetMinimalPhysRegClass().

◆ RegBanks

constRegisterBank** llvm::RegisterBankInfo::RegBanks
protected

Hold the set of supported register banks.

Definition at line389 of fileRegisterBankInfo.h.

Referenced bygetRegBank(), andRegisterBankInfo().

◆ Sizes

constunsigned* llvm::RegisterBankInfo::Sizes
protected

Hold the sizes of the register banks for all HwModes.

Definition at line395 of fileRegisterBankInfo.h.

Referenced byllvm::AMDGPURegisterBankInfo::addMappingFromTable(), andgetMaximumSize().


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

Generated on Sun Jul 20 2025 19:35:39 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp