diff options
author | Reid Kleckner <rnk@google.com> | 2018-11-03 00:41:52 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2018-11-03 00:41:52 +0000 |
commit | 2bcb288ade6df8f12157c36157ecfdc879fd95e1 (patch) | |
tree | f9196dba9c60bad4a2090c2d91fa44f2ad01fb55 /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | |
parent | 5253cccbd5fbc6db3d3bf278c40302f9f222c6e7 (diff) | |
download | llvm-2bcb288ade6df8f12157c36157ecfdc879fd95e1.zip llvm-2bcb288ade6df8f12157c36157ecfdc879fd95e1.tar.gz llvm-2bcb288ade6df8f12157c36157ecfdc879fd95e1.tar.bz2 |
[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/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index 9b2b347..01d018f 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -1339,6 +1339,7 @@ void CodeViewDebug::beginFunctionImpl(const MachineFunction *MF) { // instruction (AArch64), this will be zero. CurFn->CSRSize = MFI.getCVBytesOfCalleeSavedRegisters(); CurFn->FrameSize = MFI.getStackSize(); + CurFn->OffsetAdjustment = MFI.getOffsetAdjustment(); CurFn->HasStackRealignment = TRI->needsStackRealignment(*MF); // For this function S_FRAMEPROC record, figure out which codeview register @@ -2599,16 +2600,10 @@ void CodeViewDebug::emitLocalVariable(const FunctionInfo &FI, // 32-bit x86 call sequences often use PUSH instructions, which disrupt // ESP-relative offsets. Use the virtual frame pointer, VFRAME or $T0, - // instead. In simple cases, $T0 will be the CFA. + // instead. In frames without stack realignment, $T0 will be the CFA. if (RegisterId(Reg) == RegisterId::ESP) { Reg = unsigned(RegisterId::VFRAME); - Offset -= FI.FrameSize; - - // If the frame requires realignment, VFRAME will be ESP after it is - // aligned. We have to remove the ESP adjustments made to push CSRs and - // EBP. EBP is not included in CSRSize. - if (FI.HasStackRealignment) - Offset += FI.CSRSize + 4; + Offset += FI.OffsetAdjustment; } // If we can use the chosen frame pointer for the frame and this isn't a |