tree-cfg.c (bsi_replace): Rename final argument from PRESERVE_EH_INFO to UPDATE_EH_INFO.

* 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.

From-SVN: r109421
This commit is contained in:
Jeff Law 2006-01-06 10:50:26 -07:00 committed by Jeff Law
parent 8ae5e6f215
commit 736432eedb
25 changed files with 134 additions and 45 deletions

View File

@ -1,3 +1,50 @@
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

View File

@ -173,3 +173,7 @@ struct throw_stmt_node GTY(())
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

View File

@ -843,7 +843,7 @@ make_goto_expr_edges (basic_block bb)
#else
e->goto_locus = EXPR_LOCUS (goto_t);
#endif
bsi_remove (&last);
bsi_remove (&last, true);
return;
}
@ -1064,7 +1064,7 @@ cleanup_dead_labels (void)
|| DECL_NONLOCAL (label))
bsi_next (&i);
else
bsi_remove (&i);
bsi_remove (&i, true);
}
}
@ -1362,7 +1362,7 @@ tree_merge_blocks (basic_block a, basic_block b)
{
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
@ -2024,7 +2024,7 @@ remove_bb (basic_block bb)
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
@ -2036,7 +2036,7 @@ remove_bb (basic_block bb)
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
@ -2584,7 +2584,7 @@ disband_implicit_edges (void)
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;
@ -2800,16 +2800,25 @@ bsi_insert_after (block_stmt_iterator *i, tree t, enum bsi_iterator_update m)
/* 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);
}
@ -2819,7 +2828,7 @@ void
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);
}
@ -2830,7 +2839,7 @@ void
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);
}
@ -2851,11 +2860,12 @@ bsi_move_to_bb_end (block_stmt_iterator *from, basic_block bb)
/* 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);
@ -2865,12 +2875,12 @@ bsi_replace (const block_stmt_iterator *bsi, tree stmt, bool preserve_eh_info)
/* 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);
}
}
@ -3969,7 +3979,7 @@ tree_try_redirect_by_replacing_jump (edge e, basic_block target)
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;
@ -4066,7 +4076,7 @@ tree_redirect_edge_and_branch (edge e, basic_block dest)
}
case RETURN_EXPR:
bsi_remove (&bsi);
bsi_remove (&bsi, true);
e->flags |= EDGE_FALLTHRU;
break;
@ -4142,7 +4152,7 @@ tree_split_block (basic_block bb, void *stmt)
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);
}

View File

@ -117,7 +117,7 @@ cleanup_control_expr_graph (basic_block bb, block_stmt_iterator bsi)
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. */
@ -207,7 +207,7 @@ cleanup_control_flow (void)
/* 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;
}
@ -433,7 +433,7 @@ remove_forwarder_block (basic_block bb, basic_block **worklist)
{
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);
}
}

View File

@ -1124,7 +1124,7 @@ expand_complex_div_wide (block_stmt_iterator *bsi, tree inner_type,
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);
}
}
@ -1163,7 +1163,7 @@ expand_complex_div_wide (block_stmt_iterator *bsi, tree inner_type,
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);
}
}

View File

@ -2075,3 +2075,25 @@ maybe_clean_or_replace_eh_stmt (tree old_stmt, tree new_stmt)
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

View File

@ -449,7 +449,7 @@ static inline void bsi_prev (block_stmt_iterator *);
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);

View File

@ -287,7 +287,7 @@ tree_if_convert_cond_expr (struct loop *loop, tree stmt, tree cond,
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;
@ -934,7 +934,7 @@ combine_blocks (struct loop *loop)
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);

View File

@ -2067,7 +2067,7 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data)
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);
@ -2182,7 +2182,7 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data)
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))

View File

@ -200,7 +200,7 @@ tree_nrv (void)
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);

View File

@ -209,6 +209,12 @@ execute_free_cfg_annotations (void)
/* 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 =

View File

@ -1940,7 +1940,7 @@ rewrite_trees (var_map map, tree *values)
/* Remove any stmts marked for removal. */
if (remove)
bsi_remove (&si);
bsi_remove (&si, true);
else
bsi_next (&si);
}

View File

@ -1825,7 +1825,7 @@ static void
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

View File

@ -799,7 +799,7 @@ remove_dead_stmt (block_stmt_iterator *i, basic_block bb)
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);
}

View File

@ -351,7 +351,7 @@ dse_optimize_stmt (struct dom_walk_data *walk_data,
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. */

View File

@ -433,7 +433,7 @@ forward_propagate_into_cond (tree cond_expr)
{
tree def = SSA_NAME_DEF_STMT (test_var);
block_stmt_iterator bsi = bsi_for_stmt (def);
bsi_remove (&bsi);
bsi_remove (&bsi, true);
}
}
}
@ -827,7 +827,7 @@ tree_ssa_forward_propagate_single_use_vars (void)
if (TREE_CODE (rhs) == ADDR_EXPR)
{
if (forward_propagate_addr_expr (stmt))
bsi_remove (&bsi);
bsi_remove (&bsi, true);
else
bsi_next (&bsi);
}

View File

@ -759,7 +759,7 @@ move_computations_stmt (struct dom_walk_data *dw_data ATTRIBUTE_UNUSED,
cost, level->num);
}
bsi_insert_on_edge (loop_preheader_edge (level), stmt);
bsi_remove (&bsi);
bsi_remove (&bsi, false);
}
}

View File

@ -5326,7 +5326,7 @@ remove_statement (tree stmt, bool including_defined_name)
{
block_stmt_iterator bsi = bsi_for_stmt (stmt);
bsi_remove (&bsi);
bsi_remove (&bsi, true);
}
}

View File

@ -351,7 +351,7 @@ replace_phi_edge_with_variable (basic_block cond_block,
/* 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,

View File

@ -3407,7 +3407,7 @@ remove_dead_inserted_code (void)
else
{
bsi = bsi_for_stmt (t);
bsi_remove (&bsi);
bsi_remove (&bsi, true);
release_defs (t);
}
}

View File

@ -180,7 +180,7 @@ remove_ctrl_stmt_and_useless_edges (basic_block bb, basic_block dest_bb)
&& (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)); )
{

View File

@ -735,7 +735,7 @@ eliminate_tail_call (struct tailcall *t)
if (TREE_CODE (t) == RETURN_EXPR)
break;
bsi_remove (&bsi);
bsi_remove (&bsi, true);
release_defs (t);
}
@ -825,7 +825,7 @@ eliminate_tail_call (struct tailcall *t)
SSA_NAME_DEF_STMT (rslt) = build_empty_stmt ();
}
bsi_remove (&t->call_bsi);
bsi_remove (&t->call_bsi, true);
release_defs (call);
}

View File

@ -2944,7 +2944,7 @@ vect_transform_loop (loop_vec_info loop_vinfo,
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;
}

View File

@ -805,7 +805,7 @@ slpeel_make_loop_iterate_ntimes (struct loop *loop, tree niters)
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))

View File

@ -3026,7 +3026,7 @@ remove_range_assertions (void)
}
/* And finally, remove the copy, it is not needed. */
bsi_remove (&si);
bsi_remove (&si, true);
}
else
bsi_next (&si);