summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog24
-rw-r--r--gcc/tree-cfg.c8
-rw-r--r--gcc/tree-dfa.c6
-rw-r--r--gcc/tree-ssa-ccp.c11
-rw-r--r--gcc/tree-ssa-dce.c3
-rw-r--r--gcc/tree-ssa-dom.c43
-rw-r--r--gcc/tree-ssa-forwprop.c10
-rw-r--r--gcc/tree-ssa-loop-ivopts.c6
-rw-r--r--gcc/tree-ssa-operands.c68
-rw-r--r--gcc/tree-ssa-operands.h4
-rw-r--r--gcc/tree-ssa-propagate.c10
11 files changed, 51 insertions, 142 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 19fc0b6bee7..8b56f0e0b38 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,27 @@
+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>
* doc/passes.texi (Tree-SSA passes): Document SLP pass.
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 17cee626cb8..875dd8ead94 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -1289,9 +1289,6 @@ replace_uses_by (tree name, tree val)
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)
{
replace_exp (use, val);
@@ -1318,7 +1315,7 @@ replace_uses_by (tree name, tree val)
if (cfgcleanup_altered_bbs)
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++)
{
tree op = gimple_op (stmt, i);
@@ -1330,8 +1327,7 @@ replace_uses_by (tree name, tree val)
}
maybe_clean_or_replace_eh_stmt (stmt, stmt);
-
- pop_stmt_changes (&stmt);
+ update_stmt (stmt);
}
}
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index d00324a348e..d4a379c333c 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -651,11 +651,7 @@ get_virtual_var (tree var)
return var;
}
-/* 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. */
+/* Mark all the naked symbols in STMT for SSA renaming. */
void
mark_symbols_for_renaming (gimple stmt)
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 437d4267dd3..c3316191897 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -3023,14 +3023,9 @@ optimize_stack_restore (gimple_stmt_iterator i)
return NULL_TREE;
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);
if (!update_call_from_tree (&stack_save_gsi, rhs))
- {
- discard_stmt_changes (gsi_stmt_ptr (&stack_save_gsi));
- return NULL_TREE;
- }
- pop_stmt_changes (gsi_stmt_ptr (&stack_save_gsi));
+ return NULL_TREE;
/* No effect, so the statement will be deleted. */
return integer_zero_node;
@@ -3252,8 +3247,6 @@ execute_fold_all_builtins (void)
}
old_stmt = stmt;
- push_stmt_changes (gsi_stmt_ptr (&i));
-
if (!update_call_from_tree (&i, result))
{
gimplify_and_update_call_from_tree (&i, result);
@@ -3261,7 +3254,7 @@ execute_fold_all_builtins (void)
}
stmt = gsi_stmt (i);
- pop_stmt_changes (gsi_stmt_ptr (&i));
+ update_stmt (stmt);
if (maybe_clean_or_replace_eh_stmt (old_stmt, stmt)
&& gimple_purge_dead_eh_edges (bb))
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index 38f313daa7d..b252ece37f4 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -983,10 +983,9 @@ eliminate_unnecessary_stmts (void)
fprintf (dump_file, "\n");
}
- push_stmt_changes (gsi_stmt_ptr (&gsi));
gimple_call_set_lhs (stmt, NULL_TREE);
maybe_clean_or_replace_eh_stmt (stmt, stmt);
- pop_stmt_changes (gsi_stmt_ptr (&gsi));
+ update_stmt (stmt);
release_ssa_name (name);
}
notice_special_calls (stmt);
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index a041f0e2e27..55a13b9d012 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -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
hash code for an expression and be unable to find/remove it from
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. */
@@ -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_stack = VEC_alloc (expr_hash_elt_t, 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);
/* Setup callbacks for the generic dominator tree walker. */
@@ -742,7 +742,7 @@ tree_ssa_dominator_optimize (void)
VEC_free (expr_hash_elt_t, heap, avail_exprs_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. */
threadedge_finalize_values ();
@@ -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
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 = *stmt_p;
+ gimple stmt = VEC_last (gimple, stmts_to_rescan);
basic_block stmt_bb = gimple_bb (stmt);
if (stmt_bb != bb)
break;
- VEC_pop (gimple_p, stmts_to_rescan);
- pop_stmt_changes (stmt_p);
+ VEC_pop (gimple, stmts_to_rescan);
+ update_stmt (stmt);
}
}
@@ -2130,7 +2129,6 @@ optimize_stmt (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
update_stmt_if_modified (stmt);
opt_stats.num_stmts++;
- push_stmt_changes (gsi_stmt_ptr (&si));
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -2253,21 +2251,12 @@ optimize_stmt (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
}
}
+ /* Queue the statement to be re-scanned after all the
+ AVAIL_EXPRS have been processed. The change buffer stack for
+ all the pushed statements will be processed when this queue
+ is emptied. */
if (may_have_exposed_new_symbols)
- {
- /* Queue the statement to be re-scanned after all the
- AVAIL_EXPRS have been processed. The change buffer stack for
- all the pushed statements will be processed when this queue
- is emptied. */
- VEC_safe_push (gimple_p, heap, stmts_to_rescan, gsi_stmt_ptr (&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));
- }
+ VEC_safe_push (gimple, heap, stmts_to_rescan, gsi_stmt (si));
}
/* 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
print_gimple_stmt (dump_file, use_stmt, 0, dump_flags);
}
- push_stmt_changes (&use_stmt);
-
/* Propagate the RHS into this use of the LHS. */
FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
propagate_value (use_p, rhs);
@@ -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));
}
- discard_stmt_changes (&use_stmt);
continue;
}
@@ -2618,9 +2604,8 @@ propagate_rhs_into_lhs (gimple stmt, tree lhs, tree rhs, bitmap interesting_name
fold_stmt_inplace (use_stmt);
/* Sometimes propagation can expose new operands to the
- renamer. Note this will call update_stmt at the
- appropriate time. */
- pop_stmt_changes (&use_stmt);
+ renamer. */
+ update_stmt (use_stmt);
/* Dump details. */
if (dump_file && (dump_flags & TDF_DETAILS))
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 4549ae49ffd..8cf6ea12c1a 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -951,19 +951,17 @@ forward_propagate_addr_expr (tree name, tree rhs)
{
gimple_stmt_iterator gsi = gsi_for_stmt (use_stmt);
- push_stmt_changes (&use_stmt);
result = forward_propagate_addr_expr_1 (name, rhs, &gsi,
single_use_p);
/* 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))
{
- pop_stmt_changes (&use_stmt);
- use_stmt = gsi_stmt (gsi);
update_stmt (use_stmt);
+ use_stmt = gsi_stmt (gsi);
}
- else
- pop_stmt_changes (&use_stmt);
+
+ update_stmt (use_stmt);
}
all &= result;
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 37865e20701..b7047e12bc9 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -5304,8 +5304,6 @@ rewrite_use_compare (struct ivopts_data *data,
static void
rewrite_use (struct ivopts_data *data, struct iv_use *use, struct iv_cand *cand)
{
- push_stmt_changes (&use->stmt);
-
switch (use->type)
{
case USE_NONLINEAR_EXPR:
@@ -5323,8 +5321,8 @@ rewrite_use (struct ivopts_data *data, struct iv_use *use, struct iv_cand *cand)
default:
gcc_unreachable ();
}
-
- pop_stmt_changes (&use->stmt);
+
+ update_stmt (use->stmt);
}
/* Rewrite the uses using the selected induction variables. */
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c
index 0f8912421a1..4a8aee7c20c 100644
--- a/gcc/tree-ssa-operands.c
+++ b/gcc/tree-ssa-operands.c
@@ -147,12 +147,6 @@ static void get_expr_operands (gimple, tree *, int);
/* Number of functions with initialized ssa_operands. */
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. */
static inline unsigned
@@ -231,7 +225,6 @@ init_ssa_operands (void)
build_vuse = NULL_TREE;
build_vdef = NULL_TREE;
bitmap_obstack_initialize (&operands_bitmap_obstack);
- scb_stack = VEC_alloc (gimple_p, heap, 20);
}
gcc_assert (gimple_ssa_operands (cfun)->operand_memory == NULL);
@@ -257,11 +250,6 @@ fini_ssa_operands (void)
VEC_free (tree, heap, build_uses);
build_vdef = 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;
@@ -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. */
void
diff --git a/gcc/tree-ssa-operands.h b/gcc/tree-ssa-operands.h
index 691db93bc4c..5a8e02696d4 100644
--- a/gcc/tree-ssa-operands.h
+++ b/gcc/tree-ssa-operands.h
@@ -114,10 +114,6 @@ extern void debug_decl_set (bitmap);
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);
enum ssa_op_iter_type {
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index 3e8d1219c80..a3a87cbf7c3 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -1109,9 +1109,6 @@ substitute_and_fold (prop_value_t *prop_value, bool use_ranges_p)
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
folded. */
did_replace = false;
@@ -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. */
- pop_stmt_changes (gsi_stmt_ptr (&i));
+ update_stmt (stmt);
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))
{