[llvm-commits] [llvm] r93937 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
Dale Johannesen
dalej at apple.com
Tue Jan 19 14:50:06 PST 2010
Author: johannes
Date: Tue Jan 19 16:50:05 2010
New Revision: 93937
URL: http://llvm.org/viewvc/llvm-project?rev=93937&view=rev
Log:
Fix a case where debug_value was perturbing the
line number info.
Modified:
llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=93937&r1=93936&r2=93937&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Tue Jan 19 16:50:05 2010
@@ -666,6 +666,23 @@
}
}
+/// 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 @@
(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 @@
}
}
- if (MBBI != MBB.end())
- DL = MBBI->getDebugLoc();
+ DL = findDebugLoc(MBBI, MBB);
// Adjust stack pointer: ESP -= numbytes.
if (NumBytes >= 4096 && Subtarget->isTargetCygMing()) {
More information about the llvm-commits
mailing list