[SEH] Add new intrinsics for recovering and restoring parent frames
authorReid Kleckner <reid@kleckner.net>
Tue, 30 Jun 2015 22:46:59 +0000 (22:46 +0000)
committerReid Kleckner <reid@kleckner.net>
Tue, 30 Jun 2015 22:46:59 +0000 (22:46 +0000)
commit34c6bb0ef046b1d4c4387de8553942a4bb4bcde1
treed2206a01f78891c9ad4a296ea9c180c9639481be
parentb5778f2e34fb45d1b0797de78c47c5f14f40db45
[SEH] Add new intrinsics for recovering and restoring parent frames

The incoming EBP value established by the runtime is actually a pointer
to the end of the EH registration object, and not the true parent
function frame pointer. Clang doesn't need llvm.x86.seh.exceptioninfo
anymore because we know that the exception info pointer is at a fixed
offset from this incoming EBP.

The llvm.x86.seh.recoverfp intrinsic takes an EBP value provided by the
EH runtime and returns a pointer that is usable with llvm.framerecover.

The llvm.x86.seh.restoreframe intrinsic is inserted by the 32-bit
specific preparation pass in blocks targetted by the EH runtime. It
re-establishes any physical registers used by the parent function to
address the stack, such as the frame, base, and stack pointers.

Neither of these intrinsics correctly handle stack realignment prologues
yet, but it's possible to add that later.

Reviewers: majnemer

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241125 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/IntrinsicsX86.td
lib/CodeGen/AsmPrinter/WinException.cpp
lib/CodeGen/AsmPrinter/WinException.h
lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86WinEHState.cpp
test/CodeGen/X86/seh-catch-all-win32.ll
test/CodeGen/X86/seh-safe-div-win32.ll