[llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp LiveInterval.h

Chris Lattner lattner at cs.uiuc.edu
Sat Jul 24 23:23:11 PDT 2004



Changes in directory llvm/lib/CodeGen:

LiveInterval.cpp updated: 1.8 -> 1.9
LiveInterval.h updated: 1.7 -> 1.8

---
Log message:

Make a method const, no functionality changes



---
Diffs of the changes:  (+6 -6)

Index: llvm/lib/CodeGen/LiveInterval.cpp
diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.8 llvm/lib/CodeGen/LiveInterval.cpp:1.9
--- llvm/lib/CodeGen/LiveInterval.cpp:1.8	Sun Jul 25 00:43:53 2004
+++ llvm/lib/CodeGen/LiveInterval.cpp	Sun Jul 25 01:23:01 2004
@@ -237,10 +237,10 @@
 
 /// getLiveRangeContaining - Return the live range that contains the
 /// specified index, or null if there is none.
-LiveRange *LiveInterval::getLiveRangeContaining(unsigned Idx) {
-  Ranges::iterator It = std::upper_bound(ranges.begin(), ranges.end(), Idx);
+const LiveRange *LiveInterval::getLiveRangeContaining(unsigned Idx) const {
+  Ranges::const_iterator It = std::upper_bound(ranges.begin(),ranges.end(),Idx);
   if (It != ranges.begin()) {
-    LiveRange &LR = *prior(It);
+    const LiveRange &LR = *prior(It);
     if (LR.contains(Idx))
       return &LR;
   }
@@ -254,8 +254,8 @@
 /// is the result of a copy instruction in the source program, that occurs at
 /// index 'CopyIdx' that copies from 'Other' to 'this'.
 void LiveInterval::join(LiveInterval &Other, unsigned CopyIdx) {
-  LiveRange *SourceLR = Other.getLiveRangeContaining(CopyIdx-1);
-  LiveRange *DestLR = getLiveRangeContaining(CopyIdx);
+  const LiveRange *SourceLR = Other.getLiveRangeContaining(CopyIdx-1);
+  const LiveRange *DestLR = getLiveRangeContaining(CopyIdx);
   assert(SourceLR && DestLR && "Not joining due to a copy?");
   unsigned MergedSrcValIdx = SourceLR->ValId;
   unsigned MergedDstValIdx = DestLR->ValId;


Index: llvm/lib/CodeGen/LiveInterval.h
diff -u llvm/lib/CodeGen/LiveInterval.h:1.7 llvm/lib/CodeGen/LiveInterval.h:1.8
--- llvm/lib/CodeGen/LiveInterval.h:1.7	Sat Jul 24 13:55:15 2004
+++ llvm/lib/CodeGen/LiveInterval.h	Sun Jul 25 01:23:01 2004
@@ -112,7 +112,7 @@
 
     /// getLiveRangeContaining - Return the live range that contains the
     /// specified index, or null if there is none.
-    LiveRange *getLiveRangeContaining(unsigned Idx);
+    const LiveRange *getLiveRangeContaining(unsigned Idx) const;
 
 
     /// joinable - Two intervals are joinable if the either don't overlap at all





More information about the llvm-commits mailing list