LLVM  8.0.1
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 138 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 146 of file CalcSpillWeights.cpp.

References weightCalcHelper().

Referenced by 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 151 of file CalcSpillWeights.cpp.

References llvm::MachineRegisterInfo::addRegAllocationHint(), assert(), llvm::MachineRegisterInfo::clearSimpleHint(), copyHint(), llvm::SlotIndex::distance(), E, llvm::sys::path::end(), llvm::LiveIntervals::getMBBFromIndex(), llvm::MachineInstr::getParent(), llvm::MachineRegisterInfo::getRegAllocationHint(), llvm::MachineFunction::getRegInfo(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::LiveInterval::getSize(), llvm::LiveIntervals::getSpillWeight(), llvm::MachineFunction::getSubtarget(), I, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::MachineRegisterInfo::isAllocatable(), llvm::MachineInstr::isCopy(), llvm::MachineInstr::isDebugInstr(), llvm::MachineInstr::isIdentityCopy(), llvm::MachineInstr::isImplicitDef(), llvm::LiveRange::isLiveAtIndexes(), llvm::LoopBase< BlockT, LoopT >::isLoopExiting(), llvm::TargetRegisterInfo::isPhysicalRegister(), isRematerializable(), llvm::LiveInterval::isSpillable(), llvm::TargetRegisterInfo::isVirtualRegister(), llvm::LiveRange::isZeroLength(), Loops, llvm::LiveInterval::markNotSpillable(), llvm::operator<(), P, llvm::MachineInstr::readsWritesVirtualRegister(), llvm::LiveInterval::reg, Reg, llvm::MachineRegisterInfo::reg_instr_begin(), llvm::MachineRegisterInfo::reg_instr_end(), and llvm::RISCVFenceField::W.

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


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