[WinEH] Make llvm.eh.actions use frameescape indices for catch params
authorReid Kleckner <reid@kleckner.net>
Thu, 2 Apr 2015 21:13:31 +0000 (21:13 +0000)
committerReid Kleckner <reid@kleckner.net>
Thu, 2 Apr 2015 21:13:31 +0000 (21:13 +0000)
commitdf4fd4fc4ef483341fa866ae0d3788a15bc01877
tree3a261856f61c8f99906e2dc958645e42c71c278f
parent5b93ab6cde250b3c6470cf49daa28e54848a86c5
[WinEH] Make llvm.eh.actions use frameescape indices for catch params

This makes it possible to use the same representation of llvm.eh.actions
in outlined handlers as we use in the parent function because i32's are
just constants that can be copied freely between functions.

I had to add a sentinel alloca to the list of child allocas so that we
don't try to sink the catch object into the handler. Normally, one would
use nullptr for this kind of thing, but TinyPtrVector doesn't support
null elements. More than that, it's elements have to have a suitable
alignment. Therefore, I settled on this for my sentinel:

  AllocaInst *getCatchObjectSentinel() {
    return static_cast<AllocaInst *>(nullptr) + 1;
  }

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233947 91177308-0d34-0410-b5e6-96231b3b80d8
12 files changed:
docs/ExceptionHandling.rst
lib/CodeGen/WinEHPrepare.cpp
lib/IR/Verifier.cpp
test/CodeGen/WinEH/cppeh-catch-all.ll
test/CodeGen/WinEH/cppeh-catch-scalar.ll
test/CodeGen/WinEH/cppeh-catch-unwind.ll
test/CodeGen/WinEH/cppeh-frame-vars.ll
test/CodeGen/WinEH/cppeh-inalloca.ll
test/CodeGen/WinEH/cppeh-multi-catch.ll
test/CodeGen/WinEH/cppeh-nested-2.ll
test/CodeGen/WinEH/cppeh-nonalloca-frame-values.ll
test/CodeGen/WinEH/seh-simple.ll