From 43daa21e7c3b20f510ed5e16e2aef1b806d69d2b Mon Sep 17 00:00:00 2001 From: amacleod Date: Wed, 25 Aug 2004 21:21:19 +0000 Subject: 2004-08-25 Andrew MacLeod * tree-ssa-operands.h (struct ssa_operand_iterator_d): New. SSA operand iterator controlling structure. (SSA_OP_USE, SSA_OP_DEF, SSA_OP_VUSE, SSA_OP_VMAYUSE, SSA_OP_VMAYDEF, SSA_OP_VMUSTDEF, SSA_OP_VIRTUAL_USES, SSA_OP_VIRTUAL_DEFS, SSA_OP_ALL_USES, SSA_OP_ALL_DEFS, SSA_OP_ALL_OPERANDS): New. Operand iterator flags. (FOR_EACH_SSA_TREE_OPERAND): New. Iterate over operands as trees. (FOR_EACH_SSA_USE_OPERAND): New. Iterate over operands as uses. (FOR_EACH_SSA_DEF_OPERAND): New. Iterate over operands as defs. (FOR_EACH_SSA_MAYDEF_OPERAND): New. Iterate over V_MAY_DEFs. * tree-ssa-operands.c (NULL_DEF_OPERAND_P, NULL_USE_OPERAND_P): New. Empty operand pointers. * tree-flow-inline.h (op_iter_done): New. Return true if finished. (op_iter_next_use): New. Return next use_operand_p. (op_iter_next_def): New. Return next def_operand_p. (op_iter_next_tree): New. Return next operands as a tree. (op_iter_init): New. Initialize an iterator structure. (op_iter_init_use): New. Initialize structure and get the first use. (op_iter_init_def): New. Initialize structure and get the first def. (op_iter_init_tree): New. Initialize structure and get the first tree. (op_iter_next_maydef): New. Return next V_MAY_DEF operands. (op_iter_init_maydef): New. Initialize structure and get the first V_MAY_DEF operands. * tree-cfg.c (tree_duplicate_bb): Use new operand iterator. * tree-dfa.c (compute_immediate_uses_for_stmt, redirect_immediate_uses): Use new operand iterator. (v_may_defs_disappeared_p, v_must_defs_disappeared_p): Delete. (mark_new_vars_to_rename): Use new operand iterator. Count virtual operands instead of using *_disappeared_p routines. * tree-into-ssa.c (mark_def_sites, ssa_mark_def_sites, rewrite_stmt, ssa_rewrite_stmt): Use new operand iterator. * tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb, rewrite_trees): Use new operand iterator. * tree-pretty-print.c (dump_vops): Use new operand iterator. * tree-sra.c (mark_all_v_defs): Use new operand iterator. * tree-ssa-alias.c (compute_points_to_and_addr_escape, dump_points_to_info): Use new operand iterator. * tree-ssa-ccp.c (cp_lattice_meet, visit_stmt, initialize, replace_uses_in, replace_vuse_in, likely_value, set_rhs): Use new operand iterator. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary, propagate_necessity): Use new operand iterator. * tree-ssa-dom.c (cprop_into_stmt, optimize_stmt): Use operand iterator. (register_definitions_for_stmt): Use new operand iterator. Take stmt as a parameter instead of a stmt_ann_t. * tree-ssa-live.c (create_ssa_var_map, calculate_live_on_entry, build_tree_conflict_graph): Use new operand iterator. * tree-ssa-loop-im.c (determine_max_movement, single_reachable_address, rewrite_mem_refs): Use new operand iterator. * tree-ssa-loop-manip.c (find_uses_to_rename_stmt, check_loop_closed_ssa_use): Use new operand iterator. * tree-ssa.c (verify_ssa, replace_immediate_uses): Use operand iterator. * tree-ssanames.c (release_defs): Use new operand iterator. * tree-vectorizer.c (vect_create_data_ref): Use new operand iterator. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@86583 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-loop-im.c | 61 ++++++++++++-------------------------------------- 1 file changed, 14 insertions(+), 47 deletions(-) (limited to 'gcc/tree-ssa-loop-im.c') diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index de2540aa4f2..c5de645234c 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -406,11 +406,8 @@ determine_max_movement (tree stmt, bool must_preserve_exec) struct loop *loop = bb->loop_father; struct loop *level; struct lim_aux_data *lim_data = LIM_DATA (stmt); - use_optype uses; - vuse_optype vuses; - v_may_def_optype v_may_defs; - stmt_ann_t ann = stmt_ann (stmt); - unsigned i; + tree val; + ssa_op_iter iter; if (must_preserve_exec) level = ALWAYS_EXECUTED_IN (bb); @@ -418,19 +415,12 @@ determine_max_movement (tree stmt, bool must_preserve_exec) level = superloop_at_depth (loop, 1); lim_data->max_loop = level; - uses = USE_OPS (ann); - for (i = 0; i < NUM_USES (uses); i++) - if (!add_dependency (USE_OP (uses, i), lim_data, loop, true)) - return false; - - vuses = VUSE_OPS (ann); - for (i = 0; i < NUM_VUSES (vuses); i++) - if (!add_dependency (VUSE_OP (vuses, i), lim_data, loop, false)) + FOR_EACH_SSA_TREE_OPERAND (val, stmt, iter, SSA_OP_USE) + if (!add_dependency (val, lim_data, loop, true)) return false; - v_may_defs = V_MAY_DEF_OPS (ann); - for (i = 0; i < NUM_V_MAY_DEFS (v_may_defs); i++) - if (!add_dependency (V_MAY_DEF_OP (v_may_defs, i), lim_data, loop, false)) + FOR_EACH_SSA_TREE_OPERAND (val, stmt, iter, SSA_OP_VIRTUAL_USES) + if (!add_dependency (val, lim_data, loop, false)) return false; lim_data->cost += stmt_cost (stmt); @@ -926,10 +916,10 @@ single_reachable_address (struct loop *loop, tree stmt, unsigned in_queue = 1; dataflow_t df; unsigned i, n; - v_may_def_optype v_may_defs; - vuse_optype vuses; struct sra_data sra_data; tree call; + tree val; + ssa_op_iter iter; sbitmap_zero (seen); @@ -970,15 +960,9 @@ single_reachable_address (struct loop *loop, tree stmt, /* Traverse also definitions of the VUSES (there may be other distinct from the one we used to get to this statement). */ - v_may_defs = STMT_V_MAY_DEF_OPS (stmt); - for (i = 0; i < NUM_V_MAY_DEFS (v_may_defs); i++) - maybe_queue_var (V_MAY_DEF_OP (v_may_defs, i), loop, - seen, queue, &in_queue); + FOR_EACH_SSA_TREE_OPERAND (val, stmt, iter, SSA_OP_VIRTUAL_USES) + maybe_queue_var (val, loop, seen, queue, &in_queue); - vuses = STMT_VUSE_OPS (stmt); - for (i = 0; i < NUM_VUSES (vuses); i++) - maybe_queue_var (VUSE_OP (vuses, i), loop, - seen, queue, &in_queue); break; case PHI_NODE: @@ -1029,32 +1013,15 @@ fail: static void rewrite_mem_refs (tree tmp_var, struct mem_ref *mem_refs) { - v_may_def_optype v_may_defs; - v_must_def_optype v_must_defs; - vuse_optype vuses; - unsigned i; tree var; + ssa_op_iter iter; for (; mem_refs; mem_refs = mem_refs->next) { - v_may_defs = STMT_V_MAY_DEF_OPS (mem_refs->stmt); - for (i = 0; i < NUM_V_MAY_DEFS (v_may_defs); i++) - { - var = SSA_NAME_VAR (V_MAY_DEF_RESULT (v_may_defs, i)); - bitmap_set_bit (vars_to_rename, var_ann (var)->uid); - } - - v_must_defs = STMT_V_MUST_DEF_OPS (mem_refs->stmt); - for (i = 0; i < NUM_V_MUST_DEFS (v_must_defs); i++) - { - var = SSA_NAME_VAR (V_MUST_DEF_OP (v_must_defs, i)); - bitmap_set_bit (vars_to_rename, var_ann (var)->uid); - } - - vuses = STMT_VUSE_OPS (mem_refs->stmt); - for (i = 0; i < NUM_VUSES (vuses); i++) + FOR_EACH_SSA_TREE_OPERAND (var, mem_refs->stmt, iter, + (SSA_OP_VIRTUAL_DEFS | SSA_OP_VUSE)) { - var = SSA_NAME_VAR (VUSE_OP (vuses, i)); + var = SSA_NAME_VAR (var); bitmap_set_bit (vars_to_rename, var_ann (var)->uid); } -- cgit v1.2.1