gccint: Cleanups
1
1 11.7.6 Cleanups
1 ---------------
1
1 Destructors for local C++ objects and similar dynamic cleanups are
1 represented in GIMPLE by a 'TRY_FINALLY_EXPR'. 'TRY_FINALLY_EXPR' has
1 two operands, both of which are a sequence of statements to execute.
1 The first sequence is executed. When it completes the second sequence
1 is executed.
1
1 The first sequence may complete in the following ways:
1
1 1. Execute the last statement in the sequence and fall off the end.
1
1 2. Execute a goto statement ('GOTO_EXPR') to an ordinary label outside
1 the sequence.
1
1 3. Execute a return statement ('RETURN_EXPR').
1
1 4. Throw an exception. This is currently not explicitly represented
1 in GIMPLE.
1
1 The second sequence is not executed if the first sequence completes by
1 calling 'setjmp' or 'exit' or any other function that does not return.
1 The second sequence is also not executed if the first sequence completes
1 via a non-local goto or a computed goto (in general the compiler does
1 not know whether such a goto statement exits the first sequence or not,
1 so we assume that it doesn't).
1
1 After the second sequence is executed, if it completes normally by
1 falling off the end, execution continues wherever the first sequence
1 would have continued, by falling off the end, or doing a goto, etc.
1
1 'TRY_FINALLY_EXPR' complicates the flow graph, since the cleanup needs
1 to appear on every edge out of the controlled block; this reduces the
1 freedom to move code across these edges. Therefore, the EH lowering
1 pass which runs before most of the optimization passes eliminates these
1 expressions by explicitly adding the cleanup to each edge. Rethrowing
1 the exception is represented using 'RESX_EXPR'.
1