summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86FrameLowering.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2018-11-03 00:41:52 +0000
committerReid Kleckner <rnk@google.com>2018-11-03 00:41:52 +0000
commit2bcb288ade6df8f12157c36157ecfdc879fd95e1 (patch)
treef9196dba9c60bad4a2090c2d91fa44f2ad01fb55 /llvm/lib/Target/X86/X86FrameLowering.cpp
parent5253cccbd5fbc6db3d3bf278c40302f9f222c6e7 (diff)
downloadbcm5719-llvm-2bcb288ade6df8f12157c36157ecfdc879fd95e1.tar.gz
bcm5719-llvm-2bcb288ade6df8f12157c36157ecfdc879fd95e1.zip
[codeview] Let the X86 backend tell us the VFRAME offset adjustment
Use MachineFrameInfo's OffsetAdjustment field to pass this information from the target to CodeViewDebug.cpp. The X86 backend doesn't use it for any other purpose. This fixes PR38857 in the case where there is a non-aligned quantity of CSRs and a non-aligned quantity of locals. llvm-svn: 346062
Diffstat (limited to 'llvm/lib/Target/X86/X86FrameLowering.cpp')
-rw-r--r--llvm/lib/Target/X86/X86FrameLowering.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/llvm/lib/Target/X86/X86FrameLowering.cpp b/llvm/lib/Target/X86/X86FrameLowering.cpp
index 1eb9fa0bc1e..67ec867b562 100644
--- a/llvm/lib/Target/X86/X86FrameLowering.cpp
+++ b/llvm/lib/Target/X86/X86FrameLowering.cpp
@@ -1103,15 +1103,6 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF,
if (TRI->needsStackRealignment(MF) && !IsWin64Prologue)
NumBytes = alignTo(NumBytes, MaxAlign);
- // Get the offset of the stack slot for the EBP register, which is
- // guaranteed to be the last slot by processFunctionBeforeFrameFinalized.
- // Update the frame offset adjustment.
- if (!IsFunclet)
- MFI.setOffsetAdjustment(-NumBytes);
- else
- assert(MFI.getOffsetAdjustment() == -(int)NumBytes &&
- "should calculate same local variable offset for funclets");
-
// Save EBP/RBP into the appropriate stack slot.
BuildMI(MBB, MBBI, DL, TII.get(Is64Bit ? X86::PUSH64r : X86::PUSH32r))
.addReg(MachineFramePtr, RegState::Kill)
@@ -1167,6 +1158,15 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF,
NumBytes = StackSize - X86FI->getCalleeSavedFrameSize();
}
+ // Update the offset adjustment, which is mainly used by codeview to translate
+ // from ESP to VFRAME relative local variable offsets.
+ if (!IsFunclet) {
+ if (HasFP && TRI->needsStackRealignment(MF))
+ MFI.setOffsetAdjustment(-NumBytes);
+ else
+ MFI.setOffsetAdjustment(-StackSize);
+ }
+
// For EH funclets, only allocate enough space for outgoing calls. Save the
// NumBytes value that we would've used for the parent frame.
unsigned ParentFrameNumBytes = NumBytes;
OpenPOWER on IntegriCloud