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/lambda-code.c | |
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/lambda-code.c')
-rw-r--r-- | gcc/lambda-code.c | 64 |
1 files changed, 30 insertions, 34 deletions
diff --git a/gcc/lambda-code.c b/gcc/lambda-code.c index bf00c053d95..3a28ee30c9d 100644 --- a/gcc/lambda-code.c +++ b/gcc/lambda-code.c @@ -1923,9 +1923,10 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest, for (i = 0; VEC_iterate (tree, old_ivs, i, oldiv); i++) { imm_use_iterator imm_iter; - use_operand_p imm_use; + use_operand_p use_p; tree oldiv_def; tree oldiv_stmt = SSA_NAME_DEF_STMT (oldiv); + tree stmt; if (TREE_CODE (oldiv_stmt) == PHI_NODE) oldiv_def = PHI_RESULT (oldiv_stmt); @@ -1933,37 +1934,31 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest, oldiv_def = SINGLE_SSA_TREE_OPERAND (oldiv_stmt, SSA_OP_DEF); gcc_assert (oldiv_def != NULL_TREE); - FOR_EACH_IMM_USE_SAFE (imm_use, imm_iter, oldiv_def) - { - tree stmt = USE_STMT (imm_use); - use_operand_p use_p; - ssa_op_iter iter; + FOR_EACH_IMM_USE_STMT (stmt, imm_iter, oldiv_def) + { + tree newiv, stmts; + lambda_body_vector lbv, newlbv; + gcc_assert (TREE_CODE (stmt) != PHI_NODE); - FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE) - { - if (USE_FROM_PTR (use_p) == oldiv) - { - tree newiv, stmts; - lambda_body_vector lbv, newlbv; - /* Compute the new expression for the induction - variable. */ - depth = VEC_length (tree, new_ivs); - lbv = lambda_body_vector_new (depth); - LBV_COEFFICIENTS (lbv)[i] = 1; - - newlbv = lambda_body_vector_compute_new (transform, lbv); - - newiv = lbv_to_gcc_expression (newlbv, TREE_TYPE (oldiv), - new_ivs, &stmts); - bsi = bsi_for_stmt (stmt); - /* Insert the statements to build that - expression. */ - bsi_insert_before (&bsi, stmts, BSI_SAME_STMT); - propagate_value (use_p, newiv); - update_stmt (stmt); - - } - } + + /* Compute the new expression for the induction + variable. */ + depth = VEC_length (tree, new_ivs); + lbv = lambda_body_vector_new (depth); + LBV_COEFFICIENTS (lbv)[i] = 1; + + newlbv = lambda_body_vector_compute_new (transform, lbv); + + newiv = lbv_to_gcc_expression (newlbv, TREE_TYPE (oldiv), + new_ivs, &stmts); + bsi = bsi_for_stmt (stmt); + /* Insert the statements to build that + expression. */ + bsi_insert_before (&bsi, stmts, BSI_SAME_STMT); + + FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter) + propagate_value (use_p, newiv); + update_stmt (stmt); } } VEC_free (tree, heap, new_ivs); @@ -2482,6 +2477,7 @@ perfect_nestify (struct loops *loops, { use_operand_p use_p; imm_use_iterator imm_iter; + tree imm_stmt; tree stmt = bsi_stmt (bsi); if (stmt == exit_condition @@ -2495,10 +2491,9 @@ perfect_nestify (struct loops *loops, /* Make copies of this statement to put it back next to its uses. */ - FOR_EACH_IMM_USE_SAFE (use_p, imm_iter, + FOR_EACH_IMM_USE_STMT (imm_stmt, imm_iter, TREE_OPERAND (stmt, 0)) { - tree imm_stmt = USE_STMT (use_p); if (!exit_phi_for_loop_p (loop->inner, imm_stmt)) { block_stmt_iterator tobsi; @@ -2511,7 +2506,8 @@ perfect_nestify (struct loops *loops, newname = SSA_NAME_VAR (newname); newname = make_ssa_name (newname, newstmt); TREE_OPERAND (newstmt, 0) = newname; - SET_USE (use_p, TREE_OPERAND (newstmt, 0)); + FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter) + SET_USE (use_p, newname); bsi_insert_before (&tobsi, newstmt, BSI_SAME_STMT); update_stmt (newstmt); update_stmt (imm_stmt); |