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

Chris Lattner lattner at cs.uiuc.edu
Tue Aug 22 11:20:04 PDT 2006



Changes in directory llvm/include/llvm/CodeGen:

LiveInterval.h updated: 1.18 -> 1.19
---
Log message:

Improve the LiveInterval class to keep track of which machine instruction
defines each value# tracked by the interval.  This will be used to improve
coallescing.


---
Diffs of the changes:  (+23 -2)

 LiveInterval.h |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)


Index: llvm/include/llvm/CodeGen/LiveInterval.h
diff -u llvm/include/llvm/CodeGen/LiveInterval.h:1.18 llvm/include/llvm/CodeGen/LiveInterval.h:1.19
--- llvm/include/llvm/CodeGen/LiveInterval.h:1.18	Tue Aug 22 01:32:56 2006
+++ llvm/include/llvm/CodeGen/LiveInterval.h	Tue Aug 22 13:19:46 2006
@@ -79,6 +79,11 @@
     Ranges ranges;       // the ranges in which this register is live
   private:
     unsigned NumValues;  // the number of distinct values in this interval.
+    
+    /// InstDefiningValue - This tracks the def index of the instruction that
+    /// defines a particular value number in the interval.  This may be ~0,
+    /// which is treated as unknown.
+    SmallVector<unsigned, 4> InstDefiningValue;
   public:
 
     LiveInterval(unsigned Reg, float Weight)
@@ -109,15 +114,31 @@
     void swap(LiveInterval& other) {
       std::swap(reg, other.reg);
       std::swap(weight, other.weight);
-      ranges.swap(other.ranges);
+      std::swap(ranges, other.ranges);
       std::swap(NumValues, other.NumValues);
     }
 
     bool containsOneValue() const { return NumValues == 1; }
 
-    unsigned getNextValue() {
+    /// getNextValue - Create a new value number and return it.  MIIdx specifies
+    /// the instruction that defines the value number.
+    unsigned getNextValue(unsigned MIIdx) {
+      InstDefiningValue.push_back(MIIdx);
       return NumValues++;
     }
+    
+    /// getInstForValNum - Return the machine instruction index that defines the
+    /// specified value number.
+    unsigned getInstForValNum(unsigned ValNo) const {
+      return InstDefiningValue[ValNo];
+    }
+    
+    /// setInstDefiningValNum - Change the instruction defining the specified
+    /// value number to the specified instruction.
+    void setInstDefiningValNum(unsigned ValNo, unsigned MIIdx) {
+      InstDefiningValue[ValNo] = MIIdx;
+    }
+
 
     bool empty() const { return ranges.empty(); }
 






More information about the llvm-commits mailing list