[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)
commit399a2fe400912313eafdb7ff3b6e17b439887e9d
tree556f40456637c0e60c51ae07819490a2bf7d4b7d
parenta5812a215bd90c320221b4d33bdf2767f4ec7077
[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

llvm-svn: 241125
llvm/include/llvm/IR/IntrinsicsX86.td
llvm/lib/CodeGen/AsmPrinter/WinException.cpp
llvm/lib/CodeGen/AsmPrinter/WinException.h
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86WinEHState.cpp
llvm/test/CodeGen/X86/seh-catch-all-win32.ll
llvm/test/CodeGen/X86/seh-safe-div-win32.ll