From 6531d477a2920e5b7706c8c2ceccfc92df810d5b Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Mon, 29 Dec 2008 15:27:32 +0000 Subject: Clarify a bit. Based on feedback by Talin. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61470 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/ExceptionHandling.html | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'docs/ExceptionHandling.html') diff --git a/docs/ExceptionHandling.html b/docs/ExceptionHandling.html index 51361393c8..24a34844c7 100644 --- a/docs/ExceptionHandling.html +++ b/docs/ExceptionHandling.html @@ -203,10 +203,9 @@ to the type info of the exception object.

pad to the back end.

llvm.eh.exception takes no -arguments and returns the exception structure reference. The backend replaces -this intrinsic with the code that accesses the first argument of a call. The -LLVM C++ front end generates code to save this value in an alloca location for -further use in the landing pad and catch code.

+arguments and returns a pointer to the exception structure. This only returns a +sensible value if called after an invoke has branched to a landing pad. Due to +codegen limitations, it must currently be called in the landing pad itself.

llvm.eh.selector takes a minimum of three arguments. The first argument is the reference to the exception @@ -220,8 +219,9 @@ The result of the llvm.eh.selector is a positive number if the exception matched a type info, a negative number if it matched a filter, and zero if it matched a cleanup. If nothing is matched, the behaviour of the program is undefined. -The LLVM C++ front end generates code to save the selector value in an alloca -location for further use in the landing pad and catch code. +This only returns a sensible value if called after an invoke has branched to a +landing pad. Due to codegen limitations, it must currently be called in the +landing pad itself. If a type info matched then the selector value is the index of the type info in the exception table, which can be obtained using the llvm.eh.typeid.for intrinsic.

@@ -276,17 +276,23 @@ instead.
-

C++ allows the specification of which exception types that can be thrown from +

C++ allows the specification of which exception types can be thrown from a function. To represent this a top level landing pad may exist to filter out invalid types. To express this in LLVM code the landing pad will call llvm.eh.selector. The arguments are the -length of the filter expression (the number of type infos plus one), followed by -the type infos themselves. +href="#llvm_eh_selector">llvm.eh.selector. The arguments are a +reference to the exception structure, a reference to the personality function, +the length of the filter expression (the number of type infos plus one), +followed by the type infos themselves. llvm.eh.selector will return a negative value if the exception does not match any of the type infos. If no match is found then a call to __cxa_call_unexpected should be made, otherwise -_Unwind_Resume. Each of these functions require a reference to the -exception structure.

+_Unwind_Resume. Each of these functions requires a reference to the +exception structure. Note that the most general form of an +llvm.eh.selector call can contain +any number of type infos, filter expressions and cleanups (though having more +than one cleanup is pointless). The LLVM C++ front-end can generate such +llvm.eh.selector calls due to inlining +creating nested exception handling scopes.

@@ -340,10 +346,7 @@ provide exception handling information at various points in generated code.

i8* %llvm.eh.exception( ) -

This intrinsic indicates that the exception structure is available at this -point in the code. The backend will replace this intrinsic with code to fetch -the first argument of a call. The effect is that the intrinsic result is the -exception structure reference.

+

This intrinsic returns a pointer to the exception structure.

@@ -358,10 +361,8 @@ exception structure reference.

i64 %llvm.eh.selector.i64(i8*, i8*, i8*, ...) -

This intrinsic indicates that the exception selector is available at this -point in the code. The backend will replace this intrinsic with code to fetch -the second argument of a call. The effect is that the intrinsic result is the -exception selector.

+

This intrinsic is used to compare the exception with the given type infos, +filters and cleanups.

llvm.eh.selector takes a minimum of three arguments. The first argument is the reference to the exception -- cgit v1.2.3