aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegAllocGreedy.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-02-17 22:53:48 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-02-17 22:53:48 +0000
commit0db841f9c2b9a25fb5ecb36e350d3a802c35654c (patch)
tree93cbf855a4e3197163bfa15015abbb4bb4e75759 /lib/CodeGen/RegAllocGreedy.cpp
parent1521e91fc442b5c27d56118b45248e3d5707f7e2 (diff)
Add basic register allocator statistics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125789 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocGreedy.cpp')
-rw-r--r--lib/CodeGen/RegAllocGreedy.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/CodeGen/RegAllocGreedy.cpp b/lib/CodeGen/RegAllocGreedy.cpp
index ab56ec3272..7c35ceb1f5 100644
--- a/lib/CodeGen/RegAllocGreedy.cpp
+++ b/lib/CodeGen/RegAllocGreedy.cpp
@@ -22,6 +22,7 @@
#include "SplitKit.h"
#include "VirtRegMap.h"
#include "VirtRegRewriter.h"
+#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Function.h"
#include "llvm/PassAnalysisSupport.h"
@@ -45,6 +46,11 @@
using namespace llvm;
+STATISTIC(NumGlobalSplits, "Number of split global live ranges");
+STATISTIC(NumLocalSplits, "Number of split local live ranges");
+STATISTIC(NumReassigned, "Number of interferences reassigned");
+STATISTIC(NumEvicted, "Number of interferences evicted");
+
static RegisterRegAlloc greedyRegAlloc("greedy", "greedy register allocator",
createGreedyRegisterAllocator);
@@ -265,6 +271,7 @@ bool RAGreedy::reassignVReg(LiveInterval &InterferingVReg,
TRI->getName(OldAssign) << " to " << TRI->getName(PhysReg) << '\n');
unassign(InterferingVReg, OldAssign);
assign(InterferingVReg, PhysReg);
+ ++NumReassigned;
return true;
}
return false;
@@ -307,6 +314,7 @@ unsigned RAGreedy::tryReassignOrEvict(LiveInterval &VirtReg,
if (BestVirt) {
DEBUG(dbgs() << "evicting lighter " << *BestVirt << '\n');
unassign(*BestVirt, VRM->getPhys(BestVirt->reg));
+ ++NumEvicted;
NewVRegs.push_back(BestVirt);
return BestPhys;
}
@@ -782,6 +790,7 @@ void RAGreedy::splitAroundRegion(LiveInterval &VirtReg, unsigned PhysReg,
// per-block segments? The current approach allows the stack region to
// separate into connected components. Some components may be allocatable.
SE.finish();
+ ++NumGlobalSplits;
if (VerifyEnabled) {
MF->verify(this, "After splitting live range around region");
@@ -1094,6 +1103,7 @@ unsigned RAGreedy::tryLocalSplit(LiveInterval &VirtReg, AllocationOrder &Order,
SE.useIntv(SegStart, SegStop);
SE.closeIntv();
SE.finish();
+ ++NumLocalSplits;
return 0;
}