[WinEH] Fix ESP management with 32-bit __CxxFrameHandler3
authorReid Kleckner <rnk@google.com>
Fri, 13 Nov 2015 21:27:00 +0000 (21:27 +0000)
committerReid Kleckner <rnk@google.com>
Fri, 13 Nov 2015 21:27:00 +0000 (21:27 +0000)
commitc6477179dd3a3b6334a5be415a7a86f77db5f5e8
treeaed7fdaf060b9a7eeda5c63268ff9fd0b39e96e7
parente528e5711e69a2dbb237da7afc66a881f00d53bb
[WinEH] Fix ESP management with 32-bit __CxxFrameHandler3

The C++ EH personality automatically restores ESP from the C++ EH
registration node after a catchret. I mistakenly thought it was like
SEH, which does not restore ESP.

It makes sense for C++ EH to differ from SEH here because SEH does not
use funclets for catches, and does not allow catching inside of finally.
C++ EH may need to unwind through multiple catch funclets and eventually
catchret to some outer funclet. Therefore, the runtime has to keep track
of which ESP to use with catchret, rather than having the compiler
reload it manually.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253084 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ExpandPseudo.cpp
lib/Target/X86/X86FrameLowering.cpp
test/CodeGen/X86/catchret-fallthrough.ll
test/CodeGen/X86/win-catchpad-csrs.ll
test/CodeGen/X86/win-catchpad.ll