summaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegAllocLinearScan.cpp
diff options
context:
space:
mode:
authorAlkis Evlogimenos <alkis@evlogimenos.com>2004-07-04 07:59:06 +0000
committerAlkis Evlogimenos <alkis@evlogimenos.com>2004-07-04 07:59:06 +0000
commitd55b2b1067248fff5696229adf31d214d864ccaf (patch)
tree96cb3e26175691ce95e59eb06a48264a0aef7ace /lib/CodeGen/RegAllocLinearScan.cpp
parent3b94a5142c1029a1a50e659c45fdb0627ede7a82 (diff)
downloadllvm-d55b2b1067248fff5696229adf31d214d864ccaf.tar.gz
llvm-d55b2b1067248fff5696229adf31d214d864ccaf.tar.bz2
llvm-d55b2b1067248fff5696229adf31d214d864ccaf.tar.xz
Add efficiency statistic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14590 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocLinearScan.cpp')
-rw-r--r--lib/CodeGen/RegAllocLinearScan.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/CodeGen/RegAllocLinearScan.cpp b/lib/CodeGen/RegAllocLinearScan.cpp
index 285f493fff..0e52f46c6f 100644
--- a/lib/CodeGen/RegAllocLinearScan.cpp
+++ b/lib/CodeGen/RegAllocLinearScan.cpp
@@ -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 @@ void RA::linearScan()
// 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 @@ void RA::linearScan()
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) {