aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2009-07-09 22:30:02 +0000
committerBill Wendling <isanbard@gmail.com>2009-07-09 22:30:02 +0000
commitd15f45f53e2d5f89b777b1c2d36de0b40f303a01 (patch)
treeb4ee8e1b891cadae6fae96e398759932a6989fd1 /lib
parent5c874172ac8fd563867efc54022ac4c1571e1313 (diff)
downloadexternal_llvm-d15f45f53e2d5f89b777b1c2d36de0b40f303a01.tar.gz
external_llvm-d15f45f53e2d5f89b777b1c2d36de0b40f303a01.tar.bz2
external_llvm-d15f45f53e2d5f89b777b1c2d36de0b40f303a01.zip
If -fomit-frame-pointer is used, we still need to record when the %esp register
is modified. Otherwise, the unwinder will get confused. The old code (before I started my hacking) did this. It dropped on the floor, because I wasn't aware of this requirement. On the plus side, if we use "alloca" in a function, we create frame pointers even with -fomit-frame-pointer is enabled! This is a Good Thing(tm)!!! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75183 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/X86/X86RegisterInfo.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/Target/X86/X86RegisterInfo.cpp b/lib/Target/X86/X86RegisterInfo.cpp
index be4764e276..c9d3950217 100644
--- a/lib/Target/X86/X86RegisterInfo.cpp
+++ b/lib/Target/X86/X86RegisterInfo.cpp
@@ -873,7 +873,7 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
BuildMI(MBB, MBBI, DL, TII.get(X86::DBG_LABEL)).addImm(LabelId);
// Emit DWARF info specifying the offsets of the callee-saved registers.
- emitCalleeSavedFrameMoves(MF, LabelId, FramePtr);
+ emitCalleeSavedFrameMoves(MF, LabelId, HasFP ? FramePtr : StackPtr);
}
if (MBBI != MBB.end())
@@ -931,6 +931,25 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
if (NumBytes)
emitSPUpdate(MBB, MBBI, StackPtr, -(int64_t)NumBytes, Is64Bit, TII);
}
+
+ if (!HasFP && needsFrameMoves && NumBytes) {
+ // Mark end of stack pointer adjustment.
+ unsigned LabelId = MMI->NextLabelID();
+ BuildMI(MBB, MBBI, DL, TII.get(X86::DBG_LABEL)).addImm(LabelId);
+
+ // Define the current CFA rule to use the provided offset.
+ if (StackSize) {
+ MachineLocation SPDst(MachineLocation::VirtualFP);
+ MachineLocation SPSrc(MachineLocation::VirtualFP,
+ -StackSize + stackGrowth);
+ Moves.push_back(MachineMove(LabelId, SPDst, SPSrc));
+ } else {
+ // FIXME: Verify & implement for FP
+ MachineLocation SPDst(StackPtr);
+ MachineLocation SPSrc(StackPtr, stackGrowth);
+ Moves.push_back(MachineMove(LabelId, SPDst, SPSrc));
+ }
+ }
}
void X86RegisterInfo::emitEpilogue(MachineFunction &MF,