LLVM: llvm::LiveIntervals Class Reference (original) (raw)

#include "[llvm/CodeGen/LiveIntervals.h](LiveIntervals%5F8h%5Fsource.html)"

Classes
class HMEditor
Toolkit used by handleMove to trim or extend live intervals. More...
Public Member Functions
LiveIntervals (LiveIntervals &&)=default
LLVM_ABI ~LiveIntervals ()
LLVM_ABI bool invalidate (MachineFunction &MF, const PreservedAnalyses &PA, MachineFunctionAnalysisManager::Invalidator &Inv)
LiveInterval & getInterval (Register Reg)
const LiveInterval & getInterval (Register Reg) const
bool hasInterval (Register Reg) const
LiveInterval & createEmptyInterval (Register Reg)
Interval creation.
LiveInterval & createAndComputeVirtRegInterval (Register Reg)
LiveInterval & getOrCreateEmptyInterval (Register Reg)
Return an existing interval for Reg.
void removeInterval (Register Reg)
Interval removal.
LLVM_ABI LiveInterval::Segment addSegmentToEndOfBlock (Register Reg, MachineInstr &startInst)
Given a register and an instruction, adds a live segment from that instruction to the end of its MBB.
LLVM_ABI bool shrinkToUses (LiveInterval *li, SmallVectorImpl< MachineInstr * > *dead=nullptr)
After removing some uses of a register, shrink its live range to just the remaining uses.
LLVM_ABI void shrinkToUses (LiveInterval::SubRange &SR, Register 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.
LLVM_ABI void extendToIndices (LiveRange &LR, ArrayRef< SlotIndex > Indices, ArrayRef< SlotIndex > Undefs)
Extend the live range LR to reach all points in Indices.
void extendToIndices (LiveRange &LR, ArrayRef< SlotIndex > Indices)
LLVM_ABI 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.
void pruneValue (LiveInterval &, SlotIndex, SmallVectorImpl< SlotIndex > *)
This function should not be used.
SlotIndexes * getSlotIndexes () const
bool isNotInMIMap (const MachineInstr &Instr) const
Returns true if the specified machine instr has been removed or was never entered in the map.
SlotIndex getInstructionIndex (const MachineInstr &Instr) const
Returns the base index of the given instruction.
MachineInstr * getInstructionFromIndex (SlotIndex index) const
Returns the instruction associated with the given index.
SlotIndex getMBBStartIdx (const MachineBasicBlock *mbb) const
Return the first index in the given basic block.
SlotIndex getMBBEndIdx (const MachineBasicBlock *mbb) const
Return the last index in the given basic block.
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 ()
LLVM_ABI void print (raw_ostream &O) const
Implement the dump method.
LLVM_ABI void dump () const
void reanalyze (MachineFunction &MF)
MachineDominatorTree & getDomTree ()
LLVM_ABI MachineBasicBlock * intervalIsInOneMBB (const LiveInterval &LI) const
If LI is confined to a single basic block, return a pointer to that block.
LLVM_ABI bool hasPHIKill (const LiveInterval &LI, const VNInfo *VNI) const
Returns true if VNI is killed by any PHI-def values in LI.
LLVM_ABI void addKillFlags (const VirtRegMap *)
Add kill flags to any instruction that kills a virtual register.
LLVM_ABI void handleMove (MachineInstr &MI, bool UpdateFlags=false)
Call this method to notify LiveIntervals that instruction MI has been moved within a basic block.
LLVM_ABI void handleMoveIntoNewBundle (MachineInstr &BundleStart, bool UpdateFlags=false)
Update intervals of operands of all instructions in the newly created bundle specified by BundleStart.
LLVM_ABI void repairIntervalsInRange (MachineBasicBlock *MBB, MachineBasicBlock::iterator Begin, MachineBasicBlock::iterator End, ArrayRef< Register > OrigRegs)
Update live intervals for instructions in a range of iterators.
ArrayRef< SlotIndex > getRegMaskSlots () const
Returns a sorted array of slot indices of all instructions with register mask operands.
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.
ArrayRef< const uint32_t * > getRegMaskBits () const
Returns an array of register mask pointers corresponding to getRegMaskSlots().
ArrayRef< const uint32_t * > getRegMaskBitsInBlock (unsigned MBBNum) const
Returns an array of mask pointers corresponding to getRegMaskSlotsInBlock(MBBNum).
LLVM_ABI bool checkRegMaskInterference (const 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.
LiveRange & getRegUnit (MCRegUnit Unit)
Return the live range for register unit Unit.
LiveRange * getCachedRegUnit (MCRegUnit Unit)
Return the live range for register unit Unit if it has already been computed, or nullptr if it hasn't been computed yet.
const LiveRange * getCachedRegUnit (MCRegUnit Unit) const
void removeRegUnit (MCRegUnit Unit)
Remove computed live range for register unit Unit.
void removeAllRegUnitsForPhysReg (MCRegister Reg)
Remove associated live ranges for the register units associated with Reg.
LLVM_ABI void removePhysRegDefAt (MCRegister 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.
LLVM_ABI void removeVRegDefAt (LiveInterval &LI, SlotIndex Pos)
Remove value number and related live segments of LI and its subranges that start at position Pos.
LLVM_ABI void splitSeparateComponents (LiveInterval &LI, SmallVectorImpl< LiveInterval * > &SplitLIs)
Split separate components in LiveInterval LI into separate intervals.
LLVM_ABI void constructMainRangeFromSubranges (LiveInterval &LI)
For live interval LI with correct SubRanges construct matching information for the main live range.

Definition at line 55 of file LiveIntervals.h.

~LiveIntervals()

LiveIntervals::~LiveIntervals ( )

addKillFlags()

Add kill flags to any instruction that kills a virtual register.

Definition at line 728 of file LiveIntervals.cpp.

References llvm::LiveRange::advanceTo(), assert(), llvm::LiveRange::begin(), llvm::SmallVectorImpl< T >::clear(), llvm::LiveRange::empty(), llvm::LiveRange::end(), llvm::LiveRange::Segment::end, llvm::LiveRange::find(), llvm::LaneBitmask::getAll(), getInstructionFromIndex(), getInterval(), llvm::VirtRegMap::getPhys(), getRegUnit(), llvm::LiveInterval::hasSubRanges(), I, llvm::Register::index2VirtReg(), llvm::MCRegUnitMaskIterator::isValid(), MI, N, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::LiveRange::Segment::start, llvm::LiveInterval::subranges(), and SubReg.

addSegmentToEndOfBlock()

checkRegMaskInterference()

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 956 of file LiveIntervals.cpp.

References assert(), llvm::ArrayRef< T >::begin(), llvm::LiveRange::begin(), llvm::BitVector::clear(), llvm::BitVector::clearBitsNotInMask(), llvm::LiveRange::empty(), llvm::ArrayRef< T >::end(), llvm::LiveRange::end(), llvm::LiveRange::endIndex(), getInstructionFromIndex(), getRegMaskBits(), getRegMaskBitsInBlock(), getRegMaskSlots(), getRegMaskSlotsInBlock(), hasLiveThroughUse(), intervalIsInOneMBB(), llvm::lower_bound(), MBB, MI, llvm::LiveInterval::reg(), and llvm::BitVector::resize().

constructMainRangeFromSubranges()

void LiveIntervals::constructMainRangeFromSubranges ( LiveInterval & LI )

createAndComputeVirtRegInterval()

createEmptyInterval()

dump()

extendToIndices() [1/2]

extendToIndices() [2/2]

getCachedRegUnit() [1/2]

LiveRange * llvm::LiveIntervals::getCachedRegUnit ( MCRegUnit Unit) inline

getCachedRegUnit() [2/2]

const LiveRange * llvm::LiveIntervals::getCachedRegUnit ( MCRegUnit Unit) const inline

getDomTree()

getInstructionFromIndex()

getInstructionIndex()

Returns the base index of the given instruction.

Definition at line 247 of file LiveIntervals.h.

Referenced by addSegmentToEndOfBlock(), llvm::ScheduleDAGInstrs::buildSchedGraph(), llvm::X86InstrInfo::classifyLEAReg(), llvm::SIInstrInfo::convertToThreeAddress(), llvm::RegisterOperands::detectDeadDefs(), dumpMachineInstrRangeWithSlotIndex(), llvm::dumpMaxRegPressure(), findNextInsertLocation(), llvm::SIRegisterInfo::findReachingDef(), findUseBetween(), findUseBetween(), llvm::getLiveRegsAfter(), llvm::getLiveRegsBefore(), getVRegDef(), handleMoveIntoNewBundle(), hasSingleUse(), isDefBetween(), isDefBetween(), moveAndTeeForMultiUse(), moveForSingleUse(), oneUseDominatesOtherUses(), printRegion(), regJustKilledBefore(), rematerializeCheapDef(), repairIntervalsInRange(), replaceDominatedUses(), shrinkToUses(), and shrinkToUses().

getInterval() [1/2]

Definition at line 133 of file LiveIntervals.h.

References createAndComputeVirtRegInterval(), hasInterval(), and Reg.

Referenced by addKillFlags(), llvm::X86InstrInfo::classifyLEAReg(), llvm::RISCVInstrInfo::convertToThreeAddress(), llvm::SIInstrInfo::convertToThreeAddress(), llvm::X86InstrInfo::convertToThreeAddress(), llvm::dumpMaxRegPressure(), llvm::SIRegisterInfo::findReachingDef(), getInterval(), getLanesWithProperty(), getLanesWithProperty(), llvm::getLiveLaneMask(), getLiveRange(), llvm::getLiveRegMap(), getOrCreateEmptyInterval(), getVDefInterval(), getVRegDef(), handleMoveIntoNewBundle(), hasSingleUse(), isDefBetween(), isLocalCopy(), moveAndTeeForMultiUse(), moveForSingleUse(), oneUseDominatesOtherUses(), print(), regJustKilledBefore(), rematerializeCheapDef(), repairIntervalsInRange(), replaceDominatedUses(), llvm::HexagonRegisterInfo::shouldCoalesce(), and llvm::SystemZRegisterInfo::shouldCoalesce().

getInterval() [2/2]

getMBBEndIdx()

getMBBFromIndex()

getMBBStartIdx()

getOrCreateEmptyInterval()

getRegMaskBits()

getRegMaskBitsInBlock()

getRegMaskSlots()

getRegMaskSlotsInBlock()

getRegUnit()

LiveRange & llvm::LiveIntervals::getRegUnit ( MCRegUnit Unit) inline

getSlotIndexes()

SlotIndexes * llvm::LiveIntervals::getSlotIndexes ( ) const inline

getSpillWeight() [1/2]

getSpillWeight() [2/2]

getVNInfoAllocator()

handleMove()

handleMoveIntoNewBundle()

void LiveIntervals::handleMoveIntoNewBundle ( MachineInstr & BundleStart,
bool UpdateFlags = false )

Update intervals of operands of all instructions in the newly created bundle specified by BundleStart.

Parameters

UpdateFlags Update live intervals for nonallocatable physregs.

Assumes existing liveness is accurate.

Precondition

BundleStart should be the first instruction in the Bundle.

BundleStart should not have a have SlotIndex as one will be assigned.

Definition at line 1576 of file LiveIntervals.cpp.

References assert(), llvm::getBundleEnd(), getInstructionIndex(), getInterval(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::MachineInstr::getOpcode(), hasInterval(), I, llvm::LiveQueryResult::isDeadDef(), llvm::MachineInstr::operands(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::LiveRange::Query(), and llvm::LiveIntervals::HMEditor::updateAllRanges().

hasInterval()

bool llvm::LiveIntervals::hasInterval ( Register Reg) const inline

hasPHIKill()

InsertMachineInstrInMaps()

InsertMachineInstrRangeInMaps()

insertMBBInMaps()

intervalIsInOneMBB()

invalidate()

isLiveInToMBB()

isLiveOutOfMBB()

isNotInMIMap()

print()

pruneValue() [1/2]

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 232 of file LiveIntervals.h.

References llvm_unreachable.

pruneValue() [2/2]

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 663 of file LiveIntervals.cpp.

References llvm::df_ext_begin(), llvm::df_ext_end(), llvm::LiveQueryResult::endPoint(), I, MBB, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::LiveRange::Query(), llvm::LiveRange::removeSegment(), llvm::MachineBasicBlock::successors(), llvm::LiveQueryResult::valueIn(), and llvm::LiveQueryResult::valueOutOrDead().

reanalyze()

removeAllRegUnitsForPhysReg()

void llvm::LiveIntervals::removeAllRegUnitsForPhysReg ( MCRegister Reg) inline

removeInterval()

void llvm::LiveIntervals::removeInterval ( Register Reg) inline

RemoveMachineInstrFromMaps()

void llvm::LiveIntervals::RemoveMachineInstrFromMaps ( MachineInstr & MI) inline

removePhysRegDefAt()

removeRegUnit()

void llvm::LiveIntervals::removeRegUnit ( MCRegUnit Unit) inline

removeVRegDefAt()

repairIntervalsInRange()

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 changes that are supported are simple removal and addition of uses.

Definition at line 1701 of file LiveIntervals.cpp.

References createAndComputeVirtRegInterval(), llvm::erase(), getInstructionIndex(), getInterval(), getMBBEndIdx(), llvm::SlotIndex::getPrevSlot(), llvm::LiveRange::hasAtLeastOneValue(), hasInterval(), llvm::LiveInterval::hasSubRanges(), I, MBB, MI, llvm::none_of(), llvm::LiveInterval::removeEmptySubRanges(), removeInterval(), llvm::LiveInterval::subranges(), and SubReg.

ReplaceMachineInstrInMaps()

shrinkToUses() [1/2]

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 483 of file LiveIntervals.cpp.

References assert(), createSegmentsForValues(), llvm::dbgs(), getInstructionIndex(), llvm::LaneBitmask::getNone(), llvm::SlotIndex::getRegSlot(), llvm::Register::isVirtual(), LLVM_DEBUG, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::LiveRange::Query(), llvm::LiveInterval::reg(), llvm::LiveInterval::removeEmptySubRanges(), llvm::LiveRange::segments, shrinkToUses(), llvm::LiveInterval::subranges(), llvm::SmallVectorImpl< T >::swap(), UseMI, llvm::LiveQueryResult::valueDefined(), llvm::LiveQueryResult::valueIn(), and llvm::LiveRange::vnis().

Referenced by llvm::SIInstrInfo::convertToThreeAddress(), replaceDominatedUses(), shrinkToUses(), and shrinkToUses().

shrinkToUses() [2/2]

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 585 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::VNInfo::isPHIDef(), llvm::VNInfo::isUnused(), llvm::LiveInterval::SubRange::LaneMask, LLVM_DEBUG, llvm::VNInfo::markUnused(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::LiveRange::Query(), llvm::LiveRange::removeSegment(), llvm::LiveRange::segments, SubReg, llvm::SmallVectorImpl< T >::swap(), UseMI, llvm::LiveRange::valnos, llvm::LiveQueryResult::valueDefined(), llvm::LiveQueryResult::valueIn(), and llvm::LiveRange::vnis().

splitSeparateComponents()

Split separate components in LiveInterval LI into separate intervals.

Definition at line 1803 of file LiveIntervals.cpp.

References llvm::ConnectedVNInfoEqClasses::Classify(), createEmptyInterval(), llvm::SmallVectorTemplateCommon< T, typename >::data(), llvm::dbgs(), llvm::ConnectedVNInfoEqClasses::Distribute(), I, LLVM_DEBUG, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::LiveInterval::reg().

Referenced by shrinkToUses().

LiveIntervalsAnalysis

LiveIntervalsWrapperPass


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