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

Alkis Evlogimenos alkis at cs.uiuc.edu
Sun Jul 4 03:00:01 PDT 2004


Changes in directory llvm/lib/CodeGen:

RegAllocLinearScan.cpp updated: 1.75 -> 1.76

---
Log message:

Add efficiency statistic.


---
Diffs of the changes:  (+7 -1)

Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp
diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.75 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.76
--- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.75	Mon Jun 21 08:10:56 2004
+++ llvm/lib/CodeGen/RegAllocLinearScan.cpp	Sun Jul  4 02:59:06 2004
@@ -21,6 +21,7 @@
 #include "llvm/Target/MRegisterInfo.h"
 #include "llvm/Target/TargetMachine.h"
 #include "Support/Debug.h"
+#include "Support/Statistic.h"
 #include "Support/STLExtras.h"
 #include "LiveIntervals.h"
 #include "PhysRegTracker.h"
@@ -33,6 +34,10 @@
 using namespace llvm;
 
 namespace {
+
+    Statistic<double> efficiency
+    ("regalloc", "Ratio of intervals processed over total intervals");
+
     class RA : public MachineFunctionPass {
     private:
         MachineFunction* mf_;
@@ -178,7 +183,7 @@
         // pick the interval with the earliest start point
         IntervalPtrs::value_type cur = unhandled_.front();
         unhandled_.pop_front();
-
+        ++efficiency;
         DEBUG(std::cerr << "\n*** CURRENT ***: " << *cur << '\n');
 
         processActiveIntervals(cur);
@@ -201,6 +206,7 @@
         DEBUG(printIntervals("inactive", inactive_.begin(), inactive_.end()));
         // DEBUG(verifyAssignment());
     }
+    efficiency /= li_->getIntervals().size();
 
     // expire any remaining active intervals
     for (IntervalPtrs::iterator i = active_.begin(); i != active_.end(); ++i) {





More information about the llvm-commits mailing list