<li><a href="#llvm_eh_exception"><tt>llvm.eh.exception</tt></a></li>
<li><a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a></li>
<li><a href="#llvm_eh_typeid_for"><tt>llvm.eh.typeid.for</tt></a></li>
+ <li><a href="#llvm_eh_sjlj_setjmp"><tt>llvm.eh.sjlj.setjmp</tt></a></li>
+ <li><a href="#llvm_eh_sjlj_longjmp"><tt>llvm.eh.sjlj.longjmp</tt></a></li>
+ <li><a href="#llvm_eh_sjlj_lsda"><tt>llvm.eh.sjlj.lsda</tt></a></li>
+ <li><a href="#llvm_eh_sjlj_callsite"><tt>llvm.eh.sjlj.callsite</tt></a></li>
</ol></li>
<li><a href="#asm">Asm Table Formats</a>
<ol>
pad to the back end.</p>
<p><a href="#llvm_eh_exception"><tt>llvm.eh.exception</tt></a> 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.</p>
+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.</p>
<p><a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> takes a minimum of
three arguments. The first argument is the reference to the exception
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 <a href="#restrictions">undefined</a>.
-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
<a href="#llvm_eh_typeid_for"><tt>llvm.eh.typeid.for</tt></a> intrinsic.</p>
<div class="doc_text">
-<p>C++ allows the specification of which exception types that can be thrown from
+<p>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 <a
-href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a>. 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"><tt>llvm.eh.selector</tt></a>. 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.
<a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> 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 <tt>__cxa_call_unexpected</tt> should be made, otherwise
-<tt>_Unwind_Resume</tt>. Each of these functions require a reference to the
-exception structure.</p>
+<tt>_Unwind_Resume</tt>. Each of these functions requires a reference to the
+exception structure. Note that the most general form of an
+<a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> 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
+<a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> calls due to inlining
+creating nested exception handling scopes.</p>
</div>
i8* %<a href="#llvm_eh_exception">llvm.eh.exception</a>( )
</pre>
-<p>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.</p>
+<p>This intrinsic returns a pointer to the exception structure.</p>
</div>
i64 %<a href="#llvm_eh_selector">llvm.eh.selector.i64</a>(i8*, i8*, i8*, ...)
</pre>
-<p>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.</p>
+<p>This intrinsic is used to compare the exception with the given type infos,
+filters and cleanups.</p>
<p><a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> takes a minimum of
three arguments. The first argument is the reference to the exception
</div>
+<!-- ======================================================================= -->
+<div class="doc_subsubsection">
+ <a name="llvm_eh_sjlj_setjmp">llvm.eh.sjlj.setjmp</a>
+</div>
+
+<div class="doc_text">
+<pre>
+ i32 %<a href="#llvm_eh_sjlj_setjmp">llvm.eh.sjlj.setjmp</a>(i8*)
+</pre>
+
+<p>The SJLJ exception handling uses this intrinsic to force register saving
+for the current function and to store the address of the following instruction
+for use as a destination address by <a href="#llvm_eh_sjlj_longjmp">
+<tt>llvm.eh.sjlj.longjmp</tt></a>. The buffer format and the overall functioning
+of this intrinsic is compatible with the GCC <tt>__builtin_setjmp</tt>
+implementation, allowing code built with the two compilers to interoperate.</p>
+
+<p>The single parameter is a pointer to a five word buffer in which the
+calling context is saved. The front end places the frame pointer in the
+first word, and the target implementation of this intrinsic should place the
+destination address for a <a href="#llvm_eh_sjlj_longjmp"><tt>
+llvm.eh.sjlj.longjmp</tt></a> in the second word. The following three words
+are available for use in a target-specific manner.</p>
+
+</div>
+
+<!-- ======================================================================= -->
+<div class="doc_subsubsection">
+ <a name="llvm_eh_sjlj_lsda">llvm.eh.sjlj.lsda</a>
+</div>
+
+<div class="doc_text">
+<pre>
+ i8* %<a href="#llvm_eh_sjlj_lsda">llvm.eh.sjlj.lsda</a>( )
+</pre>
+
+<p>Used for SJLJ based exception handling, the <a href="#llvm_eh_sjlj_lsda">
+ <tt>llvm.eh.sjlj.lsda</tt></a> intrinsic returns the address of the Language
+Specific Data Area (LSDA) for the current function. The SJLJ front-end code
+stores this address in the exception handling function context for use by
+the runtime.</p>
+
+</div>
+
+<!-- ======================================================================= -->
+<div class="doc_subsubsection">
+ <a name="llvm_eh_sjlj_callsite">llvm.eh.sjlj.callsite</a>
+</div>
+
+<div class="doc_text">
+<pre>
+ void %<a href="#llvm_eh_sjlj_callsite">llvm.eh.sjlj.callsite</a>(i32)
+</pre>
+
+<p>The SJLJ front-end allocates call site indices for invoke instrucitons.
+These values are passed to the back-end via the
+<a href="#llvm_eh_sjlj_callsite"><tt>llvm.eh.sjlj.callsite</tt></a>
+intrinsic, where they are used to build the LSDA call-site table.</p>
+
+</div>
+
<!-- ======================================================================= -->
<div class="doc_section">
<a name="asm">Asm Table Formats</a>
<hr>
<address>
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img
- src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
+ src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
<a href="http://validator.w3.org/check/referer"><img
- src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
+ src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>