LLVM
17.0.0git
|
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... | |
Calculate auxiliary information for a virtual register such as its spill weight and allocation hint.
Definition at line 45 of file CalcSpillWeights.h.
|
inline |
Definition at line 57 of file CalcSpillWeights.h.
References Loops.
|
virtualdefault |
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().
void VirtRegAuxInfo::calculateSpillWeightsAndHints | ( | ) |
Compute spill weights and allocation hints for all virtual register live intervals.
Definition at line 32 of file CalcSpillWeights.cpp.
References calculateSpillWeightAndHint(), llvm::dbgs(), E, llvm::LiveIntervals::getInterval(), llvm::MachineFunction::getName(), llvm::MachineRegisterInfo::getNumVirtRegs(), llvm::MachineFunction::getRegInfo(), I, llvm::Register::index2VirtReg(), LLVM_DEBUG, MRI, and llvm::MachineRegisterInfo::reg_nodbg_empty().
|
static |
Return the preferred allocation register for reg, given a COPY instruction.
Definition at line 46 of file CalcSpillWeights.cpp.
References llvm::Register::asMCReg(), llvm::TargetRegisterClass::contains(), llvm::TargetRegisterInfo::getMatchingSuperReg(), llvm::MachineRegisterInfo::getRegClass(), llvm::TargetRegisterInfo::getSubReg(), llvm::Register::isVirtual(), MI, MRI, and TRI.
|
static |
Determine if all values in LI are rematerializable.
Definition at line 80 of file CalcSpillWeights.cpp.
References assert(), llvm::VNInfo::def, E, llvm::LiveIntervals::getInstructionFromIndex(), llvm::LiveIntervals::getInterval(), llvm::VirtRegMap::getOriginal(), I, llvm::VNInfo::isPHIDef(), llvm::VNInfo::isUnused(), MI, llvm::LiveRange::Query(), llvm::LiveInterval::reg(), TII, llvm::LiveQueryResult::valueIn(), llvm::LiveRange::vni_begin(), and llvm::LiveRange::vni_end().
|
inlineprotectedvirtual |
Weight normalization function.
Definition at line 100 of file CalcSpillWeights.h.
References llvm::normalizeSpillWeight().
|
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.
LI | The live interval for which to compute the weight. |
Start | The expected beginning of the split artifact. Instructions before start will not affect the weight. Relevant for weight calculation of future split artifact. |
End | The expected end of the split artifact. Instructions after end will not affect the weight. Relevant for weight calculation of future split artifact. |
Definition at line 148 of file CalcSpillWeights.cpp.
Referenced by calculateSpillWeightAndHint().