OSDN Git Service

[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)
commitace061bc345e3f8c6a9a5d4ba4a9b4f0c0f8d438
tree79350bd17ea148447671131388caa325ff689328
parenteb295ed84e45e32ca02ffe8d18036b50092e42e6
[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262241 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86WinEHState.cpp
test/CodeGen/WinEH/wineh-setjmp.ll [new file with mode: 0644]