llvm::TargetRegisterInfo::getRegAllocationHints

Get preferred physical registers to try first for VirtReg.

Synopsis

Declared in <llvm/CodeGen/TargetRegisterInfo.h>

virtual
bool
getRegAllocationHints(
    Register VirtReg,
    ArrayRef<MCPhysReg> Order,
    SmallVectorImpl<MCPhysReg>& Hints,
    MachineFunction const& MF,
    VirtRegMap const* VRM = nullptr,
    LiveRegMatrix const* Matrix = nullptr) const;

Description

Get a list of 'hint' registers that the register allocator should try first when allocating a physical register for the virtual register VirtReg. These registers are effectively moved to the front of the allocation order. If true is returned, regalloc will try to only use hints to the greatest extent possible even if it means spilling.

The Order argument is the allocation order for VirtReg's register class as returned from RegisterClassInfo::getOrder(). The hint registers must come from Order, and they must not be reserved.

The default implementation of this function will only add target independent register allocation hints. Targets that override this function should typically call this default implementation as well and expect to see generic copy hints added.

Return Value

True if allocation should prefer the hint registers exclusively when possible.

Parameters

NameDescription
VirtRegVirtual register needing allocation hints.
OrderAllocation order for VirtReg's register class.
HintsOutput list of preferred physical registers.
MFFunction that owns VirtReg.
VRMOptional virtual-to-physical register map.
MatrixOptional live register matrix.