LLVM 20.0.0git
|
This class represents the liveness of a register, stack slot, etc. More...
#include "llvm/CodeGen/LiveInterval.h"
Classes | |
struct | Segment |
This represents a simple continuous liveness interval for a value. More... | |
Public Types | |
using | Segments = SmallVector< Segment, 2 > |
using | VNInfoList = SmallVector< VNInfo *, 2 > |
using | SegmentSet = std::set< Segment > |
using | iterator = Segments::iterator |
using | const_iterator = Segments::const_iterator |
using | vni_iterator = VNInfoList::iterator |
using | const_vni_iterator = VNInfoList::const_iterator |
Public Member Functions | |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
vni_iterator | vni_begin () |
vni_iterator | vni_end () |
const_vni_iterator | vni_begin () const |
const_vni_iterator | vni_end () const |
iterator_range< vni_iterator > | vnis () |
iterator_range< const_vni_iterator > | vnis () const |
LiveRange (bool UseSegmentSet=false) | |
Constructs a new LiveRange object. | |
LiveRange (const LiveRange &Other, BumpPtrAllocator &Allocator) | |
Constructs a new LiveRange object by copying segments and valnos from another LiveRange. | |
void | assign (const LiveRange &Other, BumpPtrAllocator &Allocator) |
Copies values numbers and live segments from Other into this range. | |
iterator | advanceTo (iterator I, SlotIndex Pos) |
advanceTo - Advance the specified iterator to point to the Segment containing the specified position, or end() if the position is past the end of the range. | |
const_iterator | advanceTo (const_iterator I, SlotIndex Pos) const |
iterator | find (SlotIndex Pos) |
find - Return an iterator pointing to the first segment that ends after Pos, or end(). | |
const_iterator | find (SlotIndex Pos) const |
void | clear () |
size_t | size () const |
bool | hasAtLeastOneValue () const |
bool | containsOneValue () const |
unsigned | getNumValNums () const |
VNInfo * | getValNumInfo (unsigned ValNo) |
getValNumInfo - Returns pointer to the specified val#. | |
const VNInfo * | getValNumInfo (unsigned ValNo) const |
bool | containsValue (const VNInfo *VNI) const |
containsValue - Returns true if VNI belongs to this range. | |
VNInfo * | getNextValue (SlotIndex Def, VNInfo::Allocator &VNInfoAllocator) |
getNextValue - Create a new value number and return it. | |
VNInfo * | createDeadDef (SlotIndex Def, VNInfo::Allocator &VNIAlloc) |
createDeadDef - Make sure the range has a value defined at Def. | |
VNInfo * | createDeadDef (VNInfo *VNI) |
Create a def of value VNI . | |
VNInfo * | createValueCopy (const VNInfo *orig, VNInfo::Allocator &VNInfoAllocator) |
Create a copy of the given value. | |
void | RenumberValues () |
RenumberValues - Renumber all values in order of appearance and remove unused values. | |
VNInfo * | MergeValueNumberInto (VNInfo *V1, VNInfo *V2) |
MergeValueNumberInto - This method is called when two value numbers are found to be equivalent. | |
void | MergeSegmentsInAsValue (const LiveRange &RHS, VNInfo *LHSValNo) |
Merge all of the live segments of a specific val# in RHS into this live range as the specified value number. | |
void | MergeValueInAsValue (const LiveRange &RHS, const VNInfo *RHSValNo, VNInfo *LHSValNo) |
MergeValueInAsValue - Merge all of the segments of a specific val# in RHS into this live range as the specified value number. | |
bool | empty () const |
SlotIndex | beginIndex () const |
beginIndex - Return the lowest numbered slot covered. | |
SlotIndex | endIndex () const |
endNumber - return the maximum point of the range of the whole, exclusive. | |
bool | expiredAt (SlotIndex index) const |
bool | liveAt (SlotIndex index) const |
const Segment * | getSegmentContaining (SlotIndex Idx) const |
Return the segment that contains the specified index, or null if there is none. | |
Segment * | getSegmentContaining (SlotIndex Idx) |
Return the live segment that contains the specified index, or null if there is none. | |
VNInfo * | getVNInfoAt (SlotIndex Idx) const |
getVNInfoAt - Return the VNInfo that is live at Idx, or NULL. | |
VNInfo * | getVNInfoBefore (SlotIndex Idx) const |
getVNInfoBefore - Return the VNInfo that is live up to but not necessarily including Idx, or NULL. | |
iterator | FindSegmentContaining (SlotIndex Idx) |
Return an iterator to the segment that contains the specified index, or end() if there is none. | |
const_iterator | FindSegmentContaining (SlotIndex Idx) const |
bool | overlaps (const LiveRange &other) const |
overlaps - Return true if the intersection of the two live ranges is not empty. | |
bool | overlaps (const LiveRange &Other, const CoalescerPair &CP, const SlotIndexes &) const |
overlaps - Return true if the two ranges have overlapping segments that are not coalescable according to CP. | |
bool | overlaps (SlotIndex Start, SlotIndex End) const |
overlaps - Return true if the live range overlaps an interval specified by [Start, End). | |
bool | overlapsFrom (const LiveRange &Other, const_iterator StartPos) const |
overlapsFrom - Return true if the intersection of the two live ranges is not empty. | |
bool | covers (const LiveRange &Other) const |
Returns true if all segments of the Other live range are completely covered by this live range. | |
iterator | addSegment (Segment S) |
Add the specified Segment to this range, merging segments as appropriate. | |
std::pair< VNInfo *, bool > | extendInBlock (ArrayRef< SlotIndex > Undefs, SlotIndex StartIdx, SlotIndex Kill) |
Attempt to extend a value defined after StartIdx to include Use . | |
VNInfo * | extendInBlock (SlotIndex StartIdx, SlotIndex Kill) |
Simplified version of the above "extendInBlock", which assumes that no register lanes are undefined by <def,read-undef> operands. | |
void | join (LiveRange &Other, const int *ValNoAssignments, const int *RHSValNoAssignments, SmallVectorImpl< VNInfo * > &NewVNInfo) |
join - Join two live ranges (this, and other) together. | |
bool | isLocal (SlotIndex Start, SlotIndex End) const |
True iff this segment is a single segment that lies between the specified boundaries, exclusively. | |
void | removeSegment (SlotIndex Start, SlotIndex End, bool RemoveDeadValNo=false) |
Remove the specified interval from this live range. | |
void | removeSegment (Segment S, bool RemoveDeadValNo=false) |
iterator | removeSegment (iterator I, bool RemoveDeadValNo=false) |
Remove segment pointed to by iterator I from this range. | |
void | removeValNoIfDead (VNInfo *ValNo) |
Mark ValNo for deletion if no segments in this range use it. | |
LiveQueryResult | Query (SlotIndex Idx) const |
Query Liveness at Idx. | |
void | removeValNo (VNInfo *ValNo) |
removeValNo - Remove all the segments defined by the specified value#. | |
bool | isZeroLength (SlotIndexes *Indexes) const |
Returns true if the live range is zero length, i.e. | |
bool | isLiveAtIndexes (ArrayRef< SlotIndex > Slots) const |
bool | operator< (const LiveRange &other) const |
bool | isUndefIn (ArrayRef< SlotIndex > Undefs, SlotIndex Begin, SlotIndex End) const |
Returns true if there is an explicit "undef" between Begin End . | |
void | flushSegmentSet () |
Flush segment set into the regular segment vector. | |
template<typename Range , typename OutputIt > | |
bool | findIndexesLiveAt (Range &&R, OutputIt O) const |
Stores indexes from the input index sequence R at which this LiveRange is live to the output O iterator. | |
void | print (raw_ostream &OS) const |
void | dump () const |
bool | verify () const |
Walk the range and assert if any invariants fail to hold. | |
Public Attributes | |
Segments | segments |
VNInfoList | valnos |
std::unique_ptr< SegmentSet > | segmentSet |
Protected Member Functions | |
void | append (const LiveRange::Segment S) |
Append a segment to the list of segments. | |
Friends | |
class | LiveRangeUpdater |
This class represents the liveness of a register, stack slot, etc.
It manages an ordered list of Segment objects. The Segments are organized in a static single assignment form: At places where a new value is defined or different values reach a CFG join a new segment with a new value number is used.
Definition at line 157 of file LiveInterval.h.
Definition at line 213 of file LiveInterval.h.
Definition at line 222 of file LiveInterval.h.
Definition at line 212 of file LiveInterval.h.
using llvm::LiveRange::Segments = SmallVector<Segment, 2> |
Definition at line 200 of file LiveInterval.h.
using llvm::LiveRange::SegmentSet = std::set<Segment> |
Definition at line 209 of file LiveInterval.h.
Definition at line 221 of file LiveInterval.h.
using llvm::LiveRange::VNInfoList = SmallVector<VNInfo *, 2> |
Definition at line 201 of file LiveInterval.h.
|
inline |
Constructs a new LiveRange object.
Definition at line 239 of file LiveInterval.h.
|
inline |
Constructs a new LiveRange object by copying segments and valnos from another LiveRange.
Definition at line 245 of file LiveInterval.h.
References Allocator, assert(), assign(), and llvm::Other.
LiveRange::iterator LiveRange::addSegment | ( | Segment | S | ) |
Add the specified Segment to this range, merging segments as appropriate.
This returns an iterator to the inserted segment (which may have grown since it was inserted).
Definition at line 533 of file LiveInterval.cpp.
References end(), and segmentSet.
Referenced by llvm::LiveRegMatrix::checkInterference(), llvm::LiveRegMatrix::checkInterferenceLanes(), createSegmentsForValues(), and llvm::MachineBasicBlock::SplitCriticalEdge().
|
inline |
Definition at line 279 of file LiveInterval.h.
References assert(), end(), endIndex(), and I.
advanceTo - Advance the specified iterator to point to the Segment containing the specified position, or end() if the position is past the end of the range.
If no Segment contains this position, but the position is in a hole, this method returns an iterator pointing to the Segment immediately after the hole.
Definition at line 271 of file LiveInterval.h.
References assert(), end(), endIndex(), and I.
Referenced by llvm::LiveIntervals::addKillFlags(), llvm::SplitAnalysis::countLiveBlocks(), covers(), and isLiveAtIndexes().
|
protected |
Append a segment to the list of segments.
Definition at line 543 of file LiveInterval.cpp.
References assert(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::SmallVectorBase< Size_T >::empty(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), segments, and llvm::LiveRange::Segment::start.
|
inline |
Copies values numbers and live segments from Other
into this range.
Definition at line 252 of file LiveInterval.h.
References Allocator, assert(), createValueCopy(), llvm::LiveRange::Segment::end, llvm::VNInfo::id, llvm::Other, llvm::SmallVectorTemplateBase< T, bool >::push_back(), segments, llvm::LiveRange::Segment::start, llvm::LiveRange::Segment::valno, and valnos.
Referenced by LiveRange().
|
inline |
Definition at line 215 of file LiveInterval.h.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), and segments.
Referenced by llvm::LiveRangeUpdater::add(), llvm::LiveIntervals::addKillFlags(), llvm::LiveIntervals::checkRegMaskInterference(), llvm::SplitAnalysis::countLiveBlocks(), covers(), llvm::LiveRangeUpdater::flush(), llvm::SplitAnalysis::isOriginalEndpoint(), join(), MergeValueNumberInto(), overlaps(), overlapsFrom(), llvm::LiveRangeUpdater::print(), and verify().
|
inline |
Definition at line 218 of file LiveInterval.h.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), and segments.
|
inline |
beginIndex - Return the lowest numbered slot covered.
Definition at line 385 of file LiveInterval.h.
References assert(), empty(), llvm::SmallVectorTemplateCommon< T, typename >::front(), and segments.
Referenced by llvm::LiveIntervals::intervalIsInOneMBB(), isLocal(), llvm::LiveInterval::operator<(), operator<(), and llvm::SystemZRegisterInfo::shouldCoalesce().
|
inline |
Definition at line 300 of file LiveInterval.h.
References llvm::SmallVectorImpl< T >::clear(), segments, and valnos.
Referenced by llvm::LiveIntervalCalc::calculate(), and llvm::LiveIntervals::HMEditor::updateAllRanges().
|
inline |
Definition at line 311 of file LiveInterval.h.
References llvm::SmallVectorBase< Size_T >::size(), and valnos.
containsValue - Returns true if VNI belongs to this range.
Definition at line 325 of file LiveInterval.h.
References getNumValNums(), getValNumInfo(), and llvm::VNInfo::id.
Returns true if all segments of the Other
live range are completely covered by this live range.
Adjacent live ranges do not affect the covering:the liverange [1,5](5,10] covers (3,7].
Definition at line 479 of file LiveInterval.cpp.
References advanceTo(), begin(), empty(), end(), I, llvm::Last, and llvm::Other.
Referenced by llvm::LiveIntervals::HMEditor::updateAllRanges(), and llvm::LiveInterval::verify().
VNInfo * LiveRange::createDeadDef | ( | SlotIndex | Def, |
VNInfo::Allocator & | VNIAlloc | ||
) |
createDeadDef - Make sure the range has a value defined at Def.
If one already exists, return it. Otherwise allocate a new value and add liveness for a dead def.
Definition at line 355 of file LiveInterval.cpp.
References segmentSet.
Referenced by llvm::LiveIntervalCalc::constructMainRangeFromSubranges(), createDeadDef(), and llvm::SystemZInstrInfo::foldMemoryOperandImpl().
Create a def of value VNI
.
Return VNI
. If there already exists a definition at VNI->def, the value defined there must be VNI
.
Definition at line 363 of file LiveInterval.cpp.
References llvm::VNInfo::def, and segmentSet.
|
inline |
Create a copy of the given value.
The new value will be identical except for the Value number.
Definition at line 349 of file LiveInterval.h.
References llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorBase< Size_T >::size(), and valnos.
Referenced by assign().
LLVM_DUMP_METHOD void LiveRange::dump | ( | ) | const |
Definition at line 1044 of file LiveInterval.cpp.
References llvm::dbgs().
|
inline |
Definition at line 382 of file LiveInterval.h.
References llvm::SmallVectorBase< Size_T >::empty(), and segments.
Referenced by llvm::LiveIntervals::addKillFlags(), llvm::RegAllocBase::allocatePhysRegs(), beginIndex(), llvm::LiveIntervalCalc::calculate(), llvm::LiveRegMatrix::checkInterference(), llvm::LiveIntervals::checkRegMaskInterference(), llvm::LiveRegMatrix::checkRegUnitInterference(), llvm::SplitAnalysis::countLiveBlocks(), covers(), endIndex(), llvm::LiveIntervals::intervalIsInOneMBB(), llvm::SplitAnalysis::isOriginalEndpoint(), join(), overlaps(), overlapsFrom(), print(), and removeValNo().
|
inline |
Definition at line 216 of file LiveInterval.h.
References llvm::SmallVectorTemplateCommon< T, typename >::end(), and segments.
Referenced by llvm::LiveRangeUpdater::add(), llvm::LiveIntervals::addKillFlags(), addSegment(), advanceTo(), llvm::LiveIntervals::checkRegMaskInterference(), llvm::SplitAnalysis::countLiveBlocks(), covers(), FindSegmentContaining(), getSegmentContaining(), getVNInfoAt(), getVNInfoBefore(), isLiveAtIndexes(), llvm::SplitAnalysis::isOriginalEndpoint(), join(), liveAt(), MergeValueNumberInto(), overlaps(), overlapsFrom(), llvm::LiveRangeUpdater::print(), Query(), removeSegment(), llvm::LiveDebugVariables::LDVImpl::splitPHIRegister(), and verify().
|
inline |
Definition at line 219 of file LiveInterval.h.
References llvm::SmallVectorTemplateCommon< T, typename >::end(), and segments.
|
inline |
endNumber - return the maximum point of the range of the whole, exclusive.
Definition at line 392 of file LiveInterval.h.
References assert(), llvm::SmallVectorTemplateCommon< T, typename >::back(), empty(), and segments.
Referenced by advanceTo(), llvm::LiveIntervals::checkRegMaskInterference(), expiredAt(), llvm::LiveIntervals::intervalIsInOneMBB(), isLocal(), and llvm::SystemZRegisterInfo::shouldCoalesce().
Definition at line 397 of file LiveInterval.h.
References endIndex().
Referenced by regJustKilledBefore().
std::pair< VNInfo *, bool > LiveRange::extendInBlock | ( | ArrayRef< SlotIndex > | Undefs, |
SlotIndex | StartIdx, | ||
SlotIndex | Kill | ||
) |
Attempt to extend a value defined after StartIdx
to include Use
.
Both StartIdx
and Use
should be in the same basic block. In case of subranges, an extension could be prevented by an explicit "undef" caused by a <def,read-undef> on a non-overlapping lane. The list of location of such "undefs" should be provided in Undefs
. The return value is a pair: the first element is VNInfo of the value that was extended (possibly nullptr), the second is a boolean value indicating whether an "undef" was encountered. If this range is live before Use
in the basic block that starts at StartIdx
, and there is no intervening "undef", extend it to be live up to Use
, and return the pair {value, false}. If there is no segment before Use
and there is no "undef" between StartIdx
and Use
, return {nullptr, false}. If there is an "undef" before Use
, return {nullptr, true}.
Definition at line 549 of file LiveInterval.cpp.
References segmentSet.
Referenced by llvm::LiveRangeCalc::extend().
Simplified version of the above "extendInBlock", which assumes that no register lanes are undefined by <def,read-undef> operands.
If this range is live before Use
in the basic block that starts at StartIdx
, extend it to be live up to Use
, and return the value. If there is no segment before Use
, return nullptr.
Definition at line 558 of file LiveInterval.cpp.
References segmentSet.
LiveRange::iterator LiveRange::find | ( | SlotIndex | Pos | ) |
find - Return an iterator pointing to the first segment that ends after Pos, or end().
This is the same as advanceTo(begin(), Pos), but faster when searching large ranges.
If Pos is contained in a Segment, that segment is returned. If Pos is in a hole, the following Segment is returned. If Pos is beyond endIndex, end() is returned.
Definition at line 350 of file LiveInterval.cpp.
References llvm::partition_point(), and X.
Referenced by llvm::LiveRangeUpdater::add(), llvm::LiveIntervals::addKillFlags(), llvm::SIInstrInfo::convertToThreeAddress(), find(), FindSegmentContaining(), isLiveAtIndexes(), llvm::SplitAnalysis::isOriginalEndpoint(), liveAt(), overlaps(), Query(), removeSegment(), and llvm::LiveDebugVariables::LDVImpl::splitPHIRegister().
|
inline |
Definition at line 296 of file LiveInterval.h.
References find().
|
inline |
Stores indexes from the input index sequence R at which this LiveRange is live to the output O iterator.
R is a range of ascending sorted random access iterators to the input indexes. Indexes stored at O are ascending sorted so it can be used directly in the subsequent search (for example for subranges). Returns true if found at least one index.
Definition at line 628 of file LiveInterval.h.
References assert(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorTemplateCommon< T, typename >::end(), Idx, llvm::is_sorted(), and segments.
Return an iterator to the segment that contains the specified index, or end() if there is none.
Definition at line 436 of file LiveInterval.h.
References end(), find(), I, and Idx.
Referenced by getSegmentContaining(), getVNInfoAt(), getVNInfoBefore(), and moveAndTeeForMultiUse().
|
inline |
void LiveRange::flushSegmentSet | ( | ) |
Flush segment set into the regular segment vector.
The method is to be called after the live range has been created, if use of the segment set was activated in the constructor of the live range.
Definition at line 793 of file LiveInterval.cpp.
References llvm::SmallVectorImpl< T >::append(), assert(), llvm::SmallVectorBase< Size_T >::empty(), segments, segmentSet, and verify().
|
inline |
getNextValue - Create a new value number and return it.
Def
is the index of instruction that defines the value number.
Definition at line 331 of file LiveInterval.h.
References llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorBase< Size_T >::size(), and valnos.
|
inline |
Definition at line 313 of file LiveInterval.h.
References llvm::SmallVectorBase< Size_T >::size(), and valnos.
Referenced by llvm::ConnectedVNInfoEqClasses::Classify(), containsValue(), join(), and print().
Return the live segment that contains the specified index, or null if there is none.
Definition at line 415 of file LiveInterval.h.
References end(), FindSegmentContaining(), I, and Idx.
Return the segment that contains the specified index, or null if there is none.
Definition at line 408 of file LiveInterval.h.
References end(), FindSegmentContaining(), I, and Idx.
Referenced by llvm::X86InstrInfo::classifyLEAReg(), llvm::RISCVInstrInfo::convertToThreeAddress(), llvm::RegPressureTracker::getLiveThroughAt(), removeDeadSegment(), and llvm::LiveIntervals::shrinkToUses().
getValNumInfo - Returns pointer to the specified val#.
Definition at line 317 of file LiveInterval.h.
References valnos.
Referenced by containsValue(), join(), and print().
Definition at line 320 of file LiveInterval.h.
References valnos.
getVNInfoAt - Return the VNInfo that is live at Idx, or NULL.
Definition at line 421 of file LiveInterval.h.
References end(), FindSegmentContaining(), I, and Idx.
Referenced by llvm::LiveRangeEdit::allUsesAvailableAt(), llvm::ConnectedVNInfoEqClasses::Distribute(), llvm::SplitEditor::enterIntvAfter(), llvm::SplitEditor::enterIntvAtEnd(), llvm::SplitEditor::enterIntvBefore(), llvm::SIRegisterInfo::findReachingDef(), hasOneNonDBGUse(), llvm::SplitEditor::leaveIntvAfter(), llvm::SplitEditor::leaveIntvAtTop(), llvm::SplitEditor::leaveIntvBefore(), moveAndTeeForMultiUse(), llvm::SplitEditor::overlapIntv(), llvm::LiveIntervals::removePhysRegDefAt(), llvm::LiveIntervals::removeVRegDefAt(), replaceDominatedUses(), and llvm::MachineBasicBlock::SplitCriticalEdge().
getVNInfoBefore - Return the VNInfo that is live up to but not necessarily including Idx, or NULL.
Use this to find the reaching def used by an instruction at this SlotIndex position.
Definition at line 429 of file LiveInterval.h.
References end(), FindSegmentContaining(), I, and Idx.
Referenced by llvm::ConnectedVNInfoEqClasses::Classify(), llvm::ScheduleDAGMILive::computeCyclicCriticalPath(), getVRegDef(), llvm::LiveIntervals::hasPHIKill(), oneUseDominatesOtherUses(), llvm::SplitEditor::overlapIntv(), and llvm::ScheduleDAGMILive::updatePressureDiffs().
|
inline |
Definition at line 309 of file LiveInterval.h.
References llvm::SmallVectorBase< Size_T >::empty(), and valnos.
Referenced by llvm::LiveIntervals::repairIntervalsInRange().
Definition at line 803 of file LiveInterval.cpp.
References advanceTo(), llvm::ArrayRef< T >::begin(), end(), llvm::ArrayRef< T >::end(), and find().
Referenced by llvm::VirtRegAuxInfo::weightCalcHelper().
True iff this segment is a single segment that lies between the specified boundaries, exclusively.
Vregs live across a backedge are not considered local. The boundaries are expected to lie within an extended basic block, so vregs that are not live out should contain no holes.
Definition at line 518 of file LiveInterval.h.
References beginIndex(), End, and endIndex().
|
inline |
Returns true if there is an explicit "undef" between Begin
End
.
Definition at line 608 of file LiveInterval.h.
References llvm::any_of(), End, and Idx.
|
inline |
Returns true if the live range is zero length, i.e.
no live segments span instructions. It doesn't pay to spill such a range.
Definition at line 587 of file LiveInterval.h.
References llvm::SlotIndex::getBaseIndex(), llvm::SlotIndexes::getNextNonNullIndex(), and segments.
Referenced by llvm::VirtRegAuxInfo::weightCalcHelper().
void LiveRange::join | ( | LiveRange & | Other, |
const int * | ValNoAssignments, | ||
const int * | RHSValNoAssignments, | ||
SmallVectorImpl< VNInfo * > & | NewVNInfo | ||
) |
join - Join two live ranges (this, and other) together.
This applies mappings to the value numbers in the LHS/RHS ranges as specified. If the ranges are not joinable, this aborts.
Definition at line 629 of file LiveInterval.cpp.
References llvm::LiveRangeUpdater::add(), assert(), begin(), empty(), end(), llvm::SmallVectorImpl< T >::erase(), getNumValNums(), getValNumInfo(), I, llvm::VNInfo::id, llvm::Other, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorImpl< T >::resize(), segments, llvm::SmallVectorBase< Size_T >::size(), llvm::LiveRange::Segment::valno, valnos, and verify().
Definition at line 401 of file LiveInterval.h.
Referenced by llvm::GCNDownwardRPTracker::advanceBeforeNext(), llvm::SystemZInstrInfo::foldMemoryOperandImpl(), llvm::getLiveLaneMask(), getLiveLanesAt(), llvm::RegPressureTracker::getLiveLanesAt(), llvm::LiveIntervals::isLiveInToMBB(), llvm::LiveIntervals::isLiveOutOfMBB(), rematerializeCheapDef(), replaceDominatedUses(), llvm::MachineBasicBlock::SplitCriticalEdge(), and subRangeLiveAt().
Merge all of the live segments of a specific val# in RHS into this live range as the specified value number.
Merge all of the segments in RHS into this live range as the specified value number.
The segments in RHS are allowed to overlap with segments in the current range, it will replace the value numbers of the overlaped live segments with the specified value number.
The segments in RHS are allowed to overlap with segments in the current range, but only if the overlapping segments have the specified value number.
Definition at line 713 of file LiveInterval.cpp.
References llvm::LiveRangeUpdater::add(), llvm::LiveRange::Segment::end, RHS, and llvm::LiveRange::Segment::start.
void LiveRange::MergeValueInAsValue | ( | const LiveRange & | RHS, |
const VNInfo * | RHSValNo, | ||
VNInfo * | LHSValNo | ||
) |
MergeValueInAsValue - Merge all of the segments of a specific val# in RHS into this live range as the specified value number.
MergeValueInAsValue - Merge all of the live segments of a specific val# in RHS into this live range as the specified value number.
The segments in RHS are allowed to overlap with segments in the current range, but only if the overlapping segments have the specified value number.
The segments in RHS are allowed to overlap with segments in the current range, it will replace the value numbers of the overlaped segments with the specified value number.
Definition at line 725 of file LiveInterval.cpp.
References llvm::LiveRangeUpdater::add(), llvm::LiveRange::Segment::end, RHS, llvm::LiveRange::Segment::start, and llvm::LiveRange::Segment::valno.
MergeValueNumberInto - This method is called when two value numbers are found to be equivalent.
MergeValueNumberInto - This method is called when two value nubmers are found to be equivalent.
This eliminates V1, replacing all segments with the V1 value number with the V2 value number. This can cause merging of V1/V2 values numbers and compaction of the value space.
Definition at line 738 of file LiveInterval.cpp.
References assert(), begin(), llvm::VNInfo::copyFrom(), end(), llvm::SmallVectorImpl< T >::erase(), I, llvm::VNInfo::id, segments, and std::swap().
Definition at line 600 of file LiveInterval.h.
References beginIndex().
overlaps - Return true if the intersection of the two live ranges is not empty.
Definition at line 448 of file LiveInterval.h.
References begin(), empty(), and overlapsFrom().
bool LiveRange::overlaps | ( | const LiveRange & | Other, |
const CoalescerPair & | CP, | ||
const SlotIndexes & | Indexes | ||
) | const |
overlaps - Return true if the two ranges have overlapping segments that are not coalescable according to CP.
Overlapping segments where one range is defined by a coalescable copy are allowed.
Definition at line 430 of file LiveInterval.cpp.
References assert(), empty(), end(), find(), llvm::SlotIndexes::getInstructionFromIndex(), I, llvm::Other, and std::swap().
overlaps - Return true if the live range overlaps an interval specified by [Start, End).
Definition at line 473 of file LiveInterval.cpp.
References assert(), begin(), end(), End, I, and llvm::lower_bound().
bool LiveRange::overlapsFrom | ( | const LiveRange & | Other, |
const_iterator | StartPos | ||
) | const |
overlapsFrom - Return true if the intersection of the two live ranges is not empty.
The specified iterator is a hint that we can begin scanning the Other range starting at I.
Definition at line 389 of file LiveInterval.cpp.
References assert(), begin(), empty(), end(), and std::swap().
Referenced by overlaps().
void LiveRange::print | ( | raw_ostream & | OS | ) | const |
Definition at line 999 of file LiveInterval.cpp.
References assert(), llvm::VNInfo::def, empty(), getNumValNums(), getValNumInfo(), llvm::VNInfo::isPHIDef(), llvm::VNInfo::isUnused(), OS, segments, vni_begin(), and vni_end().
Referenced by llvm::LiveRangeUpdater::dump(), and llvm::operator<<().
|
inline |
Query Liveness at Idx.
The sub-instruction slot of Idx doesn't matter, only the instruction it refers to is considered.
Definition at line 542 of file LiveInterval.h.
References llvm::VNInfo::def, E, end(), find(), I, Idx, llvm::SlotIndex::isEarlierInstr(), and llvm::SlotIndex::isSameInstr().
Referenced by llvm::ScheduleDAGMILive::computeCyclicCriticalPath(), llvm::RegisterOperands::detectDeadDefs(), llvm::ConnectedVNInfoEqClasses::Distribute(), llvm::LiveIntervals::handleMoveIntoNewBundle(), hasOneNonDBGUse(), isDefBetween(), isDefInSubRange(), llvm::VirtRegAuxInfo::isRematerializable(), llvm::LiveIntervals::pruneValue(), llvm::LiveIntervals::shrinkToUses(), and llvm::ScheduleDAGMILive::updatePressureDiffs().
LiveRange::iterator LiveRange::removeSegment | ( | iterator | I, |
bool | RemoveDeadValNo = false |
||
) |
Remove segment pointed to by iterator I
from this range.
Definition at line 606 of file LiveInterval.cpp.
References llvm::SmallVectorImpl< T >::erase(), I, removeValNoIfDead(), and segments.
Definition at line 529 of file LiveInterval.h.
References llvm::LiveRange::Segment::end, removeSegment(), and llvm::LiveRange::Segment::start.
Remove the specified interval from this live range.
Does nothing if interval is not part of this live range. Note that the interval must be within a single Segment in its entirety.
Definition at line 566 of file LiveInterval.cpp.
References assert(), end(), End, llvm::SmallVectorImpl< T >::erase(), find(), I, llvm::SmallVectorImpl< T >::insert(), removeValNoIfDead(), and segments.
Referenced by moveForSingleUse(), llvm::LiveIntervals::pruneValue(), removeDeadSegment(), removeSegment(), llvm::LiveIntervals::shrinkToUses(), and llvm::MachineBasicBlock::SplitCriticalEdge().
void LiveRange::removeValNo | ( | VNInfo * | ValNo | ) |
removeValNo - Remove all the segments defined by the specified value#.
Also remove the value# from value# list.
Definition at line 621 of file LiveInterval.cpp.
References empty(), llvm::erase_if(), segments, and llvm::LiveRange::Segment::valno.
Referenced by llvm::LiveIntervals::removePhysRegDefAt(), llvm::LiveIntervals::removeVRegDefAt(), and stripValuesNotDefiningMask().
void LiveRange::removeValNoIfDead | ( | VNInfo * | ValNo | ) |
Mark ValNo
for deletion if no segments in this range use it.
Definition at line 614 of file LiveInterval.cpp.
References llvm::none_of(), and llvm::LiveRange::Segment::valno.
Referenced by removeSegment().
void LiveRange::RenumberValues | ( | ) |
RenumberValues - Renumber all values in order of appearance and remove unused values.
RenumberValues - Renumber all values in order of appearance and delete the remaining unused values.
Definition at line 516 of file LiveInterval.cpp.
References assert(), llvm::SmallVectorImpl< T >::clear(), llvm::VNInfo::id, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::VNInfo::isUnused(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), segments, llvm::SmallVectorBase< Size_T >::size(), and valnos.
Referenced by llvm::LiveRangeEdit::eliminateDeadDefs(), and llvm::SplitEditor::finish().
|
inline |
Definition at line 305 of file LiveInterval.h.
References segments, and llvm::SmallVectorBase< Size_T >::size().
Referenced by llvm::TargetRegisterInfo::shouldRegionSplitForVirtReg().
bool LiveRange::verify | ( | ) | const |
Walk the range and assert if any invariants fail to hold.
Note that this is a no-op when asserts are disabled.
Definition at line 1058 of file LiveInterval.cpp.
References begin(), end(), I, llvm::SmallVectorBase< Size_T >::size(), and valnos.
Referenced by llvm::LiveRangeUpdater::flush(), flushSegmentSet(), and join().
|
inline |
Definition at line 224 of file LiveInterval.h.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), and valnos.
Referenced by llvm::VirtRegAuxInfo::isRematerializable(), print(), and vnis().
|
inline |
Definition at line 227 of file LiveInterval.h.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), and valnos.
|
inline |
Definition at line 225 of file LiveInterval.h.
References llvm::SmallVectorTemplateCommon< T, typename >::end(), and valnos.
Referenced by llvm::VirtRegAuxInfo::isRematerializable(), print(), and vnis().
|
inline |
Definition at line 228 of file LiveInterval.h.
References llvm::SmallVectorTemplateCommon< T, typename >::end(), and valnos.
|
inline |
Definition at line 230 of file LiveInterval.h.
References llvm::make_range(), vni_begin(), and vni_end().
Referenced by llvm::LiveIntervals::shrinkToUses().
|
inline |
Definition at line 234 of file LiveInterval.h.
References llvm::make_range(), vni_begin(), and vni_end().
|
friend |
Definition at line 675 of file LiveInterval.h.
Segments llvm::LiveRange::segments |
Definition at line 203 of file LiveInterval.h.
Referenced by llvm::LiveRangeUpdater::add(), append(), assign(), begin(), beginIndex(), clear(), llvm::LiveIntervalCalc::constructMainRangeFromSubranges(), empty(), end(), endIndex(), findIndexesLiveAt(), llvm::LiveRangeUpdater::flush(), flushSegmentSet(), llvm::LiveInterval::getSize(), isZeroLength(), join(), MergeValueNumberInto(), print(), removeSegment(), removeValNo(), RenumberValues(), llvm::LiveIntervals::shrinkToUses(), and size().
std::unique_ptr<SegmentSet> llvm::LiveRange::segmentSet |
Definition at line 210 of file LiveInterval.h.
Referenced by llvm::LiveRangeUpdater::add(), addSegment(), createDeadDef(), extendInBlock(), and flushSegmentSet().
VNInfoList llvm::LiveRange::valnos |
Definition at line 204 of file LiveInterval.h.
Referenced by assign(), llvm::ConnectedVNInfoEqClasses::Classify(), clear(), llvm::LiveIntervalCalc::constructMainRangeFromSubranges(), containsOneValue(), createValueCopy(), getNextValue(), getNumValNums(), getValNumInfo(), hasAtLeastOneValue(), llvm::LiveIntervals::hasPHIKill(), join(), RenumberValues(), llvm::LiveIntervals::shrinkToUses(), stripValuesNotDefiningMask(), verify(), vni_begin(), and vni_end().