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) {
589 static_cast<VNInfo*>(VNInfoAllocator.Allocate((unsigned)sizeof(VNInfo),
592 new (VNI) VNInfo((unsigned)valnos.size(), *orig);
593 valnos.push_back(VNI);
597 /// addKills - Add a number of kills into the VNInfo kill vector. If this
598 /// interval is live at a kill point, then the kill is not added.
599 void addKills(VNInfo *VNI, const VNInfo::KillSet &kills) {
600 for (unsigned i = 0, e = static_cast<unsigned>(kills.size());
602 if (!liveBeforeAndAt(kills[i])) {
603 VNI->addKill(kills[i]);
608 /// isOnlyLROfValNo - Return true if the specified live range is the only
609 /// one defined by the its val#.
610 bool isOnlyLROfValNo(const LiveRange *LR) {
611 for (const_iterator I = begin(), E = end(); I != E; ++I) {
612 const LiveRange *Tmp = I;
613 if (Tmp != LR && Tmp->valno == LR->valno)
619 /// MergeValueNumberInto - This method is called when two value nubmers
620 /// are found to be equivalent. This eliminates V1, replacing all
621 /// LiveRanges with the V1 value number with the V2 value number. This can
622 /// cause merging of V1/V2 values numbers and compaction of the value space.
623 VNInfo* MergeValueNumberInto(VNInfo *V1, VNInfo *V2);
625 /// MergeInClobberRanges - For any live ranges that are not defined in the
626 /// current interval, but are defined in the Clobbers interval, mark them
627 /// used with an unknown definition value. Caller must pass in reference to
628 /// VNInfoAllocator since it will create a new val#.
629 void MergeInClobberRanges(const LiveInterval &Clobbers,
630 BumpPtrAllocator &VNInfoAllocator);
632 /// MergeInClobberRange - Same as MergeInClobberRanges except it merge in a
633 /// single LiveRange only.
634 void MergeInClobberRange(MachineInstrIndex Start,
635 MachineInstrIndex End,
636 BumpPtrAllocator &VNInfoAllocator);
638 /// MergeValueInAsValue - Merge all of the live ranges of a specific val#
639 /// in RHS into this live interval as the specified value number.
640 /// The LiveRanges in RHS are allowed to overlap with LiveRanges in the
641 /// current interval, it will replace the value numbers of the overlaped
642 /// live ranges with the specified value number.
643 void MergeRangesInAsValue(const LiveInterval &RHS, VNInfo *LHSValNo);
645 /// MergeValueInAsValue - Merge all of the live ranges of a specific val#
646 /// in RHS into this live interval as the specified value number.
647 /// The LiveRanges in RHS are allowed to overlap with LiveRanges in the
648 /// current interval, but only if the overlapping LiveRanges have the
649 /// specified value number.
650 void MergeValueInAsValue(const LiveInterval &RHS,
651 const VNInfo *RHSValNo, VNInfo *LHSValNo);
653 /// Copy - Copy the specified live interval. This copies all the fields
654 /// except for the register of the interval.
655 void Copy(const LiveInterval &RHS, MachineRegisterInfo *MRI,
656 BumpPtrAllocator &VNInfoAllocator);
658 bool empty() const { return ranges.empty(); }
660 /// beginIndex - Return the lowest numbered slot covered by interval.
661 MachineInstrIndex beginIndex() const {
663 return MachineInstrIndex();
664 return ranges.front().start;
667 /// endNumber - return the maximum point of the interval of the whole,
669 MachineInstrIndex endIndex() const {
671 return MachineInstrIndex();
672 return ranges.back().end;
675 bool expiredAt(MachineInstrIndex index) const {
676 return index >= endIndex();
679 bool liveAt(MachineInstrIndex index) const;
681 // liveBeforeAndAt - Check if the interval is live at the index and the
682 // index just before it. If index is liveAt, check if it starts a new live
683 // range.If it does, then check if the previous live range ends at index-1.
684 bool liveBeforeAndAt(MachineInstrIndex index) const;
686 /// getLiveRangeContaining - Return the live range that contains the
687 /// specified index, or null if there is none.
688 const LiveRange *getLiveRangeContaining(MachineInstrIndex Idx) const {
689 const_iterator I = FindLiveRangeContaining(Idx);
690 return I == end() ? 0 : &*I;
693 /// getLiveRangeContaining - Return the live range that contains the
694 /// specified index, or null if there is none.
695 LiveRange *getLiveRangeContaining(MachineInstrIndex Idx) {
696 iterator I = FindLiveRangeContaining(Idx);
697 return I == end() ? 0 : &*I;
700 /// FindLiveRangeContaining - Return an iterator to the live range that
701 /// contains the specified index, or end() if there is none.
702 const_iterator FindLiveRangeContaining(MachineInstrIndex Idx) const;
704 /// FindLiveRangeContaining - Return an iterator to the live range that
705 /// contains the specified index, or end() if there is none.
706 iterator FindLiveRangeContaining(MachineInstrIndex Idx);
708 /// findDefinedVNInfo - Find the by the specified
709 /// index (register interval) or defined
710 VNInfo *findDefinedVNInfoForRegInt(MachineInstrIndex Idx) const;
712 /// findDefinedVNInfo - Find the VNInfo that's defined by the specified
713 /// register (stack inteval only).
714 VNInfo *findDefinedVNInfoForStackInt(unsigned Reg) const;
717 /// overlaps - Return true if the intersection of the two live intervals is
719 bool overlaps(const LiveInterval& other) const {
720 return overlapsFrom(other, other.begin());
723 /// overlaps - Return true if the live interval overlaps a range specified
725 bool overlaps(MachineInstrIndex Start, MachineInstrIndex End) const;
727 /// overlapsFrom - Return true if the intersection of the two live intervals
728 /// is not empty. The specified iterator is a hint that we can begin
729 /// scanning the Other interval starting at I.
730 bool overlapsFrom(const LiveInterval& other, const_iterator I) const;
732 /// addRange - Add the specified LiveRange to this interval, merging
733 /// intervals as appropriate. This returns an iterator to the inserted live
734 /// range (which may have grown since it was inserted.
735 void addRange(LiveRange LR) {
736 addRangeFrom(LR, ranges.begin());
739 /// join - Join two live intervals (this, and other) together. This applies
740 /// mappings to the value numbers in the LHS/RHS intervals as specified. If
741 /// the intervals are not joinable, this aborts.
742 void join(LiveInterval &Other, const int *ValNoAssignments,
743 const int *RHSValNoAssignments,
744 SmallVector<VNInfo*, 16> &NewVNInfo,
745 MachineRegisterInfo *MRI);
747 /// isInOneLiveRange - Return true if the range specified is entirely in the
748 /// a single LiveRange of the live interval.
749 bool isInOneLiveRange(MachineInstrIndex Start, MachineInstrIndex End);
751 /// removeRange - Remove the specified range from this interval. Note that
752 /// the range must be a single LiveRange in its entirety.
753 void removeRange(MachineInstrIndex Start, MachineInstrIndex End,
754 bool RemoveDeadValNo = false);
756 void removeRange(LiveRange LR, bool RemoveDeadValNo = false) {
757 removeRange(LR.start, LR.end, RemoveDeadValNo);
760 /// removeValNo - Remove all the ranges defined by the specified value#.
761 /// Also remove the value# from value# list.
762 void removeValNo(VNInfo *ValNo);
764 /// scaleNumbering - Renumber VNI and ranges to provide gaps for new
766 void scaleNumbering(unsigned factor);
768 /// getSize - Returns the sum of sizes of all the LiveRange's.
770 unsigned getSize() const;
772 /// ComputeJoinedWeight - Set the weight of a live interval after
773 /// Other has been merged into it.
774 void ComputeJoinedWeight(const LiveInterval &Other);
776 bool operator<(const LiveInterval& other) const {
777 const MachineInstrIndex &thisIndex = beginIndex();
778 const MachineInstrIndex &otherIndex = other.beginIndex();
779 return (thisIndex < otherIndex ||
780 (thisIndex == otherIndex && reg < other.reg));
783 void print(raw_ostream &OS, const TargetRegisterInfo *TRI = 0) const;
788 Ranges::iterator addRangeFrom(LiveRange LR, Ranges::iterator From);
789 void extendIntervalEndTo(Ranges::iterator I, MachineInstrIndex NewEnd);
790 Ranges::iterator extendIntervalStartTo(Ranges::iterator I, MachineInstrIndex NewStr);
791 LiveInterval& operator=(const LiveInterval& rhs); // DO NOT IMPLEMENT
795 inline raw_ostream &operator<<(raw_ostream &OS, const LiveInterval &LI) {