diff options
| author | Dale Johannesen <dalej@apple.com> | 2010-01-19 22:50:05 +0000 |
|---|---|---|
| committer | Dale Johannesen <dalej@apple.com> | 2010-01-19 22:50:05 +0000 |
| commit | aa6655557b5bf9ed50eb9e281a9106003206a822 (patch) | |
| tree | 6ef5d1b74b6b6cb21053bb483afad94b256fc721 /llvm/lib | |
| parent | ca19445d08f080d8119bdd9cae245fe9b743beab (diff) | |
| download | bcm5719-llvm-aa6655557b5bf9ed50eb9e281a9106003206a822.tar.gz bcm5719-llvm-aa6655557b5bf9ed50eb9e281a9106003206a822.zip | |
Fix a case where debug_value was perturbing the
line number info.
llvm-svn: 93937
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/X86/X86RegisterInfo.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/llvm/lib/Target/X86/X86RegisterInfo.cpp b/llvm/lib/Target/X86/X86RegisterInfo.cpp index 4bc2c9e4b26..60e69e8d514 100644 --- a/llvm/lib/Target/X86/X86RegisterInfo.cpp +++ b/llvm/lib/Target/X86/X86RegisterInfo.cpp @@ -666,6 +666,23 @@ X86RegisterInfo::processFunctionBeforeCalleeSavedScan(MachineFunction &MF, } } +/// findDebugLoc - find the next valid DebugLoc starting at MBBI, skipping +/// any DEBUG_VALUE instructions. Return UnknownLoc if there is none. +static +DebugLoc findDebugLoc(MachineBasicBlock::iterator &MBBI, MachineBasicBlock &MBB) { + DebugLoc DL; + if (MBBI != MBB.end()) { + // Skip debug declarations, we don't want a DebugLoc from them. + MachineBasicBlock::iterator MBBI2 = MBBI; + while (MBBI2 != MBB.end() && + MBBI2->getOpcode()==TargetInstrInfo::DEBUG_VALUE) + MBBI2++; + if (MBBI2 != MBB.end()) + DL = MBBI2->getDebugLoc(); + } + return DL; +} + /// emitSPUpdate - Emit a series of instructions to increment / decrement the /// stack pointer by a constant value. static @@ -682,8 +699,7 @@ void emitSPUpdate(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, (Is64Bit ? X86::ADD64ri8 : X86::ADD32ri8) : (Is64Bit ? X86::ADD64ri32 : X86::ADD32ri)); uint64_t Chunk = (1LL << 31) - 1; - DebugLoc DL = (MBBI != MBB.end() ? MBBI->getDebugLoc() : - DebugLoc::getUnknownLoc()); + DebugLoc DL = findDebugLoc(MBBI, MBB); while (Offset) { uint64_t ThisVal = (Offset > Chunk) ? Chunk : Offset; @@ -1032,8 +1048,7 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const { } } - if (MBBI != MBB.end()) - DL = MBBI->getDebugLoc(); + DL = findDebugLoc(MBBI, MBB); // Adjust stack pointer: ESP -= numbytes. if (NumBytes >= 4096 && Subtarget->isTargetCygMing()) { |

