aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2006-04-27 20:22:17 +0000
committerAndrew Macleod <amacleod@gcc.gnu.org>2006-04-27 20:22:17 +0000
commit6c00f606c162459e5cc17a9c3f2474314df7071b (patch)
tree39c9b1002df8b0cd95dd8e90404343ea80786b25 /gcc/doc
parent8fcd79cbcdf931c4875a6863fe47482224b1f03d (diff)
downloadgcc-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/doc')
-rw-r--r--gcc/doc/tree-ssa.texi41
1 files changed, 26 insertions, 15 deletions
diff --git a/gcc/doc/tree-ssa.texi b/gcc/doc/tree-ssa.texi
index 7149bb9..016f812 100644
--- a/gcc/doc/tree-ssa.texi
+++ b/gcc/doc/tree-ssa.texi
@@ -1092,15 +1092,21 @@ FOR_EACH_PHI_OR_STMT_DEF (def_operand_p, phi, iter, flags)
Immediate use information is now always available. Using the immediate use
iterators, you may examine every use of any @code{SSA_NAME}. For instance,
-to change each use of @code{ssa_var} to @code{ssa_var2}:
+to change each use of @code{ssa_var} to @code{ssa_var2} and call fold_stmt on
+each stmt after that is done:
@smallexample
use_operand_p imm_use_p;
imm_use_iterator iterator;
- tree ssa_var
+ tree ssa_var, stmt;
- FOR_EACH_IMM_USE_SAFE (imm_use_p, iterator, ssa_var)
- SET_USE (imm_use_p, ssa_var_2);
+
+ FOR_EACH_IMM_USE_STMT (stmt, iterator, ssa_var)
+ @{
+ FOR_EACH_IMM_USE_ON_STMT (imm_use_p, iterator)
+ SET_USE (imm_use_p, ssa_var_2);
+ fold_stmt (stmt);
+ @}
@end smallexample
There are 2 iterators which can be used. @code{FOR_EACH_IMM_USE_FAST} is used
@@ -1108,21 +1114,26 @@ when the immediate uses are not changed, ie. you are looking at the uses, but
not setting them.
If they do get changed, then care must be taken that things are not changed
-under the iterators, so use the @code{FOR_EACH_IMM_USE_SAFE} iterator. It
-attempts to preserve the sanity of the use list by moving an iterator element
-through the use list, preventing insertions and deletions in the list from
-resulting in invalid pointers. This is a little slower since it adds a
-placeholder element and moves it through the list. This element must be
-also be removed if the loop is terminated early. A macro
-(@code{BREAK_FROM SAFE_IMM_USE}) is provided for this:
+under the iterators, so use the @code{FOR_EACH_IMM_USE_STMT} and
+@code{FOR_EACH_IMM_USE_ON_STMT} iterators. They attempt to preserve the
+sanity of the use list by moving all the uses for a statement into
+a controlled position, and then iterating over those uses. Then the
+optimization can manipulate the stmt when all the uses have been
+processed. This is a little slower than the FAST version since it adds a
+placeholder element and must sort through the list a bit for each statement.
+This placeholder element must be also be removed if the loop is
+terminated early. The macro @code{BREAK_FROM_IMM_USE_SAFE} is provided
+to do this :
@smallexample
- FOR_EACH_IMM_USE_SAFE (use_p, iter, var)
+ FOR_EACH_IMM_USE_STMT (stmt, iterator, ssa_var)
@{
- if (var == last_var)
+ if (stmt == last_stmt)
BREAK_FROM_SAFE_IMM_USE (iter);
- else
- SET_USE (use_p, var2);
+
+ FOR_EACH_IMM_USE_ON_STMT (imm_use_p, iterator)
+ SET_USE (imm_use_p, ssa_var_2);
+ fold_stmt (stmt);
@}
@end smallexample