LLVM  16.0.0git
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
llvm::VirtRegAuxInfo Class Reference

Calculate auxiliary information for a virtual register such as its spill weight and allocation hint. More...

#include "llvm/CodeGen/CalcSpillWeights.h"

Public Member Functions

 VirtRegAuxInfo (MachineFunction &MF, LiveIntervals &LIS, const VirtRegMap &VRM, const MachineLoopInfo &Loops, const MachineBlockFrequencyInfo &MBFI)
 
virtual ~VirtRegAuxInfo ()=default
 
void calculateSpillWeightAndHint (LiveInterval &LI)
 (re)compute li's spill weight and allocation hint. More...
 
void calculateSpillWeightsAndHints ()
 Compute spill weights and allocation hints for all virtual register live intervals. More...
 

Static Public Member Functions

static Register copyHint (const MachineInstr *MI, unsigned Reg, const TargetRegisterInfo &TRI, const MachineRegisterInfo &MRI)
 Return the preferred allocation register for reg, given a COPY instruction. More...
 
static bool isRematerializable (const LiveInterval &LI, const LiveIntervals &LIS, const VirtRegMap &VRM, const TargetInstrInfo &TII)
 Determine if all values in LI are rematerializable. More...
 

Protected Member Functions

float weightCalcHelper (LiveInterval &LI, SlotIndex *Start=nullptr, SlotIndex *End=nullptr)
 Helper function for weight calculations. More...
 
virtual float normalize (float UseDefFreq, unsigned Size, unsigned NumInstr)
 Weight normalization function. More...
 

Detailed Description

Calculate auxiliary information for a virtual register such as its spill weight and allocation hint.

Definition at line 45 of file CalcSpillWeights.h.

Constructor & Destructor Documentation

◆ VirtRegAuxInfo()

llvm::VirtRegAuxInfo::VirtRegAuxInfo ( MachineFunction MF,
LiveIntervals LIS,
const VirtRegMap VRM,
const MachineLoopInfo Loops,
const MachineBlockFrequencyInfo MBFI 
)
inline

Definition at line 57 of file CalcSpillWeights.h.

References Loops.

◆ ~VirtRegAuxInfo()

virtual llvm::VirtRegAuxInfo::~VirtRegAuxInfo ( )
virtualdefault

Member Function Documentation

◆ calculateSpillWeightAndHint()

void VirtRegAuxInfo::calculateSpillWeightAndHint ( LiveInterval LI)

(re)compute li's spill weight and allocation hint.

Definition at line 140 of file CalcSpillWeights.cpp.

References llvm::LiveInterval::setWeight(), and weightCalcHelper().

Referenced by llvm::LiveRangeEdit::calculateRegClassAndHint(), and calculateSpillWeightsAndHints().

◆ calculateSpillWeightsAndHints()

void VirtRegAuxInfo::calculateSpillWeightsAndHints ( )

◆ copyHint()

Register VirtRegAuxInfo::copyHint ( const MachineInstr MI,
unsigned  Reg,
const TargetRegisterInfo TRI,
const MachineRegisterInfo MRI 
)
static

◆ isRematerializable()

bool VirtRegAuxInfo::isRematerializable ( const LiveInterval LI,
const LiveIntervals LIS,
const VirtRegMap VRM,
const TargetInstrInfo TII 
)
static

◆ normalize()

virtual float llvm::VirtRegAuxInfo::normalize ( float  UseDefFreq,
unsigned  Size,
unsigned  NumInstr 
)
inlineprotectedvirtual

Weight normalization function.

Definition at line 100 of file CalcSpillWeights.h.

References llvm::normalizeSpillWeight().

◆ weightCalcHelper()

float VirtRegAuxInfo::weightCalcHelper ( LiveInterval LI,
SlotIndex Start = nullptr,
SlotIndex End = nullptr 
)
protected

Helper function for weight calculations.

(Re)compute LI's spill weight and allocation hint, or, for non null start and end - compute future expected spill weight of a split artifact of LI that will span between start and end slot indexes.

Parameters
LIThe live interval for which to compute the weight.
StartThe expected beginning of the split artifact. Instructions before start will not affect the weight. Relevant for weight calculation of future split artifact.
EndThe expected end of the split artifact. Instructions after end will not affect the weight. Relevant for weight calculation of future split artifact.
Returns
The spill weight. Returns negative weight for unspillable LI.

Definition at line 148 of file CalcSpillWeights.cpp.

Referenced by calculateSpillWeightAndHint().


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