summaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegAllocBasic.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-03-12 04:17:20 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-03-12 04:17:20 +0000
commit10a433238fe4679c8da17f3eb19611466332e312 (patch)
tree5fb2db6f54a316f1610f6ea42390d1fe4da25135 /lib/CodeGen/RegAllocBasic.cpp
parent7a387e4d9de9ab8155836e65138621192ba8316a (diff)
downloadllvm-10a433238fe4679c8da17f3eb19611466332e312.tar.gz
llvm-10a433238fe4679c8da17f3eb19611466332e312.tar.bz2
llvm-10a433238fe4679c8da17f3eb19611466332e312.tar.xz
Spill multiple registers at once.
Live range splitting can create a number of small live ranges containing only a single real use. Spill these small live ranges along with the large range they are connected to with copies. This enables memory operand folding and maximizes the spill to fill distance. Work in progress with known bugs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127529 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocBasic.cpp')
-rw-r--r--lib/CodeGen/RegAllocBasic.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/CodeGen/RegAllocBasic.cpp b/lib/CodeGen/RegAllocBasic.cpp
index 9df2047a66..d51be52027 100644
--- a/lib/CodeGen/RegAllocBasic.cpp
+++ b/lib/CodeGen/RegAllocBasic.cpp
@@ -289,6 +289,13 @@ void RegAllocBase::allocatePhysRegs() {
// Continue assigning vregs one at a time to available physical registers.
while (LiveInterval *VirtReg = dequeue()) {
+ // Unused registers can appear when the spiller coalesces snippets.
+ if (MRI->reg_nodbg_empty(VirtReg->reg)) {
+ DEBUG(dbgs() << "Dropping unused " << *VirtReg << '\n');
+ LIS->removeInterval(VirtReg->reg);
+ continue;
+ }
+
// selectOrSplit requests the allocator to return an available physical
// register if possible and populate a list of new live intervals that
// result from splitting.