+ q->is_label = is_label;
+}
+
+/* Record the LABEL label in the goto queue contained in TF.
+ TF is not null. */
+
+static void
+record_in_goto_queue_label (struct leh_tf_state *tf, treemple stmt, tree label)
+{
+ int index;
+ treemple temp, new_stmt;
+
+ if (!label)
+ return;
+
+ /* Computed and non-local gotos do not get processed. Given
+ their nature we can neither tell whether we've escaped the
+ finally block nor redirect them if we knew. */
+ if (TREE_CODE (label) != LABEL_DECL)
+ return;
+
+ /* No need to record gotos that don't leave the try block. */
+ temp.t = label;
+ if (!outside_finally_tree (temp, tf->try_finally_expr))
+ return;
+
+ if (! tf->dest_array)
+ {
+ tf->dest_array = VEC_alloc (tree, heap, 10);
+ VEC_quick_push (tree, tf->dest_array, label);
+ index = 0;
+ }
+ else
+ {
+ int n = VEC_length (tree, tf->dest_array);
+ for (index = 0; index < n; ++index)
+ if (VEC_index (tree, tf->dest_array, index) == label)
+ break;
+ if (index == n)
+ VEC_safe_push (tree, heap, tf->dest_array, label);
+ }
+
+ /* In the case of a GOTO we want to record the destination label,
+ since with a GIMPLE_COND we have an easy access to the then/else
+ labels. */
+ new_stmt = stmt;
+ record_in_goto_queue (tf, new_stmt, index, true);
+
+}
+
+/* For any GIMPLE_GOTO or GIMPLE_RETURN, decide whether it leaves a try_finally
+ node, and if so record that fact in the goto queue associated with that
+ try_finally node. */
+
+static void
+maybe_record_in_goto_queue (struct leh_state *state, gimple stmt)
+{
+ struct leh_tf_state *tf = state->tf;
+ treemple new_stmt;
+
+ if (!tf)
+ return;
+
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_COND:
+ new_stmt.tp = gimple_op_ptr (stmt, 2);
+ record_in_goto_queue_label (tf, new_stmt, gimple_cond_true_label (stmt));
+ new_stmt.tp = gimple_op_ptr (stmt, 3);
+ record_in_goto_queue_label (tf, new_stmt, gimple_cond_false_label (stmt));
+ break;
+ case GIMPLE_GOTO:
+ new_stmt.g = stmt;
+ record_in_goto_queue_label (tf, new_stmt, gimple_goto_dest (stmt));
+ break;
+
+ case GIMPLE_RETURN:
+ tf->may_return = true;
+ new_stmt.g = stmt;
+ record_in_goto_queue (tf, new_stmt, -1, false);
+ break;
+
+ default:
+ gcc_unreachable ();
+ }