aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegAllocLinearScan.cpp
diff options
context:
space:
mode:
authorAlkis Evlogimenos <alkis@evlogimenos.com>2003-12-13 11:58:10 +0000
committerAlkis Evlogimenos <alkis@evlogimenos.com>2003-12-13 11:58:10 +0000
commit94743e4915eb9a7d9c2dd57862e6634e9ece8eb5 (patch)
tree2ec6f7d4b3ee104f9f6d929af2594f85b295ccd9 /lib/CodeGen/RegAllocLinearScan.cpp
parent4c214d2bf0da92a7973bb7902c0d6d055b1fa991 (diff)
When reserving a preallocated register spill the aliases of this
register too. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10450 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocLinearScan.cpp')
-rw-r--r--lib/CodeGen/RegAllocLinearScan.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/CodeGen/RegAllocLinearScan.cpp b/lib/CodeGen/RegAllocLinearScan.cpp
index 8645a2b044..dd94ad31c1 100644
--- a/lib/CodeGen/RegAllocLinearScan.cpp
+++ b/lib/CodeGen/RegAllocLinearScan.cpp
@@ -628,6 +628,22 @@ void RA::reservePhysReg(unsigned physReg)
assignVirt2StackSlot(virtReg);
}
p2vMap_[physReg] = physReg; // this denotes a reserved physical register
+
+ // if it also aliases any other registers with values spill them too
+ for (const unsigned* as = mri_->getAliasSet(physReg); *as; ++as) {
+ unsigned virtReg = p2vMap_[*as];
+ if (virtReg != 0 && virtReg != *as) {
+ // remove interval from active
+ for (IntervalPtrs::iterator i = active_.begin(), e = active_.end();
+ i != e; ++i) {
+ if ((*i)->reg == virtReg) {
+ active_.erase(i);
+ break;
+ }
+ }
+ assignVirt2StackSlot(virtReg);
+ }
+ }
}
void RA::clearReservedPhysReg(unsigned physReg)