X86: Explain why we cannot use a 'mov' in a Win64 epilogue
authorDavid Majnemer <david.majnemer@gmail.com>
Mon, 23 Feb 2015 21:50:25 +0000 (21:50 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Mon, 23 Feb 2015 21:50:25 +0000 (21:50 +0000)
llvm-svn: 230268

llvm/lib/Target/X86/X86FrameLowering.cpp

index c3f8fdd..5657def 100644 (file)
@@ -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);