diff options
author | Bill Wendling <isanbard@gmail.com> | 2009-07-09 22:30:02 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2009-07-09 22:30:02 +0000 |
commit | ad6c36f0658ef243f402d87b4da5527be310fac3 (patch) | |
tree | 015086fdd683e6a66471bdd44cdb2806fe725238 /llvm/lib | |
parent | 7591d02c8448431204bfaca8af00633e363d4615 (diff) | |
download | bcm5719-llvm-ad6c36f0658ef243f402d87b4da5527be310fac3.tar.gz bcm5719-llvm-ad6c36f0658ef243f402d87b4da5527be310fac3.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)!!!
llvm-svn: 75183
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/X86/X86RegisterInfo.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86RegisterInfo.cpp b/llvm/lib/Target/X86/X86RegisterInfo.cpp index be4764e2768..c9d3950217b 100644 --- a/llvm/lib/Target/X86/X86RegisterInfo.cpp +++ b/llvm/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, |