PRESERVE_EH_INFO to UPDATE_EH_INFO. Fix typo in last
change (stmt -> orig_stmt).
* tree-eh.c (verify_eh_throw_stmt_node): New function.
(bsi_remove): Add new argument. Remove EH information
if requested.
(verify_eh_throw_table_statements): New function.
(bsi_remove): Add new argument REMOVE_EH_INFO. All callers
updated.
* tree-optimize.c (execute_free_cfg_annotations): Verify
the EH throw statement table after removing annotations.
* except.h (verify_eh_throw_table_statements): Prototype.
* tree-flow.h (bsi_remove): Update prototype.
* tree-vrp.c (remove_range_assertions): Add new argument to
bsi_remove call.
* tree-ssa-loop-im.c (move_computations_stmt): Likewise.
* tree-complex.c (expand_complex_div_wide): Likewise.
* tree-ssa-threadupdate.c (remove_ctrl_stmt_and_useless_edges): Likewise
* tree-tailcall.c (eliminate_tailcall): Likewise.
* tree-ssa-dse.c (dse_optimize_stmt): Likewise.
* tree-ssa-loop-ivopts.c (remove_statement): Likewise.
* tree-nrv.c (tree_nrv): Likewise.
* tree-vectorizer.c (slpeel_make_loop_iterate_ntimes): Likewise.
* tree-if-conv.c (tree_if_convert_cond_expr): Likewise.
(combine_blocks): Likewise.
* tree-ssa-phiopt.c (replace_phi_edge_with_variable): Likewise.
* tree-cfgcleanup.c (cleanup_ctrl_expr_graph): Likewise.
(cleanup_control_flow): Likewise.
(remove_forwarder_block): Likewise.
* tree-ssa-pre.c (remove_dead_inserted_code): Likewise.
* tree-sra.c (sra_replace): Likewise.
* tree-ssa-forwprop.c (forward_propagate_into_cond): Likewise.
(forward_propagate_single_use_vars): Likewise.
* tree-ssa-dce.c (remove_dead_stmt): Likewise.
* tree-inline.c (expand_call_inline): Likewise.
* tree-vect-transform.c (vect_transform_loop): Likewise.
* tree-outof-ssa.c (rewrite_trees): Likewise.
* tree-cfg.c (make_goto_expr_edges): Likewise.
(cleanup_dead_labels): Likewise.
(tree_merge_blocks, remove_bb, disband_implicit_edges): Likewise.
(bsi_move_before, bsi_move_after): Likewise.
(bsi_move_to_bb_end, try_redirect_by_replacing_jump): Likewise
(tree_redirect_edge_and_branch, tree_split_block): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109421
138bc75d-0d04-0410-961f-
82ee72b054a4
+2005-01-06 Jeff Law <law@redhat.com>
+
+ PR ada/24994
+ * tree-cfg.c (bsi_replace): Rename final argument from
+ PRESERVE_EH_INFO to UPDATE_EH_INFO. Fix typo in last
+ change (stmt -> orig_stmt).
+ * tree-eh.c (verify_eh_throw_stmt_node): New function.
+ (bsi_remove): Add new argument. Remove EH information
+ if requested.
+ (verify_eh_throw_table_statements): New function.
+ (bsi_remove): Add new argument REMOVE_EH_INFO. All callers
+ updated.
+ * tree-optimize.c (execute_free_cfg_annotations): Verify
+ the EH throw statement table after removing annotations.
+ * except.h (verify_eh_throw_table_statements): Prototype.
+ * tree-flow.h (bsi_remove): Update prototype.
+ * tree-vrp.c (remove_range_assertions): Add new argument to
+ bsi_remove call.
+ * tree-ssa-loop-im.c (move_computations_stmt): Likewise.
+ * tree-complex.c (expand_complex_div_wide): Likewise.
+ * tree-ssa-threadupdate.c (remove_ctrl_stmt_and_useless_edges): Likewise
+ * tree-tailcall.c (eliminate_tailcall): Likewise.
+ * tree-ssa-dse.c (dse_optimize_stmt): Likewise.
+ * tree-ssa-loop-ivopts.c (remove_statement): Likewise.
+ * tree-nrv.c (tree_nrv): Likewise.
+ * tree-vectorizer.c (slpeel_make_loop_iterate_ntimes): Likewise.
+ * tree-if-conv.c (tree_if_convert_cond_expr): Likewise.
+ (combine_blocks): Likewise.
+ * tree-ssa-phiopt.c (replace_phi_edge_with_variable): Likewise.
+ * tree-cfgcleanup.c (cleanup_ctrl_expr_graph): Likewise.
+ (cleanup_control_flow): Likewise.
+ (remove_forwarder_block): Likewise.
+ * tree-ssa-pre.c (remove_dead_inserted_code): Likewise.
+ * tree-sra.c (sra_replace): Likewise.
+ * tree-ssa-forwprop.c (forward_propagate_into_cond): Likewise.
+ (forward_propagate_single_use_vars): Likewise.
+ * tree-ssa-dce.c (remove_dead_stmt): Likewise.
+ * tree-inline.c (expand_call_inline): Likewise.
+ * tree-vect-transform.c (vect_transform_loop): Likewise.
+ * tree-outof-ssa.c (rewrite_trees): Likewise.
+ * tree-cfg.c (make_goto_expr_edges): Likewise.
+ (cleanup_dead_labels): Likewise.
+ (tree_merge_blocks, remove_bb, disband_implicit_edges): Likewise.
+ (bsi_move_before, bsi_move_after): Likewise.
+ (bsi_move_to_bb_end, try_redirect_by_replacing_jump): Likewise
+ (tree_redirect_edge_and_branch, tree_split_block): Likewise.
+
2006-01-06 Andrew Pinski <pinskia@physics.uc.edu>
PR tree-opt/25528
extern struct htab *get_eh_throw_stmt_table (struct function *);
extern void set_eh_throw_stmt_table (struct function *, struct htab *);
+
+#ifdef ENABLE_CHECKING
+extern void verify_eh_throw_table_statements (void);
+#endif
#else
e->goto_locus = EXPR_LOCUS (goto_t);
#endif
- bsi_remove (&last);
+ bsi_remove (&last, true);
return;
}
|| DECL_NONLOCAL (label))
bsi_next (&i);
else
- bsi_remove (&i);
+ bsi_remove (&i, true);
}
}
{
tree label = bsi_stmt (bsi);
- bsi_remove (&bsi);
+ bsi_remove (&bsi, false);
/* Now that we can thread computed gotos, we might have
a situation where we have a forced label in block B
However, the label at the start of block B might still be
new_bb = bb->prev_bb;
new_bsi = bsi_start (new_bb);
- bsi_remove (&i);
+ bsi_remove (&i, false);
bsi_insert_before (&new_bsi, stmt, BSI_NEW_STMT);
}
else
if (in_ssa_p)
release_defs (stmt);
- bsi_remove (&i);
+ bsi_remove (&i, true);
}
/* Don't warn for removed gotos. Gotos are often removed due to
if (bb->next_bb == EXIT_BLOCK_PTR
&& !TREE_OPERAND (stmt, 0))
{
- bsi_remove (&last);
+ bsi_remove (&last, true);
single_succ_edge (bb)->flags |= EDGE_FALLTHRU;
}
continue;
/* Remove the statement pointed to by iterator I. The iterator is updated
- to the next statement. */
+ to the next statement.
+
+ When REMOVE_EH_INFO is true we remove the statement pointed to by
+ iterator I from the EH tables. Otherwise we do not modify the EH
+ tables.
+
+ Generally, REMOVE_EH_INFO should be true when the statement is going to
+ be removed from the IL and not reinserted elsewhere. */
void
-bsi_remove (block_stmt_iterator *i)
+bsi_remove (block_stmt_iterator *i, bool remove_eh_info)
{
tree t = bsi_stmt (*i);
set_bb_for_stmt (t, NULL);
delink_stmt_imm_use (t);
tsi_delink (&i->tsi);
mark_stmt_modified (t);
+ if (remove_eh_info)
+ remove_stmt_from_eh_region (t);
}
bsi_move_after (block_stmt_iterator *from, block_stmt_iterator *to)
{
tree stmt = bsi_stmt (*from);
- bsi_remove (from);
+ bsi_remove (from, false);
bsi_insert_after (to, stmt, BSI_SAME_STMT);
}
bsi_move_before (block_stmt_iterator *from, block_stmt_iterator *to)
{
tree stmt = bsi_stmt (*from);
- bsi_remove (from);
+ bsi_remove (from, false);
bsi_insert_before (to, stmt, BSI_SAME_STMT);
}
/* Replace the contents of the statement pointed to by iterator BSI
- with STMT. If PRESERVE_EH_INFO is true, the exception handling
- information of the original statement is preserved. */
+ with STMT. If UPDATE_EH_INFO is true, the exception handling
+ information of the original statement is moved to the new statement. */
+
void
-bsi_replace (const block_stmt_iterator *bsi, tree stmt, bool preserve_eh_info)
+bsi_replace (const block_stmt_iterator *bsi, tree stmt, bool update_eh_info)
{
int eh_region;
tree orig_stmt = bsi_stmt (*bsi);
/* Preserve EH region information from the original statement, if
requested by the caller. */
- if (preserve_eh_info)
+ if (update_eh_info)
{
eh_region = lookup_stmt_eh_region (orig_stmt);
if (eh_region >= 0)
{
- remove_stmt_from_eh_region (stmt);
+ remove_stmt_from_eh_region (orig_stmt);
add_stmt_to_eh_region (stmt, eh_region);
}
}
if (TREE_CODE (stmt) == COND_EXPR
|| TREE_CODE (stmt) == SWITCH_EXPR)
{
- bsi_remove (&b);
+ bsi_remove (&b, true);
e = ssa_redirect_edge (e, target);
e->flags = EDGE_FALLTHRU;
return e;
}
case RETURN_EXPR:
- bsi_remove (&bsi);
+ bsi_remove (&bsi, true);
e->flags |= EDGE_FALLTHRU;
break;
while (!bsi_end_p (bsi))
{
act = bsi_stmt (bsi);
- bsi_remove (&bsi);
+ bsi_remove (&bsi, false);
bsi_insert_after (&bsi_tgt, act, BSI_NEW_STMT);
}
else
taken_edge = single_succ_edge (bb);
- bsi_remove (&bsi);
+ bsi_remove (&bsi, true);
taken_edge->flags = EDGE_FALLTHRU;
/* We removed some paths from the cfg. */
/* Remove the GOTO_EXPR as it is not needed. The CFG has all the
relevant information we need. */
- bsi_remove (&bsi);
+ bsi_remove (&bsi, true);
retval = true;
}
{
label = bsi_stmt (bsi);
gcc_assert (TREE_CODE (label) == LABEL_EXPR);
- bsi_remove (&bsi);
+ bsi_remove (&bsi, false);
bsi_insert_before (&bsi_to, label, BSI_CONTINUE_LINKING);
}
}
bsi_insert_before (bsi, t1, BSI_SAME_STMT);
t1 = build2 (MODIFY_EXPR, inner_type, ri, ti);
bsi_insert_before (bsi, t1, BSI_SAME_STMT);
- bsi_remove (bsi);
+ bsi_remove (bsi, true);
}
}
bsi_insert_before (bsi, t1, BSI_SAME_STMT);
t1 = build2 (MODIFY_EXPR, inner_type, ri, ti);
bsi_insert_before (bsi, t1, BSI_SAME_STMT);
- bsi_remove (bsi);
+ bsi_remove (bsi, true);
}
}
return false;
}
+
+#ifdef ENABLE_CHECKING
+static int
+verify_eh_throw_stmt_node (void **slot, void *data ATTRIBUTE_UNUSED)
+{
+ struct throw_stmt_node *node = (struct throw_stmt_node *)*slot;
+
+ gcc_assert (node->stmt->common.ann == NULL);
+ return 1;
+}
+
+void
+verify_eh_throw_table_statements (void)
+{
+ if (!get_eh_throw_stmt_table (cfun))
+ return;
+ htab_traverse (get_eh_throw_stmt_table (cfun),
+ verify_eh_throw_stmt_node,
+ NULL);
+}
+
+#endif
static inline tree bsi_stmt (block_stmt_iterator);
static inline tree * bsi_stmt_ptr (block_stmt_iterator);
-extern void bsi_remove (block_stmt_iterator *);
+extern void bsi_remove (block_stmt_iterator *, bool);
extern void bsi_move_before (block_stmt_iterator *, block_stmt_iterator *);
extern void bsi_move_after (block_stmt_iterator *, block_stmt_iterator *);
extern void bsi_move_to_bb_end (block_stmt_iterator *, basic_block);
using new condition. */
if (!bb_with_exit_edge_p (loop, bb_for_stmt (stmt)))
{
- bsi_remove (bsi);
+ bsi_remove (bsi, true);
cond = NULL_TREE;
}
return;
for (bsi = bsi_start (bb); !bsi_end_p (bsi); )
{
if (TREE_CODE (bsi_stmt (bsi)) == LABEL_EXPR)
- bsi_remove (&bsi);
+ bsi_remove (&bsi, true);
else
{
set_bb_for_stmt (bsi_stmt (bsi), merge_target_bb);
else
{
tree stmt = bsi_stmt (stmt_bsi);
- bsi_remove (&stmt_bsi);
+ bsi_remove (&stmt_bsi, false);
bsi_insert_after (&bsi, stmt, BSI_NEW_STMT);
}
stmt_bsi = bsi_start (return_block);
else
/* We're modifying a TSI owned by gimple_expand_calls_inline();
tsi_delink() will leave the iterator in a sane state. */
- bsi_remove (&stmt_bsi);
+ bsi_remove (&stmt_bsi, true);
bsi_next (&bsi);
if (bsi_end_p (bsi))
if (TREE_CODE (*tp) == MODIFY_EXPR
&& TREE_OPERAND (*tp, 0) == result
&& TREE_OPERAND (*tp, 1) == found)
- bsi_remove (&bsi);
+ bsi_remove (&bsi, true);
else
{
walk_tree (tp, finalize_nrv_r, &data, 0);
/* And get rid of annotations we no longer need. */
delete_tree_cfg_annotations ();
+
+#ifdef ENABLE_CHECKING
+ /* Once the statement annotations have been removed, we can verify
+ the integrity of statements in the EH throw table. */
+ verify_eh_throw_table_statements ();
+#endif
}
struct tree_opt_pass pass_free_cfg_annotations =
/* Remove any stmts marked for removal. */
if (remove)
- bsi_remove (&si);
+ bsi_remove (&si, true);
else
bsi_next (&si);
}
sra_replace (block_stmt_iterator *bsi, tree list)
{
sra_insert_before (bsi, list);
- bsi_remove (bsi);
+ bsi_remove (bsi, false);
if (bsi_end_p (*bsi))
*bsi = bsi_last (bsi->bb);
else
tree def = DEF_FROM_PTR (def_p);
mark_sym_for_renaming (SSA_NAME_VAR (def));
}
- bsi_remove (i);
+ bsi_remove (i, true);
release_defs (t);
}
\f
SET_USE (use_p, USE_FROM_PTR (var2));
}
/* Remove the dead store. */
- bsi_remove (&bsi);
+ bsi_remove (&bsi, true);
/* And release any SSA_NAMEs set in this statement back to the
SSA_NAME manager. */
{
tree def = SSA_NAME_DEF_STMT (test_var);
block_stmt_iterator bsi = bsi_for_stmt (def);
- bsi_remove (&bsi);
+ bsi_remove (&bsi, true);
}
}
}
if (TREE_CODE (rhs) == ADDR_EXPR)
{
if (forward_propagate_addr_expr (stmt))
- bsi_remove (&bsi);
+ bsi_remove (&bsi, true);
else
bsi_next (&bsi);
}
cost, level->num);
}
bsi_insert_on_edge (loop_preheader_edge (level), stmt);
- bsi_remove (&bsi);
+ bsi_remove (&bsi, false);
}
}
{
block_stmt_iterator bsi = bsi_for_stmt (stmt);
- bsi_remove (&bsi);
+ bsi_remove (&bsi, true);
}
}
/* Eliminate the COND_EXPR at the end of COND_BLOCK. */
bsi = bsi_last (cond_block);
- bsi_remove (&bsi);
+ bsi_remove (&bsi, true);
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file,
else
{
bsi = bsi_for_stmt (t);
- bsi_remove (&bsi);
+ bsi_remove (&bsi, true);
release_defs (t);
}
}
&& (TREE_CODE (bsi_stmt (bsi)) == COND_EXPR
|| TREE_CODE (bsi_stmt (bsi)) == GOTO_EXPR
|| TREE_CODE (bsi_stmt (bsi)) == SWITCH_EXPR))
- bsi_remove (&bsi);
+ bsi_remove (&bsi, true);
for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
{
if (TREE_CODE (t) == RETURN_EXPR)
break;
- bsi_remove (&bsi);
+ bsi_remove (&bsi, true);
release_defs (t);
}
SSA_NAME_DEF_STMT (rslt) = build_empty_stmt ();
}
- bsi_remove (&t->call_bsi);
+ bsi_remove (&t->call_bsi, true);
release_defs (call);
}
stmt_ann_t ann = stmt_ann (stmt);
free (stmt_info);
set_stmt_info ((tree_ann_t)ann, NULL);
- bsi_remove (&si);
+ bsi_remove (&si, true);
continue;
}
bsi_insert_before (&loop_cond_bsi, cond_stmt, BSI_SAME_STMT);
/* Remove old loop exit test: */
- bsi_remove (&loop_cond_bsi);
+ bsi_remove (&loop_cond_bsi, true);
loop_loc = find_loop_location (loop);
if (dump_file && (dump_flags & TDF_DETAILS))
}
/* And finally, remove the copy, it is not needed. */
- bsi_remove (&si);
+ bsi_remove (&si, true);
}
else
bsi_next (&si);