summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-02-23 00:56:56 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-02-23 00:56:56 +0000
commitb51f65c297d9ec037efa657c9c0c84eebdd0c4a0 (patch)
treeb5cc33722550d28eac0b24a3ae0060b8935a92c1 /llvm/lib/CodeGen
parent1aef0c5621a6c129abbb856106363ce894382478 (diff)
downloadbcm5719-llvm-b51f65c297d9ec037efa657c9c0c84eebdd0c4a0.tar.gz
bcm5719-llvm-b51f65c297d9ec037efa657c9c0c84eebdd0c4a0.zip
Keep track of how many times a live range has been dequeued, and prioritize new ranges.
When a large live range is evicted, it will usually be split when it comes around again. By deferring evicted live ranges, the splitting happens at a time when the interference pattern is more realistic. This prevents repeated splitting and evictions. llvm-svn: 126282
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/RegAllocGreedy.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/RegAllocGreedy.cpp b/llvm/lib/CodeGen/RegAllocGreedy.cpp
index 59d4fc6180e..03886195404 100644
--- a/llvm/lib/CodeGen/RegAllocGreedy.cpp
+++ b/llvm/lib/CodeGen/RegAllocGreedy.cpp
@@ -74,6 +74,7 @@ class RAGreedy : public MachineFunctionPass, public RegAllocBase {
std::auto_ptr<Spiller> SpillerInstance;
std::auto_ptr<SplitAnalysis> SA;
std::priority_queue<std::pair<unsigned, unsigned> > Queue;
+ IndexedMap<unsigned, VirtReg2IndexFunctor> Generation;
// splitting state.
@@ -186,6 +187,7 @@ void RAGreedy::getAnalysisUsage(AnalysisUsage &AU) const {
void RAGreedy::releaseMemory() {
SpillerInstance.reset(0);
+ Generation.clear();
RegAllocBase::releaseMemory();
}
@@ -202,6 +204,11 @@ void RAGreedy::enqueue(LiveInterval *LI) {
if (TargetRegisterInfo::isPhysicalRegister(Hint))
Size |= (1u << 30);
+ // Boost ranges that we see for the first time.
+ Generation.grow(Reg);
+ if (++Generation[Reg] == 1)
+ Size |= (1u << 31);
+
Queue.push(std::make_pair(Size, Reg));
}
OpenPOWER on IntegriCloud