in builds without asserts we do not need to allocate the Next pointer in "ghostly...
[oota-llvm.git] / include / llvm / CodeGen / LiveInterval.h
index 880d541e50b2facf698345959d1489cb85f8ba02..1e8202e5f4bfaed5c9c5f8ea08de64e27554b2c5 100644 (file)
@@ -145,6 +145,16 @@ namespace llvm {
       while (I->end <= Pos) ++I;
       return I;
     }
+    
+    void clear() {
+      while (!valnos.empty()) {
+        VNInfo *VNI = valnos.back();
+        valnos.pop_back();
+        VNI->~VNInfo();
+      }
+      
+      ranges.clear();
+    }
 
     /// isStackSlot - Return true if this is a stack slot interval.
     ///
@@ -261,12 +271,23 @@ namespace llvm {
         I = std::lower_bound(kills.begin(), kills.end(), KillIdx);
       return I != kills.end() && *I == KillIdx;
     }
+
+    /// isOnlyLROfValNo - Return true if the specified live range is the only
+    /// one defined by the its val#.
+    bool isOnlyLROfValNo( const LiveRange *LR) {
+      for (const_iterator I = begin(), E = end(); I != E; ++I) {
+        const LiveRange *Tmp = I;
+        if (Tmp != LR && Tmp->valno == LR->valno)
+          return false;
+      }
+      return true;
+    }
     
     /// MergeValueNumberInto - This method is called when two value nubmers
     /// are found to be equivalent.  This eliminates V1, replacing all
     /// LiveRanges with the V1 value number with the V2 value number.  This can
     /// cause merging of V1/V2 values numbers and compaction of the value space.
-    void MergeValueNumberInto(VNInfo *V1, VNInfo *V2);
+    VNInfo* MergeValueNumberInto(VNInfo *V1, VNInfo *V2);
 
     /// MergeInClobberRanges - For any live ranges that are not defined in the
     /// current interval, but are defined in the Clobbers interval, mark them
@@ -367,8 +388,12 @@ namespace llvm {
               const int *RHSValNoAssignments,
               SmallVector<VNInfo*, 16> &NewVNInfo);
 
+    /// isInOneLiveRange - Return true if the range specified is entirely in the
+    /// a single LiveRange of the live interval.
+    bool isInOneLiveRange(unsigned Start, unsigned End);
+
     /// removeRange - Remove the specified range from this interval.  Note that
-    /// the range must already be in this interval in its entirety.
+    /// the range must be a single LiveRange in its entirety.
     void removeRange(unsigned Start, unsigned End, bool RemoveDeadValNo = false);
 
     void removeRange(LiveRange LR, bool RemoveDeadValNo = false) {