LLVM
8.0.1
|
#include "llvm/CodeGen/LiveIntervals.h"
Classes | |
class | HMEditor |
Toolkit used by handleMove to trim or extend live intervals. More... | |
Public Member Functions | |
LiveIntervals () | |
~LiveIntervals () override | |
LiveInterval & | getInterval (unsigned Reg) |
const LiveInterval & | getInterval (unsigned Reg) const |
bool | hasInterval (unsigned Reg) const |
LiveInterval & | createEmptyInterval (unsigned Reg) |
Interval creation. More... | |
LiveInterval & | createAndComputeVirtRegInterval (unsigned Reg) |
void | removeInterval (unsigned Reg) |
Interval removal. More... | |
LiveInterval::Segment | addSegmentToEndOfBlock (unsigned reg, MachineInstr &startInst) |
Given a register and an instruction, adds a live segment from that instruction to the end of its MBB. More... | |
bool | shrinkToUses (LiveInterval *li, SmallVectorImpl< MachineInstr *> *dead=nullptr) |
After removing some uses of a register, shrink its live range to just the remaining uses. More... | |
void | shrinkToUses (LiveInterval::SubRange &SR, unsigned Reg) |
Specialized version of shrinkToUses(LiveInterval li, SmallVectorImpl<MachineInstr> *dead) that works on a subregister live range and only looks at uses matching the lane mask of the subregister range. More... | |
void | extendToIndices (LiveRange &LR, ArrayRef< SlotIndex > Indices, ArrayRef< SlotIndex > Undefs) |
Extend the live range LR to reach all points in Indices . More... | |
void | extendToIndices (LiveRange &LR, ArrayRef< SlotIndex > Indices) |
void | pruneValue (LiveRange &LR, SlotIndex Kill, SmallVectorImpl< SlotIndex > *EndPoints) |
If LR has a live value at Kill , prune its live range by removing any liveness reachable from Kill. More... | |
LLVM_ATTRIBUTE_UNUSED void | pruneValue (LiveInterval &, SlotIndex, SmallVectorImpl< SlotIndex > *) |
This function should not be used. More... | |
SlotIndexes * | getSlotIndexes () const |
AliasAnalysis * | getAliasAnalysis () const |
bool | isNotInMIMap (const MachineInstr &Instr) const |
Returns true if the specified machine instr has been removed or was never entered in the map. More... | |
SlotIndex | getInstructionIndex (const MachineInstr &Instr) const |
Returns the base index of the given instruction. More... | |
MachineInstr * | getInstructionFromIndex (SlotIndex index) const |
Returns the instruction associated with the given index. More... | |
SlotIndex | getMBBStartIdx (const MachineBasicBlock *mbb) const |
Return the first index in the given basic block. More... | |
SlotIndex | getMBBEndIdx (const MachineBasicBlock *mbb) const |
Return the last index in the given basic block. More... | |
bool | isLiveInToMBB (const LiveRange &LR, const MachineBasicBlock *mbb) const |
bool | isLiveOutOfMBB (const LiveRange &LR, const MachineBasicBlock *mbb) const |
MachineBasicBlock * | getMBBFromIndex (SlotIndex index) const |
void | insertMBBInMaps (MachineBasicBlock *MBB) |
SlotIndex | InsertMachineInstrInMaps (MachineInstr &MI) |
void | InsertMachineInstrRangeInMaps (MachineBasicBlock::iterator B, MachineBasicBlock::iterator E) |
void | RemoveMachineInstrFromMaps (MachineInstr &MI) |
SlotIndex | ReplaceMachineInstrInMaps (MachineInstr &MI, MachineInstr &NewMI) |
VNInfo::Allocator & | getVNInfoAllocator () |
void | getAnalysisUsage (AnalysisUsage &AU) const override |
getAnalysisUsage - This function should be overriden by passes that need analysis information to do their job. More... | |
void | releaseMemory () override |
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memory when it is no longer needed. More... | |
bool | runOnMachineFunction (MachineFunction &) override |
Pass entry point; Calculates LiveIntervals. More... | |
void | print (raw_ostream &O, const Module *=nullptr) const override |
Implement the dump method. More... | |
MachineBasicBlock * | intervalIsInOneMBB (const LiveInterval &LI) const |
If LI is confined to a single basic block, return a pointer to that block. More... | |
bool | hasPHIKill (const LiveInterval &LI, const VNInfo *VNI) const |
Returns true if VNI is killed by any PHI-def values in LI. More... | |
void | addKillFlags (const VirtRegMap *) |
Add kill flags to any instruction that kills a virtual register. More... | |
void | handleMove (MachineInstr &MI, bool UpdateFlags=false) |
Call this method to notify LiveIntervals that instruction MI has been moved within a basic block. More... | |
void | handleMoveIntoBundle (MachineInstr &MI, MachineInstr &BundleStart, bool UpdateFlags=false) |
Update intervals for operands of MI so that they begin/end on the SlotIndex for BundleStart . More... | |
void | repairIntervalsInRange (MachineBasicBlock *MBB, MachineBasicBlock::iterator Begin, MachineBasicBlock::iterator End, ArrayRef< unsigned > OrigRegs) |
Update live intervals for instructions in a range of iterators. More... | |
ArrayRef< SlotIndex > | getRegMaskSlots () const |
Returns a sorted array of slot indices of all instructions with register mask operands. More... | |
ArrayRef< SlotIndex > | getRegMaskSlotsInBlock (unsigned MBBNum) const |
Returns a sorted array of slot indices of all instructions with register mask operands in the basic block numbered MBBNum . More... | |
ArrayRef< const uint32_t * > | getRegMaskBits () const |
Returns an array of register mask pointers corresponding to getRegMaskSlots(). More... | |
ArrayRef< const uint32_t * > | getRegMaskBitsInBlock (unsigned MBBNum) const |
Returns an array of mask pointers corresponding to getRegMaskSlotsInBlock(MBBNum). More... | |
bool | checkRegMaskInterference (LiveInterval &LI, BitVector &UsableRegs) |
Test if LI is live across any register mask instructions, and compute a bit mask of physical registers that are not clobbered by any of them. More... | |
LiveRange & | getRegUnit (unsigned Unit) |
Return the live range for register unit Unit . More... | |
LiveRange * | getCachedRegUnit (unsigned Unit) |
Return the live range for register unit Unit if it has already been computed, or nullptr if it hasn't been computed yet. More... | |
const LiveRange * | getCachedRegUnit (unsigned Unit) const |
void | removeRegUnit (unsigned Unit) |
Remove computed live range for register unit Unit . More... | |
void | removePhysRegDefAt (unsigned Reg, SlotIndex Pos) |
Remove value numbers and related live segments starting at position Pos that are part of any liverange of physical register Reg or one of its subregisters. More... | |
void | removeVRegDefAt (LiveInterval &LI, SlotIndex Pos) |
Remove value number and related live segments of LI and its subranges that start at position Pos . More... | |
void | splitSeparateComponents (LiveInterval &LI, SmallVectorImpl< LiveInterval *> &SplitLIs) |
Split separate components in LiveInterval LI into separate intervals. More... | |
void | constructMainRangeFromSubranges (LiveInterval &LI) |
For live interval LI with correct SubRanges construct matching information for the main live range. More... | |
Public Member Functions inherited from llvm::MachineFunctionPass | |
bool | doInitialization (Module &) override |
doInitialization - Virtual method overridden by subclasses to do any necessary initialization before any pass is run. More... | |
Public Member Functions inherited from llvm::FunctionPass | |
FunctionPass (char &pid) | |
Pass * | createPrinterPass (raw_ostream &OS, const std::string &Banner) const override |
createPrinterPass - Get a function printer pass. More... | |
void | assignPassManager (PMStack &PMS, PassManagerType T) override |
Find appropriate Function Pass Manager or Call Graph Pass Manager in the PM Stack and add self into that manager. More... | |
PassManagerType | getPotentialPassManagerType () const override |
Return what kind of Pass Manager can manage this pass. More... | |
Public Member Functions inherited from llvm::Pass | |
Pass (PassKind K, char &pid) | |
Pass (const Pass &)=delete | |
Pass & | operator= (const Pass &)=delete |
virtual | ~Pass () |
PassKind | getPassKind () const |
virtual StringRef | getPassName () const |
getPassName - Return a nice clean name for a pass. More... | |
AnalysisID | getPassID () const |
getPassID - Return the PassID number that corresponds to this pass. More... | |
virtual bool | doFinalization (Module &) |
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes have run. More... | |
void | dump () const |
virtual void | preparePassManager (PMStack &) |
Check if available pass managers are suitable for this pass or not. More... | |
void | setResolver (AnalysisResolver *AR) |
AnalysisResolver * | getResolver () const |
virtual void * | getAdjustedAnalysisPointer (AnalysisID ID) |
getAdjustedAnalysisPointer - This method is used when a pass implements an analysis interface through multiple inheritance. More... | |
virtual ImmutablePass * | getAsImmutablePass () |
virtual PMDataManager * | getAsPMDataManager () |
virtual void | verifyAnalysis () const |
verifyAnalysis() - This member can be implemented by a analysis pass to check state of analysis information. More... | |
virtual void | dumpPassStructure (unsigned Offset=0) |
template<typename AnalysisType > | |
AnalysisType * | getAnalysisIfAvailable () const |
getAnalysisIfAvailable<AnalysisType>() - Subclasses use this function to get analysis information that might be around, for example to update it. More... | |
bool | mustPreserveAnalysisID (char &AID) const |
mustPreserveAnalysisID - This method serves the same function as getAnalysisIfAvailable, but works if you just have an AnalysisID. More... | |
template<typename AnalysisType > | |
AnalysisType & | getAnalysis () const |
getAnalysis<AnalysisType>() - This function is used by subclasses to get to the analysis information that they claim to use by overriding the getAnalysisUsage function. More... | |
template<typename AnalysisType > | |
AnalysisType & | getAnalysis (Function &F) |
getAnalysis<AnalysisType>() - This function is used by subclasses to get to the analysis information that they claim to use by overriding the getAnalysisUsage function. More... | |
template<typename AnalysisType > | |
AnalysisType & | getAnalysisID (AnalysisID PI) const |
template<typename AnalysisType > | |
AnalysisType & | getAnalysisID (AnalysisID PI, Function &F) |
Static Public Member Functions | |
static float | getSpillWeight (bool isDef, bool isUse, const MachineBlockFrequencyInfo *MBFI, const MachineInstr &MI) |
Calculate the spill weight to assign to a single instruction. More... | |
static float | getSpillWeight (bool isDef, bool isUse, const MachineBlockFrequencyInfo *MBFI, const MachineBasicBlock *MBB) |
Calculate the spill weight to assign to a single instruction. More... | |
Static Public Member Functions inherited from llvm::Pass | |
static const PassInfo * | lookupPassInfo (const void *TI) |
static const PassInfo * | lookupPassInfo (StringRef Arg) |
static Pass * | createPass (AnalysisID ID) |
Static Public Attributes | |
static char | ID = 0 |
Additional Inherited Members | |
Protected Member Functions inherited from llvm::MachineFunctionPass | |
MachineFunctionPass (char &ID) | |
void | getAnalysisUsage (AnalysisUsage &AU) const override |
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this. More... | |
virtual MachineFunctionProperties | getRequiredProperties () const |
virtual MachineFunctionProperties | getSetProperties () const |
virtual MachineFunctionProperties | getClearedProperties () const |
Protected Member Functions inherited from llvm::FunctionPass | |
bool | skipFunction (const Function &F) const |
Optional passes call this function to check whether the pass should be skipped. More... | |
Definition at line 55 of file LiveIntervals.h.
LiveIntervals::LiveIntervals | ( | ) |
Definition at line 101 of file LiveIntervals.cpp.
References llvm::PassRegistry::getPassRegistry(), and llvm::initializeLiveIntervalsPass().
|
override |
Definition at line 105 of file LiveIntervals.cpp.
void LiveIntervals::addKillFlags | ( | const VirtRegMap * | VRM | ) |
Add kill flags to any instruction that kills a virtual register.
Definition at line 684 of file LiveIntervals.cpp.
References llvm::MachineInstr::addRegisterKilled(), llvm::LiveRange::advanceTo(), assert(), llvm::LiveRange::begin(), llvm::SmallVectorImpl< T >::clear(), llvm::MachineInstr::clearRegisterKills(), llvm::LiveRange::empty(), llvm::LiveRange::end(), llvm::LiveRange::find(), llvm::LaneBitmask::getAll(), getInstructionFromIndex(), getInterval(), llvm::LaneBitmask::getNone(), llvm::MachineRegisterInfo::getNumVirtRegs(), llvm::VirtRegMap::getPhys(), getRegUnit(), llvm::TargetRegisterInfo::getSubRegIndexLaneMask(), I, llvm::TargetRegisterInfo::index2VirtReg(), llvm::LiveInterval::SubRange::LaneMask, MI, N, llvm::MachineInstr::operands(), llvm::SmallVectorTemplateBase< T >::push_back(), Reg, llvm::MachineRegisterInfo::reg_nodbg_empty(), llvm::RISCVFPRndMode::RUP, llvm::LiveInterval::subranges(), llvm::MachineRegisterInfo::subRegLivenessEnabled(), and Unit.
Referenced by getVNInfoAllocator().
LiveRange::Segment LiveIntervals::addSegmentToEndOfBlock | ( | unsigned | reg, |
MachineInstr & | startInst | ||
) |
Given a register and an instruction, adds a live segment from that instruction to the end of its MBB.
Definition at line 869 of file LiveIntervals.cpp.
References llvm::LiveRange::addSegment(), createEmptyInterval(), getInstructionIndex(), getMBBEndIdx(), llvm::LiveRange::getNextValue(), llvm::MachineInstr::getParent(), and getVNInfoAllocator().
Referenced by removeInterval().
bool LiveIntervals::checkRegMaskInterference | ( | LiveInterval & | LI, |
BitVector & | UsableRegs | ||
) |
Test if LI
is live across any register mask instructions, and compute a bit mask of physical registers that are not clobbered by any of them.
Returns false if LI
doesn't cross any register mask instructions. In that case, the bit vector is not filled in.
Definition at line 885 of file LiveIntervals.cpp.
References llvm::LiveRange::advanceTo(), assert(), llvm::ArrayRef< T >::begin(), llvm::LiveRange::begin(), llvm::tgtok::Bits, llvm::BitVector::clear(), llvm::BitVector::clearBitsNotInMask(), llvm::LiveRange::empty(), llvm::sys::path::end(), llvm::ArrayRef< T >::end(), llvm::LiveRange::end(), llvm::MCRegisterInfo::getNumRegs(), getRegMaskBits(), getRegMaskBitsInBlock(), getRegMaskSlots(), getRegMaskSlotsInBlock(), intervalIsInOneMBB(), llvm::lower_bound(), and llvm::BitVector::resize().
Referenced by llvm::LiveRegMatrix::checkRegMaskInterference(), getRegMaskBitsInBlock(), and isACalleeSavedRegister().
void LiveIntervals::constructMainRangeFromSubranges | ( | LiveInterval & | LI | ) |
For live interval LI
with correct SubRanges construct matching information for the main live range.
Expects the main live range to not have any segments or value numbers.
Definition at line 1655 of file LiveIntervals.cpp.
References assert(), getSlotIndexes(), and getVNInfoAllocator().
Referenced by removeRegUnit().
|
inline |
Definition at line 138 of file LiveIntervals.h.
References createEmptyInterval().
Referenced by getInterval(), MoveAndTeeForMultiUse(), MoveForSingleUse(), optimizeVcndVcmpPair(), print(), RematerializeCheapDef(), and repairIntervalsInRange().
|
inline |
Interval creation.
Definition at line 131 of file LiveIntervals.h.
References assert(), llvm::IndexedMap< T, ToIndexT >::grow(), hasInterval(), and Reg.
Referenced by addSegmentToEndOfBlock(), createAndComputeVirtRegInterval(), replaceRegUsesAfterLoop(), and splitSeparateComponents().
void LiveIntervals::extendToIndices | ( | LiveRange & | LR, |
ArrayRef< SlotIndex > | Indices, | ||
ArrayRef< SlotIndex > | Undefs | ||
) |
Extend the live range LR
to reach all points in Indices
.
The points in the Indices
array must be jointly dominated by the union of the existing defs in LR
and points in Undefs
.
PHI-defs are added as needed to maintain SSA form.
If a SlotIndex in Indices
is the end index of a basic block, LR
will be extended to be live out of the basic block. If a SlotIndex in Indices
is jointy dominated only by points in Undefs
, the live range will not be extended to that point.
See also LiveRangeCalc::extend().
Definition at line 613 of file LiveIntervals.cpp.
References assert(), llvm::LiveRangeCalc::extend(), getSlotIndexes(), getVNInfoAllocator(), and llvm::LiveRangeCalc::reset().
Referenced by addSegmentsWithValNo(), extendToIndices(), removeInterval(), and ReplaceDominatedUses().
Definition at line 187 of file LiveIntervals.h.
References extendToIndices(), llvm::RegState::Kill, and pruneValue().
|
inline |
Definition at line 215 of file LiveIntervals.h.
Referenced by isRematerializable().
|
overridevirtual |
getAnalysisUsage - This function should be overriden by passes that need analysis information to do their job.
If a pass specifies that it uses a particular analysis result to this function, it can then use the getAnalysis<AnalysisType>() function, below.
Reimplemented from llvm::Pass.
Definition at line 88 of file LiveIntervals.cpp.
References llvm::AnalysisUsage::addPreserved(), llvm::AnalysisUsage::addPreservedID(), llvm::AnalysisUsage::addRequired(), llvm::AnalysisUsage::addRequiredTransitive(), llvm::AnalysisUsage::addRequiredTransitiveID(), llvm::MachineFunctionPass::getAnalysisUsage(), llvm::MachineDominatorsID, llvm::MachineLoopInfoID, and llvm::AnalysisUsage::setPreservesCFG().
Referenced by getVNInfoAllocator().
Return the live range for register unit Unit
if it has already been computed, or nullptr if it hasn't been computed yet.
Definition at line 406 of file LiveIntervals.h.
References Unit.
Referenced by getLanesWithProperty(), getLiveRange(), llvm::LiveIntervals::HMEditor::getRegUnitLI(), matchPair(), and removePhysRegDefAt().
Definition at line 410 of file LiveIntervals.h.
References Unit.
|
inline |
Returns the instruction associated with the given index.
Definition at line 231 of file LiveIntervals.h.
References llvm::SlotIndexes::getInstructionFromIndex().
Referenced by addKillFlags(), addSegmentsWithValNo(), llvm::createCopyConstrainDAGMutation(), definesFullReg(), llvm::SplitEditor::dump(), llvm::SplitEditor::enterIntvAfter(), llvm::SplitEditor::enterIntvBefore(), llvm::SIRegisterInfo::findReachingDef(), llvm::InsertPointAnalysis::getLastInsertPointIter(), GetVRegDef(), llvm::CoalescerPair::isCoalescable(), isRematerializable(), llvm::SplitEditor::leaveIntvAfter(), llvm::SplitEditor::leaveIntvBefore(), matchPair(), llvm::printLivesAt(), regOverlapsSet(), llvm::SystemZRegisterInfo::shouldCoalesce(), shrinkToUses(), and llvm::LiveIntervals::HMEditor::updateAllRanges().
|
inline |
Returns the base index of the given instruction.
Definition at line 226 of file LiveIntervals.h.
References llvm::SlotIndexes::getInstructionIndex().
Referenced by addSegmentsWithValNo(), addSegmentToEndOfBlock(), llvm::ScheduleDAGInstrs::buildSchedGraph(), llvm::RegPressureTracker::bumpDownwardPressure(), llvm::RegPressureTracker::bumpUpwardPressure(), llvm::SplitAnalysis::clear(), llvm::createCopyConstrainDAGMutation(), definesFullReg(), llvm::RegisterOperands::detectDeadDefs(), dumpMachineInstrRangeWithSlotIndex(), findNextInsertLocation(), llvm::SIRegisterInfo::findReachingDef(), findUseBetween(), llvm::InsertPointAnalysis::getFirstInsertPoint(), llvm::getLiveRegsAfter(), llvm::getLiveRegsBefore(), getUsedRegMask(), GetVRegDef(), HasOneUse(), INITIALIZE_PASS(), llvm::InsertPointAnalysis::InsertPointAnalysis(), llvm::CoalescerPair::isCoalescable(), isDefBetween(), isPlainlyKilled(), matchPair(), MoveAndTeeForMultiUse(), MoveForSingleUse(), OneUseDominatesOtherUses(), llvm::RegPressureTracker::recede(), llvm::RegPressureTracker::recedeSkipDebugValues(), regJustKilledBefore(), RematerializeCheapDef(), repairIntervalsInRange(), ReplaceDominatedUses(), llvm::GCNScheduleDAGMILive::schedule(), llvm::GCNIterativeScheduler::scheduleRegion(), and shrinkToUses().
|
inline |
Definition at line 115 of file LiveIntervals.h.
References createAndComputeVirtRegInterval(), hasInterval(), and Reg.
Referenced by addKillFlags(), addSegmentsWithValNo(), llvm::RegAllocBase::allocatePhysRegs(), llvm::calculateSpillWeightsAndHints(), computeWeight(), llvm::createCopyConstrainDAGMutation(), createSegmentsForValues(), definesFullReg(), llvm::SplitEditor::dump(), llvm::SIRegisterInfo::findReachingDef(), getInterval(), getLanesWithProperty(), llvm::getLiveLaneMask(), getLiveRange(), GetVRegDef(), HasOneUse(), llvm::RegAllocBase::init(), INITIALIZE_PASS(), isACalleeSavedRegister(), llvm::CoalescerPair::isCoalescable(), isDefInSubRange(), isLocalCopy(), llvm::SplitAnalysis::isOriginalEndpoint(), isPlainlyKilled(), isRematerializable(), isTerminalReg(), matchPair(), MoveAndTeeForMultiUse(), MoveForSingleUse(), OneUseDominatesOtherUses(), print(), llvm::printLivesAt(), regJustKilledBefore(), regOverlapsSet(), RematerializeCheapDef(), repairIntervalsInRange(), ReplaceDominatedUses(), llvm::HexagonRegisterInfo::shouldCoalesce(), llvm::SystemZRegisterInfo::shouldCoalesce(), llvm::MachineBasicBlock::SplitCriticalEdge(), llvm::LiveIntervals::HMEditor::updateAllRanges(), and llvm::LiveDebugVariables::~LiveDebugVariables().
|
inline |
Definition at line 122 of file LiveIntervals.h.
References getInterval().
|
inline |
Return the last index in the given basic block.
Definition at line 241 of file LiveIntervals.h.
References llvm::SlotIndexes::getMBBEndIdx().
Referenced by addSegmentsWithValNo(), addSegmentToEndOfBlock(), llvm::SplitAnalysis::countLiveBlocks(), findNextInsertLocation(), llvm::InsertPointAnalysis::getLastInsertPointIter(), handleMove(), llvm::InsertPointAnalysis::InsertPointAnalysis(), isLiveOutOfMBB(), matchPair(), regOverlapsSet(), repairIntervalsInRange(), and llvm::SplitEditor::useIntv().
|
inline |
Definition at line 255 of file LiveIntervals.h.
References llvm::SlotIndexes::getMBBFromIndex().
Referenced by llvm::SplitAnalysis::clear(), llvm::SplitAnalysis::countLiveBlocks(), hasPHIKill(), matchPair(), and llvm::VirtRegAuxInfo::weightCalcHelper().
|
inline |
Return the first index in the given basic block.
Definition at line 236 of file LiveIntervals.h.
References llvm::SlotIndexes::getMBBStartIdx().
Referenced by addSegmentsWithValNo(), llvm::InsertPointAnalysis::getFirstInsertPoint(), handleMove(), isLiveInToMBB(), matchPair(), llvm::MachineBasicBlock::SplitCriticalEdge(), and llvm::SplitEditor::useIntv().
Returns an array of register mask pointers corresponding to getRegMaskSlots().
Definition at line 362 of file LiveIntervals.h.
Referenced by checkRegMaskInterference(), and getRegMaskBitsInBlock().
|
inline |
Returns an array of mask pointers corresponding to getRegMaskSlotsInBlock(MBBNum).
Definition at line 366 of file LiveIntervals.h.
References checkRegMaskInterference(), getRegMaskBits(), and P.
Referenced by checkRegMaskInterference().
Returns a sorted array of slot indices of all instructions with register mask operands.
Definition at line 351 of file LiveIntervals.h.
Referenced by checkRegMaskInterference(), and getRegMaskSlotsInBlock().
Returns a sorted array of slot indices of all instructions with register mask operands in the basic block numbered MBBNum
.
Definition at line 355 of file LiveIntervals.h.
References getRegMaskSlots(), and P.
Referenced by checkRegMaskInterference().
Return the live range for register unit Unit
.
It will be computed if it doesn't exist.
Definition at line 393 of file LiveIntervals.h.
References Unit.
Referenced by addKillFlags(), llvm::LiveRegMatrix::checkRegUnitInterference(), llvm::SIRegisterInfo::findReachingDef(), llvm::SystemZInstrInfo::foldMemoryOperandImpl(), llvm::LiveIntervals::HMEditor::getRegUnitLI(), isACalleeSavedRegister(), and runOnMachineFunction().
|
inline |
Definition at line 211 of file LiveIntervals.h.
Referenced by llvm::LiveRegMatrix::checkRegUnitInterference(), constructMainRangeFromSubranges(), llvm::SplitEditor::dump(), extendToIndices(), llvm::SystemZInstrInfo::foldMemoryOperandImpl(), print(), llvm::SplitEditor::reset(), llvm::GCNScheduleDAGMILive::schedule(), llvm::HexagonRegisterInfo::shouldCoalesce(), and llvm::LiveIntervals::HMEditor::updateAllRanges().
|
static |
Calculate the spill weight to assign to a single instruction.
Definition at line 854 of file LiveIntervals.cpp.
References llvm::MachineInstr::getParent().
Referenced by computeWeight(), false::IntervalSorter::operator()(), and llvm::VirtRegAuxInfo::weightCalcHelper().
|
static |
Calculate the spill weight to assign to a single instruction.
Definition at line 860 of file LiveIntervals.cpp.
References llvm::MachineBlockFrequencyInfo::getBlockFreq(), llvm::MachineBlockFrequencyInfo::getEntryFreq(), and llvm::BlockFrequency::getFrequency().
|
inline |
Definition at line 284 of file LiveIntervals.h.
References addKillFlags(), getAnalysisUsage(), handleMove(), handleMoveIntoBundle(), hasPHIKill(), intervalIsInOneMBB(), MI, llvm::RISCVFenceField::O, print(), releaseMemory(), repairIntervalsInRange(), and runOnMachineFunction().
Referenced by addSegmentsWithValNo(), addSegmentToEndOfBlock(), constructMainRangeFromSubranges(), llvm::SplitEditor::dump(), extendToIndices(), llvm::SystemZInstrInfo::foldMemoryOperandImpl(), isDefInSubRange(), print(), and llvm::SplitEditor::reset().
void LiveIntervals::handleMove | ( | MachineInstr & | MI, |
bool | UpdateFlags = false |
||
) |
Call this method to notify LiveIntervals that instruction MI
has been moved within a basic block.
This will update the live intervals for all operands of MI
. Moves between basic blocks are not supported.
UpdateFlags | Update live intervals for nonallocatable physregs. |
Definition at line 1444 of file LiveIntervals.cpp.
References assert(), getMBBEndIdx(), getMBBStartIdx(), llvm::MachineInstr::getParent(), llvm::MachineInstr::isBundled(), MRI, TRI, and llvm::LiveIntervals::HMEditor::updateAllRanges().
Referenced by getVNInfoAllocator(), MoveAndTeeForMultiUse(), MoveForSingleUse(), llvm::GCNScheduleDAGMILive::schedule(), and llvm::GCNIterativeScheduler::scheduleRegion().
void LiveIntervals::handleMoveIntoBundle | ( | MachineInstr & | MI, |
MachineInstr & | BundleStart, | ||
bool | UpdateFlags = false |
||
) |
Update intervals for operands of MI
so that they begin/end on the SlotIndex for BundleStart
.
UpdateFlags | Update live intervals for nonallocatable physregs. |
Requires MI and BundleStart to have SlotIndexes, and assumes existing liveness is accurate. BundleStart should be the first instruction in the Bundle.
Definition at line 1457 of file LiveIntervals.cpp.
References MRI, TRI, and llvm::LiveIntervals::HMEditor::updateAllRanges().
Referenced by getVNInfoAllocator().
Definition at line 126 of file LiveIntervals.h.
References llvm::IndexedMap< T, ToIndexT >::inBounds(), and Reg.
Referenced by llvm::RegAllocBase::allocatePhysRegs(), createEmptyInterval(), llvm::SIRegisterInfo::findReachingDef(), getInterval(), llvm::getLiveRegs(), isLocalCopy(), matchPair(), print(), llvm::printLivesAt(), repairIntervalsInRange(), replaceRegUsesAfterLoop(), and llvm::MachineBasicBlock::SplitCriticalEdge().
bool LiveIntervals::hasPHIKill | ( | const LiveInterval & | LI, |
const VNInfo * | VNI | ||
) | const |
Returns true if VNI is killed by any PHI-def values in LI.
This may conservatively return true to avoid expensive computations.
Definition at line 839 of file LiveIntervals.cpp.
References llvm::VNInfo::def, llvm::SlotIndexes::getMBBEndIdx(), getMBBFromIndex(), llvm::LiveRange::getVNInfoBefore(), llvm::VNInfo::isPHIDef(), llvm::VNInfo::isUnused(), llvm::MachineBasicBlock::pred_size(), llvm::MachineBasicBlock::predecessors(), and llvm::LiveRange::valnos.
Referenced by getVNInfoAllocator(), and llvm::CoalescerPair::isCoalescable().
|
inline |
Definition at line 266 of file LiveIntervals.h.
References llvm::SlotIndexes::insertMachineInstrInMaps().
Referenced by addSegmentsWithValNo(), ConvertImplicitDefToConstZero(), MoveAndTeeForMultiUse(), optimizeVcndVcmpPair(), and RematerializeCheapDef().
|
inline |
Definition at line 270 of file LiveIntervals.h.
References E, I, and llvm::SlotIndexes::insertMachineInstrInMaps().
|
inline |
Definition at line 259 of file LiveIntervals.h.
References assert(), llvm::MachineBasicBlock::getNumber(), llvm::SlotIndexes::insertMBBInMaps(), llvm::SmallVectorTemplateBase< T >::push_back(), and llvm::SmallVectorBase::size().
Referenced by llvm::MachineBasicBlock::SplitCriticalEdge().
MachineBasicBlock * LiveIntervals::intervalIsInOneMBB | ( | const LiveInterval & | LI | ) | const |
If LI is confined to a single basic block, return a pointer to that block.
If LI is live in to or out of any block, return NULL.
Definition at line 815 of file LiveIntervals.cpp.
Referenced by checkRegMaskInterference(), getVNInfoAllocator(), and isLocalCopy().
|
inline |
Definition at line 245 of file LiveIntervals.h.
References getMBBStartIdx(), and llvm::LiveRange::liveAt().
Referenced by llvm::InsertPointAnalysis::InsertPointAnalysis(), and matchPair().
|
inline |
Definition at line 250 of file LiveIntervals.h.
References getMBBEndIdx(), and llvm::LiveRange::liveAt().
|
inline |
Returns true if the specified machine instr has been removed or was never entered in the map.
Definition at line 221 of file LiveIntervals.h.
References llvm::SlotIndexes::hasIndex().
Referenced by findNextInsertLocation(), isPlainlyKilled(), and matchPair().
|
overridevirtual |
Implement the dump method.
Reimplemented from llvm::Pass.
Definition at line 155 of file LiveIntervals.cpp.
References assert(), llvm::LiveRangeCalc::calculate(), createAndComputeVirtRegInterval(), llvm::LiveRange::createDeadDef(), llvm::LiveRangeCalc::createDeadDefs(), llvm::dbgs(), llvm::LiveRange::empty(), llvm::LiveRange::flushSegmentSet(), llvm::SlotIndexes::getInstructionIndex(), getInterval(), llvm::SlotIndexes::getMBBStartIdx(), llvm::MachineFunction::getNumBlockIDs(), llvm::MCRegisterInfo::getNumRegUnits(), llvm::MachineRegisterInfo::getNumVirtRegs(), llvm::SlotIndex::getRegSlot(), getSlotIndexes(), getVNInfoAllocator(), hasInterval(), llvm::huge_valf, llvm::VNInfo::id, llvm::TargetRegisterInfo::index2VirtReg(), llvm::TargetRegisterInfo::isPhysicalRegister(), llvm::MachineRegisterInfo::isReserved(), llvm::MachineRegisterInfo::isReservedRegUnit(), llvm::MCRegisterInfo::DiffListIterator::isValid(), llvm::MCRegUnitRootIterator::isValid(), LLVM_DEBUG, LLVM_DUMP_METHOD, llvm::BitmaskEnumDetail::Mask(), MI, llvm::MachineFunction::print(), llvm::printMBBReference(), llvm::printRegUnit(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::LiveInterval::reg, Reg, llvm::MachineRegisterInfo::reg_empty(), llvm::MachineRegisterInfo::reg_nodbg_empty(), llvm::LiveRangeCalc::reset(), llvm::SmallVectorImpl< T >::resize(), llvm::MachineRegisterInfo::shouldTrackSubRegLiveness(), llvm::SmallVectorBase::size(), Unit, and llvm::UseSegmentSetForPhysRegs.
Referenced by getVNInfoAllocator(), isTerminalReg(), and llvm::MachineFunction::verify().
void LiveIntervals::pruneValue | ( | LiveRange & | LR, |
SlotIndex | Kill, | ||
SmallVectorImpl< SlotIndex > * | EndPoints | ||
) |
If LR
has a live value at Kill
, prune its live range by removing any liveness reachable from Kill.
Add live range end points to EndPoints such that extendToIndices(LI, EndPoints) will reconstruct the value's live range.
Calling pruneValue() and extendToIndices() can be used to reconstruct SSA form after adding defs to a virtual register.
Definition at line 622 of file LiveIntervals.cpp.
References llvm::df_ext_begin(), llvm::df_ext_end(), E, llvm::LiveQueryResult::endPoint(), llvm::SlotIndexes::getMBBEndIdx(), llvm::SlotIndexes::getMBBFromIndex(), llvm::SlotIndexes::getMBBRange(), I, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::LiveRange::Query(), llvm::LiveRange::removeSegment(), llvm::MachineBasicBlock::successors(), llvm::LiveQueryResult::valueIn(), and llvm::LiveQueryResult::valueOutOrDead().
Referenced by addSegmentsWithValNo(), and extendToIndices().
|
inline |
This function should not be used.
Its intent is to tell you that you are doing something wrong if you call pruneValue directly on a LiveInterval. Indeed, you are supposed to call pruneValue on the main LiveRange and all the LiveRanges of the subranges if any.
Definition at line 205 of file LiveIntervals.h.
References llvm_unreachable.
|
overridevirtual |
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memory when it is no longer needed.
The default behavior of passes is to hold onto memory for the entire duration of their lifetime (which is the entire compile time). For pipelined passes, this is not a big deal because that memory gets recycled every time the pass is invoked on another program unit. For IP passes, it is more important to free memory when it is unused.
Optionally implement this function to release pass memory when it is no longer used.
Reimplemented from llvm::Pass.
Definition at line 109 of file LiveIntervals.cpp.
References llvm::SmallVectorImpl< T >::clear(), llvm::TargetRegisterInfo::index2VirtReg(), and llvm::BumpPtrAllocatorImpl< AllocatorT, SlabSize, SizeThreshold >::Reset().
Referenced by getVNInfoAllocator().
|
inline |
Interval removal.
Definition at line 145 of file LiveIntervals.h.
References addSegmentToEndOfBlock(), extendToIndices(), Reg, and shrinkToUses().
Referenced by llvm::RegAllocBase::allocatePhysRegs(), optimizeVcndVcmpPair(), and RematerializeCheapDef().
|
inline |
Definition at line 276 of file LiveIntervals.h.
References llvm::SlotIndexes::removeMachineInstrFromMaps().
Referenced by INITIALIZE_PASS(), isACalleeSavedRegister(), isDefInSubRange(), optimizeVcndVcmpPair(), llvm::RegAllocBase::postOptimization(), and RematerializeCheapDef().
Remove value numbers and related live segments starting at position Pos
that are part of any liverange of physical register Reg
or one of its subregisters.
Definition at line 1612 of file LiveIntervals.cpp.
References getCachedRegUnit(), llvm::LiveRange::getVNInfoAt(), llvm::LiveRange::removeValNo(), TRI, and Unit.
Referenced by RematerializeCheapDef(), and removeRegUnit().
|
inline |
Remove computed live range for register unit Unit
.
Subsequent uses should rely on on-demand recomputation.
Definition at line 416 of file LiveIntervals.h.
References constructMainRangeFromSubranges(), llvm::LaneBitmask::getAll(), removePhysRegDefAt(), removeVRegDefAt(), splitSeparateComponents(), and Unit.
Referenced by optimizeVcndVcmpPair().
void LiveIntervals::removeVRegDefAt | ( | LiveInterval & | LI, |
SlotIndex | Pos | ||
) |
Remove value number and related live segments of LI
and its subranges that start at position Pos
.
Definition at line 1620 of file LiveIntervals.cpp.
References assert(), llvm::VNInfo::def, llvm::SlotIndex::getBaseIndex(), llvm::LiveRange::getVNInfoAt(), llvm::LiveInterval::removeEmptySubRanges(), llvm::LiveRange::removeValNo(), and llvm::LiveInterval::subranges().
Referenced by addSegmentsWithValNo(), INITIALIZE_PASS(), and removeRegUnit().
void LiveIntervals::repairIntervalsInRange | ( | MachineBasicBlock * | MBB, |
MachineBasicBlock::iterator | Begin, | ||
MachineBasicBlock::iterator | End, | ||
ArrayRef< unsigned > | OrigRegs | ||
) |
Update live intervals for instructions in a range of iterators.
It is intended for use after target hooks that may insert or remove instructions, and is only efficient for a small number of instructions.
OrigRegs is a vector of registers that were originally used by the instructions in the range between the two iterators.
Currently, the only only changes that are supported are simple removal and addition of uses.
Definition at line 1561 of file LiveIntervals.cpp.
References llvm::MachineBasicBlock::begin(), createAndComputeVirtRegInterval(), llvm::MachineBasicBlock::end(), getInstructionIndex(), getInterval(), getMBBEndIdx(), llvm::SlotIndex::getPrevSlot(), llvm::LiveRange::hasAtLeastOneValue(), hasInterval(), I, llvm::MachineInstr::isDebugInstr(), llvm::TargetRegisterInfo::isVirtualRegister(), MI, llvm::MachineInstr::operands_begin(), llvm::MachineInstr::operands_end(), and llvm::LiveInterval::subranges().
Referenced by getVNInfoAllocator(), and llvm::MachineBasicBlock::SplitCriticalEdge().
|
inline |
Definition at line 280 of file LiveIntervals.h.
References llvm::SlotIndexes::replaceMachineInstrInMaps().
Referenced by addSegmentsWithValNo(), definesFullReg(), and regOverlapsSet().
|
overridevirtual |
Pass entry point; Calculates LiveIntervals.
Implements llvm::MachineFunctionPass.
Definition at line 126 of file LiveIntervals.cpp.
References llvm::Pass::dump(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::MCRegisterInfo::getNumRegUnits(), llvm::MachineRegisterInfo::getNumVirtRegs(), llvm::MachineFunction::getRegInfo(), llvm::TargetSubtargetInfo::getRegisterInfo(), getRegUnit(), llvm::MachineFunction::getSubtarget(), and LLVM_DEBUG.
Referenced by getVNInfoAllocator().
bool LiveIntervals::shrinkToUses | ( | LiveInterval * | li, |
SmallVectorImpl< MachineInstr *> * | dead = nullptr |
||
) |
After removing some uses of a register, shrink its live range to just the remaining uses.
This method does not compute reaching defs for new uses, and it doesn't remove dead defs. Dead PHIDef values are marked as unused. New dead machine instructions are added to the dead vector. Returns true if the interval may have been separated into multiple connected components.
Definition at line 442 of file LiveIntervals.cpp.
References llvm::MachineInstr::addRegisterDead(), llvm::MachineInstr::allDefsAreDead(), assert(), llvm::LiveRange::begin(), createSegmentsForValues(), llvm::dbgs(), llvm::tgtok::Def, llvm::VNInfo::def, llvm::LiveRange::end(), llvm::LiveRange::FindSegmentContaining(), llvm::SlotIndex::getDeadSlot(), getInstructionFromIndex(), getInstructionIndex(), llvm::LaneBitmask::getNone(), llvm::SlotIndex::getRegSlot(), I, llvm::VNInfo::isPHIDef(), llvm::VNInfo::isUnused(), llvm::TargetRegisterInfo::isVirtualRegister(), LLVM_DEBUG, llvm::make_range(), llvm::VNInfo::markUnused(), MI, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::LiveRange::Query(), llvm::LiveInterval::reg, llvm::MachineRegisterInfo::reg_instructions(), llvm::LiveInterval::removeEmptySubRanges(), llvm::LiveRange::removeSegment(), llvm::LiveRange::segments, llvm::MachineInstr::setRegisterDefReadUndef(), llvm::MachineRegisterInfo::shouldTrackSubRegLiveness(), llvm::LiveInterval::subranges(), llvm::SmallVectorImpl< T >::swap(), UseMI, llvm::LiveRange::valnos, llvm::LiveQueryResult::valueDefined(), llvm::LiveQueryResult::valueIn(), llvm::LiveRange::vni_begin(), and llvm::LiveRange::vni_end().
Referenced by removeInterval(), ReplaceDominatedUses(), and ShrinkToUses().
void LiveIntervals::shrinkToUses | ( | LiveInterval::SubRange & | SR, |
unsigned | Reg | ||
) |
Specialized version of shrinkToUses(LiveInterval li, SmallVectorImpl<MachineInstr> *dead) that works on a subregister live range and only looks at uses matching the lane mask of the subregister range.
This may leave the subrange empty which needs to be cleaned up with LiveInterval::removeEmptySubranges() afterwards.
Definition at line 543 of file LiveIntervals.cpp.
References assert(), createSegmentsForValues(), llvm::dbgs(), llvm::VNInfo::def, llvm::LiveRange::Segment::end, llvm::SlotIndex::getDeadSlot(), getInstructionIndex(), llvm::SlotIndex::getRegSlot(), llvm::LiveRange::getSegmentContaining(), llvm::TargetRegisterInfo::getSubRegIndexLaneMask(), llvm::VNInfo::isPHIDef(), llvm::VNInfo::isUnused(), llvm::TargetRegisterInfo::isVirtualRegister(), llvm::LiveInterval::SubRange::LaneMask, LLVM_DEBUG, llvm::make_range(), llvm::VNInfo::markUnused(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::LiveRange::Query(), llvm::LiveRange::removeSegment(), llvm::LiveRange::segments, SubReg, llvm::SmallVectorImpl< T >::swap(), llvm::MachineRegisterInfo::use_nodbg_operands(), UseMI, llvm::LiveRange::valnos, llvm::LiveQueryResult::valueDefined(), llvm::LiveQueryResult::valueIn(), llvm::LiveRange::vni_begin(), and llvm::LiveRange::vni_end().
void LiveIntervals::splitSeparateComponents | ( | LiveInterval & | LI, |
SmallVectorImpl< LiveInterval *> & | SplitLIs | ||
) |
Split separate components in LiveInterval LI
into separate intervals.
Definition at line 1638 of file LiveIntervals.cpp.
References llvm::ConnectedVNInfoEqClasses::Classify(), createEmptyInterval(), llvm::SmallVectorTemplateCommon< T >::data(), llvm::dbgs(), llvm::ConnectedVNInfoEqClasses::Distribute(), I, LLVM_DEBUG, MRI, llvm::SmallVectorTemplateBase< T >::push_back(), and llvm::LiveInterval::reg.
Referenced by INITIALIZE_PASS(), removeRegUnit(), and ShrinkToUses().
|
static |
Definition at line 100 of file LiveIntervals.h.