LLVM 22.0.0git
LiveInterval.h
Go to the documentation of this file.
1//===- llvm/CodeGen/LiveInterval.h - Interval representation ----*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file implements the LiveRange and LiveInterval classes. Given some
10// numbering of each the machine instructions an interval [i, j) is said to be a
11// live range for register v if there is no instruction with number j' >= j
12// such that v is live at j' and there is no instruction with number i' < i such
13// that v is live at i'. In this implementation ranges can have holes,
14// i.e. a range might look like [1,20), [50,65), [1000,1001). Each
15// individual segment is represented as an instance of LiveRange::Segment,
16// and the whole range is represented as an instance of LiveRange.
17//
18//===----------------------------------------------------------------------===//
19
20#ifndef LLVM_CODEGEN_LIVEINTERVAL_H
21#define LLVM_CODEGEN_LIVEINTERVAL_H
22
23#include "llvm/ADT/ArrayRef.h"
25#include "llvm/ADT/STLExtras.h"
30#include "llvm/MC/LaneBitmask.h"
34#include <algorithm>
35#include <cassert>
36#include <cstddef>
37#include <functional>
38#include <memory>
39#include <set>
40#include <tuple>
41#include <utility>
42
43namespace llvm {
44
45 class CoalescerPair;
46 class LiveIntervals;
48 class raw_ostream;
49
50 /// VNInfo - Value Number Information.
51 /// This class holds information about a machine level values, including
52 /// definition and use points.
53 ///
54 class VNInfo {
55 public:
57
58 /// The ID number of this value.
59 unsigned id;
60
61 /// The index of the defining instruction.
63
64 /// VNInfo constructor.
65 VNInfo(unsigned i, SlotIndex d) : id(i), def(d) {}
66
67 /// VNInfo constructor, copies values from orig, except for the value number.
68 VNInfo(unsigned i, const VNInfo &orig) : id(i), def(orig.def) {}
69
70 /// Copy from the parameter into this VNInfo.
71 void copyFrom(VNInfo &src) {
72 def = src.def;
73 }
74
75 /// Returns true if this value is defined by a PHI instruction (or was,
76 /// PHI instructions may have been eliminated).
77 /// PHI-defs begin at a block boundary, all other defs begin at register or
78 /// EC slots.
79 bool isPHIDef() const { return def.isBlock(); }
80
81 /// Returns true if this value is unused.
82 bool isUnused() const { return !def.isValid(); }
83
84 /// Mark this value as unused.
85 void markUnused() { def = SlotIndex(); }
86
87 LLVM_ABI void print(raw_ostream &OS) const;
88 LLVM_ABI void dump() const;
89 };
90
91 inline raw_ostream &operator<<(raw_ostream &OS, const VNInfo &VNI) {
92 VNI.print(OS);
93 return OS;
94 }
95
96 /// Result of a LiveRange query. This class hides the implementation details
97 /// of live ranges, and it should be used as the primary interface for
98 /// examining live ranges around instructions.
100 VNInfo *const EarlyVal;
101 VNInfo *const LateVal;
102 const SlotIndex EndPoint;
103 const bool Kill;
104
105 public:
106 LiveQueryResult(VNInfo *EarlyVal, VNInfo *LateVal, SlotIndex EndPoint,
107 bool Kill)
108 : EarlyVal(EarlyVal), LateVal(LateVal), EndPoint(EndPoint), Kill(Kill)
109 {}
110
111 /// Return the value that is live-in to the instruction. This is the value
112 /// that will be read by the instruction's use operands. Return NULL if no
113 /// value is live-in.
114 VNInfo *valueIn() const {
115 return EarlyVal;
116 }
117
118 /// Return true if the live-in value is killed by this instruction. This
119 /// means that either the live range ends at the instruction, or it changes
120 /// value.
121 bool isKill() const {
122 return Kill;
123 }
124
125 /// Return true if this instruction has a dead def.
126 bool isDeadDef() const {
127 return EndPoint.isDead();
128 }
129
130 /// Return the value leaving the instruction, if any. This can be a
131 /// live-through value, or a live def. A dead def returns NULL.
132 VNInfo *valueOut() const {
133 return isDeadDef() ? nullptr : LateVal;
134 }
135
136 /// Returns the value alive at the end of the instruction, if any. This can
137 /// be a live-through value, a live def or a dead def.
139 return LateVal;
140 }
141
142 /// Return the value defined by this instruction, if any. This includes
143 /// dead defs, it is the value created by the instruction's def operands.
145 return EarlyVal == LateVal ? nullptr : LateVal;
146 }
147
148 /// Return the end point of the last live range segment to interact with
149 /// the instruction, if any.
150 ///
151 /// The end point is an invalid SlotIndex only if the live range doesn't
152 /// intersect the instruction at all.
153 ///
154 /// The end point may be at or past the end of the instruction's basic
155 /// block. That means the value was live out of the block.
157 return EndPoint;
158 }
159 };
160
161 /// This class represents the liveness of a register, stack slot, etc.
162 /// It manages an ordered list of Segment objects.
163 /// The Segments are organized in a static single assignment form: At places
164 /// where a new value is defined or different values reach a CFG join a new
165 /// segment with a new value number is used.
166 class LiveRange {
167 public:
168 /// This represents a simple continuous liveness interval for a value.
169 /// The start point is inclusive, the end point exclusive. These intervals
170 /// are rendered as [start,end).
171 struct Segment {
172 SlotIndex start; // Start point of the interval (inclusive)
173 SlotIndex end; // End point of the interval (exclusive)
174 VNInfo *valno = nullptr; // identifier for the value contained in this
175 // segment.
176
177 Segment() = default;
178
180 : start(S), end(E), valno(V) {
181 assert(S < E && "Cannot create empty or backwards segment");
182 }
183
184 /// Return true if the index is covered by this segment.
185 bool contains(SlotIndex I) const {
186 return start <= I && I < end;
187 }
188
189 /// Return true if the given interval, [S, E), is covered by this segment.
191 assert((S < E) && "Backwards interval?");
192 return (start <= S && S < end) && (start < E && E <= end);
193 }
194
195 bool operator<(const Segment &Other) const {
196 return std::tie(start, end) < std::tie(Other.start, Other.end);
197 }
198 bool operator==(const Segment &Other) const {
199 return start == Other.start && end == Other.end;
200 }
201
202 bool operator!=(const Segment &Other) const {
203 return !(*this == Other);
204 }
205
206 LLVM_ABI void dump() const;
207 };
208
211
212 Segments segments; // the liveness segments
213 VNInfoList valnos; // value#'s
214
215 // The segment set is used temporarily to accelerate initial computation
216 // of live ranges of physical registers in computeRegUnitRange.
217 // After that the set is flushed to the segment vector and deleted.
218 using SegmentSet = std::set<Segment>;
219 std::unique_ptr<SegmentSet> segmentSet;
220
223
224 iterator begin() { return segments.begin(); }
225 iterator end() { return segments.end(); }
226
227 const_iterator begin() const { return segments.begin(); }
228 const_iterator end() const { return segments.end(); }
229
232
233 vni_iterator vni_begin() { return valnos.begin(); }
234 vni_iterator vni_end() { return valnos.end(); }
235
236 const_vni_iterator vni_begin() const { return valnos.begin(); }
237 const_vni_iterator vni_end() const { return valnos.end(); }
238
242
246
247 /// Constructs a new LiveRange object.
248 LiveRange(bool UseSegmentSet = false)
249 : segmentSet(UseSegmentSet ? std::make_unique<SegmentSet>()
250 : nullptr) {}
251
252 /// Constructs a new LiveRange object by copying segments and valnos from
253 /// another LiveRange.
255 assert(Other.segmentSet == nullptr &&
256 "Copying of LiveRanges with active SegmentSets is not supported");
258 }
259
260 /// Copies values numbers and live segments from \p Other into this range.
262 if (this == &Other)
263 return;
264
265 assert(Other.segmentSet == nullptr &&
266 "Copying of LiveRanges with active SegmentSets is not supported");
267 // Duplicate valnos.
268 for (const VNInfo *VNI : Other.valnos)
270 // Now we can copy segments and remap their valnos.
271 for (const Segment &S : Other.segments)
272 segments.push_back(Segment(S.start, S.end, valnos[S.valno->id]));
273 }
274
275 /// advanceTo - Advance the specified iterator to point to the Segment
276 /// containing the specified position, or end() if the position is past the
277 /// end of the range. If no Segment contains this position, but the
278 /// position is in a hole, this method returns an iterator pointing to the
279 /// Segment immediately after the hole.
281 assert(I != end());
282 if (Pos >= endIndex())
283 return end();
284 while (I->end <= Pos) ++I;
285 return I;
286 }
287
289 assert(I != end());
290 if (Pos >= endIndex())
291 return end();
292 while (I->end <= Pos) ++I;
293 return I;
294 }
295
296 /// find - Return an iterator pointing to the first segment that ends after
297 /// Pos, or end(). This is the same as advanceTo(begin(), Pos), but faster
298 /// when searching large ranges.
299 ///
300 /// If Pos is contained in a Segment, that segment is returned.
301 /// If Pos is in a hole, the following Segment is returned.
302 /// If Pos is beyond endIndex, end() is returned.
304
306 return const_cast<LiveRange*>(this)->find(Pos);
307 }
308
309 void clear() {
310 valnos.clear();
311 segments.clear();
312 }
313
314 size_t size() const {
315 return segments.size();
316 }
317
318 bool hasAtLeastOneValue() const { return !valnos.empty(); }
319
320 bool containsOneValue() const { return valnos.size() == 1; }
321
322 unsigned getNumValNums() const { return (unsigned)valnos.size(); }
323
324 /// getValNumInfo - Returns pointer to the specified val#.
325 ///
326 inline VNInfo *getValNumInfo(unsigned ValNo) {
327 return valnos[ValNo];
328 }
329 inline const VNInfo *getValNumInfo(unsigned ValNo) const {
330 return valnos[ValNo];
331 }
332
333 /// containsValue - Returns true if VNI belongs to this range.
334 bool containsValue(const VNInfo *VNI) const {
335 return VNI && VNI->id < getNumValNums() && VNI == getValNumInfo(VNI->id);
336 }
337
338 /// getNextValue - Create a new value number and return it.
339 /// @p Def is the index of instruction that defines the value number.
341 VNInfo *VNI =
342 new (VNInfoAllocator) VNInfo((unsigned)valnos.size(), Def);
343 valnos.push_back(VNI);
344 return VNI;
345 }
346
347 /// createDeadDef - Make sure the range has a value defined at Def.
348 /// If one already exists, return it. Otherwise allocate a new value and
349 /// add liveness for a dead def.
351
352 /// Create a def of value @p VNI. Return @p VNI. If there already exists
353 /// a definition at VNI->def, the value defined there must be @p VNI.
355
356 /// Create a copy of the given value. The new value will be identical except
357 /// for the Value number.
359 VNInfo::Allocator &VNInfoAllocator) {
360 VNInfo *VNI =
361 new (VNInfoAllocator) VNInfo((unsigned)valnos.size(), *orig);
362 valnos.push_back(VNI);
363 return VNI;
364 }
365
366 /// RenumberValues - Renumber all values in order of appearance and remove
367 /// unused values.
369
370 /// MergeValueNumberInto - This method is called when two value numbers
371 /// are found to be equivalent. This eliminates V1, replacing all
372 /// segments with the V1 value number with the V2 value number. This can
373 /// cause merging of V1/V2 values numbers and compaction of the value space.
375
376 /// Merge all of the live segments of a specific val# in RHS into this live
377 /// range as the specified value number. The segments in RHS are allowed
378 /// to overlap with segments in the current range, it will replace the
379 /// value numbers of the overlaped live segments with the specified value
380 /// number.
382 VNInfo *LHSValNo);
383
384 /// MergeValueInAsValue - Merge all of the segments of a specific val#
385 /// in RHS into this live range as the specified value number.
386 /// The segments in RHS are allowed to overlap with segments in the
387 /// current range, but only if the overlapping segments have the
388 /// specified value number.
390 const VNInfo *RHSValNo, VNInfo *LHSValNo);
391
392 bool empty() const { return segments.empty(); }
393
394 /// beginIndex - Return the lowest numbered slot covered.
396 assert(!empty() && "Call to beginIndex() on empty range.");
397 return segments.front().start;
398 }
399
400 /// endNumber - return the maximum point of the range of the whole,
401 /// exclusive.
403 assert(!empty() && "Call to endIndex() on empty range.");
404 return segments.back().end;
405 }
406
407 bool expiredAt(SlotIndex index) const {
408 return index >= endIndex();
409 }
410
411 bool liveAt(SlotIndex index) const {
412 const_iterator r = find(index);
413 return r != end() && r->start <= index;
414 }
415
416 /// Return the segment that contains the specified index, or null if there
417 /// is none.
420 return I == end() ? nullptr : &*I;
421 }
422
423 /// Return the live segment that contains the specified index, or null if
424 /// there is none.
427 return I == end() ? nullptr : &*I;
428 }
429
430 /// getVNInfoAt - Return the VNInfo that is live at Idx, or NULL.
433 return I == end() ? nullptr : I->valno;
434 }
435
436 /// getVNInfoBefore - Return the VNInfo that is live up to but not
437 /// necessarily including Idx, or NULL. Use this to find the reaching def
438 /// used by an instruction at this SlotIndex position.
441 return I == end() ? nullptr : I->valno;
442 }
443
444 /// Return an iterator to the segment that contains the specified index, or
445 /// end() if there is none.
447 iterator I = find(Idx);
448 return I != end() && I->start <= Idx ? I : end();
449 }
450
452 const_iterator I = find(Idx);
453 return I != end() && I->start <= Idx ? I : end();
454 }
455
456 /// overlaps - Return true if the intersection of the two live ranges is
457 /// not empty.
458 bool overlaps(const LiveRange &other) const {
459 if (other.empty())
460 return false;
461 return overlapsFrom(other, other.begin());
462 }
463
464 /// overlaps - Return true if the two ranges have overlapping segments
465 /// that are not coalescable according to CP.
466 ///
467 /// Overlapping segments where one range is defined by a coalescable
468 /// copy are allowed.
469 LLVM_ABI bool overlaps(const LiveRange &Other, const CoalescerPair &CP,
470 const SlotIndexes &) const;
471
472 /// overlaps - Return true if the live range overlaps an interval specified
473 /// by [Start, End).
474 LLVM_ABI bool overlaps(SlotIndex Start, SlotIndex End) const;
475
476 /// overlapsFrom - Return true if the intersection of the two live ranges
477 /// is not empty. The specified iterator is a hint that we can begin
478 /// scanning the Other range starting at I.
480 const_iterator StartPos) const;
481
482 /// Returns true if all segments of the @p Other live range are completely
483 /// covered by this live range.
484 /// Adjacent live ranges do not affect the covering:the liverange
485 /// [1,5](5,10] covers (3,7].
486 LLVM_ABI bool covers(const LiveRange &Other) const;
487
488 /// Add the specified Segment to this range, merging segments as
489 /// appropriate. This returns an iterator to the inserted segment (which
490 /// may have grown since it was inserted).
491 LLVM_ABI iterator addSegment(Segment S);
492
493 /// Attempt to extend a value defined after @p StartIdx to include @p Use.
494 /// Both @p StartIdx and @p Use should be in the same basic block. In case
495 /// of subranges, an extension could be prevented by an explicit "undef"
496 /// caused by a <def,read-undef> on a non-overlapping lane. The list of
497 /// location of such "undefs" should be provided in @p Undefs.
498 /// The return value is a pair: the first element is VNInfo of the value
499 /// that was extended (possibly nullptr), the second is a boolean value
500 /// indicating whether an "undef" was encountered.
501 /// If this range is live before @p Use in the basic block that starts at
502 /// @p StartIdx, and there is no intervening "undef", extend it to be live
503 /// up to @p Use, and return the pair {value, false}. If there is no
504 /// segment before @p Use and there is no "undef" between @p StartIdx and
505 /// @p Use, return {nullptr, false}. If there is an "undef" before @p Use,
506 /// return {nullptr, true}.
507 LLVM_ABI std::pair<VNInfo *, bool> extendInBlock(ArrayRef<SlotIndex> Undefs,
508 SlotIndex StartIdx,
509 SlotIndex Kill);
510
511 /// Simplified version of the above "extendInBlock", which assumes that
512 /// no register lanes are undefined by <def,read-undef> operands.
513 /// If this range is live before @p Use in the basic block that starts
514 /// at @p StartIdx, extend it to be live up to @p Use, and return the
515 /// value. If there is no segment before @p Use, return nullptr.
517
518 /// join - Join two live ranges (this, and other) together. This applies
519 /// mappings to the value numbers in the LHS/RHS ranges as specified. If
520 /// the ranges are not joinable, this aborts.
521 LLVM_ABI void join(LiveRange &Other, const int *ValNoAssignments,
522 const int *RHSValNoAssignments,
523 SmallVectorImpl<VNInfo *> &NewVNInfo);
524
525 /// True iff this segment is a single segment that lies between the
526 /// specified boundaries, exclusively. Vregs live across a backedge are not
527 /// considered local. The boundaries are expected to lie within an extended
528 /// basic block, so vregs that are not live out should contain no holes.
529 bool isLocal(SlotIndex Start, SlotIndex End) const {
530 return beginIndex() > Start.getBaseIndex() &&
531 endIndex() < End.getBoundaryIndex();
532 }
533
534 /// Remove the specified interval from this live range.
535 /// Does nothing if interval is not part of this live range.
536 /// Note that the interval must be within a single Segment in its entirety.
538 bool RemoveDeadValNo = false);
539
540 void removeSegment(Segment S, bool RemoveDeadValNo = false) {
541 removeSegment(S.start, S.end, RemoveDeadValNo);
542 }
543
544 /// Remove segment pointed to by iterator @p I from this range.
545 LLVM_ABI iterator removeSegment(iterator I, bool RemoveDeadValNo = false);
546
547 /// Mark \p ValNo for deletion if no segments in this range use it.
548 LLVM_ABI void removeValNoIfDead(VNInfo *ValNo);
549
550 /// Query Liveness at Idx.
551 /// The sub-instruction slot of Idx doesn't matter, only the instruction
552 /// it refers to is considered.
554 // Find the segment that enters the instruction.
556 const_iterator E = end();
557 if (I == E)
558 return LiveQueryResult(nullptr, nullptr, SlotIndex(), false);
559
560 // Is this an instruction live-in segment?
561 // If Idx is the start index of a basic block, include live-in segments
562 // that start at Idx.getBaseIndex().
563 VNInfo *EarlyVal = nullptr;
564 VNInfo *LateVal = nullptr;
565 SlotIndex EndPoint;
566 bool Kill = false;
567 if (I->start <= Idx.getBaseIndex()) {
568 EarlyVal = I->valno;
569 EndPoint = I->end;
570 // Move to the potentially live-out segment.
571 if (SlotIndex::isSameInstr(Idx, I->end)) {
572 Kill = true;
573 if (++I == E)
574 return LiveQueryResult(EarlyVal, LateVal, EndPoint, Kill);
575 }
576 // Special case: A PHIDef value can have its def in the middle of a
577 // segment if the value happens to be live out of the layout
578 // predecessor.
579 // Such a value is not live-in.
580 if (EarlyVal->def == Idx.getBaseIndex())
581 EarlyVal = nullptr;
582 }
583 // I now points to the segment that may be live-through, or defined by
584 // this instr. Ignore segments starting after the current instr.
585 if (!SlotIndex::isEarlierInstr(Idx, I->start)) {
586 LateVal = I->valno;
587 EndPoint = I->end;
588 }
589 return LiveQueryResult(EarlyVal, LateVal, EndPoint, Kill);
590 }
591
592 /// removeValNo - Remove all the segments defined by the specified value#.
593 /// Also remove the value# from value# list.
594 LLVM_ABI void removeValNo(VNInfo *ValNo);
595
596 /// Returns true if the live range is zero length, i.e. no live segments
597 /// span instructions. It doesn't pay to spill such a range.
598 bool isZeroLength(SlotIndexes *Indexes) const {
599 for (const Segment &S : segments)
600 if (Indexes->getNextNonNullIndex(S.start).getBaseIndex() <
601 S.end.getBaseIndex())
602 return false;
603 return true;
604 }
605
606 // Returns true if any segment in the live range contains any of the
607 // provided slot indexes. Slots which occur in holes between
608 // segments will not cause the function to return true.
610
611 bool operator<(const LiveRange& other) const {
612 const SlotIndex &thisIndex = beginIndex();
613 const SlotIndex &otherIndex = other.beginIndex();
614 return thisIndex < otherIndex;
615 }
616
617 /// Returns true if there is an explicit "undef" between @p Begin
618 /// @p End.
620 SlotIndex End) const {
621 return llvm::any_of(Undefs, [Begin, End](SlotIndex Idx) -> bool {
622 return Begin <= Idx && Idx < End;
623 });
624 }
625
626 /// Flush segment set into the regular segment vector.
627 /// The method is to be called after the live range
628 /// has been created, if use of the segment set was
629 /// activated in the constructor of the live range.
631
632 /// Stores indexes from the input index sequence R at which this LiveRange
633 /// is live to the output O iterator.
634 /// R is a range of _ascending sorted_ _random_ access iterators
635 /// to the input indexes. Indexes stored at O are ascending sorted so it
636 /// can be used directly in the subsequent search (for example for
637 /// subranges). Returns true if found at least one index.
638 template <typename Range, typename OutputIt>
639 bool findIndexesLiveAt(Range &&R, OutputIt O) const {
641 auto Idx = R.begin(), EndIdx = R.end();
642 auto Seg = segments.begin(), EndSeg = segments.end();
643 bool Found = false;
644 while (Idx != EndIdx && Seg != EndSeg) {
645 // if the Seg is lower find first segment that is above Idx using binary
646 // search
647 if (Seg->end <= *Idx) {
648 Seg =
649 std::upper_bound(++Seg, EndSeg, *Idx, [=](auto V, const auto &S) {
650 return V < S.end;
651 });
652 if (Seg == EndSeg)
653 break;
654 }
655 auto NotLessStart = std::lower_bound(Idx, EndIdx, Seg->start);
656 if (NotLessStart == EndIdx)
657 break;
658 auto NotLessEnd = std::lower_bound(NotLessStart, EndIdx, Seg->end);
659 if (NotLessEnd != NotLessStart) {
660 Found = true;
661 O = std::copy(NotLessStart, NotLessEnd, O);
662 }
663 Idx = NotLessEnd;
664 ++Seg;
665 }
666 return Found;
667 }
668
669 LLVM_ABI void print(raw_ostream &OS) const;
670 LLVM_ABI void dump() const;
671
672 /// Walk the range and assert if any invariants fail to hold.
673 ///
674 /// Note that this is a no-op when asserts are disabled.
675#ifdef NDEBUG
676 [[nodiscard]] bool verify() const { return true; }
677#else
678 [[nodiscard]] bool verify() const;
679#endif
680
681 protected:
682 /// Append a segment to the list of segments.
683 LLVM_ABI void append(const LiveRange::Segment S);
684
685 private:
686 friend class LiveRangeUpdater;
687 void addSegmentToSet(Segment S);
688 void markValNoForDeletion(VNInfo *V);
689 };
690
691 inline raw_ostream &operator<<(raw_ostream &OS, const LiveRange &LR) {
692 LR.print(OS);
693 return OS;
694 }
695
696 /// LiveInterval - This class represents the liveness of a register,
697 /// or stack slot.
698 class LiveInterval : public LiveRange {
699 public:
701
702 /// A live range for subregisters. The LaneMask specifies which parts of the
703 /// super register are covered by the interval.
704 /// (@sa TargetRegisterInfo::getSubRegIndexLaneMask()).
705 class SubRange : public LiveRange {
706 public:
707 SubRange *Next = nullptr;
709
710 /// Constructs a new SubRange object.
712
713 /// Constructs a new SubRange object by copying liveness from @p Other.
717
718 LLVM_ABI void print(raw_ostream &OS) const;
719 LLVM_ABI void dump() const;
720 };
721
722 private:
723 SubRange *SubRanges = nullptr; ///< Single linked list of subregister live
724 /// ranges.
725 const Register Reg; // the register or stack slot of this interval.
726 float Weight = 0.0; // weight of this interval
727
728 public:
729 Register reg() const { return Reg; }
730 float weight() const { return Weight; }
731 void incrementWeight(float Inc) { Weight += Inc; }
732 void setWeight(float Value) { Weight = Value; }
733
734 LiveInterval(Register Reg, float Weight) : Reg(Reg), Weight(Weight) {}
735
739
740 template<typename T>
742 T *P;
743
744 public:
746 using value_type = T;
747 using pointer = T *;
748 using reference = T &;
749 using iterator_category = std::forward_iterator_tag;
750
752
754 P = P->Next;
755 return *this;
756 }
758 SingleLinkedListIterator res = *this;
759 ++*this;
760 return res;
761 }
763 return P != Other.operator->();
764 }
766 return P == Other.operator->();
767 }
768 T &operator*() const {
769 return *P;
770 }
771 T *operator->() const {
772 return P;
773 }
774 };
775
778
780 return subrange_iterator(SubRanges);
781 }
783 return subrange_iterator(nullptr);
784 }
785
787 return const_subrange_iterator(SubRanges);
788 }
792
796
800
801 /// Creates a new empty subregister live range. The range is added at the
802 /// beginning of the subrange list; subrange iterators stay valid.
804 LaneBitmask LaneMask) {
805 SubRange *Range = new (Allocator) SubRange(LaneMask);
806 appendSubRange(Range);
807 return Range;
808 }
809
810 /// Like createSubRange() but the new range is filled with a copy of the
811 /// liveness information in @p CopyFrom.
813 LaneBitmask LaneMask,
814 const LiveRange &CopyFrom) {
815 SubRange *Range = new (Allocator) SubRange(LaneMask, CopyFrom, Allocator);
816 appendSubRange(Range);
817 return Range;
818 }
819
820 /// Returns true if subregister liveness information is available.
821 bool hasSubRanges() const {
822 return SubRanges != nullptr;
823 }
824
825 /// Removes all subregister liveness information.
827
828 /// Removes all subranges without any segments (subranges without segments
829 /// are not considered valid and should only exist temporarily).
831
832 /// getSize - Returns the sum of sizes of all the LiveRange's.
833 ///
834 LLVM_ABI unsigned getSize() const;
835
836 /// isSpillable - Can this interval be spilled?
837 bool isSpillable() const { return Weight != huge_valf; }
838
839 /// markNotSpillable - Mark interval as not spillable
840 void markNotSpillable() { Weight = huge_valf; }
841
842 /// For a given lane mask @p LaneMask, compute indexes at which the
843 /// lane is marked undefined by subregister <def,read-undef> definitions.
845 LaneBitmask LaneMask,
847 const SlotIndexes &Indexes) const;
848
849 /// Refines the subranges to support \p LaneMask. This may only be called
850 /// for LI.hasSubrange()==true. Subregister ranges are split or created
851 /// until \p LaneMask can be matched exactly. \p Mod is executed on the
852 /// matching subranges.
853 ///
854 /// Example:
855 /// Given an interval with subranges with lanemasks L0F00, L00F0 and
856 /// L000F, refining for mask L0018. Will split the L00F0 lane into
857 /// L00E0 and L0010 and the L000F lane into L0007 and L0008. The Mod
858 /// function will be applied to the L0010 and L0008 subranges.
859 ///
860 /// \p Indexes and \p TRI are required to clean up the VNIs that
861 /// don't define the related lane masks after they get shrunk. E.g.,
862 /// when L000F gets split into L0007 and L0008 maybe only a subset
863 /// of the VNIs that defined L000F defines L0007.
864 ///
865 /// The clean up of the VNIs need to look at the actual instructions
866 /// to decide what is or is not live at a definition point. If the
867 /// update of the subranges occurs while the IR does not reflect these
868 /// changes, \p ComposeSubRegIdx can be used to specify how the
869 /// definition are going to be rewritten.
870 /// E.g., let say we want to merge:
871 /// V1.sub1:<2 x s32> = COPY V2.sub3:<4 x s32>
872 /// We do that by choosing a class where sub1:<2 x s32> and sub3:<4 x s32>
873 /// overlap, i.e., by choosing a class where we can find "offset + 1 == 3".
874 /// Put differently we align V2's sub3 with V1's sub1:
875 /// V2: sub0 sub1 sub2 sub3
876 /// V1: <offset> sub0 sub1
877 ///
878 /// This offset will look like a composed subregidx in the class:
879 /// V1.(composed sub2 with sub1):<4 x s32> = COPY V2.sub3:<4 x s32>
880 /// => V1.(composed sub2 with sub1):<4 x s32> = COPY V2.sub3:<4 x s32>
881 ///
882 /// Now if we didn't rewrite the uses and def of V1, all the checks for V1
883 /// need to account for this offset.
884 /// This happens during coalescing where we update the live-ranges while
885 /// still having the old IR around because updating the IR on-the-fly
886 /// would actually clobber some information on how the live-ranges that
887 /// are being updated look like.
888 LLVM_ABI void
890 std::function<void(LiveInterval::SubRange &)> Apply,
891 const SlotIndexes &Indexes, const TargetRegisterInfo &TRI,
892 unsigned ComposeSubRegIdx = 0);
893
894 bool operator<(const LiveInterval& other) const {
895 const SlotIndex &thisIndex = beginIndex();
896 const SlotIndex &otherIndex = other.beginIndex();
897 return std::tie(thisIndex, Reg) < std::tie(otherIndex, other.Reg);
898 }
899
900 LLVM_ABI void print(raw_ostream &OS) const;
901 LLVM_ABI void dump() const;
902
903 /// Walks the interval and assert if any invariants fail to hold.
904 ///
905 /// Note that this is a no-op when asserts are disabled.
906#ifdef NDEBUG
907 [[nodiscard]] bool verify(const MachineRegisterInfo *MRI = nullptr) const {
908 return true;
909 }
910#else
911 [[nodiscard]] bool verify(const MachineRegisterInfo *MRI = nullptr) const;
912#endif
913
914 private:
915 /// Appends @p Range to SubRanges list.
916 void appendSubRange(SubRange *Range) {
917 Range->Next = SubRanges;
918 SubRanges = Range;
919 }
920
921 /// Free memory held by SubRange.
922 void freeSubRange(SubRange *S);
923 };
924
926 const LiveInterval::SubRange &SR) {
927 SR.print(OS);
928 return OS;
929 }
930
932 LI.print(OS);
933 return OS;
934 }
935
936 LLVM_ABI raw_ostream &operator<<(raw_ostream &OS,
937 const LiveRange::Segment &S);
938
939 inline bool operator<(SlotIndex V, const LiveRange::Segment &S) {
940 return V < S.start;
941 }
942
943 inline bool operator<(const LiveRange::Segment &S, SlotIndex V) {
944 return S.start < V;
945 }
946
947 /// Helper class for performant LiveRange bulk updates.
948 ///
949 /// Calling LiveRange::addSegment() repeatedly can be expensive on large
950 /// live ranges because segments after the insertion point may need to be
951 /// shifted. The LiveRangeUpdater class can defer the shifting when adding
952 /// many segments in order.
953 ///
954 /// The LiveRange will be in an invalid state until flush() is called.
956 LiveRange *LR;
957 SlotIndex LastStart;
958 LiveRange::iterator WriteI;
961 void mergeSpills();
962
963 public:
964 /// Create a LiveRangeUpdater for adding segments to LR.
965 /// LR will temporarily be in an invalid state until flush() is called.
966 LiveRangeUpdater(LiveRange *lr = nullptr) : LR(lr) {}
967
969
970 /// Add a segment to LR and coalesce when possible, just like
971 /// LR.addSegment(). Segments should be added in increasing start order for
972 /// best performance.
974
975 void add(SlotIndex Start, SlotIndex End, VNInfo *VNI) {
976 add(LiveRange::Segment(Start, End, VNI));
977 }
978
979 /// Return true if the LR is currently in an invalid state, and flush()
980 /// needs to be called.
981 bool isDirty() const { return LastStart.isValid(); }
982
983 /// Flush the updater state to LR so it is valid and contains all added
984 /// segments.
985 LLVM_ABI void flush();
986
987 /// Select a different destination live range.
988 void setDest(LiveRange *lr) {
989 if (LR != lr && isDirty())
990 flush();
991 LR = lr;
992 }
993
994 /// Get the current destination live range.
995 LiveRange *getDest() const { return LR; }
996
997 LLVM_ABI void dump() const;
998 LLVM_ABI void print(raw_ostream &) const;
999 };
1000
1002 X.print(OS);
1003 return OS;
1004 }
1005
1006 /// ConnectedVNInfoEqClasses - Helper class that can divide VNInfos in a
1007 /// LiveInterval into equivalence clases of connected components. A
1008 /// LiveInterval that has multiple connected components can be broken into
1009 /// multiple LiveIntervals.
1010 ///
1011 /// Given a LiveInterval that may have multiple connected components, run:
1012 ///
1013 /// unsigned numComps = ConEQ.Classify(LI);
1014 /// if (numComps > 1) {
1015 /// // allocate numComps-1 new LiveIntervals into LIS[1..]
1016 /// ConEQ.Distribute(LIS);
1017 /// }
1018
1020 LiveIntervals &LIS;
1021 IntEqClasses EqClass;
1022
1023 public:
1024 explicit ConnectedVNInfoEqClasses(LiveIntervals &lis) : LIS(lis) {}
1025
1026 /// Classify the values in \p LR into connected components.
1027 /// Returns the number of connected components.
1028 LLVM_ABI unsigned Classify(const LiveRange &LR);
1029
1030 /// getEqClass - Classify creates equivalence classes numbered 0..N. Return
1031 /// the equivalence class assigned the VNI.
1032 unsigned getEqClass(const VNInfo *VNI) const { return EqClass[VNI->id]; }
1033
1034 /// Distribute values in \p LI into a separate LiveIntervals
1035 /// for each connected component. LIV must have an empty LiveInterval for
1036 /// each additional connected component. The first connected component is
1037 /// left in \p LI.
1040 };
1041
1042} // end namespace llvm
1043
1044#endif // LLVM_CODEGEN_LIVEINTERVAL_H
unsigned const MachineRegisterInfo * MRI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the BumpPtrAllocator interface.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define LLVM_ABI
Definition Compiler.h:213
Equivalence classes for small integers.
A common definition of LaneBitmask for use in TableGen and CodeGen.
#define I(x, y, z)
Definition MD5.cpp:58
Register Reg
Register const TargetRegisterInfo * TRI
#define T
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
Basic Register Allocator
This file contains some templates that are useful if you are working with the STL at all.
This file defines the SmallVector class.
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")
Value * RHS
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:41
A helper class for register coalescers.
ConnectedVNInfoEqClasses(LiveIntervals &lis)
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.
SingleLinkedListIterator< T > operator++(int)
std::forward_iterator_tag iterator_category
bool operator==(const SingleLinkedListIterator< T > &Other) const
bool operator!=(const SingleLinkedListIterator< T > &Other) const
SingleLinkedListIterator< T > & operator++()
A live range for subregisters.
LLVM_ABI void print(raw_ostream &OS) const
SubRange(LaneBitmask LaneMask)
Constructs a new SubRange object.
LLVM_ABI void dump() const
SubRange(LaneBitmask LaneMask, const LiveRange &Other, BumpPtrAllocator &Allocator)
Constructs a new SubRange object by copying liveness from Other.
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...
void markNotSpillable()
markNotSpillable - Mark interval as not spillable
float weight() const
Register reg() const
bool isSpillable() const
isSpillable - Can this interval be spilled?
bool hasSubRanges() const
Returns true if subregister liveness information is available.
LLVM_ABI void dump() const
const_subrange_iterator subrange_begin() const
SingleLinkedListIterator< SubRange > subrange_iterator
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.
const_subrange_iterator subrange_end() const
void incrementWeight(float Inc)
bool operator<(const LiveInterval &other) const
LLVM_ABI void print(raw_ostream &OS) const
LiveInterval(Register Reg, float Weight)
iterator_range< const_subrange_iterator > subranges() const
subrange_iterator subrange_begin()
subrange_iterator subrange_end()
SingleLinkedListIterator< const SubRange > const_subrange_iterator
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.
void setWeight(float Value)
LLVM_ABI void clearSubRanges()
Removes all subregister liveness information.
Result of a LiveRange query.
VNInfo * valueOutOrDead() const
Returns the value alive at the end of the instruction, if any.
bool isDeadDef() const
Return true if this instruction has a dead def.
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.
SlotIndex endPoint() const
Return the end point of the last live range segment to interact with the instruction,...
LiveQueryResult(VNInfo *EarlyVal, VNInfo *LateVal, SlotIndex EndPoint, bool Kill)
bool isKill() const
Return true if the live-in value is killed by this instruction.
Helper class for performant LiveRange bulk updates.
LLVM_ABI void print(raw_ostream &) const
void setDest(LiveRange *lr)
Select a different destination live range.
LLVM_ABI void flush()
Flush the updater state to LR so it is valid and contains all added segments.
LiveRangeUpdater(LiveRange *lr=nullptr)
Create a LiveRangeUpdater for adding segments to LR.
void add(SlotIndex Start, SlotIndex End, VNInfo *VNI)
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.
LiveRange * getDest() const
Get the current destination live range.
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.
iterator_range< const_vni_iterator > vnis() const
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
const_iterator FindSegmentContaining(SlotIndex Idx) const
const Segment * getSegmentContaining(SlotIndex Idx) const
Return the segment that contains the specified index, or null if there is none.
VNInfoList::iterator vni_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...
iterator_range< vni_iterator > vnis()
const_iterator advanceTo(const_iterator I, SlotIndex Pos) const
LiveRange(const LiveRange &Other, BumpPtrAllocator &Allocator)
Constructs a new LiveRange object by copying segments and valnos from another LiveRange.
VNInfo * createValueCopy(const VNInfo *orig, VNInfo::Allocator &VNInfoAllocator)
Create a copy of the given value.
Segments::const_iterator const_iterator
bool liveAt(SlotIndex index) const
LLVM_ABI VNInfo * createDeadDef(SlotIndex Def, VNInfo::Allocator &VNIAlloc)
createDeadDef - Make sure the range has a value defined at Def.
std::set< Segment > SegmentSet
const_iterator find(SlotIndex Pos) const
const_iterator begin() const
LLVM_ABI bool isLiveAtIndexes(ArrayRef< SlotIndex > Slots) const
bool containsValue(const VNInfo *VNI) const
containsValue - Returns true if VNI belongs to this range.
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.
vni_iterator vni_begin()
iterator advanceTo(iterator I, SlotIndex Pos)
advanceTo - Advance the specified iterator to point to the Segment containing the specified position,...
bool isZeroLength(SlotIndexes *Indexes) const
Returns true if the live range is zero length, i.e.
std::unique_ptr< SegmentSet > segmentSet
LLVM_ABI void removeValNo(VNInfo *ValNo)
removeValNo - Remove all the segments defined by the specified value#.
const_vni_iterator vni_begin() const
bool empty() const
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.
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 iterat...
VNInfo * getVNInfoBefore(SlotIndex Idx) const
getVNInfoBefore - Return the VNInfo that is live up to but not necessarily including Idx,...
const_vni_iterator vni_end() const
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 expiredAt(SlotIndex index) const
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
iterator begin()
const VNInfo * getValNumInfo(unsigned ValNo) const
SlotIndex beginIndex() const
beginIndex - Return the lowest numbered slot covered.
const_iterator end() const
VNInfoList valnos
SlotIndex endIndex() const
endNumber - return the maximum point of the range of the whole, exclusive.
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 ...
Segment * getSegmentContaining(SlotIndex Idx)
Return the live segment that contains the specified index, or null if there is none.
bool isUndefIn(ArrayRef< SlotIndex > Undefs, SlotIndex Begin, SlotIndex End) const
Returns true if there is an explicit "undef" between Begin End.
bool containsOneValue() const
size_t size() const
vni_iterator vni_end()
bool hasAtLeastOneValue() const
SmallVector< Segment, 2 > Segments
VNInfoList::const_iterator const_vni_iterator
bool isLocal(SlotIndex Start, SlotIndex End) const
True iff this segment is a single segment that lies between the specified boundaries,...
VNInfo * getNextValue(SlotIndex Def, VNInfo::Allocator &VNInfoAllocator)
getNextValue - Create a new value number and return it.
iterator FindSegmentContaining(SlotIndex Idx)
Return an iterator to the segment that contains the specified index, or end() if there is none.
void assign(const LiveRange &Other, BumpPtrAllocator &Allocator)
Copies values numbers and live segments from Other into this range.
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.
void removeSegment(Segment S, bool RemoveDeadValNo=false)
LLVM_ABI void dump() const
SmallVector< VNInfo *, 2 > VNInfoList
bool operator<(const LiveRange &other) 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().
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Wrapper class representing virtual and physical registers.
Definition Register.h:19
SlotIndex - An opaque wrapper around machine indexes.
Definition SlotIndexes.h:66
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 getBoundaryIndex() const
Returns the boundary index for associated with this index.
SlotIndex getBaseIndex() const
Returns the base index for associated with this index.
SlotIndex getPrevSlot() const
Returns the previous slot in the index list.
SlotIndexes pass.
SlotIndex getNextNonNullIndex(SlotIndex Index)
Returns the next non-null index, if one exists.
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.
void copyFrom(VNInfo &src)
Copy from the parameter into this VNInfo.
LLVM_ABI void dump() const
VNInfo(unsigned i, SlotIndex d)
VNInfo constructor.
VNInfo(unsigned i, const VNInfo &orig)
VNInfo constructor, copies values from orig, except for the value number.
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...
LLVM Value Representation.
Definition Value.h:75
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
This is an optimization pass for GlobalISel generic memory operations.
bool operator<(int64_t V1, const APSInt &V2)
Definition APSInt.h:362
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1712
bool is_sorted(R &&Range, Compare C)
Wrapper function around std::is_sorted to check if elements in a range R are sorted with respect to a...
Definition STLExtras.h:1900
BumpPtrAllocatorImpl BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:383
@ Other
Any other memory.
Definition ModRef.h:68
LLVM_ABI const float huge_valf
Use this rather than HUGE_VALF; the latter causes warnings on MSVC.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:870
This represents a simple continuous liveness interval for a value.
bool operator==(const Segment &Other) const
bool containsInterval(SlotIndex S, SlotIndex E) const
Return true if the given interval, [S, E), is covered by this segment.
bool operator!=(const Segment &Other) const
Segment(SlotIndex S, SlotIndex E, VNInfo *V)
bool contains(SlotIndex I) const
Return true if the index is covered by this segment.
LLVM_ABI void dump() const
bool operator<(const Segment &Other) const