[WinEH] Make setjmp work correctly with EH
authorDavid Majnemer <david.majnemer@gmail.com>
Mon, 29 Feb 2016 19:16:03 +0000 (19:16 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Mon, 29 Feb 2016 19:16:03 +0000 (19:16 +0000)
commite60ee3b8ce9ad7baa712a36371525f4a89b9f571
tree72ae20c6f5fcc09690ba8ee26b4f86a4469f9a5c
parent939993ff2fe38eca498b0806b22a35412222a0eb
[WinEH] Make setjmp work correctly with EH

32-bit X86 EH on Windows utilizes a stack of registration nodes
allocated and deallocated on entry/exit.  A registration node contains a
bunch of EH personality specific information like which try-state we are
currently in.

Because a setjmp target allows control flow from arbitrary program
points, there is no way to ensure that the try-state we are in is
correctly updated once we transfer control.

MSVC compatible compilers, like MSVC and ICC, utilize runtime helpers to
reinitialize the try-state when a longjmp occurs.  This is implemented
by adding additional arguments to _setjmp3: the desired try-state and
a helper routine to update the try-state.

Differential Revision: http://reviews.llvm.org/D17721

llvm-svn: 262241
llvm/lib/Target/X86/X86WinEHState.cpp
llvm/test/CodeGen/WinEH/wineh-setjmp.ll [new file with mode: 0644]