diff options
author | Andrew MacLeod <amacleod@redhat.com> | 2006-04-27 20:22:17 +0000 |
---|---|---|
committer | Andrew Macleod <amacleod@gcc.gnu.org> | 2006-04-27 20:22:17 +0000 |
commit | 6c00f606c162459e5cc17a9c3f2474314df7071b (patch) | |
tree | 39c9b1002df8b0cd95dd8e90404343ea80786b25 /gcc/tree-cfg.c | |
parent | 8fcd79cbcdf931c4875a6863fe47482224b1f03d (diff) | |
download | gcc-6c00f606c162459e5cc17a9c3f2474314df7071b.zip gcc-6c00f606c162459e5cc17a9c3f2474314df7071b.tar.gz gcc-6c00f606c162459e5cc17a9c3f2474314df7071b.tar.bz2 |
Implement new immediate use iterators.
2006-04-27 Andrew MacLeod <amacleod@redhat.com>
PR tree-optimization/26854
* tree-vrp.c (remove_range_assertions): Use new Immuse iterator.
* doc/tree-ssa.texi: Update immuse iterator documentation.
* tree-ssa-math-opts.c (execute_cse_reciprocals_1): Use new iterator.
* tree-ssa-dom.c (propagate_rhs_into_lhs): Use new iterator.
* tree-flow-inline.h (end_safe_imm_use_traverse, end_safe_imm_use_p,
first_safe_imm_use, next_safe_imm_use): Remove.
(end_imm_use_stmt_p): New. Check for end of immuse stmt traversal.
(end_imm_use_stmt_traverse): New. Terminate immuse stmt traversal.
(move_use_after_head): New. Helper function to sort immuses in a stmt.
(link_use_stmts_after): New. Link all immuses in a stmt consescutively.
(first_imm_use_stmt): New. Get first stmt in an immuse list.
(next_imm_use_stmt): New. Get next stmt in an immuse list.
(first_imm_use_on_stmt): New. Get first immuse on a stmt.
(end_imm_use_on_stmt_p): New. Check for end of immuses on a stmt.
(next_imm_use_on_stmt): New. Move to next immuse on a stmt.
* tree-ssa-forwprop.c (forward_propagate_addr_expr): Use new iterator.
* lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use new iterator.
(perfect_nestify): Use new iterator.
* tree-vect-transform.c (vect_create_epilog_for_reduction): Use new
iterator.
* tree-flow.h (struct immediate_use_iterator_d): Add comments.
(next_imm_name): New field in struct immediate_use_iterator_d.
(FOR_EACH_IMM_USE_SAFE, BREAK_FROM_SAFE_IMM_USE): Remove.
(FOR_EACH_IMM_USE_STMT, BREAK_FROM_IMM_USE_STMT,
FOR_EACH_IMM_USE_ON_STMT): New immediate use iterator macros.
* tree-cfg.c (replace_uses_by): Use new iterator.
* tree-ssa-threadedge.c (lhs_of_dominating_assert): Use new iterator.
* tree-ssa-operands.c (correct_use_link): Remove.
(finalize_ssa_use_ops): No longer call correct_use_link.
From-SVN: r113321
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r-- | gcc/tree-cfg.c | 63 |
1 files changed, 27 insertions, 36 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 9ae48eb..744a903 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -1259,51 +1259,42 @@ replace_uses_by (tree name, tree val) tree stmt; edge e; unsigned i; - VEC(tree,heap) *stmts = VEC_alloc (tree, heap, 20); - FOR_EACH_IMM_USE_SAFE (use, imm_iter, name) + + FOR_EACH_IMM_USE_STMT (stmt, imm_iter, name) { - stmt = USE_STMT (use); - replace_exp (use, val); + FOR_EACH_IMM_USE_ON_STMT (use, imm_iter) + { + replace_exp (use, val); - if (TREE_CODE (stmt) == PHI_NODE) - { - e = PHI_ARG_EDGE (stmt, PHI_ARG_INDEX_FROM_USE (use)); - if (e->flags & EDGE_ABNORMAL) + if (TREE_CODE (stmt) == PHI_NODE) { - /* This can only occur for virtual operands, since - for the real ones SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name)) - would prevent replacement. */ - gcc_assert (!is_gimple_reg (name)); - SSA_NAME_OCCURS_IN_ABNORMAL_PHI (val) = 1; + e = PHI_ARG_EDGE (stmt, PHI_ARG_INDEX_FROM_USE (use)); + if (e->flags & EDGE_ABNORMAL) + { + /* This can only occur for virtual operands, since + for the real ones SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name)) + would prevent replacement. */ + gcc_assert (!is_gimple_reg (name)); + SSA_NAME_OCCURS_IN_ABNORMAL_PHI (val) = 1; + } } } - else - VEC_safe_push (tree, heap, stmts, stmt); - } - - /* We do not update the statements in the loop above. Consider - x = w * w; - - If we performed the update in the first loop, the statement - would be rescanned after first occurrence of w is replaced, - the new uses would be placed to the beginning of the list, - and we would never process them. */ - for (i = 0; VEC_iterate (tree, stmts, i, stmt); i++) - { - tree rhs; - - fold_stmt_inplace (stmt); + if (TREE_CODE (stmt) != PHI_NODE) + { + tree rhs; - rhs = get_rhs (stmt); - if (TREE_CODE (rhs) == ADDR_EXPR) - recompute_tree_invariant_for_addr_expr (rhs); + fold_stmt_inplace (stmt); + rhs = get_rhs (stmt); + if (TREE_CODE (rhs) == ADDR_EXPR) + recompute_tree_invariant_for_addr_expr (rhs); - maybe_clean_or_replace_eh_stmt (stmt, stmt); - mark_new_vars_to_rename (stmt); + maybe_clean_or_replace_eh_stmt (stmt, stmt); + mark_new_vars_to_rename (stmt); + } } - - VEC_free (tree, heap, stmts); + + gcc_assert (num_imm_uses (name) == 0); /* Also update the trees stored in loop structures. */ if (current_loops) |