+ <p>
+ This file implements lowering for the <tt>llvm.gc*</tt> intrinsics for targets
+ that do not natively support them (which includes the C backend). Note that
+ the code generated is not as efficient as it would be for targets that
+ natively support the GC intrinsics, but it is useful for getting new targets
+ up-and-running quickly.
+ </p>
+
+ <p>
+ This pass implements the code transformation described in this paper:
+ </p>
+
+ <blockquote><p>
+ "Accurate Garbage Collection in an Uncooperative Environment"
+ Fergus Henderson, ISMM, 2002
+ </p></blockquote>
+</div>
+
+<!-------------------------------------------------------------------------- -->
+<div class="doc_subsection">
+ <a name="lowerinvoke">Lower invoke and unwind, for unwindless code generators</a>
+</div>
+<div class="doc_text">
+ <p>
+ This transformation is designed for use by code generators which do not yet
+ support stack unwinding. This pass supports two models of exception handling
+ lowering, the 'cheap' support and the 'expensive' support.
+ </p>
+
+ <p>
+ 'Cheap' exception handling support gives the program the ability to execute
+ any program which does not "throw an exception", by turning 'invoke'
+ instructions into calls and by turning 'unwind' instructions into calls to
+ abort(). If the program does dynamically use the unwind instruction, the
+ program will print a message then abort.
+ </p>
+
+ <p>
+ 'Expensive' exception handling support gives the full exception handling
+ support to the program at the cost of making the 'invoke' instruction
+ really expensive. It basically inserts setjmp/longjmp calls to emulate the
+ exception handling as necessary.
+ </p>
+
+ <p>
+ Because the 'expensive' support slows down programs a lot, and EH is only
+ used for a subset of the programs, it must be specifically enabled by the
+ <tt>-enable-correct-eh-support</tt> option.
+ </p>
+
+ <p>
+ Note that after this pass runs the CFG is not entirely accurate (exceptional
+ control flow edges are not correct anymore) so only very simple things should
+ be done after the lowerinvoke pass has run (like generation of native code).
+ This should not be used as a general purpose "my LLVM-to-LLVM pass doesn't
+ support the invoke instruction yet" lowering pass.
+ </p>
+</div>
+
+<!-------------------------------------------------------------------------- -->
+<div class="doc_subsection">
+ <a name="lowerselect">Lower select instructions to branches</a>
+</div>
+<div class="doc_text">
+ <p>
+ Lowers select instructions into conditional branches for targets that do not
+ have conditional moves or that have not implemented the select instruction
+ yet.
+ </p>
+
+ <p>
+ Note that this pass could be improved. In particular it turns every select
+ instruction into a new conditional branch, even though some common cases have
+ select instructions on the same predicate next to each other. It would be
+ better to use the same branch for the whole group of selects.
+ </p>