diff options
author | Alkis Evlogimenos <alkis@evlogimenos.com> | 2003-12-05 11:17:55 +0000 |
---|---|---|
committer | Alkis Evlogimenos <alkis@evlogimenos.com> | 2003-12-05 11:17:55 +0000 |
commit | 49787e35c3eebb7afce81829d426114451f8a597 (patch) | |
tree | c5b658aaaeae6bd4e8026ec02a44a5ebe06d1b93 | |
parent | b27ef248f579b354aab434f63c417ab1103e47e2 (diff) |
Fix bug in register spilling when a preallocated live range overlaps a
potential register assignment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10291 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/RegAllocLinearScan.cpp | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/lib/CodeGen/RegAllocLinearScan.cpp b/lib/CodeGen/RegAllocLinearScan.cpp index 709fdafc3e..dff2741943 100644 --- a/lib/CodeGen/RegAllocLinearScan.cpp +++ b/lib/CodeGen/RegAllocLinearScan.cpp @@ -251,16 +251,6 @@ bool RA::runOnMachineFunction(MachineFunction &fn) { // if this register is preallocated, look for an interval that // overlaps with it and assign it to a memory location if (i->reg < MRegisterInfo::FirstVirtualRegister) { - for (IntervalPtrs::iterator - ai = active_.begin(), ae = active_.end(); ai != ae; ++ai) { - unsigned virtReg = (*ai)->reg; - Virt2PhysMap::const_iterator it = v2pMap_.find(virtReg); - if (it != v2pMap_.end() && it->second == i->reg) { - active_.erase(ai); - clearVirtReg(virtReg); - break; - } - } reservePhysReg(i->reg); active_.push_back(&*i); } @@ -607,7 +597,7 @@ void RA::assignStackSlotAtInterval(Intervals::const_iterator cur) void RA::reservePhysReg(unsigned physReg) { - DEBUG(std::cerr << "\t\t\treserving physical physical register: " + DEBUG(std::cerr << "\t\t\treserving physical register: " << mri_->getName(physReg) << '\n'); // if this register holds a value spill it unsigned virtReg = p2vMap_[physReg]; @@ -621,14 +611,14 @@ void RA::reservePhysReg(unsigned physReg) break; } } - spillVirtReg(virtReg); + assignVirt2StackSlot(virtReg); } p2vMap_[physReg] = physReg; // this denotes a reserved physical register } void RA::clearReservedPhysReg(unsigned physReg) { - DEBUG(std::cerr << "\t\t\tclearing reserved physical physical register: " + DEBUG(std::cerr << "\t\t\tclearing reserved physical register: " << mri_->getName(physReg) << '\n'); assert(p2vMap_[physReg] == physReg && "attempt to clear a non reserved physical register"); |