From 16ae40677683c9a05a2481e5bb4d9ccbff190803 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Mon, 23 Feb 2015 21:50:25 +0000 Subject: [PATCH] X86: Explain why we cannot use a 'mov' in a Win64 epilogue git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230268 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86FrameLowering.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Target/X86/X86FrameLowering.cpp b/lib/Target/X86/X86FrameLowering.cpp index c3f8fddd844..5657def8ce9 100644 --- a/lib/Target/X86/X86FrameLowering.cpp +++ b/lib/Target/X86/X86FrameLowering.cpp @@ -1048,6 +1048,12 @@ void X86FrameLowering::emitEpilogue(MachineFunction &MF, if (RegInfo->needsStackRealignment(MF)) MBBI = FirstCSPop; if (IsWinEH) { + // There are only two legal forms of epilogue: + // - add SEHAllocationSize, %rsp + // - lea SEHAllocationSize(%FramePtr), %rsp + // + // We are *not* permitted to use 'mov %FramePtr, %rsp' because the Win64 + // unwinder will not recognize 'mov' as an epilogue instruction. unsigned SEHFrameOffset = calculateSetFPREG(SEHStackAllocAmt); addRegOffset(BuildMI(MBB, MBBI, DL, TII.get(X86::LEA64r), StackPtr), FramePtr, false, SEHStackAllocAmt - SEHFrameOffset); -- 2.34.1