gccint: GIMPLE Exception Handling
1
1 12.4 Exception Handling
1 =======================
1
1 Other exception handling constructs are represented using
1 'GIMPLE_TRY_CATCH'. 'GIMPLE_TRY_CATCH' has two operands. The first
1 operand is a sequence of statements to execute. If executing these
1 statements does not throw an exception, then the second operand is
1 ignored. Otherwise, if an exception is thrown, then the second operand
1 of the 'GIMPLE_TRY_CATCH' is checked. The second operand may have the
1 following forms:
1
1 1. A sequence of statements to execute. When an exception occurs,
1 these statements are executed, and then the exception is rethrown.
1
1 2. A sequence of 'GIMPLE_CATCH' statements. Each 'GIMPLE_CATCH' has a
1 list of applicable exception types and handler code. If the thrown
1 exception matches one of the caught types, the associated handler
1 code is executed. If the handler code falls off the bottom,
1 execution continues after the original 'GIMPLE_TRY_CATCH'.
1
1 3. A 'GIMPLE_EH_FILTER' statement. This has a list of permitted
1 exception types, and code to handle a match failure. If the thrown
1 exception does not match one of the allowed types, the associated
1 match failure code is executed. If the thrown exception does
1 match, it continues unwinding the stack looking for the next
1 handler.
1
1 Currently throwing an exception is not directly represented in GIMPLE,
1 since it is implemented by calling a function. At some point in the
1 future we will want to add some way to express that the call will throw
1 an exception of a known type.
1
1 Just before running the optimizers, the compiler lowers the high-level
1 EH constructs above into a set of 'goto's, magic labels, and EH regions.
1 Continuing to unwind at the end of a cleanup is represented with a
1 'GIMPLE_RESX'.
1