X86, Win64: Allow 'mov' to restore the stack pointer if we have a FP
authorDavid Majnemer <david.majnemer@gmail.com>
Wed, 25 Feb 2015 21:13:37 +0000 (21:13 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Wed, 25 Feb 2015 21:13:37 +0000 (21:13 +0000)
commit92d1637e2f4310d1512e93f669d02741c9b45dcd
treee3e4d5e1431c29ce2fc286ab8b93f30e74914c1c
parentdd51ad933e8ffb1dbd7aa165ad304db069b59038
X86, Win64: Allow 'mov' to restore the stack pointer if we have a FP

The Win64 epilogue structure is very restrictive, it permits a very
small number of opcodes and none of them are 'mov'.

This means that given:
  mov %rbp, %rsp
  pop %rbp

The mov isn't the epilogue, only the pop is.  This is problematic unless
a frame pointer is present in which case we are free to do whatever we'd
like in the "body" of the function.  If a frame pointer is present,
unwinding will undo the prologue operations in reverse order regardless
of the fact that we are at an instruction which is reseting the stack
pointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230543 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86FrameLowering.cpp
test/CodeGen/X86/win64_eh.ll