From b85e023b8b2358145f39c3a7bc9a5c0e644e8d6d 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 llvm-svn: 230268 --- llvm/lib/Target/X86/X86FrameLowering.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/llvm/lib/Target/X86/X86FrameLowering.cpp b/llvm/lib/Target/X86/X86FrameLowering.cpp index c3f8fdd..5657def 100644 --- a/llvm/lib/Target/X86/X86FrameLowering.cpp +++ b/llvm/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.7.4