1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Correctly compute the ration of iterations/#intervals.

llvm-svn: 14626
This commit is contained in:
Alkis Evlogimenos 2004-07-04 17:23:35 +00:00
parent 8d61e9ad98
commit 69ea68d4b6

View File

@ -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) {