50 template <
typename ImplT,
typename IteratorT,
typename CollectionT>
51 class CalcLiveRangeUtilBase {
56 CalcLiveRangeUtilBase(
LiveRange *LR) : LR(LR) {}
60 typedef IteratorT iterator;
63 assert(!Def.
isDead() &&
"Cannot define a value at the dead slot");
65 iterator
I =
impl().find(Def);
66 if (I == segments().
end()) {
67 VNInfo *VNI = LR->getNextValue(Def, VNInfoAllocator);
72 Segment *S = segmentAt(I);
74 assert(S->valno->def == S->start &&
"Inconsistent existing value def");
83 S->start = S->valno->def =
Def;
87 VNInfo *VNI = LR->getNextValue(Def, VNInfoAllocator);
88 segments().insert(I, Segment(Def, Def.
getDeadSlot(), VNI));
93 if (segments().empty())
97 if (I == segments().begin())
100 if (I->end <= StartIdx)
103 extendSegmentEndTo(I, Use);
111 void extendSegmentEndTo(iterator I,
SlotIndex NewEnd) {
112 assert(I != segments().
end() &&
"Not a valid segment!");
113 Segment *S = segmentAt(I);
117 iterator MergeTo = std::next(I);
118 for (; MergeTo != segments().end() && NewEnd >= MergeTo->end; ++MergeTo)
119 assert(MergeTo->valno == ValNo &&
"Cannot merge with differing values!");
122 S->end = std::max(NewEnd, std::prev(MergeTo)->
end);
126 if (MergeTo != segments().
end() && MergeTo->start <= I->
end &&
127 MergeTo->valno == ValNo) {
128 S->end = MergeTo->end;
133 segments().erase(std::next(I), MergeTo);
139 iterator extendSegmentStartTo(iterator I,
SlotIndex NewStart) {
140 assert(I != segments().
end() &&
"Not a valid segment!");
141 Segment *S = segmentAt(I);
145 iterator MergeTo =
I;
147 if (MergeTo == segments().
begin()) {
149 segments().erase(MergeTo, I);
152 assert(MergeTo->valno == ValNo &&
"Cannot merge with differing values!");
154 }
while (NewStart <= MergeTo->start);
158 if (MergeTo->end >= NewStart && MergeTo->valno == ValNo) {
159 segmentAt(MergeTo)->end = S->end;
163 Segment *MergeToSeg = segmentAt(MergeTo);
164 MergeToSeg->start = NewStart;
165 MergeToSeg->end = S->end;
168 segments().erase(std::next(MergeTo), std::next(I));
172 iterator addSegment(Segment S) {
174 iterator I =
impl().findInsertPos(S);
178 if (I != segments().
begin()) {
179 iterator B = std::prev(I);
180 if (S.valno == B->valno) {
181 if (B->start <= Start && B->end >= Start) {
182 extendSegmentEndTo(B, End);
188 assert(B->end <= Start &&
189 "Cannot overlap two segments with differing ValID's"
190 " (did you def the same reg twice in a MachineInstr?)");
196 if (I != segments().
end()) {
197 if (S.valno == I->valno) {
198 if (I->start <= End) {
199 I = extendSegmentStartTo(I, Start);
204 extendSegmentEndTo(I, End);
210 assert(I->start >= End &&
211 "Cannot overlap two segments with differing ValID's");
218 return segments().insert(I, S);
222 ImplT &
impl() {
return *
static_cast<ImplT *
>(
this); }
224 CollectionT &segments() {
return impl().segmentsColl(); }
226 Segment *segmentAt(iterator I) {
return const_cast<Segment *
>(&(*I)); }
234 class CalcLiveRangeUtilVector;
238 class CalcLiveRangeUtilVector :
public CalcLiveRangeUtilVectorBase {
240 CalcLiveRangeUtilVector(
LiveRange *LR) : CalcLiveRangeUtilVectorBase(LR) {}
243 friend CalcLiveRangeUtilVectorBase;
247 void insertAtEnd(
const Segment &S) { LR->segments.
push_back(S); }
249 iterator find(
SlotIndex Pos) {
return LR->find(Pos); }
251 iterator findInsertPos(Segment S) {
252 return std::upper_bound(LR->begin(), LR->end(), S.start);
261 class CalcLiveRangeUtilSet;
262 typedef CalcLiveRangeUtilBase<CalcLiveRangeUtilSet,
263 LiveRange::SegmentSet::iterator,
266 class CalcLiveRangeUtilSet :
public CalcLiveRangeUtilSetBase {
268 CalcLiveRangeUtilSet(
LiveRange *LR) : CalcLiveRangeUtilSetBase(LR) {}
271 friend CalcLiveRangeUtilSetBase;
275 void insertAtEnd(
const Segment &S) {
276 LR->segmentSet->insert(LR->segmentSet->end(), S);
281 LR->segmentSet->upper_bound(Segment(Pos, Pos.
getNextSlot(),
nullptr));
282 if (I == LR->segmentSet->begin())
284 iterator PrevI = std::prev(I);
285 if (Pos < (*PrevI).end)
290 iterator findInsertPos(Segment S) {
291 iterator I = LR->segmentSet->upper_bound(S);
292 if (I != LR->segmentSet->end() && !(S.start < *
I))
312 size_t Mid = Len >> 1;
313 if (Pos < I[Mid].
end)
316 I += Mid + 1, Len -= Mid + 1;
325 return CalcLiveRangeUtilSet(
this).createDeadDef(Def, VNInfoAllocator);
327 return CalcLiveRangeUtilVector(
this).createDeadDef(Def, VNInfoAllocator);
350 assert(!
empty() &&
"empty range");
356 assert((StartPos->start <= i->start || StartPos == other.
begin()) &&
357 StartPos != other.
end() &&
"Bogus start position hint!");
359 if (i->start < j->start) {
360 i = std::upper_bound(i, ie, j->start);
361 if (i !=
begin()) --i;
362 }
else if (j->start < i->start) {
364 if (StartPos != other.
end() && StartPos->start <= i->start) {
365 assert(StartPos < other.
end() && i <
end());
366 j = std::upper_bound(j, je, i->start);
367 if (j != other.
begin()) --j;
373 if (j == je)
return false;
376 if (i->start > j->start) {
381 if (i->end > j->start)
391 assert(!
empty() &&
"empty range");
407 assert(J->end >= I->start);
409 if (J->start < I->end) {
411 SlotIndex Def = std::max(I->start, J->start);
418 if (J->end > I->end) {
426 while (J->end < I->start);
433 assert(Start < End &&
"Invalid range");
435 return I !=
begin() && (--
I)->
end > Start;
440 return Other.
empty();
445 if (I ==
end() || I->start > O.
start)
449 while (I->end < O.
end) {
453 if (I ==
end() || Last->end != I->start)
463 void LiveRange::markValNoForDeletion(
VNInfo *ValNo) {
480 if (!Seen.
insert(VNI).second)
482 assert(!VNI->
isUnused() &&
"Unused valno used by live segment");
488 void LiveRange::addSegmentToSet(Segment S) {
489 CalcLiveRangeUtilSet(
this).addSegment(S);
499 return CalcLiveRangeUtilVector(
this).addSegment(S);
514 return CalcLiveRangeUtilSet(
this).extendInBlock(StartIdx, Kill);
516 return CalcLiveRangeUtilVector(
this).extendInBlock(StartIdx, Kill);
522 bool RemoveDeadValNo) {
525 assert(I !=
end() &&
"Segment is not in range!");
526 assert(I->containsInterval(Start, End)
527 &&
"Segment is not entirely in range!");
531 if (I->start == Start) {
533 if (RemoveDeadValNo) {
537 if (II != I && II->valno == ValNo) {
543 markValNoForDeletion(ValNo);
573 return S.
valno == ValNo;
576 markValNoForDeletion(ValNo);
580 const int *LHSValNoAssignments,
581 const int *RHSValNoAssignments,
587 bool MustMapCurValNos =
false;
589 unsigned NumNewVals = NewVNInfo.
size();
590 for (
unsigned i = 0; i != NumVals; ++i) {
591 unsigned LHSValID = LHSValNoAssignments[i];
593 (NewVNInfo[LHSValID] && NewVNInfo[LHSValID] !=
getValNumInfo(i))) {
594 MustMapCurValNos =
true;
600 if (MustMapCurValNos && !
empty()) {
604 OutIt->valno = NewVNInfo[LHSValNoAssignments[OutIt->valno->id]];
605 for (
iterator I = std::next(OutIt), E =
end(); I != E; ++
I) {
606 VNInfo* nextValNo = NewVNInfo[LHSValNoAssignments[I->valno->id]];
607 assert(nextValNo &&
"Huh?");
612 if (OutIt->valno == nextValNo && OutIt->end == I->start) {
617 OutIt->valno = nextValNo;
619 OutIt->start = I->start;
638 unsigned NumValNos = 0;
639 for (
unsigned i = 0; i < NumNewVals; ++i) {
640 VNInfo *VNI = NewVNInfo[i];
642 if (NumValNos >= NumVals)
646 VNI->
id = NumValNos++;
649 if (NumNewVals < NumVals)
679 if (S.
valno == RHSValNo)
688 assert(V1 != V2 &&
"Identical value#'s are always equivalent!");
696 if (V1->
id < V2->
id) {
704 if (S->valno != V1)
continue;
710 if (Prev->valno == V2 && Prev->end == S->start) {
728 if (I->start == S->end && I->valno == V2) {
737 markValNoForDeletion(V1);
743 assert(
segmentSet !=
nullptr &&
"segment set must have been created");
746 "segment set can be used only initially before switching to the array");
752 void LiveInterval::freeSubRange(SubRange *S) {
760 while (I !=
nullptr) {
771 }
while (I !=
nullptr && I->
empty());
777 for (
SubRange *I = SubRanges, *Next; I !=
nullptr; I = Next) {
795 assert(I != LR.
end());
797 if (S.valno !=
nullptr)
804 if (!Visited.
insert(Pred).second)
808 if (VNI !=
nullptr) {
820 LiveRange::iterator OutIt;
821 VNInfo *PrevValNo =
nullptr;
822 for (LiveRange::iterator I = LI.
begin(), E = LI.
end(); I != E; ++
I) {
825 if (S.
valno ==
nullptr) {
827 assert(S.
start.
isBlock() &&
"valno should only be missing at block begin");
833 if (VNI !=
nullptr) {
838 assert(S.
valno !=
nullptr &&
"could not determine valno");
841 if (PrevValNo == S.
valno && OutIt->end == S.
start) {
845 if (PrevValNo ==
nullptr)
870 assert(
hasSubRanges() &&
"expected subranges to be present");
881 SRs.push_back(std::make_pair(&SR, SR.begin()));
882 if (!First.
isValid() || SR.segments.front().start < First)
883 First = SR.segments.front().start;
884 if (!Last.
isValid() || SR.segments.back().end > Last)
885 Last = SR.segments.back().end;
890 bool ConstructingSegment =
false;
891 bool NeedVNIFixup =
false;
892 unsigned ActiveMask = 0;
902 unsigned EventMask = 0;
908 for (
auto &SRP : SRs) {
913 while (I != SR.
end() &&
915 (I->end == Pos && (ActiveMask & SR.
LaneMask) == 0)))
919 if ((ActiveMask & SR.
LaneMask) == 0 &&
920 Pos <= I->start && I->start <= NextPos) {
922 if (I->start == NextPos && Event == BEGIN_SEGMENT) {
924 IsDef |= I->valno->def == I->start;
925 }
else if (I->start < NextPos || Event != END_SEGMENT) {
926 Event = BEGIN_SEGMENT;
929 IsDef = I->valno->def == I->start;
932 if ((ActiveMask & SR.
LaneMask) != 0 &&
933 Pos <= I->end && I->end <= NextPos) {
935 if (I->end == NextPos && Event == END_SEGMENT)
947 if (Event == BEGIN_SEGMENT) {
948 if (ConstructingSegment && IsDef) {
950 CurrentSegment.
end = Pos;
952 ConstructingSegment =
false;
956 if (!ConstructingSegment) {
986 CurrentSegment.
start = Pos;
987 CurrentSegment.
valno = VNI;
988 ConstructingSegment =
true;
990 ActiveMask |= EventMask;
991 }
else if (Event == END_SEGMENT) {
992 assert(ConstructingSegment);
994 ActiveMask &= ~EventMask;
995 if (ActiveMask == 0) {
996 CurrentSegment.
end = Pos;
998 ConstructingSegment =
false;
1002 assert(Event == NOTHING);
1013 assert(ActiveMask == 0 && !ConstructingSegment &&
"all segments ended");
1020 Sum += S.start.distance(S.end);
1025 return os <<
'[' << S.
start <<
',' << S.
end <<
':' << S.
valno->
id <<
")";
1028 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
1030 dbgs() << *
this <<
"\n";
1040 assert(S.valno ==
getValNumInfo(S.valno->id) &&
"Bad VNInfo");
1051 if (vnum) OS <<
" ";
1068 for (
const SubRange &SR : subranges()) {
1069 OS <<
format(
" L%04X ", SR.LaneMask) << SR;
1073 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
1075 dbgs() << *
this <<
"\n";
1079 dbgs() << *
this <<
"\n";
1086 assert(I->start.isValid());
1087 assert(I->end.isValid());
1088 assert(I->start < I->end);
1089 assert(I->valno !=
nullptr);
1091 assert(I->valno ==
valnos[I->valno->id]);
1092 if (std::next(I) != E) {
1093 assert(I->end <= std::next(I)->start);
1094 if (I->end == std::next(I)->start)
1095 assert(I->valno != std::next(I)->valno);
1106 for (
const SubRange &SR : subranges()) {
1108 assert((Mask & SR.LaneMask) == 0);
1109 Mask |= SR.LaneMask;
1112 assert((Mask & ~MaxMask) == 0);
1154 OS <<
"Clean updater: " << *LR <<
'\n';
1156 OS <<
"Null updater.\n";
1159 assert(LR &&
"Can't have null LR in dirty updater.");
1160 OS <<
" updater with gap = " << (ReadI - WriteI)
1161 <<
", last start = " << LastStart
1163 for (
const auto &S :
make_range(LR->begin(), WriteI))
1166 for (
unsigned I = 0, E = Spills.size(); I != E; ++
I)
1167 OS <<
' ' << Spills[I];
1169 for (
const auto &S :
make_range(ReadI, LR->end()))
1182 assert(A.
start <= B.
start &&
"Unordered live segments.");
1187 assert(A.
valno == B.
valno &&
"Cannot overlap different values");
1192 assert(LR &&
"Cannot add to a null destination");
1196 if (LR->segmentSet !=
nullptr) {
1197 LR->addSegmentToSet(Seg);
1202 if (!LastStart.isValid() || LastStart > Seg.
start) {
1206 assert(Spills.empty() &&
"Leftover spilled segments");
1207 WriteI = ReadI = LR->begin();
1211 LastStart = Seg.
start;
1214 LiveRange::iterator E = LR->end();
1215 if (ReadI != E && ReadI->end <= Seg.
start) {
1217 if (ReadI != WriteI)
1220 if (ReadI == WriteI)
1221 ReadI = WriteI = LR->find(Seg.
start);
1223 while (ReadI != E && ReadI->end <= Seg.
start)
1224 *WriteI++ = *ReadI++;
1227 assert(ReadI == E || ReadI->end > Seg.
start);
1230 if (ReadI != E && ReadI->start <= Seg.
start) {
1231 assert(ReadI->valno == Seg.
valno &&
"Cannot overlap different values");
1233 if (ReadI->end >= Seg.
end)
1236 Seg.
start = ReadI->start;
1242 Seg.
end = std::max(Seg.
end, ReadI->end);
1247 if (!Spills.empty() &&
coalescable(Spills.back(), Seg)) {
1248 Seg.
start = Spills.back().start;
1249 Seg.
end = std::max(Spills.back().end, Seg.
end);
1254 if (WriteI != LR->begin() &&
coalescable(WriteI[-1], Seg)) {
1255 WriteI[-1].end = std::max(WriteI[-1].
end, Seg.
end);
1260 if (WriteI != ReadI) {
1267 LR->segments.push_back(Seg);
1268 WriteI = ReadI = LR->
end();
1270 Spills.push_back(Seg);
1275 void LiveRangeUpdater::mergeSpills() {
1277 size_t GapSize = ReadI - WriteI;
1278 size_t NumMoved =
std::min(Spills.size(), GapSize);
1279 LiveRange::iterator Src = WriteI;
1280 LiveRange::iterator Dst = Src + NumMoved;
1281 LiveRange::iterator SpillSrc = Spills.end();
1282 LiveRange::iterator B = LR->begin();
1288 while (Src != Dst) {
1289 if (Src != B && Src[-1].start > SpillSrc[-1].start)
1292 *--Dst = *--SpillSrc;
1294 assert(NumMoved ==
size_t(Spills.end() - SpillSrc));
1295 Spills.erase(SpillSrc, Spills.end());
1304 assert(LR &&
"Cannot add to a null destination");
1307 if (Spills.empty()) {
1308 LR->segments.erase(WriteI, ReadI);
1314 size_t GapSize = ReadI - WriteI;
1315 if (GapSize < Spills.size()) {
1317 size_t WritePos = WriteI - LR->begin();
1320 WriteI = LR->begin() + WritePos;
1323 LR->segments.erase(WriteI + Spills.size(), ReadI);
1325 ReadI = WriteI + Spills.size();
1335 const VNInfo *used =
nullptr, *unused =
nullptr;
1342 EqClass.join(unused->id, VNI->
id);
1349 assert(MBB &&
"Phi-def has no defining MBB");
1352 PE = MBB->
pred_end(); PI != PE; ++PI)
1354 EqClass.join(VNI->
id, PVNI->id);
1361 EqClass.join(VNI->
id, UVNI->id);
1367 EqClass.join(used->
id, unused->id);
1370 return EqClass.getNumClasses();
1375 assert(LIV[0] &&
"LIV[0] must be set");
1380 RE = MRI.
reg_end(); RI != RE;) {
1390 Idx = LIS.getSlotIndexes()->getIndexBefore(MI);
1392 Idx = LIS.getInstructionIndex(MI);
1399 MO.
setReg(LIV[getEqClass(VNI)]->reg);
1404 while (J != E && EqClass[J->valno->id] == 0)
1407 if (
unsigned eq = EqClass[I->valno->id]) {
1409 "New intervals should be empty");
1420 while (j != e && EqClass[j] == 0)
1422 for (
unsigned i = j; i != e; ++i) {
1424 if (
unsigned eq = EqClass[i]) {
void add(LiveRange::Segment)
Add a segment to LR and coalesce when possible, just like LR.addSegment().
void RenumberValues()
RenumberValues - Renumber all values in order of appearance and remove unused values.
void push_back(const T &Elt)
const_iterator end(StringRef path)
Get end iterator over path.
void flush()
Flush the updater state to LR so it is valid and contains all added segments.
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
Segments::iterator iterator
SlotIndex def
The index of the defining instruction.
static bool coalescable(const LiveRange::Segment &A, const LiveRange::Segment &B)
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...
LiveInterval - This class represents the liveness of a register, or stack slot.
iterator advanceTo(iterator I, SlotIndex Pos)
advanceTo - Advance the specified iterator to point to the Segment containing the specified position...
void constructMainRangeFromSubranges(const SlotIndexes &Indexes, VNInfo::Allocator &VNIAllocator)
Construct main live range by merging the SubRanges of LI.
const_iterator begin(StringRef path)
Get begin iterator over path.
A live range for subregisters.
This represents a simple continuous liveness interval for a value.
void markUnused()
Mark this value as unused.
VNInfo - Value Number Information.
unsigned getNumValNums() const
void flushSegmentSet()
Flush segment set into the regular segment vector.
This class represents the liveness of a register, stack slot, etc.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
unsigned getMaxLaneMaskForVReg(unsigned Reg) const
Returns a mask covering all bits that can appear in lane masks of subregisters of the virtual registe...
static bool isEarlierInstr(SlotIndex A, SlotIndex B)
isEarlierInstr - Return true if A refers to an instruction earlier than B.
void removeEmptySubRanges()
Removes all subranges without any segments (subranges without segments are not considered valid and s...
A Use represents the edge between a Value definition and its users.
A helper class for register coalescers.
iterator_range< subrange_iterator > subranges()
Result of a LiveRange query.
Number of individual test Apply this number of consecutive mutations to each input exit after the first new interesting input is found the minimized corpus is saved into the first input directory Number of jobs to run If min(jobs, NumberOfCpuCores()/2)\" is used.") FUZZER_FLAG_INT(reload
unsigned Classify(const LiveInterval *LI)
Classify - Classify the values in LI into connected components.
bool isBlock() const
isBlock - Returns true if this is a block boundary slot.
unsigned getSize() const
getSize - Returns the sum of sizes of all the LiveRange's.
SlotIndex getDeadSlot() const
Returns the dead def kill slot for the current instruction.
void print(raw_ostream &OS) const
bool isUnused() const
Returns true if this value is unused.
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 ...
place backedge safepoints impl
void Distribute(LiveInterval *LIV[], MachineRegisterInfo &MRI)
Distribute - Distribute values in LIV[0] into a separate LiveInterval for each connected component...
PrintReg - Helper class for printing registers on a raw_ostream.
bool isDead() const
isDead - Returns true if this is a dead def kill slot.
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
iterator addSegment(Segment S)
Add the specified Segment to this range, merging segments as appropriate.
VNInfo * MergeValueNumberInto(VNInfo *V1, VNInfo *V2)
MergeValueNumberInto - This method is called when two value numbers are found to be equivalent...
VNInfo * extendInBlock(SlotIndex StartIdx, SlotIndex Use)
If this range is live before Use in the basic block that starts at StartIdx, extend it to be live up ...
bool expiredAt(SlotIndex index) const
void copyFrom(VNInfo &src)
Copy from the parameter into this VNInfo.
SlotIndex getPrevSlot() const
Returns the previous slot in the index list.
format_object< Ts...> format(const char *Fmt, const Ts &...Vals)
These are helper functions used to produce formatted output.
bool isDebugValue() const
void removeValNo(VNInfo *ValNo)
removeValNo - Remove all the segments defined by the specified value#.
friend const_iterator end(StringRef path)
Get end iterator over path.
LiveQueryResult Query(SlotIndex Idx) const
Query Liveness at Idx.
bool isValid() const
Returns true if this is a valid index.
Allocate memory in an ever growing pool, as if by bump-pointer.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
bool overlaps(const LiveRange &other) const
overlaps - Return true if the intersection of the two live ranges is not empty.
VNInfo * valueDefined() const
Return the value defined by this instruction, if any.
void append(const LiveRange::Segment S)
Append a segment to the list of segments.
iterator_range< pred_iterator > predecessors()
void verify() const
Walk the range and assert if any invariants fail to hold.
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
iterator erase(iterator I)
pred_iterator pred_begin()
bool isPHIDef() const
Returns true if this value is defined by a PHI instruction (or was, PHI instructions may have been el...
MachineInstr * getInstructionFromIndex(SlotIndex index) const
Returns the instruction for the given index, or null if the given index has no instruction associated...
std::vector< MachineBasicBlock * >::const_iterator const_pred_iterator
iterator find(SlotIndex Pos)
find - Return an iterator pointing to the first segment that ends after Pos, or end().
unsigned id
The ID number of this value.
void removeSegment(SlotIndex Start, SlotIndex End, bool RemoveDeadValNo=false)
Remove the specified segment from this range.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
static void determineMissingVNIs(const SlotIndexes &Indexes, LiveInterval &LI)
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
static bool isSameInstr(SlotIndex A, SlotIndex B)
isSameInstr - Return true if A and B refer to the same instruction.
MachineOperand class - Representation of each machine instruction operand.
MachineBasicBlock * getMBBFromIndex(SlotIndex index) const
Returns the basic block which the given index falls in.
std::unique_ptr< SegmentSet > segmentSet
bool isCoalescable(const MachineInstr *) const
Return true if MI is a copy instruction that will become an identity copy after coalescing.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void clearSubRanges()
Removes all subregister liveness information.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
SlotIndex getMBBEndIdx(unsigned Num) const
Returns the last index in the given basic block number.
iterator insert(iterator I, T &&Elt)
VNInfo * getValNumInfo(unsigned ValNo)
getValNumInfo - Returns pointer to the specified val#.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
SlotIndex beginIndex() const
beginIndex - Return the lowest numbered slot covered.
Representation of each machine instruction.
void print(raw_ostream &OS) const
void print(raw_ostream &) const
VNInfo * createDeadDef(SlotIndex Def, VNInfo::Allocator &VNInfoAllocator)
createDeadDef - Make sure the range has a value defined at Def.
SlotIndex endIndex() const
endNumber - return the maximum point of the range of the whole, exclusive.
void setReg(unsigned Reg)
Change the register this operand corresponds to.
static void createDeadDef(SlotIndexes &Indexes, VNInfo::Allocator &Alloc, LiveRange &LR, const MachineOperand &MO)
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
static VNInfo * searchForVNI(const SlotIndexes &Indexes, LiveRange &LR, const MachineBasicBlock *MBB, SmallPtrSetImpl< const MachineBasicBlock * > &Visited)
Helper function for constructMainRangeFromSubranges(): Search the CFG backwards until we find a place...
Helper class for performant LiveRange bulk updates.
std::set< Segment > SegmentSet
VNInfo * getNextValue(SlotIndex def, VNInfo::Allocator &VNInfoAllocator)
getNextValue - Create a new value number and return it.
This class implements an extremely fast bulk output stream that can only output to a stream...
void join(LiveRange &Other, const int *ValNoAssignments, const int *RHSValNoAssignments, SmallVectorImpl< VNInfo * > &NewVNInfo)
join - Join two live ranges (this, and other) together.
reg_iterator reg_begin(unsigned RegNo) const
bool readsReg() const
readsReg - Returns true if this operand reads the previous value of its register. ...
VNInfo * valueIn() const
Return the value that is live-in to the instruction.
SlotIndex getNextSlot() const
Returns the next slot in the index list.
bool hasSubRanges() const
Returns true if subregister liveness information is available.
static reg_iterator reg_end()
SlotIndex - An opaque wrapper around machine indexes.
reg_begin/reg_end - Provide iteration support to walk over all definitions and uses of a register wit...
bool overlapsFrom(const LiveRange &Other, const_iterator I) 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...
VNInfo * getVNInfoBefore(SlotIndex Idx) const
getVNInfoBefore - Return the VNInfo that is live up to but not necessarilly including Idx...