summaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegAllocGreedy.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-07-23 03:22:33 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-07-23 03:22:33 +0000
commitb4666364f4db4889883d7a6c02a177ebcde7c240 (patch)
tree416f0b3c24f62057eea5af405304bfc91fd4020c /lib/CodeGen/RegAllocGreedy.cpp
parente60f103d2d3541e57a6ca8d788e959e03b615e5f (diff)
downloadllvm-b4666364f4db4889883d7a6c02a177ebcde7c240.tar.gz
llvm-b4666364f4db4889883d7a6c02a177ebcde7c240.tar.bz2
llvm-b4666364f4db4889883d7a6c02a177ebcde7c240.tar.xz
Prepare RAGreedy::growRegion for compact regions.
A split candidate can have a null PhysReg which means that it doesn't map to a real interference pattern. Instead, pretend that all through blocks have interference. This makes it possible to generate compact regions where the live range doesn't go through blocks that don't use it. The live range will still be live between directly connected blocks with uses. Splitting around a compact region tends to produce a live range with a high spill weight, so it may evict a less dense live range. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135845 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocGreedy.cpp')
-rw-r--r--lib/CodeGen/RegAllocGreedy.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/CodeGen/RegAllocGreedy.cpp b/lib/CodeGen/RegAllocGreedy.cpp
index 570a832303..0267717b84 100644
--- a/lib/CodeGen/RegAllocGreedy.cpp
+++ b/lib/CodeGen/RegAllocGreedy.cpp
@@ -749,7 +749,14 @@ void RAGreedy::growRegion(GlobalSplitCandidate &Cand) {
// Any new blocks to add?
if (ActiveBlocks.size() == AddedTo)
break;
- addThroughConstraints(Cand.Intf, makeArrayRef(ActiveBlocks).slice(AddedTo));
+
+ // Compute through constraints from the interference, or assume that all
+ // through blocks prefer spilling when forming compact regions.
+ ArrayRef<unsigned> NewBlocks = makeArrayRef(ActiveBlocks).slice(AddedTo);
+ if (Cand.PhysReg)
+ addThroughConstraints(Cand.Intf, NewBlocks);
+ else
+ SpillPlacer->addPrefSpill(NewBlocks);
AddedTo = ActiveBlocks.size();
// Perhaps iterating can enable more bundles?