diff options
author | Reid Kleckner <reid@kleckner.net> | 2015-04-02 21:13:31 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2015-04-02 21:13:31 +0000 |
commit | df4fd4fc4ef483341fa866ae0d3788a15bc01877 (patch) | |
tree | 3a261856f61c8f99906e2dc958645e42c71c278f /docs/ExceptionHandling.rst | |
parent | 5b93ab6cde250b3c6470cf49daa28e54848a86c5 (diff) |
[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
Diffstat (limited to 'docs/ExceptionHandling.rst')
-rw-r--r-- | docs/ExceptionHandling.rst | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/docs/ExceptionHandling.rst b/docs/ExceptionHandling.rst index 21de19b0752c..6c33e0b363c5 100644 --- a/docs/ExceptionHandling.rst +++ b/docs/ExceptionHandling.rst @@ -519,25 +519,29 @@ action. A code of ``i32 1`` indicates a catch action, which expects three additional arguments. Different EH schemes give different meanings to the three arguments, -but the first argument indicates whether the catch should fire, the second is a -pointer to stack object where the exception object should be stored, and the -third is the code to run to catch the exception. +but the first argument indicates whether the catch should fire, the second is +the frameescape index of the exception object, and the third is the code to run +to catch the exception. For Windows C++ exception handling, the first argument for a catch handler is a -pointer to the RTTI type descriptor for the object to catch. The third argument -is a pointer to a function implementing the catch. This function returns the -address of the basic block where execution should resume after handling the -exception. +pointer to the RTTI type descriptor for the object to catch. The second +argument is an index into the argument list of the ``llvm.frameescape`` call in +the main function. The exception object will be copied into the provided stack +object. If the exception object is not required, this argument should be -1. +The third argument is a pointer to a function implementing the catch. This +function returns the address of the basic block where execution should resume +after handling the exception. For Windows SEH, the first argument is a pointer to the filter function, which indicates if the exception should be caught or not. The second argument is -typically null. The third argument is the address of a basic block where the -exception will be handled. In other words, catch handlers are not outlined in -SEH. After running cleanups, execution immediately resumes at this PC. +typically negative one. The third argument is the address of a basic block +where the exception will be handled. In other words, catch handlers are not +outlined in SEH. After running cleanups, execution immediately resumes at this +PC. In order to preserve the structure of the CFG, a call to '``llvm.eh.actions``' -must be followed by an ':ref:`indirectbr <i_indirectbr>`' instruction that jumps -to the result of the intrinsic call. +must be followed by an ':ref:`indirectbr <i_indirectbr>`' instruction that +jumps to the result of the intrinsic call. ``llvm.eh.unwindhelp`` ---------------------- |