diff options
Diffstat (limited to 'gcc/tree-into-ssa.c')
-rw-r--r-- | gcc/tree-into-ssa.c | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index d86efe4..b5a854f 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -128,7 +128,7 @@ static bitmap names_to_release; /* vec of vec of PHIs to rewrite in a basic block. Element I corresponds the to basic block with index I. Allocated once per compilation, *not* released between different functions. */ -static vec<gimple_vec> phis_to_rewrite; +static vec< vec<gphi *> > phis_to_rewrite; /* The bitmap of non-NULL elements of PHIS_TO_REWRITE. */ static bitmap blocks_with_phis_to_rewrite; @@ -960,9 +960,9 @@ find_def_blocks_for (tree var) /* Marks phi node PHI in basic block BB for rewrite. */ static void -mark_phi_for_rewrite (basic_block bb, gimple phi) +mark_phi_for_rewrite (basic_block bb, gphi *phi) { - gimple_vec phis; + vec<gphi *> phis; unsigned n, idx = bb->index; if (rewrite_uses_p (phi)) @@ -1001,7 +1001,7 @@ insert_phi_nodes_for (tree var, bitmap phi_insertion_points, bool update_p) { unsigned bb_index; edge e; - gimple phi; + gphi *phi; basic_block bb; bitmap_iterator bi; struct def_blocks_d *def_map = find_def_blocks_for (var); @@ -1405,8 +1405,8 @@ rewrite_add_phi_arguments (basic_block bb) FOR_EACH_EDGE (e, ei, bb->succs) { - gimple phi; - gimple_stmt_iterator gsi; + gphi *phi; + gphi_iterator gsi; for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi); gsi_next (&gsi)) @@ -1414,7 +1414,7 @@ rewrite_add_phi_arguments (basic_block bb) tree currdef, res; location_t loc; - phi = gsi_stmt (gsi); + phi = gsi.phi (); res = gimple_phi_result (phi); currdef = get_reaching_def (SSA_NAME_VAR (res)); /* Virtual operand PHI args do not need a location. */ @@ -1444,8 +1444,6 @@ public: void rewrite_dom_walker::before_dom_children (basic_block bb) { - gimple_stmt_iterator gsi; - if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "\n\nRenaming block #%d\n\n", bb->index); @@ -1455,7 +1453,8 @@ rewrite_dom_walker::before_dom_children (basic_block bb) /* Step 1. Register new definitions for every PHI node in the block. Conceptually, all the PHI nodes are executed in parallel and each PHI node introduces a new version for the associated variable. */ - for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + for (gphi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi); + gsi_next (&gsi)) { tree result = gimple_phi_result (gsi_stmt (gsi)); register_new_def (result, SSA_NAME_VAR (result)); @@ -1465,7 +1464,8 @@ rewrite_dom_walker::before_dom_children (basic_block bb) with its immediate reaching definitions. Update the current definition of a variable when a new real or virtual definition is found. */ if (bitmap_bit_p (interesting_blocks, bb->index)) - for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi); + gsi_next (&gsi)) rewrite_stmt (&gsi); /* Step 3. Visit all the successor blocks of BB looking for PHI nodes. @@ -2016,8 +2016,8 @@ rewrite_update_phi_arguments (basic_block bb) FOR_EACH_EDGE (e, ei, bb->succs) { - gimple phi; - gimple_vec phis; + gphi *phi; + vec<gphi *> phis; if (!bitmap_bit_p (blocks_with_phis_to_rewrite, e->dest->index)) continue; @@ -2070,12 +2070,13 @@ rewrite_update_phi_arguments (basic_block bb) else { gimple stmt = SSA_NAME_DEF_STMT (reaching_def); + gphi *other_phi = dyn_cast <gphi *> (stmt); /* Single element PHI nodes behave like copies, so get the location from the phi argument. */ - if (gimple_code (stmt) == GIMPLE_PHI - && gimple_phi_num_args (stmt) == 1) - locus = gimple_phi_arg_location (stmt, 0); + if (other_phi + && gimple_phi_num_args (other_phi) == 1) + locus = gimple_phi_arg_location (other_phi, 0); else locus = gimple_location (stmt); } @@ -2108,7 +2109,6 @@ void rewrite_update_dom_walker::before_dom_children (basic_block bb) { bool is_abnormal_phi; - gimple_stmt_iterator gsi; if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "Registering new PHI nodes in block #%d\n", @@ -2129,10 +2129,11 @@ rewrite_update_dom_walker::before_dom_children (basic_block bb) register it as a new definition for its corresponding name. Also register definitions for names whose underlying symbols are marked for renaming. */ - for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + for (gphi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi); + gsi_next (&gsi)) { tree lhs, lhs_sym; - gimple phi = gsi_stmt (gsi); + gphi *phi = gsi.phi (); if (!register_defs_p (phi)) continue; @@ -2164,7 +2165,7 @@ rewrite_update_dom_walker::before_dom_children (basic_block bb) if (bitmap_bit_p (interesting_blocks, bb->index)) { gcc_checking_assert (bitmap_bit_p (blocks_to_update, bb->index)); - for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); ) + for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi); ) if (rewrite_update_stmt (gsi_stmt (gsi), gsi)) gsi_remove (&gsi, true); else @@ -2480,7 +2481,7 @@ mark_use_interesting (tree var, gimple stmt, basic_block bb, bool insert_phi_p) mark_block_for_update (bb); if (gimple_code (stmt) == GIMPLE_PHI) - mark_phi_for_rewrite (def_bb, stmt); + mark_phi_for_rewrite (def_bb, as_a <gphi *> (stmt)); else { set_rewrite_uses (stmt, true); @@ -2522,7 +2523,6 @@ static void prepare_block_for_update (basic_block bb, bool insert_phi_p) { basic_block son; - gimple_stmt_iterator si; edge e; edge_iterator ei; @@ -2530,9 +2530,10 @@ prepare_block_for_update (basic_block bb, bool insert_phi_p) /* Process PHI nodes marking interesting those that define or use the symbols that we are interested in. */ - for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si)) + for (gphi_iterator si = gsi_start_phis (bb); !gsi_end_p (si); + gsi_next (&si)) { - gimple phi = gsi_stmt (si); + gphi *phi = si.phi (); tree lhs_sym, lhs = gimple_phi_result (phi); if (TREE_CODE (lhs) == SSA_NAME @@ -2556,7 +2557,8 @@ prepare_block_for_update (basic_block bb, bool insert_phi_p) } /* Process the statements. */ - for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si)) + for (gimple_stmt_iterator si = gsi_start_bb (bb); !gsi_end_p (si); + gsi_next (&si)) { gimple stmt; ssa_op_iter i; @@ -2628,7 +2630,7 @@ prepare_use_sites_for (tree name, bool insert_phi_p) if (gimple_code (stmt) == GIMPLE_PHI) { int ix = PHI_ARG_INDEX_FROM_USE (use_p); - edge e = gimple_phi_arg_edge (stmt, ix); + edge e = gimple_phi_arg_edge (as_a <gphi *> (stmt), ix); mark_use_interesting (name, stmt, e->src, insert_phi_p); } else @@ -2840,7 +2842,7 @@ delete_update_ssa (void) if (blocks_with_phis_to_rewrite) EXECUTE_IF_SET_IN_BITMAP (blocks_with_phis_to_rewrite, 0, i, bi) { - gimple_vec phis = phis_to_rewrite[i]; + vec<gphi *> phis = phis_to_rewrite[i]; phis.release (); phis_to_rewrite[i].create (0); } @@ -2935,7 +2937,7 @@ mark_virtual_operand_for_renaming (tree name) removed. */ void -mark_virtual_phi_result_for_renaming (gimple phi) +mark_virtual_phi_result_for_renaming (gphi *phi) { if (dump_file && (dump_flags & TDF_DETAILS)) { |