LLVM 22.0.0git
llvm::LiveRange Class Reference

This class represents the liveness of a register, stack slot, etc. More...

#include "llvm/CodeGen/LiveInterval.h"

Inheritance diagram for llvm::LiveRange:
[legend]

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_iteratorvnis ()
iterator_range< const_vni_iteratorvnis () 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
LLVM_ABI 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
VNInfogetValNumInfo (unsigned ValNo)
 getValNumInfo - Returns pointer to the specified val#.
const VNInfogetValNumInfo (unsigned ValNo) const
bool containsValue (const VNInfo *VNI) const
 containsValue - Returns true if VNI belongs to this range.
VNInfogetNextValue (SlotIndex Def, VNInfo::Allocator &VNInfoAllocator)
 getNextValue - Create a new value number and return it.
LLVM_ABI VNInfocreateDeadDef (SlotIndex Def, VNInfo::Allocator &VNIAlloc)
 createDeadDef - Make sure the range has a value defined at Def.
LLVM_ABI VNInfocreateDeadDef (VNInfo *VNI)
 Create a def of value VNI.
VNInfocreateValueCopy (const VNInfo *orig, VNInfo::Allocator &VNInfoAllocator)
 Create a copy of the given value.
LLVM_ABI void RenumberValues ()
 RenumberValues - Renumber all values in order of appearance and remove unused values.
LLVM_ABI VNInfoMergeValueNumberInto (VNInfo *V1, VNInfo *V2)
 MergeValueNumberInto - This method is called when two value numbers are found to be equivalent.
LLVM_ABI 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.
LLVM_ABI 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 SegmentgetSegmentContaining (SlotIndex Idx) const
 Return the segment that contains the specified index, or null if there is none.
SegmentgetSegmentContaining (SlotIndex Idx)
 Return the live segment that contains the specified index, or null if there is none.
VNInfogetVNInfoAt (SlotIndex Idx) const
 getVNInfoAt - Return the VNInfo that is live at Idx, or NULL.
VNInfogetVNInfoBefore (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.
LLVM_ABI 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.
LLVM_ABI bool overlaps (SlotIndex Start, SlotIndex End) const
 overlaps - Return true if the live range overlaps an interval specified by [Start, End).
LLVM_ABI bool overlapsFrom (const LiveRange &Other, const_iterator StartPos) const
 overlapsFrom - Return true if the intersection of the two live ranges is not empty.
LLVM_ABI bool covers (const LiveRange &Other) const
 Returns true if all segments of the Other live range are completely covered by this live range.
LLVM_ABI iterator addSegment (Segment S)
 Add the specified Segment to this range, merging segments as appropriate.
LLVM_ABI std::pair< VNInfo *, boolextendInBlock (ArrayRef< SlotIndex > Undefs, SlotIndex StartIdx, SlotIndex Kill)
 Attempt to extend a value defined after StartIdx to include Use.
LLVM_ABI VNInfoextendInBlock (SlotIndex StartIdx, SlotIndex Kill)
 Simplified version of the above "extendInBlock", which assumes that no register lanes are undefined by <def,read-undef> operands.
LLVM_ABI 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.
LLVM_ABI void removeSegment (SlotIndex Start, SlotIndex End, bool RemoveDeadValNo=false)
 Remove the specified interval from this live range.
void removeSegment (Segment S, bool RemoveDeadValNo=false)
LLVM_ABI iterator removeSegment (iterator I, bool RemoveDeadValNo=false)
 Remove segment pointed to by iterator I from this range.
LLVM_ABI 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.
LLVM_ABI 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.
LLVM_ABI 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.
LLVM_ABI 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.
LLVM_ABI void print (raw_ostream &OS) const
LLVM_ABI 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< SegmentSetsegmentSet

Protected Member Functions

LLVM_ABI void append (const LiveRange::Segment S)
 Append a segment to the list of segments.

Friends

class LiveRangeUpdater

Detailed Description

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 158 of file LiveInterval.h.

Member Typedef Documentation

◆ const_iterator

◆ const_vni_iterator

◆ iterator

Definition at line 213 of file LiveInterval.h.

◆ Segments

Definition at line 201 of file LiveInterval.h.

◆ SegmentSet

Definition at line 210 of file LiveInterval.h.

◆ vni_iterator

◆ VNInfoList

Definition at line 202 of file LiveInterval.h.

Constructor & Destructor Documentation

◆ LiveRange() [1/2]

◆ LiveRange() [2/2]

llvm::LiveRange::LiveRange ( const LiveRange & Other,
BumpPtrAllocator & Allocator )
inline

Constructs a new LiveRange object by copying segments and valnos from another LiveRange.

Definition at line 246 of file LiveInterval.h.

References Allocator, assert(), assign(), LiveRange(), and llvm::Other.

Member Function Documentation

◆ addSegment()

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().

◆ advanceTo() [1/2]

const_iterator llvm::LiveRange::advanceTo ( const_iterator I,
SlotIndex Pos ) const
inline

Definition at line 280 of file LiveInterval.h.

References assert(), end(), endIndex(), and I.

◆ advanceTo() [2/2]

iterator llvm::LiveRange::advanceTo ( iterator I,
SlotIndex Pos )
inline

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 272 of file LiveInterval.h.

References assert(), end(), endIndex(), and I.

Referenced by llvm::LiveIntervals::addKillFlags(), llvm::SplitAnalysis::countLiveBlocks(), covers(), and isLiveAtIndexes().

◆ append()

void LiveRange::append ( const LiveRange::Segment S)
protected

Append a segment to the list of segments.

Definition at line 543 of file LiveInterval.cpp.

References assert(), segments, and llvm::LiveRange::Segment::start.

◆ assign()

void llvm::LiveRange::assign ( const LiveRange & Other,
BumpPtrAllocator & Allocator )
inline

Copies values numbers and live segments from Other into this range.

Definition at line 253 of file LiveInterval.h.

References Allocator, assert(), createValueCopy(), llvm::LiveRange::Segment::end, llvm::VNInfo::id, LiveRange(), llvm::Other, segments, llvm::LiveRange::Segment::start, llvm::LiveRange::Segment::valno, and valnos.

Referenced by LiveRange().

◆ begin() [1/2]

◆ begin() [2/2]

const_iterator llvm::LiveRange::begin ( ) const
inline

Definition at line 219 of file LiveInterval.h.

References segments.

◆ beginIndex()

SlotIndex llvm::LiveRange::beginIndex ( ) const
inline

beginIndex - Return the lowest numbered slot covered.

Definition at line 387 of file LiveInterval.h.

References assert(), empty(), and segments.

Referenced by llvm::LiveIntervals::intervalIsInOneMBB(), isLocal(), llvm::LiveInterval::operator<(), operator<(), and llvm::SystemZRegisterInfo::shouldCoalesce().

◆ clear()

◆ containsOneValue()

bool llvm::LiveRange::containsOneValue ( ) const
inline

Definition at line 312 of file LiveInterval.h.

References valnos.

◆ containsValue()

bool llvm::LiveRange::containsValue ( const VNInfo * VNI) const
inline

containsValue - Returns true if VNI belongs to this range.

Definition at line 326 of file LiveInterval.h.

References getNumValNums(), getValNumInfo(), and llvm::VNInfo::id.

◆ covers()

bool LiveRange::covers ( const LiveRange & Other) const

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, LiveRange(), and llvm::Other.

Referenced by llvm::LiveIntervals::HMEditor::updateAllRanges(), and llvm::LiveInterval::verify().

◆ createDeadDef() [1/2]

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().

◆ createDeadDef() [2/2]

VNInfo * LiveRange::createDeadDef ( VNInfo * VNI)

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.

◆ createValueCopy()

VNInfo * llvm::LiveRange::createValueCopy ( const VNInfo * orig,
VNInfo::Allocator & VNInfoAllocator )
inline

Create a copy of the given value.

The new value will be identical except for the Value number.

Definition at line 350 of file LiveInterval.h.

References valnos.

Referenced by assign().

◆ dump()

LLVM_DUMP_METHOD void LiveRange::dump ( ) const

Definition at line 1044 of file LiveInterval.cpp.

References llvm::dbgs(), and LLVM_DUMP_METHOD.

◆ empty()

◆ end() [1/2]

◆ end() [2/2]

const_iterator llvm::LiveRange::end ( ) const
inline

Definition at line 220 of file LiveInterval.h.

References segments.

◆ endIndex()

SlotIndex llvm::LiveRange::endIndex ( ) const
inline

endNumber - return the maximum point of the range of the whole, exclusive.

Definition at line 394 of file LiveInterval.h.

References assert(), empty(), and segments.

Referenced by advanceTo(), advanceTo(), llvm::LiveIntervals::checkRegMaskInterference(), expiredAt(), llvm::LiveIntervals::intervalIsInOneMBB(), isLocal(), and llvm::SystemZRegisterInfo::shouldCoalesce().

◆ expiredAt()

bool llvm::LiveRange::expiredAt ( SlotIndex index) const
inline

Definition at line 399 of file LiveInterval.h.

References endIndex().

Referenced by regJustKilledBefore().

◆ extendInBlock() [1/2]

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().

◆ extendInBlock() [2/2]

VNInfo * LiveRange::extendInBlock ( SlotIndex StartIdx,
SlotIndex Kill )

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.

◆ find() [1/2]

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 find(), llvm::partition_point(), and X.

Referenced by llvm::LiveIntervals::addKillFlags(), find(), find(), FindSegmentContaining(), FindSegmentContaining(), isLiveAtIndexes(), llvm::SplitAnalysis::isOriginalEndpoint(), liveAt(), overlaps(), Query(), removeSegment(), and llvm::LiveDebugVariables::LDVImpl::splitPHIRegister().

◆ find() [2/2]

const_iterator llvm::LiveRange::find ( SlotIndex Pos) const
inline

Definition at line 297 of file LiveInterval.h.

References find(), and LiveRange().

◆ findIndexesLiveAt()

template<typename Range, typename OutputIt>
bool llvm::LiveRange::findIndexesLiveAt ( Range && R,
OutputIt O ) const
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 631 of file LiveInterval.h.

References assert(), llvm::is_sorted(), Range, and segments.

◆ FindSegmentContaining() [1/2]

iterator llvm::LiveRange::FindSegmentContaining ( SlotIndex Idx)
inline

Return an iterator to the segment that contains the specified index, or end() if there is none.

Definition at line 438 of file LiveInterval.h.

References end(), find(), and I.

Referenced by getSegmentContaining(), getSegmentContaining(), getVNInfoAt(), getVNInfoBefore(), and moveAndTeeForMultiUse().

◆ FindSegmentContaining() [2/2]

const_iterator llvm::LiveRange::FindSegmentContaining ( SlotIndex Idx) const
inline

Definition at line 443 of file LiveInterval.h.

References end(), find(), and I.

◆ flushSegmentSet()

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 assert(), segments, segmentSet, and verify().

◆ getNextValue()

VNInfo * llvm::LiveRange::getNextValue ( SlotIndex Def,
VNInfo::Allocator & VNInfoAllocator )
inline

getNextValue - Create a new value number and return it.

Def is the index of instruction that defines the value number.

Definition at line 332 of file LiveInterval.h.

References valnos.

◆ getNumValNums()

unsigned llvm::LiveRange::getNumValNums ( ) const
inline

Definition at line 314 of file LiveInterval.h.

References valnos.

Referenced by llvm::ConnectedVNInfoEqClasses::Classify(), containsValue(), join(), and print().

◆ getSegmentContaining() [1/2]

Segment * llvm::LiveRange::getSegmentContaining ( SlotIndex Idx)
inline

Return the live segment that contains the specified index, or null if there is none.

Definition at line 417 of file LiveInterval.h.

References end(), FindSegmentContaining(), and I.

◆ getSegmentContaining() [2/2]

const Segment * llvm::LiveRange::getSegmentContaining ( SlotIndex Idx) const
inline

Return the segment that contains the specified index, or null if there is none.

Definition at line 410 of file LiveInterval.h.

References end(), FindSegmentContaining(), and I.

Referenced by llvm::X86InstrInfo::classifyLEAReg(), llvm::RISCVInstrInfo::convertToThreeAddress(), llvm::RegPressureTracker::getLiveThroughAt(), removeDeadSegment(), and llvm::LiveIntervals::shrinkToUses().

◆ getValNumInfo() [1/2]

VNInfo * llvm::LiveRange::getValNumInfo ( unsigned ValNo)
inline

getValNumInfo - Returns pointer to the specified val#.

Definition at line 318 of file LiveInterval.h.

References valnos.

Referenced by containsValue(), join(), and print().

◆ getValNumInfo() [2/2]

const VNInfo * llvm::LiveRange::getValNumInfo ( unsigned ValNo) const
inline

Definition at line 321 of file LiveInterval.h.

References valnos.

◆ getVNInfoAt()

◆ getVNInfoBefore()

VNInfo * llvm::LiveRange::getVNInfoBefore ( SlotIndex Idx) const
inline

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 431 of file LiveInterval.h.

References end(), FindSegmentContaining(), llvm::SlotIndex::getPrevSlot(), and I.

Referenced by llvm::ConnectedVNInfoEqClasses::Classify(), llvm::ScheduleDAGMILive::computeCyclicCriticalPath(), getVRegDef(), llvm::LiveIntervals::hasPHIKill(), oneUseDominatesOtherUses(), and llvm::ScheduleDAGMILive::updatePressureDiffs().

◆ hasAtLeastOneValue()

bool llvm::LiveRange::hasAtLeastOneValue ( ) const
inline

Definition at line 310 of file LiveInterval.h.

References valnos.

Referenced by llvm::LiveIntervals::repairIntervalsInRange().

◆ isLiveAtIndexes()

bool LiveRange::isLiveAtIndexes ( ArrayRef< SlotIndex > Slots) const

◆ isLocal()

bool llvm::LiveRange::isLocal ( SlotIndex Start,
SlotIndex End ) const
inline

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 521 of file LiveInterval.h.

References beginIndex(), endIndex(), and llvm::SlotIndex::getBoundaryIndex().

◆ isUndefIn()

bool llvm::LiveRange::isUndefIn ( ArrayRef< SlotIndex > Undefs,
SlotIndex Begin,
SlotIndex End ) const
inline

Returns true if there is an explicit "undef" between Begin End.

Definition at line 611 of file LiveInterval.h.

References llvm::any_of().

◆ isZeroLength()

bool llvm::LiveRange::isZeroLength ( SlotIndexes * Indexes) const
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 590 of file LiveInterval.h.

References llvm::SlotIndex::getBaseIndex(), llvm::SlotIndexes::getNextNonNullIndex(), and segments.

Referenced by llvm::VirtRegAuxInfo::weightCalcHelper().

◆ join()

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(), getNumValNums(), getValNumInfo(), I, llvm::VNInfo::id, LiveRange(), LiveRangeUpdater, llvm::Other, segments, llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::LiveRange::Segment::valno, valnos, and verify().

◆ liveAt()

◆ MergeSegmentsInAsValue()

void LiveRange::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.

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, LiveRange(), LiveRangeUpdater, and llvm::LiveRange::Segment::start.

◆ MergeValueInAsValue()

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, LiveRange(), LiveRangeUpdater, llvm::LiveRange::Segment::start, and llvm::LiveRange::Segment::valno.

◆ MergeValueNumberInto()

VNInfo * LiveRange::MergeValueNumberInto ( VNInfo * V1,
VNInfo * V2 )

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(), I, llvm::VNInfo::id, segments, and std::swap().

◆ operator<()

bool llvm::LiveRange::operator< ( const LiveRange & other) const
inline

Definition at line 603 of file LiveInterval.h.

References beginIndex(), and LiveRange().

◆ overlaps() [1/3]

bool llvm::LiveRange::overlaps ( const LiveRange & other) const
inline

overlaps - Return true if the intersection of the two live ranges is not empty.

Definition at line 450 of file LiveInterval.h.

References begin(), empty(), LiveRange(), and overlapsFrom().

◆ overlaps() [2/3]

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, LiveRange(), llvm::Other, and std::swap().

◆ overlaps() [3/3]

bool LiveRange::overlaps ( SlotIndex Start,
SlotIndex End ) const

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(), I, and llvm::lower_bound().

◆ overlapsFrom()

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(), LiveRange(), and std::swap().

Referenced by overlaps().

◆ print()

◆ Query()

◆ removeSegment() [1/3]

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 I, removeValNoIfDead(), and segments.

◆ removeSegment() [2/3]

void llvm::LiveRange::removeSegment ( Segment S,
bool RemoveDeadValNo = false )
inline

◆ removeSegment() [3/3]

void LiveRange::removeSegment ( SlotIndex Start,
SlotIndex End,
bool RemoveDeadValNo = false )

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(), find(), I, removeValNoIfDead(), and segments.

Referenced by moveForSingleUse(), llvm::LiveIntervals::pruneValue(), removeDeadSegment(), removeSegment(), llvm::LiveIntervals::shrinkToUses(), and llvm::MachineBasicBlock::SplitCriticalEdge().

◆ removeValNo()

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().

◆ removeValNoIfDead()

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(), and removeSegment().

◆ RenumberValues()

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::VNInfo::id, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::VNInfo::isUnused(), segments, and valnos.

Referenced by llvm::LiveRangeEdit::eliminateDeadDefs(), and llvm::SplitEditor::finish().

◆ size()

size_t llvm::LiveRange::size ( ) const
inline

Definition at line 306 of file LiveInterval.h.

References segments.

Referenced by llvm::TargetRegisterInfo::shouldRegionSplitForVirtReg().

◆ verify()

bool LiveRange::verify ( ) const
nodiscard

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, and valnos.

Referenced by flushSegmentSet(), join(), and llvm::LiveInterval::verify().

◆ vni_begin() [1/2]

vni_iterator llvm::LiveRange::vni_begin ( )
inline

Definition at line 225 of file LiveInterval.h.

References valnos.

Referenced by llvm::VirtRegAuxInfo::isRematerializable(), print(), vnis(), and vnis().

◆ vni_begin() [2/2]

const_vni_iterator llvm::LiveRange::vni_begin ( ) const
inline

Definition at line 228 of file LiveInterval.h.

References valnos.

◆ vni_end() [1/2]

vni_iterator llvm::LiveRange::vni_end ( )
inline

Definition at line 226 of file LiveInterval.h.

References valnos.

Referenced by llvm::VirtRegAuxInfo::isRematerializable(), print(), vnis(), and vnis().

◆ vni_end() [2/2]

const_vni_iterator llvm::LiveRange::vni_end ( ) const
inline

Definition at line 229 of file LiveInterval.h.

References valnos.

◆ vnis() [1/2]

iterator_range< vni_iterator > llvm::LiveRange::vnis ( )
inline

◆ vnis() [2/2]

iterator_range< const_vni_iterator > llvm::LiveRange::vnis ( ) const
inline

Definition at line 235 of file LiveInterval.h.

References llvm::make_range(), vni_begin(), and vni_end().

◆ LiveRangeUpdater

friend class LiveRangeUpdater
friend

Definition at line 678 of file LiveInterval.h.

References LiveRangeUpdater.

Referenced by join(), LiveRangeUpdater, MergeSegmentsInAsValue(), and MergeValueInAsValue().

Member Data Documentation

◆ segments

◆ segmentSet

std::unique_ptr<SegmentSet> llvm::LiveRange::segmentSet

◆ valnos


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