1 //===-- llvm/CodeGen/LiveInterval.h - Interval representation ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements the LiveRange and LiveInterval classes. Given some
11 // numbering of each the machine instructions an interval [i, j) is said to be a
12 // live interval for register v if there is no instruction with number j' >= j
13 // such that v is live at j' and there is no instruction with number i' < i such
14 // that v is live at i'. In this implementation intervals can have holes,
15 // i.e. an interval might look like [1,20), [50,65), [1000,1001). Each
16 // individual range is represented as an instance of LiveRange, and the whole
17 // interval is represented as an instance of LiveInterval.
19 //===----------------------------------------------------------------------===//
21 #ifndef LLVM_CODEGEN_LIVEINTERVAL_H
22 #define LLVM_CODEGEN_LIVEINTERVAL_H
24 #include "llvm/ADT/DenseMapInfo.h"
25 #include "llvm/ADT/SmallVector.h"
26 #include "llvm/Support/Allocator.h"
27 #include "llvm/Support/AlignOf.h"
33 class MachineRegisterInfo;
34 class TargetRegisterInfo;
37 /// MachineInstrIndex - An opaque wrapper around machine indexes.
38 class MachineInstrIndex {
40 friend class LiveInterval;
41 friend class LiveIntervals;
42 friend struct DenseMapInfo<MachineInstrIndex>;
46 enum Slot { LOAD, USE, DEF, STORE, NUM };
52 static const unsigned PHI_BIT = 1 << 31;
56 /// Construct a default MachineInstrIndex pointing to a reserved index.
57 MachineInstrIndex() : index(0) {}
59 /// Construct an index from the given index, pointing to the given slot.
60 MachineInstrIndex(MachineInstrIndex m, Slot s)
61 : index((m.index / NUM) * NUM + s) {}
63 /// Print this index to the given raw_ostream.
64 void print(raw_ostream &os) const;
66 /// Compare two MachineInstrIndex objects for equality.
67 bool operator==(MachineInstrIndex other) const {
68 return ((index & ~PHI_BIT) == (other.index & ~PHI_BIT));
70 /// Compare two MachineInstrIndex objects for inequality.
71 bool operator!=(MachineInstrIndex other) const {
72 return ((index & ~PHI_BIT) != (other.index & ~PHI_BIT));
75 /// Compare two MachineInstrIndex objects. Return true if the first index
76 /// is strictly lower than the second.
77 bool operator<(MachineInstrIndex other) const {
78 return ((index & ~PHI_BIT) < (other.index & ~PHI_BIT));
80 /// Compare two MachineInstrIndex objects. Return true if the first index
81 /// is lower than, or equal to, the second.
82 bool operator<=(MachineInstrIndex other) const {
83 return ((index & ~PHI_BIT) <= (other.index & ~PHI_BIT));
86 /// Compare two MachineInstrIndex objects. Return true if the first index
87 /// is greater than the second.
88 bool operator>(MachineInstrIndex other) const {
89 return ((index & ~PHI_BIT) > (other.index & ~PHI_BIT));
92 /// Compare two MachineInstrIndex objects. Return true if the first index
93 /// is greater than, or equal to, the second.
94 bool operator>=(MachineInstrIndex other) const {
95 return ((index & ~PHI_BIT) >= (other.index & ~PHI_BIT));
98 /// Returns true if this index represents a load.
100 return ((index % NUM) == LOAD);
103 /// Returns true if this index represents a use.
105 return ((index % NUM) == USE);
108 /// Returns true if this index represents a def.
110 return ((index % NUM) == DEF);
113 /// Returns true if this index represents a store.
114 bool isStore() const {
115 return ((index % NUM) == STORE);
118 /// Returns the slot for this MachineInstrIndex.
119 Slot getSlot() const {
120 return static_cast<Slot>(index % NUM);
123 /// Returns true if this index represents a non-PHI use/def.
124 bool isNonPHIIndex() const {
125 return ((index & PHI_BIT) == 0);
128 /// Returns true if this index represents a PHI use/def.
129 bool isPHIIndex() const {
130 return ((index & PHI_BIT) == PHI_BIT);
135 /// Construct an index from the given index, with its PHI kill marker set.
136 MachineInstrIndex(bool phi, MachineInstrIndex o) : index(o.index) {
143 explicit MachineInstrIndex(unsigned idx)
144 : index(idx & ~PHI_BIT) {}
146 MachineInstrIndex(bool phi, unsigned idx)
147 : index(idx & ~PHI_BIT) {
152 MachineInstrIndex(bool phi, unsigned idx, Slot slot)
153 : index(((idx / NUM) * NUM + slot) & ~PHI_BIT) {
158 MachineInstrIndex nextSlot_() const {
159 assert((index & PHI_BIT) == ((index + 1) & PHI_BIT) &&
160 "Index out of bounds.");
161 return MachineInstrIndex(index + 1);
164 MachineInstrIndex nextIndex_() const {
165 assert((index & PHI_BIT) == ((index + NUM) & PHI_BIT) &&
166 "Index out of bounds.");
167 return MachineInstrIndex(index + NUM);
170 MachineInstrIndex prevSlot_() const {
171 assert((index & PHI_BIT) == ((index - 1) & PHI_BIT) &&
172 "Index out of bounds.");
173 return MachineInstrIndex(index - 1);
176 MachineInstrIndex prevIndex_() const {
177 assert((index & PHI_BIT) == ((index - NUM) & PHI_BIT) &&
178 "Index out of bounds.");
179 return MachineInstrIndex(index - NUM);
182 int distance(MachineInstrIndex other) const {
183 return (other.index & ~PHI_BIT) - (index & ~PHI_BIT);
186 /// Returns an unsigned number suitable as an index into a
187 /// vector over all instructions.
188 unsigned getVecIndex() const {
189 return (index & ~PHI_BIT) / NUM;
192 /// Scale this index by the given factor.
193 MachineInstrIndex scale(unsigned factor) const {
194 unsigned i = (index & ~PHI_BIT) / NUM,
195 o = (index % ~PHI_BIT) % NUM;
196 assert(index <= (~0U & ~PHI_BIT) / (factor * NUM) &&
197 "Rescaled interval would overflow");
198 return MachineInstrIndex(i * NUM * factor, o);
201 static MachineInstrIndex emptyKey() {
202 return MachineInstrIndex(true, 0x7fffffff);
205 static MachineInstrIndex tombstoneKey() {
206 return MachineInstrIndex(true, 0x7ffffffe);
209 static unsigned getHashValue(const MachineInstrIndex &v) {
215 inline raw_ostream& operator<<(raw_ostream &os, MachineInstrIndex mi) {
220 /// Densemap specialization for MachineInstrIndex.
222 struct DenseMapInfo<MachineInstrIndex> {
223 static inline MachineInstrIndex getEmptyKey() {
224 return MachineInstrIndex::emptyKey();
226 static inline MachineInstrIndex getTombstoneKey() {
227 return MachineInstrIndex::tombstoneKey();
229 static inline unsigned getHashValue(const MachineInstrIndex &v) {
230 return MachineInstrIndex::getHashValue(v);
232 static inline bool isEqual(const MachineInstrIndex &LHS,
233 const MachineInstrIndex &RHS) {
236 static inline bool isPod() { return true; }
240 /// VNInfo - Value Number Information.
241 /// This class holds information about a machine level values, including
242 /// definition and use points.
244 /// Care must be taken in interpreting the def index of the value. The
245 /// following rules apply:
247 /// If the isDefAccurate() method returns false then def does not contain the
248 /// index of the defining MachineInstr, or even (necessarily) to a
249 /// MachineInstr at all. In general such a def index is not meaningful
250 /// and should not be used. The exception is that, for values originally
251 /// defined by PHI instructions, after PHI elimination def will contain the
252 /// index of the MBB in which the PHI originally existed. This can be used
253 /// to insert code (spills or copies) which deals with the value, which will
254 /// be live in to the block.
259 REDEF_BY_EC = 1 << 1,
262 IS_DEF_ACCURATE = 1 << 4
273 typedef SmallVector<MachineInstrIndex, 4> KillSet;
275 /// The ID number of this value.
278 /// The index of the defining instruction (if isDefAccurate() returns true).
279 MachineInstrIndex def;
284 : flags(IS_UNUSED), id(~1U) { cr.copy = 0; }
286 /// VNInfo constructor.
287 /// d is presumed to point to the actual defining instr. If it doesn't
288 /// setIsDefAccurate(false) should be called after construction.
289 VNInfo(unsigned i, MachineInstrIndex d, MachineInstr *c)
290 : flags(IS_DEF_ACCURATE), id(i), def(d) { cr.copy = c; }
292 /// VNInfo construtor, copies values from orig, except for the value number.
293 VNInfo(unsigned i, const VNInfo &orig)
294 : flags(orig.flags), cr(orig.cr), id(i), def(orig.def), kills(orig.kills)
297 /// Copy from the parameter into this VNInfo.
298 void copyFrom(VNInfo &src) {
305 /// Used for copying value number info.
306 unsigned getFlags() const { return flags; }
307 void setFlags(unsigned flags) { this->flags = flags; }
309 /// For a register interval, if this VN was definied by a copy instr
310 /// getCopy() returns a pointer to it, otherwise returns 0.
311 /// For a stack interval the behaviour of this method is undefined.
312 MachineInstr* getCopy() const { return cr.copy; }
313 /// For a register interval, set the copy member.
314 /// This method should not be called on stack intervals as it may lead to
315 /// undefined behavior.
316 void setCopy(MachineInstr *c) { cr.copy = c; }
318 /// For a stack interval, returns the reg which this stack interval was
320 /// For a register interval the behaviour of this method is undefined.
321 unsigned getReg() const { return cr.reg; }
322 /// For a stack interval, set the defining register.
323 /// This method should not be called on register intervals as it may lead
324 /// to undefined behaviour.
325 void setReg(unsigned reg) { cr.reg = reg; }
327 /// Returns true if one or more kills are PHI nodes.
328 bool hasPHIKill() const { return flags & HAS_PHI_KILL; }
329 /// Set the PHI kill flag on this value.
330 void setHasPHIKill(bool hasKill) {
332 flags |= HAS_PHI_KILL;
334 flags &= ~HAS_PHI_KILL;
337 /// Returns true if this value is re-defined by an early clobber somewhere
338 /// during the live range.
339 bool hasRedefByEC() const { return flags & REDEF_BY_EC; }
340 /// Set the "redef by early clobber" flag on this value.
341 void setHasRedefByEC(bool hasRedef) {
343 flags |= REDEF_BY_EC;
345 flags &= ~REDEF_BY_EC;
348 /// Returns true if this value is defined by a PHI instruction (or was,
349 /// PHI instrucions may have been eliminated).
350 bool isPHIDef() const { return flags & IS_PHI_DEF; }
351 /// Set the "phi def" flag on this value.
352 void setIsPHIDef(bool phiDef) {
356 flags &= ~IS_PHI_DEF;
359 /// Returns true if this value is unused.
360 bool isUnused() const { return flags & IS_UNUSED; }
361 /// Set the "is unused" flag on this value.
362 void setIsUnused(bool unused) {
369 /// Returns true if the def is accurate.
370 bool isDefAccurate() const { return flags & IS_DEF_ACCURATE; }
371 /// Set the "is def accurate" flag on this value.
372 void setIsDefAccurate(bool defAccurate) {
374 flags |= IS_DEF_ACCURATE;
376 flags &= ~IS_DEF_ACCURATE;
379 /// Returns true if the given index is a kill of this value.
380 bool isKill(MachineInstrIndex k) const {
381 KillSet::const_iterator
382 i = std::lower_bound(kills.begin(), kills.end(), k);
383 return (i != kills.end() && *i == k);
386 /// addKill - Add a kill instruction index to the specified value
388 void addKill(MachineInstrIndex k) {
393 i = std::lower_bound(kills.begin(), kills.end(), k);
398 /// Remove the specified kill index from this value's kills list.
399 /// Returns true if the value was present, otherwise returns false.
400 bool removeKill(MachineInstrIndex k) {
401 KillSet::iterator i = std::lower_bound(kills.begin(), kills.end(), k);
402 if (i != kills.end() && *i == k) {
409 /// Remove all kills in the range [s, e).
410 void removeKills(MachineInstrIndex s, MachineInstrIndex e) {
412 si = std::lower_bound(kills.begin(), kills.end(), s),
413 se = std::upper_bound(kills.begin(), kills.end(), e);
420 /// LiveRange structure - This represents a simple register range in the
421 /// program, with an inclusive start point and an exclusive end point.
422 /// These ranges are rendered as [start,end).
424 MachineInstrIndex start; // Start point of the interval (inclusive)
425 MachineInstrIndex end; // End point of the interval (exclusive)
426 VNInfo *valno; // identifier for the value contained in this interval.
428 LiveRange(MachineInstrIndex S, MachineInstrIndex E, VNInfo *V)
429 : start(S), end(E), valno(V) {
431 assert(S < E && "Cannot create empty or backwards range");
434 /// contains - Return true if the index is covered by this range.
436 bool contains(MachineInstrIndex I) const {
437 return start <= I && I < end;
440 /// containsRange - Return true if the given range, [S, E), is covered by
442 bool containsRange(MachineInstrIndex S, MachineInstrIndex E) const {
443 assert((S < E) && "Backwards interval?");
444 return (start <= S && S < end) && (start < E && E <= end);
447 bool operator<(const LiveRange &LR) const {
448 return start < LR.start || (start == LR.start && end < LR.end);
450 bool operator==(const LiveRange &LR) const {
451 return start == LR.start && end == LR.end;
455 void print(raw_ostream &os) const;
458 LiveRange(); // DO NOT IMPLEMENT
461 raw_ostream& operator<<(raw_ostream& os, const LiveRange &LR);
464 inline bool operator<(MachineInstrIndex V, const LiveRange &LR) {
468 inline bool operator<(const LiveRange &LR, MachineInstrIndex V) {
472 /// LiveInterval - This class represents some number of live ranges for a
473 /// register or value. This class also contains a bit of register allocator
478 typedef SmallVector<LiveRange,4> Ranges;
479 typedef SmallVector<VNInfo*,4> VNInfoList;
481 unsigned reg; // the register or stack slot of this interval
482 // if the top bits is set, it represents a stack slot.
483 float weight; // weight of this interval
484 Ranges ranges; // the ranges in which this register is live
485 VNInfoList valnos; // value#'s
498 LiveInterval(unsigned Reg, float Weight, bool IsSS = false)
499 : reg(Reg), weight(Weight) {
501 reg = reg | (1U << (sizeof(unsigned)*CHAR_BIT-1));
504 typedef Ranges::iterator iterator;
505 iterator begin() { return ranges.begin(); }
506 iterator end() { return ranges.end(); }
508 typedef Ranges::const_iterator const_iterator;
509 const_iterator begin() const { return ranges.begin(); }
510 const_iterator end() const { return ranges.end(); }
512 typedef VNInfoList::iterator vni_iterator;
513 vni_iterator vni_begin() { return valnos.begin(); }
514 vni_iterator vni_end() { return valnos.end(); }
516 typedef VNInfoList::const_iterator const_vni_iterator;
517 const_vni_iterator vni_begin() const { return valnos.begin(); }
518 const_vni_iterator vni_end() const { return valnos.end(); }
520 /// advanceTo - Advance the specified iterator to point to the LiveRange
521 /// containing the specified position, or end() if the position is past the
522 /// end of the interval. If no LiveRange contains this position, but the
523 /// position is in a hole, this method returns an iterator pointing the the
524 /// LiveRange immediately after the hole.
525 iterator advanceTo(iterator I, MachineInstrIndex Pos) {
526 if (Pos >= endIndex())
528 while (I->end <= Pos) ++I;
533 while (!valnos.empty()) {
534 VNInfo *VNI = valnos.back();
542 /// isStackSlot - Return true if this is a stack slot interval.
544 bool isStackSlot() const {
545 return reg & (1U << (sizeof(unsigned)*CHAR_BIT-1));
548 /// getStackSlotIndex - Return stack slot index if this is a stack slot
550 int getStackSlotIndex() const {
551 assert(isStackSlot() && "Interval is not a stack slot interval!");
552 return reg & ~(1U << (sizeof(unsigned)*CHAR_BIT-1));
555 bool hasAtLeastOneValue() const { return !valnos.empty(); }
557 bool containsOneValue() const { return valnos.size() == 1; }
559 unsigned getNumValNums() const { return (unsigned)valnos.size(); }
561 /// getValNumInfo - Returns pointer to the specified val#.
563 inline VNInfo *getValNumInfo(unsigned ValNo) {
564 return valnos[ValNo];
566 inline const VNInfo *getValNumInfo(unsigned ValNo) const {
567 return valnos[ValNo];
570 /// getNextValue - Create a new value number and return it. MIIdx specifies
571 /// the instruction that defines the value number.
572 VNInfo *getNextValue(MachineInstrIndex def, MachineInstr *CopyMI,
573 bool isDefAccurate, BumpPtrAllocator &VNInfoAllocator){
575 static_cast<VNInfo*>(VNInfoAllocator.Allocate((unsigned)sizeof(VNInfo),
577 new (VNI) VNInfo((unsigned)valnos.size(), def, CopyMI);
578 VNI->setIsDefAccurate(isDefAccurate);
579 valnos.push_back(VNI);
583 /// Create a copy of the given value. The new value will be identical except
584 /// for the Value number.
585 VNInfo *createValueCopy(const VNInfo *orig,
586 BumpPtrAllocator &VNInfoAllocator) {
588 static_cast<VNInfo*>(VNInfoAllocator.Allocate((unsigned)sizeof(VNInfo),
591 new (VNI) VNInfo((unsigned)valnos.size(), *orig);
592 valnos.push_back(VNI);
596 /// addKills - Add a number of kills into the VNInfo kill vector. If this
597 /// interval is live at a kill point, then the kill is not added.
598 void addKills(VNInfo *VNI, const VNInfo::KillSet &kills) {
599 for (unsigned i = 0, e = static_cast<unsigned>(kills.size());
601 if (!liveBeforeAndAt(kills[i])) {
602 VNI->addKill(kills[i]);
607 /// isOnlyLROfValNo - Return true if the specified live range is the only
608 /// one defined by the its val#.
609 bool isOnlyLROfValNo(const LiveRange *LR) {
610 for (const_iterator I = begin(), E = end(); I != E; ++I) {
611 const LiveRange *Tmp = I;
612 if (Tmp != LR && Tmp->valno == LR->valno)
618 /// MergeValueNumberInto - This method is called when two value nubmers
619 /// are found to be equivalent. This eliminates V1, replacing all
620 /// LiveRanges with the V1 value number with the V2 value number. This can
621 /// cause merging of V1/V2 values numbers and compaction of the value space.
622 VNInfo* MergeValueNumberInto(VNInfo *V1, VNInfo *V2);
624 /// MergeInClobberRanges - For any live ranges that are not defined in the
625 /// current interval, but are defined in the Clobbers interval, mark them
626 /// used with an unknown definition value. Caller must pass in reference to
627 /// VNInfoAllocator since it will create a new val#.
628 void MergeInClobberRanges(const LiveInterval &Clobbers,
629 BumpPtrAllocator &VNInfoAllocator);
631 /// MergeInClobberRange - Same as MergeInClobberRanges except it merge in a
632 /// single LiveRange only.
633 void MergeInClobberRange(MachineInstrIndex Start,
634 MachineInstrIndex End,
635 BumpPtrAllocator &VNInfoAllocator);
637 /// MergeValueInAsValue - Merge all of the live ranges of a specific val#
638 /// in RHS into this live interval as the specified value number.
639 /// The LiveRanges in RHS are allowed to overlap with LiveRanges in the
640 /// current interval, it will replace the value numbers of the overlaped
641 /// live ranges with the specified value number.
642 void MergeRangesInAsValue(const LiveInterval &RHS, VNInfo *LHSValNo);
644 /// MergeValueInAsValue - Merge all of the live ranges of a specific val#
645 /// in RHS into this live interval as the specified value number.
646 /// The LiveRanges in RHS are allowed to overlap with LiveRanges in the
647 /// current interval, but only if the overlapping LiveRanges have the
648 /// specified value number.
649 void MergeValueInAsValue(const LiveInterval &RHS,
650 const VNInfo *RHSValNo, VNInfo *LHSValNo);
652 /// Copy - Copy the specified live interval. This copies all the fields
653 /// except for the register of the interval.
654 void Copy(const LiveInterval &RHS, MachineRegisterInfo *MRI,
655 BumpPtrAllocator &VNInfoAllocator);
657 bool empty() const { return ranges.empty(); }
659 /// beginIndex - Return the lowest numbered slot covered by interval.
660 MachineInstrIndex beginIndex() const {
662 return MachineInstrIndex();
663 return ranges.front().start;
666 /// endNumber - return the maximum point of the interval of the whole,
668 MachineInstrIndex endIndex() const {
670 return MachineInstrIndex();
671 return ranges.back().end;
674 bool expiredAt(MachineInstrIndex index) const {
675 return index >= endIndex();
678 bool liveAt(MachineInstrIndex index) const;
680 // liveBeforeAndAt - Check if the interval is live at the index and the
681 // index just before it. If index is liveAt, check if it starts a new live
682 // range.If it does, then check if the previous live range ends at index-1.
683 bool liveBeforeAndAt(MachineInstrIndex index) const;
685 /// getLiveRangeContaining - Return the live range that contains the
686 /// specified index, or null if there is none.
687 const LiveRange *getLiveRangeContaining(MachineInstrIndex Idx) const {
688 const_iterator I = FindLiveRangeContaining(Idx);
689 return I == end() ? 0 : &*I;
692 /// getLiveRangeContaining - Return the live range that contains the
693 /// specified index, or null if there is none.
694 LiveRange *getLiveRangeContaining(MachineInstrIndex Idx) {
695 iterator I = FindLiveRangeContaining(Idx);
696 return I == end() ? 0 : &*I;
699 /// FindLiveRangeContaining - Return an iterator to the live range that
700 /// contains the specified index, or end() if there is none.
701 const_iterator FindLiveRangeContaining(MachineInstrIndex Idx) const;
703 /// FindLiveRangeContaining - Return an iterator to the live range that
704 /// contains the specified index, or end() if there is none.
705 iterator FindLiveRangeContaining(MachineInstrIndex Idx);
707 /// findDefinedVNInfo - Find the by the specified
708 /// index (register interval) or defined
709 VNInfo *findDefinedVNInfoForRegInt(MachineInstrIndex Idx) const;
711 /// findDefinedVNInfo - Find the VNInfo that's defined by the specified
712 /// register (stack inteval only).
713 VNInfo *findDefinedVNInfoForStackInt(unsigned Reg) const;
716 /// overlaps - Return true if the intersection of the two live intervals is
718 bool overlaps(const LiveInterval& other) const {
719 return overlapsFrom(other, other.begin());
722 /// overlaps - Return true if the live interval overlaps a range specified
724 bool overlaps(MachineInstrIndex Start, MachineInstrIndex End) const;
726 /// overlapsFrom - Return true if the intersection of the two live intervals
727 /// is not empty. The specified iterator is a hint that we can begin
728 /// scanning the Other interval starting at I.
729 bool overlapsFrom(const LiveInterval& other, const_iterator I) const;
731 /// addRange - Add the specified LiveRange to this interval, merging
732 /// intervals as appropriate. This returns an iterator to the inserted live
733 /// range (which may have grown since it was inserted.
734 void addRange(LiveRange LR) {
735 addRangeFrom(LR, ranges.begin());
738 /// join - Join two live intervals (this, and other) together. This applies
739 /// mappings to the value numbers in the LHS/RHS intervals as specified. If
740 /// the intervals are not joinable, this aborts.
741 void join(LiveInterval &Other, const int *ValNoAssignments,
742 const int *RHSValNoAssignments,
743 SmallVector<VNInfo*, 16> &NewVNInfo,
744 MachineRegisterInfo *MRI);
746 /// isInOneLiveRange - Return true if the range specified is entirely in the
747 /// a single LiveRange of the live interval.
748 bool isInOneLiveRange(MachineInstrIndex Start, MachineInstrIndex End);
750 /// removeRange - Remove the specified range from this interval. Note that
751 /// the range must be a single LiveRange in its entirety.
752 void removeRange(MachineInstrIndex Start, MachineInstrIndex End,
753 bool RemoveDeadValNo = false);
755 void removeRange(LiveRange LR, bool RemoveDeadValNo = false) {
756 removeRange(LR.start, LR.end, RemoveDeadValNo);
759 /// removeValNo - Remove all the ranges defined by the specified value#.
760 /// Also remove the value# from value# list.
761 void removeValNo(VNInfo *ValNo);
763 /// scaleNumbering - Renumber VNI and ranges to provide gaps for new
765 void scaleNumbering(unsigned factor);
767 /// getSize - Returns the sum of sizes of all the LiveRange's.
769 unsigned getSize() const;
771 /// ComputeJoinedWeight - Set the weight of a live interval after
772 /// Other has been merged into it.
773 void ComputeJoinedWeight(const LiveInterval &Other);
775 bool operator<(const LiveInterval& other) const {
776 const MachineInstrIndex &thisIndex = beginIndex();
777 const MachineInstrIndex &otherIndex = other.beginIndex();
778 return (thisIndex < otherIndex ||
779 (thisIndex == otherIndex && reg < other.reg));
782 void print(raw_ostream &OS, const TargetRegisterInfo *TRI = 0) const;
787 Ranges::iterator addRangeFrom(LiveRange LR, Ranges::iterator From);
788 void extendIntervalEndTo(Ranges::iterator I, MachineInstrIndex NewEnd);
789 Ranges::iterator extendIntervalStartTo(Ranges::iterator I, MachineInstrIndex NewStr);
790 LiveInterval& operator=(const LiveInterval& rhs); // DO NOT IMPLEMENT
794 inline raw_ostream &operator<<(raw_ostream &OS, const LiveInterval &LI) {