Next:OpenMP, Previous:Jumps, Up:Statements [Contents][Index]
Destructors for local C++ objects and similar dynamic cleanups arerepresented in GIMPLE by aTRY_FINALLY_EXPR.TRY_FINALLY_EXPR has two operands, both of which are a sequenceof statements to execute. The first sequence is executed. When itcompletes the second sequence is executed.
The first sequence may complete in the following ways:
GOTO_EXPR) to an ordinarylabel outside the sequence.RETURN_EXPR).The second sequence is not executed if the first sequence completes bycallingsetjmp orexit or any other function that doesnot return. The second sequence is also not executed if the firstsequence completes via a non-local goto or a computed goto (in generalthe compiler does not know whether such a goto statement exits thefirst sequence or not, so we assume that it doesn’t).
After the second sequence is executed, if it completes normally byfalling off the end, execution continues wherever the first sequencewould have continued, by falling off the end, or doing a goto, etc.
If the second sequence is anEH_ELSE_EXPR selector, then thesequence in its first operand is used when the first sequence completesnormally, and that in its second operand is used for exceptionalcleanups, i.e., when an exception propagates out of the first sequence.
TRY_FINALLY_EXPR complicates the flow graph, since the cleanupneeds to appear on every edge out of the controlled block; thisreduces the freedom to move code across these edges. Therefore, theEH lowering pass which runs before most of the optimization passeseliminates these expressions by explicitly adding the cleanup to eachedge. Rethrowing the exception is represented usingRESX_EXPR.
Next:OpenMP, Previous:Jumps, Up:Statements [Contents][Index]