diff options
author | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-07-04 17:23:35 +0000 |
---|---|---|
committer | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-07-04 17:23:35 +0000 |
commit | c156095b174987226a94583cb7e10c426dddaea6 (patch) | |
tree | 309d213356ba677e78425c8315834abc8fd4fdf5 /lib/CodeGen/RegAllocLinearScan.cpp | |
parent | 38343f6cfe505139118efa65b2ecabb7b5a59ff1 (diff) |
Correctly compute the ration of iterations/#intervals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14626 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocLinearScan.cpp')
-rw-r--r-- | lib/CodeGen/RegAllocLinearScan.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/CodeGen/RegAllocLinearScan.cpp b/lib/CodeGen/RegAllocLinearScan.cpp index 0e52f46c6f..d5d3459906 100644 --- a/lib/CodeGen/RegAllocLinearScan.cpp +++ b/lib/CodeGen/RegAllocLinearScan.cpp @@ -38,6 +38,9 @@ namespace { 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 @@ void RA::linearScan() // 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 @@ void RA::linearScan() 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) { |