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

Alkis Evlogimenos alkis at cs.uiuc.edu
Sun Jul 4 12:24:01 PDT 2004


Changes in directory llvm/lib/CodeGen:

RegAllocLinearScan.cpp updated: 1.76 -> 1.77

---
Log message:

Correctly compute the ration of iterations/#intervals.


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

Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp
diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.76 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.77
--- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.76	Sun Jul  4 02:59:06 2004
+++ llvm/lib/CodeGen/RegAllocLinearScan.cpp	Sun Jul  4 12:23:35 2004
@@ -38,6 +38,9 @@
     Statistic<double> efficiency
     ("regalloc", "Ratio of intervals processed over total intervals");
 
+    static unsigned numIterations = 0;
+    static unsigned numIntervals = 0;
+
     class RA : public MachineFunctionPass {
     private:
         MachineFunction* mf_;
@@ -183,7 +186,7 @@
         // pick the interval with the earliest start point
         IntervalPtrs::value_type cur = unhandled_.front();
         unhandled_.pop_front();
-        ++efficiency;
+        ++numIterations;
         DEBUG(std::cerr << "\n*** CURRENT ***: " << *cur << '\n');
 
         processActiveIntervals(cur);
@@ -206,7 +209,8 @@
         DEBUG(printIntervals("inactive", inactive_.begin(), inactive_.end()));
         // DEBUG(verifyAssignment());
     }
-    efficiency /= li_->getIntervals().size();
+    numIntervals += li_->getIntervals().size();
+    efficiency = double(numIterations) / double(numIntervals);
 
     // expire any remaining active intervals
     for (IntervalPtrs::iterator i = active_.begin(); i != active_.end(); ++i) {





More information about the llvm-commits mailing list