Commit cff4e50d by Paolo Bonzini Committed by Paolo Bonzini

tree-ssa-operands.h (push_stmt_changes, [...]): Delete.

2009-05-24  Paolo Bonzini  <bonzini@gnu.org>

	* tree-ssa-operands.h (push_stmt_changes, pop_stmt_changes,
	discard_stmt_changes): Delete.
	* tree-ssa-operands.c (scb_stack): Delete.
	(init_ssa_operands): Do not initialize it.
	(fini_ssa_operands): Do not free it.
	(push_stmt_changes, pop_stmt_changes, discard_stmt_changes): Delete.

	* tree-cfg.c (replace_uses_by): Replace pop_stmt_changes with 
	update_stmt, remove the others.  Fix comments.
	* tree-dfa.c (optimize_stack_restore): Likewise.
	* tree-ssa-forwprop.c (forward_propagate_addr_expr): Likewise.
	* tree-ssa-loop-ivopts.c (rewrite_use): Likewise.
	* tree-ssa-dce.c (eliminate_unnecessary_stmts): Likewise.
	* tree-ssa-ccp.c (optimize_stack_restore, execute_fold_all_builtins):
	Likewise.
	* tree-ssa-propagate.c (substitute_and_fold): Likewise.
	* tree-ssa-dom.c (propagate_rhs_into_lhs): Likewise.
	(dom_opt_finalize_block): Likewise, adjusting access to stmts_to_rescan.
	(optimize_stmt): Likewise, adjusting access to stmts_to_rescan.
	(stmts_to_rescan): Change item type to gimple.
	(tree_ssa_dominator_optimize): Change type of stmts_to_rescan.

From-SVN: r147831
parent 6e00e546
2009-05-24 Paolo Bonzini <bonzini@gnu.org>
* tree-ssa-operands.h (push_stmt_changes, pop_stmt_changes,
discard_stmt_changes): Delete.
* tree-ssa-operands.c (scb_stack): Delete.
(init_ssa_operands): Do not initialize it.
(fini_ssa_operands): Do not free it.
(push_stmt_changes, pop_stmt_changes, discard_stmt_changes): Delete.
* tree-cfg.c (replace_uses_by): Replace pop_stmt_changes with
update_stmt, remove the others. Fix comments.
* tree-dfa.c (optimize_stack_restore): Likewise.
* tree-ssa-forwprop.c (forward_propagate_addr_expr): Likewise.
* tree-ssa-loop-ivopts.c (rewrite_use): Likewise.
* tree-ssa-dce.c (eliminate_unnecessary_stmts): Likewise.
* tree-ssa-ccp.c (optimize_stack_restore, execute_fold_all_builtins):
Likewise.
* tree-ssa-propagate.c (substitute_and_fold): Likewise.
* tree-ssa-dom.c (propagate_rhs_into_lhs): Likewise.
(dom_opt_finalize_block): Likewise, adjusting access to stmts_to_rescan.
(optimize_stmt): Likewise, adjusting access to stmts_to_rescan.
(stmts_to_rescan): Change item type to gimple.
(tree_ssa_dominator_optimize): Change type of stmts_to_rescan.
2009-05-24 Ira Rosen <irar@il.ibm.com> 2009-05-24 Ira Rosen <irar@il.ibm.com>
* doc/passes.texi (Tree-SSA passes): Document SLP pass. * doc/passes.texi (Tree-SSA passes): Document SLP pass.
......
...@@ -1289,9 +1289,6 @@ replace_uses_by (tree name, tree val) ...@@ -1289,9 +1289,6 @@ replace_uses_by (tree name, tree val)
FOR_EACH_IMM_USE_STMT (stmt, imm_iter, name) FOR_EACH_IMM_USE_STMT (stmt, imm_iter, name)
{ {
if (gimple_code (stmt) != GIMPLE_PHI)
push_stmt_changes (&stmt);
FOR_EACH_IMM_USE_ON_STMT (use, imm_iter) FOR_EACH_IMM_USE_ON_STMT (use, imm_iter)
{ {
replace_exp (use, val); replace_exp (use, val);
...@@ -1318,7 +1315,7 @@ replace_uses_by (tree name, tree val) ...@@ -1318,7 +1315,7 @@ replace_uses_by (tree name, tree val)
if (cfgcleanup_altered_bbs) if (cfgcleanup_altered_bbs)
bitmap_set_bit (cfgcleanup_altered_bbs, gimple_bb (stmt)->index); bitmap_set_bit (cfgcleanup_altered_bbs, gimple_bb (stmt)->index);
/* FIXME. This should go in pop_stmt_changes. */ /* FIXME. This should go in update_stmt. */
for (i = 0; i < gimple_num_ops (stmt); i++) for (i = 0; i < gimple_num_ops (stmt); i++)
{ {
tree op = gimple_op (stmt, i); tree op = gimple_op (stmt, i);
...@@ -1330,8 +1327,7 @@ replace_uses_by (tree name, tree val) ...@@ -1330,8 +1327,7 @@ replace_uses_by (tree name, tree val)
} }
maybe_clean_or_replace_eh_stmt (stmt, stmt); maybe_clean_or_replace_eh_stmt (stmt, stmt);
update_stmt (stmt);
pop_stmt_changes (&stmt);
} }
} }
......
...@@ -651,11 +651,7 @@ get_virtual_var (tree var) ...@@ -651,11 +651,7 @@ get_virtual_var (tree var)
return var; return var;
} }
/* Mark all the naked symbols in STMT for SSA renaming. /* Mark all the naked symbols in STMT for SSA renaming. */
NOTE: This function should only be used for brand new statements.
If the caller is modifying an existing statement, it should use the
combination push_stmt_changes/pop_stmt_changes. */
void void
mark_symbols_for_renaming (gimple stmt) mark_symbols_for_renaming (gimple stmt)
......
...@@ -3023,14 +3023,9 @@ optimize_stack_restore (gimple_stmt_iterator i) ...@@ -3023,14 +3023,9 @@ optimize_stack_restore (gimple_stmt_iterator i)
return NULL_TREE; return NULL_TREE;
stack_save_gsi = gsi_for_stmt (stack_save); stack_save_gsi = gsi_for_stmt (stack_save);
push_stmt_changes (gsi_stmt_ptr (&stack_save_gsi));
rhs = build_int_cst (TREE_TYPE (gimple_call_arg (call, 0)), 0); rhs = build_int_cst (TREE_TYPE (gimple_call_arg (call, 0)), 0);
if (!update_call_from_tree (&stack_save_gsi, rhs)) if (!update_call_from_tree (&stack_save_gsi, rhs))
{
discard_stmt_changes (gsi_stmt_ptr (&stack_save_gsi));
return NULL_TREE; return NULL_TREE;
}
pop_stmt_changes (gsi_stmt_ptr (&stack_save_gsi));
/* No effect, so the statement will be deleted. */ /* No effect, so the statement will be deleted. */
return integer_zero_node; return integer_zero_node;
...@@ -3252,8 +3247,6 @@ execute_fold_all_builtins (void) ...@@ -3252,8 +3247,6 @@ execute_fold_all_builtins (void)
} }
old_stmt = stmt; old_stmt = stmt;
push_stmt_changes (gsi_stmt_ptr (&i));
if (!update_call_from_tree (&i, result)) if (!update_call_from_tree (&i, result))
{ {
gimplify_and_update_call_from_tree (&i, result); gimplify_and_update_call_from_tree (&i, result);
...@@ -3261,7 +3254,7 @@ execute_fold_all_builtins (void) ...@@ -3261,7 +3254,7 @@ execute_fold_all_builtins (void)
} }
stmt = gsi_stmt (i); stmt = gsi_stmt (i);
pop_stmt_changes (gsi_stmt_ptr (&i)); update_stmt (stmt);
if (maybe_clean_or_replace_eh_stmt (old_stmt, stmt) if (maybe_clean_or_replace_eh_stmt (old_stmt, stmt)
&& gimple_purge_dead_eh_edges (bb)) && gimple_purge_dead_eh_edges (bb))
......
...@@ -983,10 +983,9 @@ eliminate_unnecessary_stmts (void) ...@@ -983,10 +983,9 @@ eliminate_unnecessary_stmts (void)
fprintf (dump_file, "\n"); fprintf (dump_file, "\n");
} }
push_stmt_changes (gsi_stmt_ptr (&gsi));
gimple_call_set_lhs (stmt, NULL_TREE); gimple_call_set_lhs (stmt, NULL_TREE);
maybe_clean_or_replace_eh_stmt (stmt, stmt); maybe_clean_or_replace_eh_stmt (stmt, stmt);
pop_stmt_changes (gsi_stmt_ptr (&gsi)); update_stmt (stmt);
release_ssa_name (name); release_ssa_name (name);
} }
notice_special_calls (stmt); notice_special_calls (stmt);
......
...@@ -134,7 +134,7 @@ static VEC(expr_hash_elt_t,heap) *avail_exprs_stack; ...@@ -134,7 +134,7 @@ static VEC(expr_hash_elt_t,heap) *avail_exprs_stack;
expressions are removed from AVAIL_EXPRS. Else we may change the expressions are removed from AVAIL_EXPRS. Else we may change the
hash code for an expression and be unable to find/remove it from hash code for an expression and be unable to find/remove it from
AVAIL_EXPRS. */ AVAIL_EXPRS. */
static VEC(gimple_p,heap) *stmts_to_rescan; static VEC(gimple,heap) *stmts_to_rescan;
/* Structure for entries in the expression hash table. */ /* Structure for entries in the expression hash table. */
...@@ -626,7 +626,7 @@ tree_ssa_dominator_optimize (void) ...@@ -626,7 +626,7 @@ tree_ssa_dominator_optimize (void)
avail_exprs = htab_create (1024, real_avail_expr_hash, avail_expr_eq, free_expr_hash_elt); avail_exprs = htab_create (1024, real_avail_expr_hash, avail_expr_eq, free_expr_hash_elt);
avail_exprs_stack = VEC_alloc (expr_hash_elt_t, heap, 20); avail_exprs_stack = VEC_alloc (expr_hash_elt_t, heap, 20);
const_and_copies_stack = VEC_alloc (tree, heap, 20); const_and_copies_stack = VEC_alloc (tree, heap, 20);
stmts_to_rescan = VEC_alloc (gimple_p, heap, 20); stmts_to_rescan = VEC_alloc (gimple, heap, 20);
need_eh_cleanup = BITMAP_ALLOC (NULL); need_eh_cleanup = BITMAP_ALLOC (NULL);
/* Setup callbacks for the generic dominator tree walker. */ /* Setup callbacks for the generic dominator tree walker. */
...@@ -742,7 +742,7 @@ tree_ssa_dominator_optimize (void) ...@@ -742,7 +742,7 @@ tree_ssa_dominator_optimize (void)
VEC_free (expr_hash_elt_t, heap, avail_exprs_stack); VEC_free (expr_hash_elt_t, heap, avail_exprs_stack);
VEC_free (tree, heap, const_and_copies_stack); VEC_free (tree, heap, const_and_copies_stack);
VEC_free (gimple_p, heap, stmts_to_rescan); VEC_free (gimple, heap, stmts_to_rescan);
/* Free the value-handle array. */ /* Free the value-handle array. */
threadedge_finalize_values (); threadedge_finalize_values ();
...@@ -1047,17 +1047,16 @@ dom_opt_finalize_block (struct dom_walk_data *walk_data, basic_block bb) ...@@ -1047,17 +1047,16 @@ dom_opt_finalize_block (struct dom_walk_data *walk_data, basic_block bb)
/* If we queued any statements to rescan in this block, then /* If we queued any statements to rescan in this block, then
go ahead and rescan them now. */ go ahead and rescan them now. */
while (VEC_length (gimple_p, stmts_to_rescan) > 0) while (VEC_length (gimple, stmts_to_rescan) > 0)
{ {
gimple *stmt_p = VEC_last (gimple_p, stmts_to_rescan); gimple stmt = VEC_last (gimple, stmts_to_rescan);
gimple stmt = *stmt_p;
basic_block stmt_bb = gimple_bb (stmt); basic_block stmt_bb = gimple_bb (stmt);
if (stmt_bb != bb) if (stmt_bb != bb)
break; break;
VEC_pop (gimple_p, stmts_to_rescan); VEC_pop (gimple, stmts_to_rescan);
pop_stmt_changes (stmt_p); update_stmt (stmt);
} }
} }
...@@ -2130,7 +2129,6 @@ optimize_stmt (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED, ...@@ -2130,7 +2129,6 @@ optimize_stmt (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
update_stmt_if_modified (stmt); update_stmt_if_modified (stmt);
opt_stats.num_stmts++; opt_stats.num_stmts++;
push_stmt_changes (gsi_stmt_ptr (&si));
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
{ {
...@@ -2253,21 +2251,12 @@ optimize_stmt (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED, ...@@ -2253,21 +2251,12 @@ optimize_stmt (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
} }
} }
if (may_have_exposed_new_symbols)
{
/* Queue the statement to be re-scanned after all the /* Queue the statement to be re-scanned after all the
AVAIL_EXPRS have been processed. The change buffer stack for AVAIL_EXPRS have been processed. The change buffer stack for
all the pushed statements will be processed when this queue all the pushed statements will be processed when this queue
is emptied. */ is emptied. */
VEC_safe_push (gimple_p, heap, stmts_to_rescan, gsi_stmt_ptr (&si)); if (may_have_exposed_new_symbols)
} VEC_safe_push (gimple, heap, stmts_to_rescan, gsi_stmt (si));
else
{
/* Otherwise, just discard the recently pushed change buffer. If
not, the STMTS_TO_RESCAN queue will get out of synch with the
change buffer stack. */
discard_stmt_changes (gsi_stmt_ptr (&si));
}
} }
/* Search for an existing instance of STMT in the AVAIL_EXPRS table. /* Search for an existing instance of STMT in the AVAIL_EXPRS table.
...@@ -2565,8 +2554,6 @@ propagate_rhs_into_lhs (gimple stmt, tree lhs, tree rhs, bitmap interesting_name ...@@ -2565,8 +2554,6 @@ propagate_rhs_into_lhs (gimple stmt, tree lhs, tree rhs, bitmap interesting_name
print_gimple_stmt (dump_file, use_stmt, 0, dump_flags); print_gimple_stmt (dump_file, use_stmt, 0, dump_flags);
} }
push_stmt_changes (&use_stmt);
/* Propagate the RHS into this use of the LHS. */ /* Propagate the RHS into this use of the LHS. */
FOR_EACH_IMM_USE_ON_STMT (use_p, iter) FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
propagate_value (use_p, rhs); propagate_value (use_p, rhs);
...@@ -2601,7 +2588,6 @@ propagate_rhs_into_lhs (gimple stmt, tree lhs, tree rhs, bitmap interesting_name ...@@ -2601,7 +2588,6 @@ propagate_rhs_into_lhs (gimple stmt, tree lhs, tree rhs, bitmap interesting_name
bitmap_set_bit (interesting_names, SSA_NAME_VERSION (result)); bitmap_set_bit (interesting_names, SSA_NAME_VERSION (result));
} }
discard_stmt_changes (&use_stmt);
continue; continue;
} }
...@@ -2618,9 +2604,8 @@ propagate_rhs_into_lhs (gimple stmt, tree lhs, tree rhs, bitmap interesting_name ...@@ -2618,9 +2604,8 @@ propagate_rhs_into_lhs (gimple stmt, tree lhs, tree rhs, bitmap interesting_name
fold_stmt_inplace (use_stmt); fold_stmt_inplace (use_stmt);
/* Sometimes propagation can expose new operands to the /* Sometimes propagation can expose new operands to the
renamer. Note this will call update_stmt at the renamer. */
appropriate time. */ update_stmt (use_stmt);
pop_stmt_changes (&use_stmt);
/* Dump details. */ /* Dump details. */
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
......
...@@ -951,19 +951,17 @@ forward_propagate_addr_expr (tree name, tree rhs) ...@@ -951,19 +951,17 @@ forward_propagate_addr_expr (tree name, tree rhs)
{ {
gimple_stmt_iterator gsi = gsi_for_stmt (use_stmt); gimple_stmt_iterator gsi = gsi_for_stmt (use_stmt);
push_stmt_changes (&use_stmt);
result = forward_propagate_addr_expr_1 (name, rhs, &gsi, result = forward_propagate_addr_expr_1 (name, rhs, &gsi,
single_use_p); single_use_p);
/* If the use has moved to a different statement adjust /* If the use has moved to a different statement adjust
the update machinery. */ the update machinery for the old statement too. */
if (use_stmt != gsi_stmt (gsi)) if (use_stmt != gsi_stmt (gsi))
{ {
pop_stmt_changes (&use_stmt);
use_stmt = gsi_stmt (gsi);
update_stmt (use_stmt); update_stmt (use_stmt);
use_stmt = gsi_stmt (gsi);
} }
else
pop_stmt_changes (&use_stmt); update_stmt (use_stmt);
} }
all &= result; all &= result;
......
...@@ -5304,8 +5304,6 @@ rewrite_use_compare (struct ivopts_data *data, ...@@ -5304,8 +5304,6 @@ rewrite_use_compare (struct ivopts_data *data,
static void static void
rewrite_use (struct ivopts_data *data, struct iv_use *use, struct iv_cand *cand) rewrite_use (struct ivopts_data *data, struct iv_use *use, struct iv_cand *cand)
{ {
push_stmt_changes (&use->stmt);
switch (use->type) switch (use->type)
{ {
case USE_NONLINEAR_EXPR: case USE_NONLINEAR_EXPR:
...@@ -5324,7 +5322,7 @@ rewrite_use (struct ivopts_data *data, struct iv_use *use, struct iv_cand *cand) ...@@ -5324,7 +5322,7 @@ rewrite_use (struct ivopts_data *data, struct iv_use *use, struct iv_cand *cand)
gcc_unreachable (); gcc_unreachable ();
} }
pop_stmt_changes (&use->stmt); update_stmt (use->stmt);
} }
/* Rewrite the uses using the selected induction variables. */ /* Rewrite the uses using the selected induction variables. */
......
...@@ -147,12 +147,6 @@ static void get_expr_operands (gimple, tree *, int); ...@@ -147,12 +147,6 @@ static void get_expr_operands (gimple, tree *, int);
/* Number of functions with initialized ssa_operands. */ /* Number of functions with initialized ssa_operands. */
static int n_initialized = 0; static int n_initialized = 0;
/* Stack of statements to change. Every call to
push_stmt_changes pushes the stmt onto the stack. Calls to
pop_stmt_changes pop a stmt off of the stack and compute the set
of changes for the popped statement. */
static VEC(gimple_p,heap) *scb_stack;
/* Return the DECL_UID of the base variable of T. */ /* Return the DECL_UID of the base variable of T. */
static inline unsigned static inline unsigned
...@@ -231,7 +225,6 @@ init_ssa_operands (void) ...@@ -231,7 +225,6 @@ init_ssa_operands (void)
build_vuse = NULL_TREE; build_vuse = NULL_TREE;
build_vdef = NULL_TREE; build_vdef = NULL_TREE;
bitmap_obstack_initialize (&operands_bitmap_obstack); bitmap_obstack_initialize (&operands_bitmap_obstack);
scb_stack = VEC_alloc (gimple_p, heap, 20);
} }
gcc_assert (gimple_ssa_operands (cfun)->operand_memory == NULL); gcc_assert (gimple_ssa_operands (cfun)->operand_memory == NULL);
...@@ -257,11 +250,6 @@ fini_ssa_operands (void) ...@@ -257,11 +250,6 @@ fini_ssa_operands (void)
VEC_free (tree, heap, build_uses); VEC_free (tree, heap, build_uses);
build_vdef = NULL_TREE; build_vdef = NULL_TREE;
build_vuse = NULL_TREE; build_vuse = NULL_TREE;
/* The change buffer stack had better be empty. */
gcc_assert (VEC_length (gimple_p, scb_stack) == 0);
VEC_free (gimple_p, heap, scb_stack);
scb_stack = NULL;
} }
gimple_ssa_operands (cfun)->free_defs = NULL; gimple_ssa_operands (cfun)->free_defs = NULL;
...@@ -1329,62 +1317,6 @@ debug_immediate_uses_for (tree var) ...@@ -1329,62 +1317,6 @@ debug_immediate_uses_for (tree var)
} }
/* Push *STMT_P on the SCB_STACK. This function is deprecated, do not
introduce new uses of it. */
void
push_stmt_changes (gimple *stmt_p)
{
gimple stmt = *stmt_p;
/* It makes no sense to keep track of PHI nodes. */
if (gimple_code (stmt) == GIMPLE_PHI)
return;
VEC_safe_push (gimple_p, heap, scb_stack, stmt_p);
}
/* Pop the top stmt from SCB_STACK and act on the differences between
what was recorded by push_stmt_changes and the current state of
the statement. This function is deprecated, do not introduce
new uses of it. */
void
pop_stmt_changes (gimple *stmt_p)
{
gimple *stmt2_p, stmt = *stmt_p;
/* It makes no sense to keep track of PHI nodes. */
if (gimple_code (stmt) == GIMPLE_PHI)
return;
stmt2_p = VEC_pop (gimple_p, scb_stack);
gcc_assert (stmt_p == stmt2_p);
/* Force an operand re-scan on the statement and mark any newly
exposed variables. This also will mark the virtual operand
for renaming if necessary. */
update_stmt (stmt);
}
/* Discard the topmost stmt from SCB_STACK. This is useful
when the caller realized that it did not actually modified the
statement. It avoids the expensive operand re-scan.
This function is deprecated, do not introduce new uses of it. */
void
discard_stmt_changes (gimple *stmt_p)
{
gimple *stmt2_p, stmt = *stmt_p;
/* It makes no sense to keep track of PHI nodes. */
if (gimple_code (stmt) == GIMPLE_PHI)
return;
stmt2_p = VEC_pop (gimple_p, scb_stack);
gcc_assert (stmt_p == stmt2_p);
}
/* Unlink STMTs virtual definition from the IL by propagating its use. */ /* Unlink STMTs virtual definition from the IL by propagating its use. */
void void
......
...@@ -114,10 +114,6 @@ extern void debug_decl_set (bitmap); ...@@ -114,10 +114,6 @@ extern void debug_decl_set (bitmap);
extern bool ssa_operands_active (void); extern bool ssa_operands_active (void);
extern void push_stmt_changes (gimple *);
extern void pop_stmt_changes (gimple *);
extern void discard_stmt_changes (gimple *);
extern void unlink_stmt_vdef (gimple); extern void unlink_stmt_vdef (gimple);
enum ssa_op_iter_type { enum ssa_op_iter_type {
......
...@@ -1109,9 +1109,6 @@ substitute_and_fold (prop_value_t *prop_value, bool use_ranges_p) ...@@ -1109,9 +1109,6 @@ substitute_and_fold (prop_value_t *prop_value, bool use_ranges_p)
continue; continue;
} }
/* Record the state of the statement before replacements. */
push_stmt_changes (gsi_stmt_ptr (&i));
/* Replace the statement with its folded version and mark it /* Replace the statement with its folded version and mark it
folded. */ folded. */
did_replace = false; did_replace = false;
...@@ -1172,14 +1169,9 @@ substitute_and_fold (prop_value_t *prop_value, bool use_ranges_p) ...@@ -1172,14 +1169,9 @@ substitute_and_fold (prop_value_t *prop_value, bool use_ranges_p)
} }
/* Determine what needs to be done to update the SSA form. */ /* Determine what needs to be done to update the SSA form. */
pop_stmt_changes (gsi_stmt_ptr (&i)); update_stmt (stmt);
something_changed = true; something_changed = true;
} }
else
{
/* The statement was not modified, discard the change buffer. */
discard_stmt_changes (gsi_stmt_ptr (&i));
}
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment