37#include "llvm/Config/llvm-config.h"
66template <
typename ImplT,
typename IteratorT,
typename CollectionT>
67class CalcLiveRangeUtilBase {
72 CalcLiveRangeUtilBase(
LiveRange *LR) : LR(LR) {}
75 using Segment = LiveRange::Segment;
91 assert(!
Def.isDead() &&
"Cannot define a value at the dead slot");
93 "If ForVNI is specified, it must match Def");
94 iterator
I =
impl().find(Def);
95 if (
I == segments().
end()) {
96 VNInfo *VNI = ForVNI ? ForVNI : LR->getNextValue(Def, *VNInfoAllocator);
97 impl().insertAtEnd(Segment(Def,
Def.getDeadSlot(), VNI));
101 Segment *S = segmentAt(
I);
103 assert((!ForVNI || ForVNI == S->valno) &&
"Value number mismatch");
104 assert(S->valno->def == S->start &&
"Inconsistent existing value def");
111 Def = std::min(Def, S->start);
113 S->start = S->valno->def =
Def;
117 VNInfo *VNI = ForVNI ? ForVNI : LR->getNextValue(Def, *VNInfoAllocator);
118 segments().insert(
I, Segment(Def,
Def.getDeadSlot(), VNI));
122 VNInfo *extendInBlock(SlotIndex StartIdx, SlotIndex Use) {
123 if (segments().
empty())
126 impl().findInsertPos(Segment(
Use.getPrevSlot(), Use,
nullptr));
127 if (
I == segments().
begin())
130 if (
I->end <= StartIdx)
133 extendSegmentEndTo(
I, Use);
138 SlotIndex StartIdx, SlotIndex Use) {
139 if (segments().
empty())
140 return std::make_pair(
nullptr,
false);
141 SlotIndex BeforeUse =
Use.getPrevSlot();
142 iterator
I =
impl().findInsertPos(Segment(BeforeUse, Use,
nullptr));
143 if (
I == segments().
begin())
144 return std::make_pair(
nullptr, LR->isUndefIn(Undefs, StartIdx, BeforeUse));
146 if (
I->end <= StartIdx)
147 return std::make_pair(
nullptr, LR->isUndefIn(Undefs, StartIdx, BeforeUse));
149 if (LR->isUndefIn(Undefs,
I->end, BeforeUse))
150 return std::make_pair(
nullptr,
true);
151 extendSegmentEndTo(
I, Use);
153 return std::make_pair(
I->valno,
false);
160 void extendSegmentEndTo(iterator
I, SlotIndex NewEnd) {
161 assert(
I != segments().
end() &&
"Not a valid segment!");
162 Segment *S = segmentAt(
I);
163 VNInfo *ValNo =
I->valno;
166 iterator MergeTo = std::next(
I);
167 for (; MergeTo != segments().end() && NewEnd >= MergeTo->end; ++MergeTo)
168 assert(MergeTo->valno == ValNo &&
"Cannot merge with differing values!");
171 S->end = std::max(NewEnd, std::prev(MergeTo)->end);
175 if (MergeTo != segments().
end() && MergeTo->start <=
I->end &&
176 MergeTo->valno == ValNo) {
177 S->end = MergeTo->end;
182 segments().erase(std::next(
I), MergeTo);
188 iterator extendSegmentStartTo(iterator
I, SlotIndex NewStart) {
189 assert(
I != segments().
end() &&
"Not a valid segment!");
190 Segment *S = segmentAt(
I);
191 VNInfo *ValNo =
I->valno;
194 iterator MergeTo =
I;
196 if (MergeTo == segments().
begin()) {
198 segments().erase(MergeTo,
I);
201 assert(MergeTo->valno == ValNo &&
"Cannot merge with differing values!");
203 }
while (NewStart <= MergeTo->start);
207 if (MergeTo->end >= NewStart && MergeTo->valno == ValNo) {
208 segmentAt(MergeTo)->end = S->end;
212 Segment *MergeToSeg = segmentAt(MergeTo);
213 MergeToSeg->start = NewStart;
214 MergeToSeg->end = S->end;
217 segments().erase(std::next(MergeTo), std::next(
I));
221 iterator addSegment(Segment S) {
222 SlotIndex
Start = S.start,
End = S.end;
223 iterator
I =
impl().findInsertPos(S);
227 if (
I != segments().
begin()) {
228 iterator
B = std::prev(
I);
229 if (S.valno ==
B->valno) {
230 if (
B->start <= Start &&
B->end >= Start) {
231 extendSegmentEndTo(
B,
End);
238 "Cannot overlap two segments with differing ValID's"
239 " (did you def the same reg twice in a MachineInstr?)");
245 if (
I != segments().
end()) {
246 if (S.valno ==
I->valno) {
247 if (
I->start <=
End) {
248 I = extendSegmentStartTo(
I, Start);
253 extendSegmentEndTo(
I,
End);
260 "Cannot overlap two segments with differing ValID's");
267 return segments().insert(
I, S);
271 ImplT &
impl() {
return *
static_cast<ImplT *
>(
this); }
273 CollectionT &segments() {
return impl().segmentsColl(); }
275 Segment *segmentAt(iterator
I) {
return const_cast<Segment *
>(&(*I)); }
283class CalcLiveRangeUtilVector;
284using CalcLiveRangeUtilVectorBase =
288class CalcLiveRangeUtilVector :
public CalcLiveRangeUtilVectorBase {
290 CalcLiveRangeUtilVector(
LiveRange *LR) : CalcLiveRangeUtilVectorBase(LR) {}
293 friend CalcLiveRangeUtilVectorBase;
295 LiveRange::Segments &segmentsColl() {
return LR->
segments; }
309class CalcLiveRangeUtilSet;
310using CalcLiveRangeUtilSetBase =
311 CalcLiveRangeUtilBase<CalcLiveRangeUtilSet, LiveRange::SegmentSet::iterator,
314class CalcLiveRangeUtilSet :
public CalcLiveRangeUtilSetBase {
316 CalcLiveRangeUtilSet(
LiveRange *LR) : CalcLiveRangeUtilSetBase(LR) {}
319 friend CalcLiveRangeUtilSetBase;
321 LiveRange::SegmentSet &segmentsColl() {
return *LR->
segmentSet; }
323 void insertAtEnd(
const Segment &S) {
333 if (Pos < (*PrevI).end)
354 [&](
const Segment &
X) {
return X.end <= Pos; });
360 return CalcLiveRangeUtilSet(
this).createDeadDef(Def, &VNIAlloc,
nullptr);
362 return CalcLiveRangeUtilVector(
this).createDeadDef(Def, &VNIAlloc,
nullptr);
368 return CalcLiveRangeUtilSet(
this).createDeadDef(VNI->
def,
nullptr, VNI);
370 return CalcLiveRangeUtilVector(
this).createDeadDef(VNI->
def,
nullptr, VNI);
399 assert((StartPos->start <= i->start || StartPos == other.
begin()) &&
400 StartPos != other.
end() &&
"Bogus start position hint!");
402 if (i->start < j->start) {
403 i = std::upper_bound(i, ie, j->start);
404 if (i !=
begin()) --i;
405 }
else if (j->start < i->start) {
407 if (StartPos != other.
end() && StartPos->start <= i->start) {
409 j = std::upper_bound(j, je, i->start);
410 if (j != other.
begin()) --j;
416 if (j == je)
return false;
419 if (i->start > j->start) {
424 if (i->end > j->start)
452 if (J->start <
I->end) {
461 if (J->end >
I->end) {
469 while (J->end <=
I->start);
483 return Other.empty();
488 if (
I ==
end() ||
I->start > O.start)
492 while (
I->end < O.end) {
506void LiveRange::markValNoForDeletion(
VNInfo *ValNo) {
523 if (!Seen.
insert(VNI).second)
531void LiveRange::addSegmentToSet(Segment S) {
532 CalcLiveRangeUtilSet(
this).addSegment(S);
542 return CalcLiveRangeUtilVector(
this).addSegment(S);
547 assert(
I !=
end() &&
"Cannot merge end iterator");
551 if (Prev->valno ==
I->valno && Prev->end ==
I->start) {
577 return CalcLiveRangeUtilSet(
this).extendInBlock(Undefs, StartIdx,
Kill);
579 return CalcLiveRangeUtilVector(
this).extendInBlock(Undefs, StartIdx,
Kill);
585 return CalcLiveRangeUtilSet(
this).extendInBlock(StartIdx,
Kill);
587 return CalcLiveRangeUtilVector(
this).extendInBlock(StartIdx,
Kill);
591 bool RemoveDeadValNo) {
600 &&
"Segment is not entirely in range!");
604 if (
I->start == Start) {
640 markValNoForDeletion(ValNo);
648 [ValNo](
const Segment &S) {
return S.
valno == ValNo; });
650 markValNoForDeletion(ValNo);
654 const int *LHSValNoAssignments,
655 const int *RHSValNoAssignments,
662 bool MustMapCurValNos =
false;
664 unsigned NumNewVals = NewVNInfo.
size();
665 for (
unsigned i = 0; i != NumVals; ++i) {
666 unsigned LHSValID = LHSValNoAssignments[i];
668 (NewVNInfo[LHSValID] && NewVNInfo[LHSValID] !=
getValNumInfo(i))) {
669 MustMapCurValNos =
true;
675 if (MustMapCurValNos && !
empty()) {
679 OutIt->valno = NewVNInfo[LHSValNoAssignments[OutIt->valno->id]];
681 VNInfo* nextValNo = NewVNInfo[LHSValNoAssignments[
I->valno->id]];
682 assert(nextValNo &&
"Huh?");
687 if (OutIt->valno == nextValNo && OutIt->end ==
I->start) {
692 OutIt->valno = nextValNo;
694 OutIt->start =
I->start;
713 unsigned NumValNos = 0;
714 for (
unsigned i = 0; i < NumNewVals; ++i) {
715 VNInfo *VNI = NewVNInfo[i];
717 if (NumValNos >= NumVals)
721 VNI->
id = NumValNos++;
724 if (NumNewVals < NumVals)
725 valnos.resize(NumNewVals);
740 for (
const Segment &S : RHS.segments)
753 for (
const Segment &S : RHS.segments)
754 if (S.
valno == RHSValNo)
763 assert(
V1 != V2 &&
"Identical value#'s are always equivalent!");
771 if (
V1->id < V2->
id) {
779 if (S->valno !=
V1)
continue;
788 markValNoForDeletion(
V1);
797 "segment set can be used only initially before switching to the array");
816 if (SegmentI == SegmentE)
820 for ( ; SlotI != SlotE; ++SlotI) {
824 if (SegmentI == SegmentE)
828 if (SegmentI->contains(*SlotI))
837void LiveInterval::freeSubRange(SubRange *S) {
845 while (
I !=
nullptr) {
856 }
while (
I !=
nullptr &&
I->empty());
876 unsigned ComposeSubRegIdx) {
879 if (!
Reg || !
Reg.isVirtual())
891 assert(
MI &&
"Cannot find the definition of a value");
894 if (!MOI->isReg() || !MOI->isDef())
896 if (MOI->getReg() !=
Reg)
898 LaneBitmask OrigMask =
TRI.getSubRegIndexLaneMask(MOI->getSubReg());
901 ?
TRI.composeSubRegIndexLaneMask(ComposeSubRegIdx, OrigMask)
903 if ((ExpectedDefMask & LaneMask).
none())
912 for (
VNInfo *VNI : ToBeRemoved)
923 unsigned ComposeSubRegIdx) {
932 if (SRMask == Matching) {
938 SR.LaneMask = SRMask & ~Matching;
948 Apply(*MatchingRange);
949 ToApply &= ~Matching;
961 Sum += S.start.distance(S.end);
971 assert((VRegMask & LaneMask).any());
976 unsigned SubReg = MO.getSubReg();
977 assert(SubReg != 0 &&
"Undef should only be set on subreg defs");
980 if ((UndefMask & LaneMask).any()) {
990 return OS <<
'[' << S.
start <<
',' << S.
end <<
':' << S.
valno->
id <<
')';
993#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
995 dbgs() << *
this <<
'\n';
1030 assert(vnum == vni->
id &&
"Bad VNInfo");
1037 <<
static_cast<const LiveRange &
>(*this);
1046 OS <<
" weight:" << Weight;
1049#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
1055 dbgs() << *
this <<
'\n';
1059 dbgs() << *
this <<
'\n';
1066 if (!
I->start.isValid())
1068 if (!
I->end.isValid())
1070 if (
I->start >=
I->end)
1072 if (
I->valno ==
nullptr)
1074 if (
I->valno->id >=
valnos.size())
1076 if (
I->valno !=
valnos[
I->valno->id])
1078 if (std::next(
I) != E) {
1079 if (
I->end > std::next(
I)->start)
1081 if (
I->end == std::next(
I)->start) {
1082 if (
I->valno == std::next(
I)->valno)
1101 if ((Mask & SR.LaneMask).any())
1104 Mask |= SR.LaneMask;
1107 if ((Mask & ~MaxMask).any())
1155#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
1159 OS <<
"Clean updater: " << *LR <<
'\n';
1161 OS <<
"Null updater.\n";
1164 assert(LR &&
"Can't have null LR in dirty updater.");
1165 OS <<
" updater with gap = " << (ReadI - WriteI)
1166 <<
", last start = " << LastStart
1168 for (
const auto &S :
make_range(LR->begin(), WriteI))
1174 for (
const auto &S :
make_range(ReadI, LR->end()))
1187 assert(
A.start <=
B.start &&
"Unordered live segments.");
1188 if (
A.end ==
B.start)
1189 return A.valno ==
B.valno;
1190 if (
A.end <
B.start)
1192 assert(
A.valno ==
B.valno &&
"Cannot overlap different values");
1197 assert(LR &&
"Cannot add to a null destination");
1201 if (LR->segmentSet !=
nullptr) {
1202 LR->addSegmentToSet(Seg);
1207 if (!LastStart.isValid() || LastStart > Seg.
start) {
1211 assert(Spills.empty() &&
"Leftover spilled segments");
1212 WriteI = ReadI = LR->begin();
1216 LastStart = Seg.
start;
1220 if (ReadI != E && ReadI->end <= Seg.
start) {
1222 if (ReadI != WriteI)
1225 if (ReadI == WriteI)
1226 ReadI = WriteI = LR->find(Seg.
start);
1228 while (ReadI != E && ReadI->end <= Seg.
start)
1229 *WriteI++ = *ReadI++;
1235 if (ReadI != E && ReadI->start <= Seg.
start) {
1236 assert(ReadI->valno == Seg.
valno &&
"Cannot overlap different values");
1238 if (ReadI->end >= Seg.
end)
1241 Seg.
start = ReadI->start;
1247 Seg.
end = std::max(Seg.
end, ReadI->end);
1252 if (!Spills.empty() &&
coalescable(Spills.back(), Seg)) {
1253 Seg.
start = Spills.back().start;
1254 Seg.
end = std::max(Spills.back().end, Seg.
end);
1259 if (WriteI != LR->begin() &&
coalescable(WriteI[-1], Seg)) {
1260 WriteI[-1].end = std::max(WriteI[-1].
end, Seg.
end);
1265 if (WriteI != ReadI) {
1272 LR->segments.push_back(Seg);
1273 WriteI = ReadI = LR->end();
1275 Spills.push_back(Seg);
1280void LiveRangeUpdater::mergeSpills() {
1282 size_t GapSize = ReadI - WriteI;
1283 size_t NumMoved = std::min(Spills.size(), GapSize);
1293 while (Src != Dst) {
1294 if (Src !=
B && Src[-1].start > SpillSrc[-1].start)
1297 *--Dst = *--SpillSrc;
1299 assert(NumMoved ==
size_t(Spills.end() - SpillSrc));
1300 Spills.erase(SpillSrc, Spills.end());
1309 assert(LR &&
"Cannot add to a null destination");
1312 if (Spills.empty()) {
1313 LR->segments.erase(WriteI, ReadI);
1319 size_t GapSize = ReadI - WriteI;
1320 if (GapSize < Spills.size()) {
1322 size_t WritePos = WriteI - LR->begin();
1325 WriteI = LR->begin() + WritePos;
1328 LR->segments.erase(WriteI + Spills.size(), ReadI);
1330 ReadI = WriteI + Spills.size();
1341 const VNInfo *used =
nullptr, *unused =
nullptr;
1342 bool HasUnreachablePHIDef =
false;
1349 EqClass.join(unused->id, VNI->
id);
1356 assert(
MBB &&
"Phi-def has no defining MBB");
1361 EqClass.join(VNI->
id, PVNI->id);
1368 EqClass.join(VNI->
id, UVNI->id);
1374 EqClass.join(used->id, unused->id);
1376 if (HasUnreachablePHIDef) {
1377 const VNInfo *Defined =
nullptr;
1385 unsigned Leader = EqClass.findLeader(VNI->
id);
1386 Leaders[VNI->
id] = Leader;
1388 KeepSeparate.
set(Leader);
1391 KeepSeparate.
set(Leader);
1400 unsigned Leader = Leaders[VNI->
id];
1401 if (KeepSeparate.
test(Leader))
1404 EqClass.join(Defined->
id, VNI->
id);
1405 KeepSeparate.
set(Leader);
1411 return EqClass.getNumClasses();
1421 if (
MI->isDebugValue()) {
1424 SlotIndex Idx = LIS.getSlotIndexes()->getIndexBefore(*
MI);
1436 MO.setReg(LIV[EqClass - 1]->reg());
1441 unsigned NumComponents = EqClass.getNumClasses();
1448 unsigned NumValNos = SR.valnos.size();
1450 VNIMapping.
reserve(NumValNos);
1452 SubRanges.
resize(NumComponents-1,
nullptr);
1453 for (
unsigned I = 0;
I < NumValNos; ++
I) {
1454 const VNInfo &VNI = *SR.valnos[
I];
1455 unsigned ComponentNum;
1460 assert(MainRangeVNI !=
nullptr
1461 &&
"SubRange def must have corresponding main range def");
1463 if (ComponentNum > 0 && SubRanges[ComponentNum-1] ==
nullptr) {
1464 SubRanges[ComponentNum-1]
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file implements the BitVector class.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static BasicBlock::iterator findInsertPos(Value *Addr, Instruction *MemoryInst, Value *SunkAddr)
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
A common definition of LaneBitmask for use in TableGen and CodeGen.
static void createDeadDef(SlotIndexes &Indexes, VNInfo::Allocator &Alloc, LiveRange &LR, const MachineOperand &MO)
static bool coalescable(const LiveRange::Segment &A, const LiveRange::Segment &B)
static void stripValuesNotDefiningMask(Register Reg, LiveInterval::SubRange &SR, LaneBitmask LaneMask, const SlotIndexes &Indexes, const TargetRegisterInfo &TRI, unsigned ComposeSubRegIdx)
For each VNI in SR, check whether or not that value defines part of the mask describe by LaneMask and...
This file contains helper functions to modify live ranges.
Register const TargetRegisterInfo * TRI
place backedge safepoints impl
MachineRegisterInfo & MRI
SI Optimize VGPR LiveRange
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
bool test(unsigned Idx) const
Returns true if bit Idx is set.
BitVector & set()
Set all bits in the bitvector.
A helper class for register coalescers.
bool isCoalescable(const MachineInstr *) const
Return true if MI is a copy instruction that will become an identity copy after coalescing.
LLVM_ABI void Distribute(LiveInterval &LI, LiveInterval *LIV[], MachineRegisterInfo &MRI)
Distribute values in LI into a separate LiveIntervals for each connected component.
LLVM_ABI unsigned Classify(const LiveRange &LR)
Classify the values in LR into connected components.
unsigned getEqClass(const VNInfo *VNI) const
getEqClass - Classify creates equivalence classes numbered 0..N.
ConstMIBundleOperands - Iterate over all operands in a const bundle of machine instructions.
bool isReachableFromEntry(const NodeT *A) const
isReachableFromEntry - Return true if A is dominated by the entry block of the function containing it...
A live range for subregisters.
LLVM_ABI void print(raw_ostream &OS) const
LLVM_ABI void dump() const
LiveInterval - This class represents the liveness of a register, or stack slot.
LLVM_ABI void removeEmptySubRanges()
Removes all subranges without any segments (subranges without segments are not considered valid and s...
bool hasSubRanges() const
Returns true if subregister liveness information is available.
LLVM_ABI void dump() const
LLVM_ABI unsigned getSize() const
getSize - Returns the sum of sizes of all the LiveRange's.
SubRange * createSubRangeFrom(BumpPtrAllocator &Allocator, LaneBitmask LaneMask, const LiveRange &CopyFrom)
Like createSubRange() but the new range is filled with a copy of the liveness information in CopyFrom...
iterator_range< subrange_iterator > subranges()
LLVM_ABI void refineSubRanges(BumpPtrAllocator &Allocator, LaneBitmask LaneMask, std::function< void(LiveInterval::SubRange &)> Apply, const SlotIndexes &Indexes, const TargetRegisterInfo &TRI, unsigned ComposeSubRegIdx=0)
Refines the subranges to support LaneMask.
LLVM_ABI void print(raw_ostream &OS) const
LLVM_ABI void computeSubRangeUndefs(SmallVectorImpl< SlotIndex > &Undefs, LaneBitmask LaneMask, const MachineRegisterInfo &MRI, const SlotIndexes &Indexes) const
For a given lane mask LaneMask, compute indexes at which the lane is marked undefined by subregister ...
SubRange * createSubRange(BumpPtrAllocator &Allocator, LaneBitmask LaneMask)
Creates a new empty subregister live range.
LLVM_ABI void clearSubRanges()
Removes all subregister liveness information.
Result of a LiveRange query.
VNInfo * valueIn() const
Return the value that is live-in to the instruction.
VNInfo * valueOut() const
Return the value leaving the instruction, if any.
VNInfo * valueDefined() const
Return the value defined by this instruction, if any.
LLVM_ABI void print(raw_ostream &) const
LLVM_ABI void flush()
Flush the updater state to LR so it is valid and contains all added segments.
LLVM_ABI void dump() const
bool isDirty() const
Return true if the LR is currently in an invalid state, and flush() needs to be called.
LLVM_ABI void add(LiveRange::Segment)
Add a segment to LR and coalesce when possible, just like LR.addSegment().
This class represents the liveness of a register, stack slot, etc.
LiveRange(bool UseSegmentSet=false)
Constructs a new LiveRange object.
VNInfo * getValNumInfo(unsigned ValNo)
getValNumInfo - Returns pointer to the specified val#.
LLVM_ABI iterator addSegment(Segment S)
Add the specified Segment to this range, merging segments as appropriate.
Segments::iterator iterator
LLVM_ABI void join(LiveRange &Other, const int *ValNoAssignments, const int *RHSValNoAssignments, SmallVectorImpl< VNInfo * > &NewVNInfo)
join - Join two live ranges (this, and other) together.
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...
Segments::const_iterator const_iterator
LLVM_ABI VNInfo * createDeadDef(SlotIndex Def, VNInfo::Allocator &VNIAlloc)
createDeadDef - Make sure the range has a value defined at Def.
LLVM_ABI iterator mergeAdjacentSegments(iterator I)
Merge the segment pointed to by I with its immediate neighbors when they use the same value number an...
std::set< Segment > SegmentSet
LLVM_ABI bool isLiveAtIndexes(ArrayRef< SlotIndex > Slots) const
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.
iterator advanceTo(iterator I, SlotIndex Pos)
advanceTo - Advance the specified iterator to point to the Segment containing the specified position,...
std::unique_ptr< SegmentSet > segmentSet
LLVM_ABI void removeValNo(VNInfo *ValNo)
removeValNo - Remove all the segments defined by the specified value#.
LLVM_ABI void RenumberValues()
RenumberValues - Renumber all values in order of appearance and remove unused values.
bool overlaps(const LiveRange &other) const
overlaps - Return true if the intersection of the two live ranges is not empty.
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.
LiveQueryResult Query(SlotIndex Idx) const
Query Liveness at Idx.
VNInfo * getVNInfoBefore(SlotIndex Idx) const
getVNInfoBefore - Return the VNInfo that is live up to but not necessarily including Idx,...
LLVM_ABI std::pair< VNInfo *, bool > extendInBlock(ArrayRef< SlotIndex > Undefs, SlotIndex StartIdx, SlotIndex Kill)
Attempt to extend a value defined after StartIdx to include Use.
bool verify() const
Walk the range and assert if any invariants fail to hold.
LLVM_ABI void append(const LiveRange::Segment S)
Append a segment to the list of segments.
friend class LiveRangeUpdater
LLVM_ABI VNInfo * MergeValueNumberInto(VNInfo *V1, VNInfo *V2)
MergeValueNumberInto - This method is called when two value numbers are found to be equivalent.
unsigned getNumValNums() const
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 ...
SmallVector< Segment, 2 > Segments
VNInfoList::const_iterator const_vni_iterator
LLVM_ABI void removeSegment(SlotIndex Start, SlotIndex End, bool RemoveDeadValNo=false)
Remove the specified interval from this live range.
LLVM_ABI void removeValNoIfDead(VNInfo *ValNo)
Mark ValNo for deletion if no segments in this range use it.
LLVM_ABI void dump() const
LLVM_ABI void print(raw_ostream &OS) const
LLVM_ABI void flushSegmentSet()
Flush segment set into the regular segment vector.
VNInfo * getVNInfoAt(SlotIndex Idx) const
getVNInfoAt - Return the VNInfo that is live at Idx, or NULL.
LLVM_ABI iterator find(SlotIndex Pos)
find - Return an iterator pointing to the first segment that ends after Pos, or end().
bool isValid() const
isValid - Returns true until all the operands have been visited.
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Wrapper class representing virtual and physical registers.
SlotIndex - An opaque wrapper around machine indexes.
static bool isSameInstr(SlotIndex A, SlotIndex B)
isSameInstr - Return true if A and B refer to the same instruction.
static bool isEarlierInstr(SlotIndex A, SlotIndex B)
isEarlierInstr - Return true if A refers to an instruction earlier than B.
SlotIndex getNextSlot() const
Returns the next slot in the index list.
SlotIndex getRegSlot(bool EC=false) const
Returns the register use/def slot in the current instruction for a normal or early-clobber def.
SlotIndex getInstructionIndex(const MachineInstr &MI, bool IgnoreBundle=false) const
Returns the base index for the given instruction.
MachineInstr * getInstructionFromIndex(SlotIndex index) const
Returns the instruction for the given index, or null if the given index has no instruction associated...
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void reserve(size_type N)
void push_back(const T &Elt)
pointer data()
Return a pointer to the vector's buffer, even if empty().
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
VNInfo - Value Number Information.
LLVM_ABI void dump() const
LLVM_ABI void print(raw_ostream &OS) const
void markUnused()
Mark this value as unused.
BumpPtrAllocator Allocator
bool isUnused() const
Returns true if this value is unused.
unsigned id
The ID number of this value.
SlotIndex def
The index of the defining instruction.
bool isPHIDef() const
Returns true if this value is defined by a PHI instruction (or was, PHI instructions may have been el...
This class implements an extremely fast bulk output stream that can only output to a stream.
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
NodeAddr< DefNode * > Def
NodeAddr< UseNode * > Use
LLVM_ABI iterator begin() const
This is an optimization pass for GlobalISel generic memory operations.
auto find(R &&Range, const T &Val)
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
@ Kill
The last use of a register.
@ EarlyClobber
Register definition happens before uses.
auto partition_point(R &&Range, Predicate P)
Binary search for the first iterator in a range where a predicate is false.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
Printable PrintLaneMask(LaneBitmask LaneMask)
Create Printable object to print LaneBitmasks on a raw_ostream.
auto upper_bound(R &&Range, T &&Value)
Provide wrappers to std::upper_bound which take ranges instead of having to pass begin/end explicitly...
static void DistributeRange(LiveRangeT &LR, LiveRangeT *SplitLRs[], EqClassesT VNIClasses)
Helper function that distributes live range value numbers and the corresponding segments of a primary...
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool none_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly.
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
auto lower_bound(R &&Range, T &&Value)
Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly...
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
ArrayRef(const T &OneElt) -> ArrayRef< T >
void erase_if(Container &C, UnaryPredicate P)
Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent t...
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Next
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
@ End
Run the machine verifier once, at the end of the pipeline.
LLVM_ABI Printable printReg(Register Reg, const TargetRegisterInfo *TRI=nullptr, unsigned SubIdx=0, const MachineRegisterInfo *MRI=nullptr)
Prints virtual and physical registers with or without a TRI instance.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
ListT< IteratorSpecifierT< T, I, E > > IteratorT
static constexpr LaneBitmask getAll()
constexpr bool none() const
constexpr bool any() const
This represents a simple continuous liveness interval for a value.
LLVM_ABI void dump() const