LLVM 23.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 (empty() || 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 /// Merge the segment pointed to by @p I with its immediate neighbors when
494 /// they use the same value number and touch it. @p I must be a valid
495 /// iterator into this live range. Returns an iterator to the merged
496 /// segment, which may be @p I or the previous segment if @p I was merged
497 /// into it.
499
500 /// Attempt to extend a value defined after @p StartIdx to include @p Use.
501 /// Both @p StartIdx and @p Use should be in the same basic block. In case
502 /// of subranges, an extension could be prevented by an explicit "undef"
503 /// caused by a <def,read-undef> on a non-overlapping lane. The list of
504 /// location of such "undefs" should be provided in @p Undefs.
505 /// The return value is a pair: the first element is VNInfo of the value
506 /// that was extended (possibly nullptr), the second is a boolean value
507 /// indicating whether an "undef" was encountered.
508 /// If this range is live before @p Use in the basic block that starts at
509 /// @p StartIdx, and there is no intervening "undef", extend it to be live
510 /// up to @p Use, and return the pair {value, false}. If there is no
511 /// segment before @p Use and there is no "undef" between @p StartIdx and
512 /// @p Use, return {nullptr, false}. If there is an "undef" before @p Use,
513 /// return {nullptr, true}.
514 LLVM_ABI std::pair<VNInfo *, bool> extendInBlock(ArrayRef<SlotIndex> Undefs,
515 SlotIndex StartIdx,
517
518 /// Simplified version of the above "extendInBlock", which assumes that
519 /// no register lanes are undefined by <def,read-undef> operands.
520 /// If this range is live before @p Use in the basic block that starts
521 /// at @p StartIdx, extend it to be live up to @p Use, and return the
522 /// value. If there is no segment before @p Use, return nullptr.
524
525 /// join - Join two live ranges (this, and other) together. This applies
526 /// mappings to the value numbers in the LHS/RHS ranges as specified. If
527 /// the ranges are not joinable, this aborts.
528 LLVM_ABI void join(LiveRange &Other, const int *ValNoAssignments,
529 const int *RHSValNoAssignments,
530 SmallVectorImpl<VNInfo *> &NewVNInfo);
531
532 /// True iff this segment is a single segment that lies between the
533 /// specified boundaries, exclusively. Vregs live across a backedge are not
534 /// considered local. The boundaries are expected to lie within an extended
535 /// basic block, so vregs that are not live out should contain no holes.
536 bool isLocal(SlotIndex Start, SlotIndex End) const {
537 return beginIndex() > Start.getBaseIndex() &&
538 endIndex() < End.getBoundaryIndex();
539 }
540
541 /// Remove the specified interval from this live range.
542 /// Does nothing if interval is not part of this live range.
543 /// Note that the interval must be within a single Segment in its entirety.
545 bool RemoveDeadValNo = false);
546
547 void removeSegment(Segment S, bool RemoveDeadValNo = false) {
548 removeSegment(S.start, S.end, RemoveDeadValNo);
549 }
550
551 /// Remove segment pointed to by iterator @p I from this range.
552 LLVM_ABI iterator removeSegment(iterator I, bool RemoveDeadValNo = false);
553
554 /// Mark \p ValNo for deletion if no segments in this range use it.
555 LLVM_ABI void removeValNoIfDead(VNInfo *ValNo);
556
557 /// Query Liveness at Idx.
558 /// The sub-instruction slot of Idx doesn't matter, only the instruction
559 /// it refers to is considered.
561 // Find the segment that enters the instruction.
563 const_iterator E = end();
564 if (I == E)
565 return LiveQueryResult(nullptr, nullptr, SlotIndex(), false);
566
567 // Is this an instruction live-in segment?
568 // If Idx is the start index of a basic block, include live-in segments
569 // that start at Idx.getBaseIndex().
570 VNInfo *EarlyVal = nullptr;
571 VNInfo *LateVal = nullptr;
572 SlotIndex EndPoint;
573 bool Kill = false;
574 if (I->start <= Idx.getBaseIndex()) {
575 EarlyVal = I->valno;
576 EndPoint = I->end;
577 // Move to the potentially live-out segment.
578 if (SlotIndex::isSameInstr(Idx, I->end)) {
579 Kill = true;
580 if (++I == E)
581 return LiveQueryResult(EarlyVal, LateVal, EndPoint, Kill);
582 }
583 // Special case: A PHIDef value can have its def in the middle of a
584 // segment if the value happens to be live out of the layout
585 // predecessor.
586 // Such a value is not live-in.
587 if (EarlyVal->def == Idx.getBaseIndex())
588 EarlyVal = nullptr;
589 }
590 // I now points to the segment that may be live-through, or defined by
591 // this instr. Ignore segments starting after the current instr.
592 if (!SlotIndex::isEarlierInstr(Idx, I->start)) {
593 LateVal = I->valno;
594 EndPoint = I->end;
595 }
596 return LiveQueryResult(EarlyVal, LateVal, EndPoint, Kill);
597 }
598
599 /// removeValNo - Remove all the segments defined by the specified value#.
600 /// Also remove the value# from value# list.
601 LLVM_ABI void removeValNo(VNInfo *ValNo);
602
603 /// Returns true if the live range is zero length, i.e. no live segments
604 /// span instructions. It doesn't pay to spill such a range.
605 bool isZeroLength(SlotIndexes *Indexes) const {
606 for (const Segment &S : segments)
607 if (Indexes->getNextNonNullIndex(S.start).getBaseIndex() <
608 S.end.getBaseIndex())
609 return false;
610 return true;
611 }
612
613 // Returns true if any segment in the live range contains any of the
614 // provided slot indexes. Slots which occur in holes between
615 // segments will not cause the function to return true.
617
618 bool operator<(const LiveRange& other) const {
619 const SlotIndex &thisIndex = beginIndex();
620 const SlotIndex &otherIndex = other.beginIndex();
621 return thisIndex < otherIndex;
622 }
623
624 /// Returns true if there is an explicit "undef" between @p Begin
625 /// @p End.
627 SlotIndex End) const {
628 return llvm::any_of(Undefs, [Begin, End](SlotIndex Idx) -> bool {
629 return Begin <= Idx && Idx < End;
630 });
631 }
632
633 /// Flush segment set into the regular segment vector.
634 /// The method is to be called after the live range
635 /// has been created, if use of the segment set was
636 /// activated in the constructor of the live range.
638
639 /// Stores indexes from the input index sequence R at which this LiveRange
640 /// is live to the output O iterator.
641 /// R is a range of _ascending sorted_ _random_ access iterators
642 /// to the input indexes. Indexes stored at O are ascending sorted so it
643 /// can be used directly in the subsequent search (for example for
644 /// subranges). Returns true if found at least one index.
645 template <typename Range, typename OutputIt>
646 bool findIndexesLiveAt(Range &&R, OutputIt O) const {
648 auto Idx = R.begin(), EndIdx = R.end();
649 auto Seg = segments.begin(), EndSeg = segments.end();
650 bool Found = false;
651 while (Idx != EndIdx && Seg != EndSeg) {
652 // if the Seg is lower find first segment that is above Idx using binary
653 // search
654 if (Seg->end <= *Idx) {
655 Seg =
656 std::upper_bound(++Seg, EndSeg, *Idx, [=](auto V, const auto &S) {
657 return V < S.end;
658 });
659 if (Seg == EndSeg)
660 break;
661 }
662 auto NotLessStart = std::lower_bound(Idx, EndIdx, Seg->start);
663 if (NotLessStart == EndIdx)
664 break;
665 auto NotLessEnd = std::lower_bound(NotLessStart, EndIdx, Seg->end);
666 if (NotLessEnd != NotLessStart) {
667 Found = true;
668 O = std::copy(NotLessStart, NotLessEnd, O);
669 }
670 Idx = NotLessEnd;
671 ++Seg;
672 }
673 return Found;
674 }
675
676 LLVM_ABI void print(raw_ostream &OS) const;
677 LLVM_ABI void dump() const;
678
679 /// Walk the range and assert if any invariants fail to hold.
680 ///
681 /// Note that this is a no-op when asserts are disabled.
682#ifdef NDEBUG
683 [[nodiscard]] bool verify() const { return true; }
684#else
685 [[nodiscard]] bool verify() const;
686#endif
687
688 protected:
689 /// Append a segment to the list of segments.
690 LLVM_ABI void append(const LiveRange::Segment S);
691
692 private:
693 friend class LiveRangeUpdater;
694 void addSegmentToSet(Segment S);
695 void markValNoForDeletion(VNInfo *V);
696 };
697
698 inline raw_ostream &operator<<(raw_ostream &OS, const LiveRange &LR) {
699 LR.print(OS);
700 return OS;
701 }
702
703 /// LiveInterval - This class represents the liveness of a register,
704 /// or stack slot.
705 class LiveInterval : public LiveRange {
706 public:
708
709 /// A live range for subregisters. The LaneMask specifies which parts of the
710 /// super register are covered by the interval.
711 /// (@sa TargetRegisterInfo::getSubRegIndexLaneMask()).
712 class SubRange : public LiveRange {
713 public:
714 SubRange *Next = nullptr;
716
717 /// Constructs a new SubRange object.
719
720 /// Constructs a new SubRange object by copying liveness from @p Other.
724
725 LLVM_ABI void print(raw_ostream &OS) const;
726 LLVM_ABI void dump() const;
727 };
728
729 private:
730 SubRange *SubRanges = nullptr; ///< Single linked list of subregister live
731 /// ranges.
732 const Register Reg; // the register or stack slot of this interval.
733 float Weight = 0.0; // weight of this interval
734
735 public:
736 Register reg() const { return Reg; }
737 float weight() const { return Weight; }
738 void incrementWeight(float Inc) { Weight += Inc; }
739 void setWeight(float Value) { Weight = Value; }
740
741 LiveInterval(Register Reg, float Weight) : Reg(Reg), Weight(Weight) {}
742
746
747 template<typename T>
749 T *P;
750
751 public:
753 using value_type = T;
754 using pointer = T *;
755 using reference = T &;
756 using iterator_category = std::forward_iterator_tag;
757
759
761 P = P->Next;
762 return *this;
763 }
765 SingleLinkedListIterator res = *this;
766 ++*this;
767 return res;
768 }
770 return P != Other.operator->();
771 }
773 return P == Other.operator->();
774 }
775 T &operator*() const {
776 return *P;
777 }
778 T *operator->() const {
779 return P;
780 }
781 };
782
785
787 return subrange_iterator(SubRanges);
788 }
790 return subrange_iterator(nullptr);
791 }
792
794 return const_subrange_iterator(SubRanges);
795 }
799
803
807
808 /// Creates a new empty subregister live range. The range is added at the
809 /// beginning of the subrange list; subrange iterators stay valid.
811 LaneBitmask LaneMask) {
812 SubRange *Range = new (Allocator) SubRange(LaneMask);
813 appendSubRange(Range);
814 return Range;
815 }
816
817 /// Like createSubRange() but the new range is filled with a copy of the
818 /// liveness information in @p CopyFrom.
820 LaneBitmask LaneMask,
821 const LiveRange &CopyFrom) {
822 SubRange *Range = new (Allocator) SubRange(LaneMask, CopyFrom, Allocator);
823 appendSubRange(Range);
824 return Range;
825 }
826
827 /// Returns true if subregister liveness information is available.
828 bool hasSubRanges() const {
829 return SubRanges != nullptr;
830 }
831
832 /// Removes all subregister liveness information.
834
835 /// Removes all subranges without any segments (subranges without segments
836 /// are not considered valid and should only exist temporarily).
838
839 /// getSize - Returns the sum of sizes of all the LiveRange's.
840 ///
841 LLVM_ABI unsigned getSize() const;
842
843 /// isSpillable - Can this interval be spilled?
844 bool isSpillable() const { return Weight != huge_valf; }
845
846 /// markNotSpillable - Mark interval as not spillable
847 void markNotSpillable() { Weight = huge_valf; }
848
849 /// For a given lane mask @p LaneMask, compute indexes at which the
850 /// lane is marked undefined by subregister <def,read-undef> definitions.
852 LaneBitmask LaneMask,
853 const MachineRegisterInfo &MRI,
854 const SlotIndexes &Indexes) const;
855
856 /// Refines the subranges to support \p LaneMask. This may only be called
857 /// for LI.hasSubrange()==true. Subregister ranges are split or created
858 /// until \p LaneMask can be matched exactly. \p Mod is executed on the
859 /// matching subranges.
860 ///
861 /// Example:
862 /// Given an interval with subranges with lanemasks L0F00, L00F0 and
863 /// L000F, refining for mask L0018. Will split the L00F0 lane into
864 /// L00E0 and L0010 and the L000F lane into L0007 and L0008. The Mod
865 /// function will be applied to the L0010 and L0008 subranges.
866 ///
867 /// \p Indexes and \p TRI are required to clean up the VNIs that
868 /// don't define the related lane masks after they get shrunk. E.g.,
869 /// when L000F gets split into L0007 and L0008 maybe only a subset
870 /// of the VNIs that defined L000F defines L0007.
871 ///
872 /// The clean up of the VNIs need to look at the actual instructions
873 /// to decide what is or is not live at a definition point. If the
874 /// update of the subranges occurs while the IR does not reflect these
875 /// changes, \p ComposeSubRegIdx can be used to specify how the
876 /// definition are going to be rewritten.
877 /// E.g., let say we want to merge:
878 /// V1.sub1:<2 x s32> = COPY V2.sub3:<4 x s32>
879 /// We do that by choosing a class where sub1:<2 x s32> and sub3:<4 x s32>
880 /// overlap, i.e., by choosing a class where we can find "offset + 1 == 3".
881 /// Put differently we align V2's sub3 with V1's sub1:
882 /// V2: sub0 sub1 sub2 sub3
883 /// V1: <offset> sub0 sub1
884 ///
885 /// This offset will look like a composed subregidx in the class:
886 /// V1.(composed sub2 with sub1):<4 x s32> = COPY V2.sub3:<4 x s32>
887 /// => V1.(composed sub2 with sub1):<4 x s32> = COPY V2.sub3:<4 x s32>
888 ///
889 /// Now if we didn't rewrite the uses and def of V1, all the checks for V1
890 /// need to account for this offset.
891 /// This happens during coalescing where we update the live-ranges while
892 /// still having the old IR around because updating the IR on-the-fly
893 /// would actually clobber some information on how the live-ranges that
894 /// are being updated look like.
895 LLVM_ABI void
897 std::function<void(LiveInterval::SubRange &)> Apply,
898 const SlotIndexes &Indexes, const TargetRegisterInfo &TRI,
899 unsigned ComposeSubRegIdx = 0);
900
901 bool operator<(const LiveInterval& other) const {
902 const SlotIndex &thisIndex = beginIndex();
903 const SlotIndex &otherIndex = other.beginIndex();
904 return std::tie(thisIndex, Reg) < std::tie(otherIndex, other.Reg);
905 }
906
907 LLVM_ABI void print(raw_ostream &OS) const;
908 LLVM_ABI void dump() const;
909
910 /// Walks the interval and assert if any invariants fail to hold.
911 ///
912 /// Note that this is a no-op when asserts are disabled.
913#ifdef NDEBUG
914 [[nodiscard]] bool verify(const MachineRegisterInfo *MRI = nullptr) const {
915 return true;
916 }
917#else
918 [[nodiscard]] bool verify(const MachineRegisterInfo *MRI = nullptr) const;
919#endif
920
921 private:
922 /// Appends @p Range to SubRanges list.
923 void appendSubRange(SubRange *Range) {
924 Range->Next = SubRanges;
925 SubRanges = Range;
926 }
927
928 /// Free memory held by SubRange.
929 void freeSubRange(SubRange *S);
930 };
931
933 const LiveInterval::SubRange &SR) {
934 SR.print(OS);
935 return OS;
936 }
937
939 LI.print(OS);
940 return OS;
941 }
942
943 LLVM_ABI raw_ostream &operator<<(raw_ostream &OS,
944 const LiveRange::Segment &S);
945
946 inline bool operator<(SlotIndex V, const LiveRange::Segment &S) {
947 return V < S.start;
948 }
949
950 inline bool operator<(const LiveRange::Segment &S, SlotIndex V) {
951 return S.start < V;
952 }
953
954 /// Helper class for performant LiveRange bulk updates.
955 ///
956 /// Calling LiveRange::addSegment() repeatedly can be expensive on large
957 /// live ranges because segments after the insertion point may need to be
958 /// shifted. The LiveRangeUpdater class can defer the shifting when adding
959 /// many segments in order.
960 ///
961 /// The LiveRange will be in an invalid state until flush() is called.
963 LiveRange *LR;
964 SlotIndex LastStart;
965 LiveRange::iterator WriteI;
968 void mergeSpills();
969
970 public:
971 /// Create a LiveRangeUpdater for adding segments to LR.
972 /// LR will temporarily be in an invalid state until flush() is called.
973 LiveRangeUpdater(LiveRange *lr = nullptr) : LR(lr) {}
974
976
977 /// Add a segment to LR and coalesce when possible, just like
978 /// LR.addSegment(). Segments should be added in increasing start order for
979 /// best performance.
981
982 void add(SlotIndex Start, SlotIndex End, VNInfo *VNI) {
983 add(LiveRange::Segment(Start, End, VNI));
984 }
985
986 /// Return true if the LR is currently in an invalid state, and flush()
987 /// needs to be called.
988 bool isDirty() const { return LastStart.isValid(); }
989
990 /// Flush the updater state to LR so it is valid and contains all added
991 /// segments.
992 LLVM_ABI void flush();
993
994 /// Select a different destination live range.
995 void setDest(LiveRange *lr) {
996 if (LR != lr && isDirty())
997 flush();
998 LR = lr;
999 }
1000
1001 /// Get the current destination live range.
1002 LiveRange *getDest() const { return LR; }
1003
1004 LLVM_ABI void dump() const;
1005 LLVM_ABI void print(raw_ostream &) const;
1006 };
1007
1009 X.print(OS);
1010 return OS;
1011 }
1012
1013 /// ConnectedVNInfoEqClasses - Helper class that can divide VNInfos in a
1014 /// LiveInterval into equivalence clases of connected components. A
1015 /// LiveInterval that has multiple connected components can be broken into
1016 /// multiple LiveIntervals.
1017 ///
1018 /// Given a LiveInterval that may have multiple connected components, run:
1019 ///
1020 /// unsigned numComps = ConEQ.Classify(LI);
1021 /// if (numComps > 1) {
1022 /// // allocate numComps-1 new LiveIntervals into LIS[1..]
1023 /// ConEQ.Distribute(LIS);
1024 /// }
1025
1027 LiveIntervals &LIS;
1028 IntEqClasses EqClass;
1029
1030 public:
1031 explicit ConnectedVNInfoEqClasses(LiveIntervals &lis) : LIS(lis) {}
1032
1033 /// Classify the values in \p LR into connected components.
1034 /// Returns the number of connected components.
1035 LLVM_ABI unsigned Classify(const LiveRange &LR);
1036
1037 /// getEqClass - Classify creates equivalence classes numbered 0..N. Return
1038 /// the equivalence class assigned the VNI.
1039 unsigned getEqClass(const VNInfo *VNI) const { return EqClass[VNI->id]; }
1040
1041 /// Distribute values in \p LI into a separate LiveIntervals
1042 /// for each connected component. LIV must have an empty LiveInterval for
1043 /// each additional connected component. The first connected component is
1044 /// left in \p LI.
1046 MachineRegisterInfo &MRI);
1047 };
1048
1049} // end namespace llvm
1050
1051#endif // LLVM_CODEGEN_LIVEINTERVAL_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the BumpPtrAllocator interface.
#define X(NUM, ENUM, NAME)
Definition ELF.h:856
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define LLVM_ABI
Definition Compiler.h:215
Equivalence classes for small integers.
A common definition of LaneBitmask for use in TableGen and CodeGen.
#define I(x, y, z)
Definition MD5.cpp:57
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.
Value * RHS
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
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.
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
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:20
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:360
@ Kill
The last use of a register.
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:1746
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:1970
@ 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)
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:390
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:860
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