summaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegAllocFast.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-07-09 21:48:31 +0000
committerDevang Patel <dpatel@apple.com>2010-07-09 21:48:31 +0000
commit7a029b6d7e58cb0f1010f14d99d7661e387cfb54 (patch)
tree672eb4fe879b6233ead55b65934a661fc8c478c2 /lib/CodeGen/RegAllocFast.cpp
parent58dbf3784d3daff5f1e5e08363aee8290d1a5dc1 (diff)
downloadllvm-7a029b6d7e58cb0f1010f14d99d7661e387cfb54.tar.gz
llvm-7a029b6d7e58cb0f1010f14d99d7661e387cfb54.tar.bz2
llvm-7a029b6d7e58cb0f1010f14d99d7661e387cfb54.tar.xz
Update DBG_VALUE to refer appropriate stack slot in case of a spill.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108023 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocFast.cpp')
-rw-r--r--lib/CodeGen/RegAllocFast.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/CodeGen/RegAllocFast.cpp b/lib/CodeGen/RegAllocFast.cpp
index 272eff24e4..f44478e5dd 100644
--- a/lib/CodeGen/RegAllocFast.cpp
+++ b/lib/CodeGen/RegAllocFast.cpp
@@ -764,8 +764,25 @@ void RAFast::AllocateBasicBlock() {
LiveRegMap::iterator LRI = LiveVirtRegs.find(Reg);
if (LRI != LiveVirtRegs.end())
setPhysReg(MI, i, LRI->second.PhysReg);
- else
- MO.setReg(0); // We can't allocate a physreg for a DebugValue, sorry!
+ else {
+ int SS = StackSlotForVirtReg[Reg];
+ if (SS == -1)
+ MO.setReg(0); // We can't allocate a physreg for a DebugValue, sorry!
+ else {
+ // Modify DBG_VALUE now that the value is in a spill slot.
+ uint64_t Offset = MI->getOperand(1).getImm();
+ const MDNode *MDPtr =
+ MI->getOperand(MI->getNumOperands()-1).getMetadata();
+ DebugLoc DL = MI->getDebugLoc();
+ if (MachineInstr *NewDV =
+ TII->emitFrameIndexDebugValue(*MF, SS, Offset, MDPtr, DL)) {
+ DEBUG(dbgs() << "Modifying debug info due to spill:" << "\t" << *MI);
+ MachineBasicBlock *MBB = MI->getParent();
+ MBB->insert(MBB->erase(MI), NewDV);
+ } else
+ MO.setReg(0); // We can't allocate a physreg for a DebugValue, sorry!
+ }
+ }
}
// Next instruction.
continue;