diff options
author | amacleod <amacleod@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-04-27 20:22:17 +0000 |
---|---|---|
committer | amacleod <amacleod@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-04-27 20:22:17 +0000 |
commit | 09aca5bc960f760addfa6a24c162cbebfd9e367e (patch) | |
tree | 39c9b1002df8b0cd95dd8e90404343ea80786b25 /gcc/tree-flow.h | |
parent | 3de2e08eeb62519bc9d32a407a918adf87a46beb (diff) | |
download | gcc-09aca5bc960f760addfa6a24c162cbebfd9e367e.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113321 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-flow.h')
-rw-r--r-- | gcc/tree-flow.h | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h index 87e8328ec05..98ed8afe282 100644 --- a/gcc/tree-flow.h +++ b/gcc/tree-flow.h @@ -225,9 +225,15 @@ struct function_ann_d GTY(()) typedef struct immediate_use_iterator_d { + /* This is the current use the iterator is processing. */ ssa_use_operand_t *imm_use; + /* This marks the last use in the list (use node from SSA_NAME) */ ssa_use_operand_t *end_p; + /* This node is inserted and used to mark the end of the uses for a stmt. */ ssa_use_operand_t iter_node; + /* This is the next ssa_name to visit. IMM_USE may get removed before + the next one is traversed to, so it must be cached early. */ + ssa_use_operand_t *next_imm_name; } imm_use_iterator; @@ -239,18 +245,43 @@ typedef struct immediate_use_iterator_d !end_readonly_imm_use_p (&(ITER)); \ (DEST) = next_readonly_imm_use (&(ITER))) +/* Use this iterator to visit each stmt which has a use of SSAVAR. */ -#define FOR_EACH_IMM_USE_SAFE(DEST, ITER, SSAVAR) \ - for ((DEST) = first_safe_imm_use (&(ITER), (SSAVAR)); \ - !end_safe_imm_use_p (&(ITER)); \ - (DEST) = next_safe_imm_use (&(ITER))) +#define FOR_EACH_IMM_USE_STMT(STMT, ITER, SSAVAR) \ + for ((STMT) = first_imm_use_stmt (&(ITER), (SSAVAR)); \ + !end_imm_use_stmt_p (&(ITER)); \ + (STMT) = next_imm_use_stmt (&(ITER))) -#define BREAK_FROM_SAFE_IMM_USE(ITER) \ +/* Use this to terminate the FOR_EACH_IMM_USE_STMT loop early. Failure to + do so will result in leaving a iterator marker node in the immediate + use list, and nothing good will come from that. */ +#define BREAK_FROM_IMM_USE_STMT(ITER) \ { \ - end_safe_imm_use_traverse (&(ITER)); \ + end_imm_use_stmt_traverse (&(ITER)); \ break; \ } + +/* Use this iterator in combination with FOR_EACH_IMM_USE_STMT to + get access to each occurence of ssavar on the stmt returned by + that iterator.. for instance: + + FOR_EACH_IMM_USE_STMT (stmt, iter, var) + { + FOR_EACH_IMM_USE_ON_STMT (use_p, iter) + { + SET_USE (use_p) = blah; + } + update_stmt (stmt); + } */ + +#define FOR_EACH_IMM_USE_ON_STMT(DEST, ITER) \ + for ((DEST) = first_imm_use_on_stmt (&(ITER)); \ + !end_imm_use_on_stmt_p (&(ITER)); \ + (DEST) = next_imm_use_on_stmt (&(ITER))) + + + struct stmt_ann_d GTY(()) { struct tree_ann_common_d common; |