summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/RegAllocGreedy.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-12-08 22:22:41 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-12-08 22:22:41 +0000
commite0df786c98a97f40b0bef54cf80fee5ff395a991 (patch)
tree6b0ed95b3c28553a3b6998f251c8601bbcf766e9 /llvm/lib/CodeGen/RegAllocGreedy.cpp
parent1b93e7b4ed79de5efcebd975b23bbf6e5d8adeb2 (diff)
downloadbcm5719-llvm-e0df786c98a97f40b0bef54cf80fee5ff395a991.tar.gz
bcm5719-llvm-e0df786c98a97f40b0bef54cf80fee5ff395a991.zip
Store (priority,regnum) pairs in the priority queue instead of providing an
abstract priority queue interface in subclasses that want to override the priority calculations. Subclasses must provide a getPriority() implementation instead. This approach requires less code as long as priorities are expressable as simple floats, and it avoids the dangers of defining potentially expensive priority comparison functions. It also should speed up priority_queue operations since they no longer have to chase pointers when comparing registers. This is not measurable, though. Preferably, we shouldn't use floats to guide code generation. The use of floats here is derived from the use of floats for spill weights. Spill weights have a dynamic range that doesn't lend itself easily to a fixpoint implementation. When someone invents a stable spill weight representation, it can be reused for allocation priorities. llvm-svn: 121294
Diffstat (limited to 'llvm/lib/CodeGen/RegAllocGreedy.cpp')
-rw-r--r--llvm/lib/CodeGen/RegAllocGreedy.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/RegAllocGreedy.cpp b/llvm/lib/CodeGen/RegAllocGreedy.cpp
index 96e5531840b..5f2be811aa6 100644
--- a/llvm/lib/CodeGen/RegAllocGreedy.cpp
+++ b/llvm/lib/CodeGen/RegAllocGreedy.cpp
@@ -70,6 +70,8 @@ public:
virtual Spiller &spiller() { return *SpillerInstance; }
+ virtual float getPriority(LiveInterval *LI) { return LI->weight; }
+
virtual unsigned selectOrSplit(LiveInterval &VirtReg,
SmallVectorImpl<LiveInterval*> &SplitVRegs);
OpenPOWER on IntegriCloud