LLVM 23.0.0git
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, ProfileSummaryInfo *PSI=nullptr)
virtual ~VirtRegAuxInfo ()=default
LLVM_ABI void calculateSpillWeightAndHint (LiveInterval &LI)
 (re)compute li's spill weight and allocation hint.
LLVM_ABI void calculateSpillWeightsAndHints ()
 Compute spill weights and allocation hints for all virtual register live intervals.

Static Public Member Functions

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

Protected Member Functions

LLVM_ABI float weightCalcHelper (LiveInterval &LI)
 Helper function for weight calculations.
virtual float normalize (float UseDefFreq, unsigned Size, unsigned NumInstr)
 Weight normalization function.

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,
ProfileSummaryInfo * PSI = nullptr )
inline

Definition at line 59 of file CalcSpillWeights.h.

◆ ~VirtRegAuxInfo()

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

References LLVM_ABI, MI, Reg, TII, and TRI.

Member Function Documentation

◆ allUsesAvailableAt()

◆ calculateSpillWeightAndHint()

void VirtRegAuxInfo::calculateSpillWeightAndHint ( LiveInterval & LI)

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

Definition at line 213 of file CalcSpillWeights.cpp.

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

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

◆ calculateSpillWeightsAndHints()

void VirtRegAuxInfo::calculateSpillWeightsAndHints ( )

Compute spill weights and allocation hints for all virtual register live intervals.

Definition at line 33 of file CalcSpillWeights.cpp.

References calculateSpillWeightAndHint(), llvm::dbgs(), llvm::MachineRegisterInfo::getNumVirtRegs(), I, llvm::Register::index2VirtReg(), LLVM_DEBUG, and llvm::MachineRegisterInfo::reg_nodbg_empty().

Referenced by llvm::RABasic::runOnMachineFunction().

◆ copyHint()

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

Return the preferred allocation register for reg, given a COPY instruction.

Definition at line 47 of file CalcSpillWeights.cpp.

References llvm::Register::asMCReg(), llvm::TargetRegisterClass::contains(), llvm::MachineRegisterInfo::getRegClass(), llvm::Register::isVirtual(), MI, Register, llvm::Sub, and TRI.

Referenced by weightCalcHelper().

◆ isRematerializable()

◆ normalize()

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

Weight normalization function.

Definition at line 105 of file CalcSpillWeights.h.

References llvm::normalizeSpillWeight(), and Size.

Referenced by weightCalcHelper().

◆ weightCalcHelper()

float VirtRegAuxInfo::weightCalcHelper ( LiveInterval & LI)
protected

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