LLVM  14.0.0git
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...
 
float futureWeight (LiveInterval &LI, SlotIndex Start, SlotIndex End)
 Compute future expected spill weight of a split artifact of LI that will span between start and end slot indexes. More...
 
void calculateSpillWeightsAndHints ()
 Compute spill weights and allocation hints for all virtual register live intervals. 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 46 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 58 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 139 of file CalcSpillWeights.cpp.

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

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

◆ calculateSpillWeightsAndHints()

void VirtRegAuxInfo::calculateSpillWeightsAndHints ( )

◆ futureWeight()

float VirtRegAuxInfo::futureWeight ( LiveInterval LI,
SlotIndex  Start,
SlotIndex  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 to be split.
StartThe expected beginning of the split artifact. Instructions before start will not affect the weight.
EndThe expected end of the split artifact. Instructions after end will not affect the weight.
Returns
The expected spill weight of the split artifact. Returns negative weight for unspillable LI.

Definition at line 147 of file CalcSpillWeights.cpp.

◆ 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(), and llvm::Check::Size.

◆ 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 152 of file CalcSpillWeights.cpp.

Referenced by calculateSpillWeightAndHint().


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