LLVM  6.0.0svn
Public Types | Public 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 Types

using NormalizingFn = float(*)(float, unsigned, unsigned)
 

Public Member Functions

 VirtRegAuxInfo (MachineFunction &mf, LiveIntervals &lis, VirtRegMap *vrm, const MachineLoopInfo &loops, const MachineBlockFrequencyInfo &mbfi, NormalizingFn norm=normalizeSpillWeight)
 
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...
 
float weightCalcHelper (LiveInterval &li, SlotIndex *start=nullptr, SlotIndex *end=nullptr)
 Helper function for weight calculations. More...
 

Detailed Description

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

Definition at line 47 of file CalcSpillWeights.h.

Member Typedef Documentation

◆ NormalizingFn

Definition at line 49 of file CalcSpillWeights.h.

Constructor & Destructor Documentation

◆ VirtRegAuxInfo()

llvm::VirtRegAuxInfo::VirtRegAuxInfo ( MachineFunction mf,
LiveIntervals lis,
VirtRegMap vrm,
const MachineLoopInfo loops,
const MachineBlockFrequencyInfo mbfi,
NormalizingFn  norm = normalizeSpillWeight 
)
inline

Member Function Documentation

◆ calculateSpillWeightAndHint()

void VirtRegAuxInfo::calculateSpillWeightAndHint ( LiveInterval li)

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

Definition at line 136 of file CalcSpillWeights.cpp.

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

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

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

References weightCalcHelper().

Referenced by llvm::createGreedyRegisterAllocator(), and VirtRegAuxInfo().

◆ weightCalcHelper()

float VirtRegAuxInfo::weightCalcHelper ( LiveInterval li,
SlotIndex start = nullptr,
SlotIndex end = nullptr 
)

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 begining 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 149 of file CalcSpillWeights.cpp.

References assert(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::clear(), copyHint(), llvm::SlotIndex::distance(), E, llvm::sys::path::end(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::LiveIntervals::getInstructionIndex(), llvm::MachineLoopInfo::getLoopFor(), llvm::LiveIntervals::getMBBFromIndex(), llvm::MachineInstr::getParent(), llvm::MachineRegisterInfo::getRegAllocationHint(), llvm::MachineFunction::getRegInfo(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::LiveIntervals::getRegMaskSlots(), llvm::LiveInterval::getSize(), llvm::LiveIntervals::getSlotIndexes(), llvm::LiveIntervals::getSpillWeight(), llvm::MachineFunction::getSubtarget(), I, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::MachineRegisterInfo::isAllocatable(), llvm::MachineInstr::isCopy(), llvm::MachineInstr::isDebugValue(), llvm::MachineInstr::isIdentityCopy(), llvm::MachineInstr::isImplicitDef(), llvm::LiveRange::isLiveAtIndexes(), llvm::LiveIntervals::isLiveOutOfMBB(), llvm::LoopBase< BlockT, LoopT >::isLoopExiting(), llvm::TargetRegisterInfo::isPhysicalRegister(), isRematerializable(), llvm::LiveInterval::isSpillable(), llvm::LiveRange::isZeroLength(), llvm::LiveInterval::markNotSpillable(), llvm::MachineInstr::readsWritesVirtualRegister(), llvm::LiveInterval::reg, llvm::MachineRegisterInfo::reg_instr_begin(), llvm::MachineRegisterInfo::reg_instr_end(), and llvm::MachineRegisterInfo::setRegAllocationHint().

Referenced by calculateSpillWeightAndHint(), futureWeight(), and VirtRegAuxInfo().


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