This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 88/89] Use gimple_phi in many more places.
- From: David Malcolm <dmalcolm at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: David Malcolm <dmalcolm at redhat dot com>
- Date: Mon, 21 Apr 2014 12:57:59 -0400
- Subject: [PATCH 88/89] Use gimple_phi in many more places.
- Authentication-results: sourceware.org; auth=none
- References: <1398099480-49147-1-git-send-email-dmalcolm at redhat dot com>
This patch converts almost every usage of gsi_start_phis to act on a
gimple_phi_iterator: everywhere (I believe) where the underlying
statements are then accessed via a gimple_phi_ accessor.
There are some places where the phi nodes then just go through
generic gimple APIs; in these cases I didn't bother converting
the iterators.
gcc/
* gimple-ssa-strength-reduction.c (slsr_process_phi): Require a
gimple_phi.
* ipa-inline-analysis.c (predicate_for_phi_result): Likewise.
* tree-emutls.c (lower_emutls_phi_arg): Likewise.
* tree-if-conv.c (predicate_scalar_phi): Likewise.
* tree-into-ssa.c (mark_virtual_phi_result_for_renaming): Likewise.
* tree-into-ssa.h (mark_virtual_phi_result_for_renaming): Likewise.
* tree-phinodes.c (degenerate_phi_result): Likewise.
* tree-phinodes.h (degenerate_phi_result): Likewise.
* tree-ssa.c (verify_use): Likewise.
* tree-switch-conversion.c (array_value_type): Likewise.
* graphite-scop-detection.c (same_close_phi_node): Require a pair
of gimple_phi.
(remove_duplicate_close_phi): Require a gimple_phi and a
gimple_phi_iterator.
(make_close_phi_nodes_unique): Convert a local into a
gimple_phi_iterator.
* gimple-pretty-print.c (gimple_dump_bb_for_graph): Split iterator
into gimple_stmt_iterator and gimple_phi_iterator, converting local
from gimple to gimple_phi.
* gimple-ssa-strength-reduction.c
(find_candidates_dom_walker::before_dom_children): Likewise.
* ipa-inline-analysis.c (estimate_function_body_sizes): Likewise.
* ipa-split.c (verify_non_ssa_vars): Likewise.
(visit_bb): Likewise.
(split_function): Likewise.
* lto-streamer-out.c (output_function): Likewise.
* sese.c (sese_build_liveouts_bb): Likewise.
* tree-cfg.c (gimple_can_merge_blocks_p): Likewise.
* tree-complex.c (init_dont_simulate_again): Likewise.
* tree-dfa.c (collect_dfa_stats): Likewise.
* tree-eh.c (sink_clobbers): Likewise.
* tree-emutls.c (lower_emutls_function_body): Likewise.
* tree-into-ssa.c (rewrite_dom_walker::before_dom_children):
Likewise.
(rewrite_update_dom_walker::before_dom_children): Likewise.
(prepare_block_for_update): Likewise.
* tree-loop-distribution.c (stmts_from_loop): Likewise.
(generate_loops_for_partition): Likewise.
(destroy_loop): Likewise.
(tree_loop_distribution): Likewise.
* tree-ssa-coalesce.c (build_ssa_conflict_graph): Likewise.
* tree-ssa-copy.c (init_copy_prop): Likewise.
* tree-ssa-copyrename.c (rename_ssa_copies): Likewise.
* tree-ssa-loop-ivcanon.c (propagate_constants_for_unrolling): Likewise.
* tree-ssa-loop-manip.c (find_uses_to_rename_bb): Likewise.
(verify_loop_closed_ssa): Likewise.
* tree-ssa-math-opts.c (execute_cse_reciprocals): Likewise.
* tree-ssa-pre.c (compute_avail): Likewise.
(eliminate_dom_walker::before_dom_children): Likewise.
* tree-ssa-strlen.c (strlen_dom_walker::before_dom_children): Likewise.
* tree-ssa-structalias.c (compute_points_to_sets): Likewise.
(ipa_pta_execute): Likewise.
* tree-ssa-tail-merge.c (same_succ_hash): Likewise.
(release_last_vdef): Likewise.
* tree-ssa.c (verify_ssa): Likewise.
(execute_update_addresses_taken): Likewise.
* tree-stdarg.c (check_all_va_list_escapes): Likewise.
(execute_optimize_stdarg): Likewise.
* tree-switch-conversion.c (build_arrays): Likewise.
* tree-vect-loop-manip.c (rename_variables_in_bb): Likewise.
* tree-vect-loop.c (vect_determine_vectorization_factor): Likewise.
(vect_analyze_loop_operations): Likewise.
(vect_transform_loop): Likewise.
* tree-vrp.c (find_assert_locations_1): Likewise.
(vrp_initialize): Likewise.
* graphite-sese-to-poly.c (gsi_for_phi_node): Convert psi to a
gimple_phi_iterator.
(rewrite_degenerate_phi): Require a gimple_phi_iterator; strengthen
local "phi" from gimple to gimple-phi.
* ipa-split.c (consider_split): Convert local psi to a
gimple_phi_iterator.
* tree-cfg.c (gimple_merge_blocks): Likewise.
* tree-eh.c (unsplit_eh): Replace reuse of gsi with a new
gimple_phi_iterator gpi, using it to convert statement from gimple
to a gimple_phi.
(cleanup_empty_eh_merge_phis): Strengthen ophi from gimple to
gimple_phi.
* tree-ssa-dce.c (eliminate_unnecessary_stmts): Replace reuse of
gsi with a new gimple_phi_iterator gpi, using it to convert
expressions from gimple to gimple_phi; add a checked cast to
gimple_phi.
* tree-if-conv.c (predicate_all_scalar_phis): Convert local phi_gsi
to be a gimple_phi_iterator; convert "phi" to be a gimple_phi.
* tree-parloops.c (loop_has_vector_phi_nodes): Convert local to be a
gimple_phi_iterator.
* tree-ssa-ccp.c (ccp_initialize): Likewise.
* tree-scalar-evolution.c (analyze_initial_condition): Add checked cast
to a gimple_phi.
* tree-ssa.c (insert_debug_temp_for_var_def): Likewise.
* tree-ssa-dom.c (get_rhs_or_phi_arg): Likewise.
---
gcc/gimple-pretty-print.c | 10 ++++----
gcc/gimple-ssa-strength-reduction.c | 11 +++++----
gcc/graphite-scop-detection.c | 16 ++++++-------
gcc/graphite-sese-to-poly.c | 6 ++---
gcc/ipa-inline-analysis.c | 11 +++++----
gcc/ipa-split.c | 47 ++++++++++++++++++++----------------
gcc/lto-streamer-out.c | 15 ++++++------
gcc/sese.c | 9 +++----
gcc/tree-cfg.c | 12 ++++++----
gcc/tree-complex.c | 10 ++++----
gcc/tree-dfa.c | 10 ++++----
gcc/tree-eh.c | 18 +++++++-------
gcc/tree-emutls.c | 11 +++++----
gcc/tree-if-conv.c | 9 +++----
gcc/tree-into-ssa.c | 28 ++++++++++++----------
gcc/tree-into-ssa.h | 2 +-
gcc/tree-loop-distribution.c | 48 ++++++++++++++++++++-----------------
gcc/tree-parloops.c | 4 ++--
gcc/tree-phinodes.c | 2 +-
gcc/tree-phinodes.h | 2 +-
gcc/tree-scalar-evolution.c | 2 +-
gcc/tree-ssa-ccp.c | 4 ++--
gcc/tree-ssa-coalesce.c | 10 ++++----
gcc/tree-ssa-copy.c | 9 +++----
gcc/tree-ssa-copyrename.c | 12 +++++-----
gcc/tree-ssa-dce.c | 10 ++++----
gcc/tree-ssa-dom.c | 2 +-
gcc/tree-ssa-loop-ivcanon.c | 8 +++----
gcc/tree-ssa-loop-manip.c | 19 ++++++++-------
gcc/tree-ssa-math-opts.c | 13 +++++-----
gcc/tree-ssa-pre.c | 22 ++++++++---------
gcc/tree-ssa-strlen.c | 13 +++++-----
gcc/tree-ssa-structalias.c | 19 +++++++--------
gcc/tree-ssa-tail-merge.c | 19 ++++++++-------
gcc/tree-ssa.c | 24 +++++++++----------
gcc/tree-stdarg.c | 19 +++++++--------
gcc/tree-switch-conversion.c | 9 +++----
gcc/tree-vect-loop-manip.c | 9 +++----
gcc/tree-vect-loop.c | 34 +++++++++++++-------------
gcc/tree-vrp.c | 19 ++++++++-------
40 files changed, 294 insertions(+), 263 deletions(-)
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 887093f..60d34fe 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -2492,14 +2492,13 @@ gimple_dump_bb (FILE *file, basic_block bb, int indent, int flags)
void
gimple_dump_bb_for_graph (pretty_printer *pp, basic_block bb)
{
- gimple_stmt_iterator gsi;
-
pp_printf (pp, "<bb %d>:\n", bb->index);
pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true);
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
if (!virtual_operand_p (gimple_phi_result (phi))
|| (dump_flags & TDF_VOPS))
{
@@ -2512,7 +2511,8 @@ gimple_dump_bb_for_graph (pretty_printer *pp, basic_block bb)
}
}
- 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))
{
gimple stmt = gsi_stmt (gsi);
pp_bar (pp);
diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c
index f5bfc19..13d259f 100644
--- a/gcc/gimple-ssa-strength-reduction.c
+++ b/gcc/gimple-ssa-strength-reduction.c
@@ -746,7 +746,7 @@ add_cand_for_stmt (gimple gs, slsr_cand_t c)
is used to help find a basis for subsequent candidates. */
static void
-slsr_process_phi (gimple phi, bool speed)
+slsr_process_phi (gimple_phi phi, bool speed)
{
unsigned i;
tree arg0_base = NULL_TREE, base_type;
@@ -1674,12 +1674,13 @@ void
find_candidates_dom_walker::before_dom_children (basic_block bb)
{
bool speed = optimize_bb_for_speed_p (bb);
- gimple_stmt_iterator gsi;
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- slsr_process_phi (gsi_stmt (gsi), speed);
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
+ slsr_process_phi (gsi.phi (), speed);
- 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))
{
gimple gs = gsi_stmt (gsi);
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index af04dd0..747f0c7 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -1233,7 +1233,7 @@ limit_scops (vec<scop_p> *scops)
argument. */
static inline bool
-same_close_phi_node (gimple p1, gimple p2)
+same_close_phi_node (gimple_phi p1, gimple_phi p2)
{
return operand_equal_p (gimple_phi_arg_def (p1, 0),
gimple_phi_arg_def (p2, 0), 0);
@@ -1243,15 +1243,15 @@ same_close_phi_node (gimple p1, gimple p2)
of PHI. */
static void
-remove_duplicate_close_phi (gimple phi, gimple_stmt_iterator *gsi)
+remove_duplicate_close_phi (gimple_phi phi, gimple_phi_iterator *gsi)
{
gimple use_stmt;
use_operand_p use_p;
imm_use_iterator imm_iter;
tree res = gimple_phi_result (phi);
- tree def = gimple_phi_result (gsi_stmt (*gsi));
+ tree def = gimple_phi_result (gsi->phi ());
- gcc_assert (same_close_phi_node (phi, gsi_stmt (*gsi)));
+ gcc_assert (same_close_phi_node (phi, gsi->phi ()));
FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, def)
{
@@ -1276,12 +1276,12 @@ remove_duplicate_close_phi (gimple phi, gimple_stmt_iterator *gsi)
static void
make_close_phi_nodes_unique (basic_block bb)
{
- gimple_stmt_iterator psi;
+ gimple_phi_iterator psi;
for (psi = gsi_start_phis (bb); !gsi_end_p (psi); gsi_next (&psi))
{
- gimple_stmt_iterator gsi = psi;
- gimple phi = gsi_stmt (psi);
+ gimple_phi_iterator gsi = psi;
+ gimple_phi phi = psi.phi ();
/* At this point, PHI should be a close phi in normal form. */
gcc_assert (gimple_phi_num_args (phi) == 1);
@@ -1289,7 +1289,7 @@ make_close_phi_nodes_unique (basic_block bb)
/* Iterate over the next phis and remove duplicates. */
gsi_next (&gsi);
while (!gsi_end_p (gsi))
- if (same_close_phi_node (phi, gsi_stmt (gsi)))
+ if (same_close_phi_node (phi, gsi.phi ()))
remove_duplicate_close_phi (phi, &gsi);
else
gsi_next (&gsi);
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 11ea1d3..78d5915 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -1939,7 +1939,7 @@ gsi_for_phi_node (gimple_phi stmt)
basic_block bb = gimple_bb (stmt);
for (psi = gsi_start_phis (bb); !gsi_end_p (psi); gsi_next (&psi))
- if (stmt == gsi_stmt (psi))
+ if (stmt == psi.phi ())
return psi;
gcc_unreachable ();
@@ -2267,12 +2267,12 @@ rewrite_phi_out_of_ssa (scop_p scop, gimple_phi_iterator *psi)
form "x = phi (y, y, ..., y)" to "x = y". */
static void
-rewrite_degenerate_phi (gimple_stmt_iterator *psi)
+rewrite_degenerate_phi (gimple_phi_iterator *psi)
{
tree rhs;
gimple stmt;
gimple_stmt_iterator gsi;
- gimple phi = gsi_stmt (*psi);
+ gimple_phi phi = psi->phi ();
tree res = gimple_phi_result (phi);
basic_block bb;
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index 29242e0..ccd3811 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -2258,7 +2258,7 @@ phi_result_unknown_predicate (struct ipa_node_params *info,
NONCONSTANT_NAMES, if possible. */
static void
-predicate_for_phi_result (struct inline_summary *summary, gimple phi,
+predicate_for_phi_result (struct inline_summary *summary, gimple_phi phi,
struct predicate *p,
vec<predicate_t> nonconstant_names)
{
@@ -2441,7 +2441,6 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
/* Benefits are scaled by probability of elimination that is in range
<0,2>. */
basic_block bb;
- gimple_stmt_iterator bsi;
struct function *my_function = DECL_STRUCT_FUNCTION (node->decl);
int freq;
struct inline_summary *info = inline_summary (node);
@@ -2522,7 +2521,8 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
struct predicate phi_predicate;
bool first_phi = true;
- for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_phi_iterator bsi = gsi_start_phis (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
if (first_phi
&& !phi_result_unknown_predicate (parms_info, info, bb,
@@ -2535,14 +2535,15 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
fprintf (dump_file, " ");
print_gimple_stmt (dump_file, gsi_stmt (bsi), 0, 0);
}
- predicate_for_phi_result (info, gsi_stmt (bsi), &phi_predicate,
+ predicate_for_phi_result (info, bsi.phi (), &phi_predicate,
nonconstant_names);
}
}
fix_builtin_expect_stmt = find_foldable_builtin_expect (bb);
- for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_stmt_iterator bsi = gsi_start_bb (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
gimple stmt = gsi_stmt (bsi);
int this_size = estimate_num_insns (stmt, &eni_size_weights);
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index 0808f9c..2788289 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -224,7 +224,6 @@ verify_non_ssa_vars (struct split_point *current, bitmap non_ssa_vars,
while (!worklist.is_empty ())
{
- gimple_stmt_iterator bsi;
basic_block bb = worklist.pop ();
FOR_EACH_EDGE (e, ei, bb->preds)
@@ -235,7 +234,8 @@ verify_non_ssa_vars (struct split_point *current, bitmap non_ssa_vars,
e->src->index));
worklist.safe_push (e->src);
}
- for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_stmt_iterator bsi = gsi_start_bb (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
gimple stmt = gsi_stmt (bsi);
if (is_gimple_debug (stmt))
@@ -257,7 +257,8 @@ verify_non_ssa_vars (struct split_point *current, bitmap non_ssa_vars,
}
}
}
- for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_phi_iterator bsi = gsi_start_phis (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
if (walk_stmt_load_store_addr_ops
(gsi_stmt (bsi), non_ssa_vars, test_nonssa_use, test_nonssa_use,
@@ -271,10 +272,11 @@ verify_non_ssa_vars (struct split_point *current, bitmap non_ssa_vars,
{
if (e->dest != return_bb)
continue;
- for (bsi = gsi_start_phis (return_bb); !gsi_end_p (bsi);
+ for (gimple_phi_iterator bsi = gsi_start_phis (return_bb);
+ !gsi_end_p (bsi);
gsi_next (&bsi))
{
- gimple stmt = gsi_stmt (bsi);
+ gimple_phi stmt = bsi.phi ();
tree op = gimple_phi_arg_def (stmt, e->dest_idx);
if (virtual_operand_p (gimple_phi_result (stmt)))
@@ -594,15 +596,15 @@ consider_split (struct split_point *current, bitmap non_ssa_vars,
for the return value. If there are other PHIs, give up. */
if (return_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
{
- gimple_stmt_iterator psi;
+ gimple_phi_iterator psi;
for (psi = gsi_start_phis (return_bb); !gsi_end_p (psi); gsi_next (&psi))
- if (!virtual_operand_p (gimple_phi_result (gsi_stmt (psi)))
+ if (!virtual_operand_p (gimple_phi_result (psi.phi ()))
&& !(retval
&& current->split_part_set_retval
&& TREE_CODE (retval) == SSA_NAME
&& !DECL_BY_REFERENCE (DECL_RESULT (current_function_decl))
- && SSA_NAME_DEF_STMT (retval) == gsi_stmt (psi)))
+ && SSA_NAME_DEF_STMT (retval) == psi.phi ()))
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file,
@@ -769,12 +771,12 @@ visit_bb (basic_block bb, basic_block return_bb,
bitmap set_ssa_names, bitmap used_ssa_names,
bitmap non_ssa_vars)
{
- gimple_stmt_iterator bsi;
edge e;
edge_iterator ei;
bool can_split = true;
- for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_stmt_iterator bsi = gsi_start_bb (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
gimple stmt = gsi_stmt (bsi);
tree op;
@@ -843,9 +845,10 @@ visit_bb (basic_block bb, basic_block return_bb,
mark_nonssa_use,
mark_nonssa_use);
}
- for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_phi_iterator bsi = gsi_start_phis (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
- gimple stmt = gsi_stmt (bsi);
+ gimple_phi stmt = bsi.phi ();
unsigned int i;
if (virtual_operand_p (gimple_phi_result (stmt)))
@@ -867,9 +870,11 @@ visit_bb (basic_block bb, basic_block return_bb,
FOR_EACH_EDGE (e, ei, bb->succs)
if (e->dest == return_bb)
{
- for (bsi = gsi_start_phis (return_bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_phi_iterator bsi = gsi_start_phis (return_bb);
+ !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
- gimple stmt = gsi_stmt (bsi);
+ gimple_phi stmt = bsi.phi ();
tree op = gimple_phi_arg_def (stmt, e->dest_idx);
if (virtual_operand_p (gimple_phi_result (stmt)))
@@ -1093,7 +1098,6 @@ split_function (struct split_point *split_point)
struct cgraph_node *node, *cur_node = cgraph_get_node (current_function_decl);
basic_block return_bb = find_return_bb ();
basic_block call_bb;
- gimple_stmt_iterator gsi;
gimple_call call;
edge e;
edge_iterator ei;
@@ -1197,9 +1201,10 @@ split_function (struct split_point *split_point)
if (return_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
{
bool phi_p = false;
- for (gsi = gsi_start_phis (return_bb); !gsi_end_p (gsi);)
+ for (gimple_phi_iterator gsi = gsi_start_phis (return_bb);
+ !gsi_end_p (gsi);)
{
- gimple stmt = gsi_stmt (gsi);
+ gimple_phi stmt = gsi.phi ();
if (!virtual_operand_p (gimple_phi_result (stmt)))
{
gsi_next (&gsi);
@@ -1218,7 +1223,9 @@ split_function (struct split_point *split_point)
entry of the SESE region as the vuse of the call and the reaching
vdef of the exit of the SESE region as the vdef of the call. */
if (!phi_p)
- for (gsi = gsi_start_bb (return_bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (return_bb);
+ !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
if (gimple_vuse (stmt))
@@ -1264,7 +1271,7 @@ split_function (struct split_point *split_point)
/* Create the basic block we place call into. It is the entry basic block
split after last label. */
call_bb = split_point->entry_bb;
- for (gsi = gsi_start_bb (call_bb); !gsi_end_p (gsi);)
+ for (gimple_stmt_iterator gsi = gsi_start_bb (call_bb); !gsi_end_p (gsi);)
if (gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
{
last_stmt = gsi_stmt (gsi);
@@ -1276,7 +1283,7 @@ split_function (struct split_point *split_point)
remove_edge (e);
/* Produce the call statement. */
- gsi = gsi_last_bb (call_bb);
+ gimple_stmt_iterator gsi = gsi_last_bb (call_bb);
FOR_EACH_VEC_ELT (args_to_pass, i, arg)
if (!is_gimple_val (arg))
{
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index 0f37f1c..158d830 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -1861,16 +1861,17 @@ output_function (struct cgraph_node *node)
set_gimple_stmt_max_uid (cfun, 0);
FOR_ALL_BB_FN (bb, cfun)
{
- gimple_stmt_iterator gsi;
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- gimple stmt = gsi_stmt (gsi);
+ gimple_phi stmt = gsi.phi ();
/* Virtual PHIs are not going to be streamed. */
if (!virtual_operand_p (gimple_phi_result (stmt)))
gimple_set_uid (stmt, inc_gimple_stmt_max_uid (cfun));
}
- 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))
{
gimple stmt = gsi_stmt (gsi);
gimple_set_uid (stmt, inc_gimple_stmt_max_uid (cfun));
@@ -1880,10 +1881,10 @@ output_function (struct cgraph_node *node)
virtual phis now. */
FOR_ALL_BB_FN (bb, cfun)
{
- gimple_stmt_iterator gsi;
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- gimple stmt = gsi_stmt (gsi);
+ gimple_phi stmt = gsi.phi ();
if (virtual_operand_p (gimple_phi_result (stmt)))
gimple_set_uid (stmt, inc_gimple_stmt_max_uid (cfun));
}
diff --git a/gcc/sese.c b/gcc/sese.c
index f146238..976f5cc 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -214,18 +214,19 @@ sese_build_liveouts_use (sese region, bitmap liveouts, basic_block bb,
static void
sese_build_liveouts_bb (sese region, bitmap liveouts, basic_block bb)
{
- gimple_stmt_iterator bsi;
edge e;
edge_iterator ei;
ssa_op_iter iter;
use_operand_p use_p;
FOR_EACH_EDGE (e, ei, bb->succs)
- for (bsi = gsi_start_phis (e->dest); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_phi_iterator bsi = gsi_start_phis (e->dest); !gsi_end_p (bsi);
+ gsi_next (&bsi))
sese_build_liveouts_use (region, liveouts, bb,
- PHI_ARG_DEF_FROM_EDGE (gsi_stmt (bsi), e));
+ PHI_ARG_DEF_FROM_EDGE (bsi.phi (), e));
- for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_stmt_iterator bsi = gsi_start_bb (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
gimple stmt = gsi_stmt (bsi);
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 355c4ac..187fa570 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -1599,7 +1599,6 @@ static bool
gimple_can_merge_blocks_p (basic_block a, basic_block b)
{
gimple stmt;
- gimple_stmt_iterator gsi;
if (!single_succ_p (a))
return false;
@@ -1629,7 +1628,8 @@ gimple_can_merge_blocks_p (basic_block a, basic_block b)
return false;
/* Examine the labels at the beginning of B. */
- for (gsi = gsi_start_bb (b); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (b); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
tree lab;
gimple_label label_stmt = gsi_stmt (gsi)->dyn_cast_gimple_label ();
@@ -1649,9 +1649,10 @@ gimple_can_merge_blocks_p (basic_block a, basic_block b)
/* It must be possible to eliminate all phi nodes in B. If ssa form
is not up-to-date and a name-mapping is registered, we cannot eliminate
any phis. Symbols marked for renaming are never a problem though. */
- for (gsi = gsi_start_phis (b); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (b); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
/* Technically only new names matter. */
if (name_registered_for_update_p (PHI_RESULT (phi)))
return false;
@@ -1763,7 +1764,8 @@ replace_uses_by (tree name, tree val)
static void
gimple_merge_blocks (basic_block a, basic_block b)
{
- gimple_stmt_iterator last, gsi, psi;
+ gimple_stmt_iterator last, gsi;
+ gimple_phi_iterator psi;
if (dump_file)
fprintf (dump_file, "Merging blocks %d and %d\n", a->index, b->index);
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index 425fcbe..e29973b 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -203,20 +203,20 @@ static bool
init_dont_simulate_again (void)
{
basic_block bb;
- gimple_stmt_iterator gsi;
- gimple phi;
bool saw_a_complex_op = false;
FOR_EACH_BB_FN (bb, cfun)
{
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
prop_set_simulate_again (phi,
is_complex_reg (gimple_phi_result (phi)));
}
- 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))
{
gimple stmt;
tree op0, op1;
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index fcf8d80..8f11dac 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -281,18 +281,18 @@ collect_dfa_stats (struct dfa_stats_d *dfa_stats_p ATTRIBUTE_UNUSED)
/* Walk all the statements in the function counting references. */
FOR_EACH_BB_FN (bb, cfun)
{
- gimple_stmt_iterator si;
-
- for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
+ for (gimple_phi_iterator si = gsi_start_phis (bb); !gsi_end_p (si);
+ gsi_next (&si))
{
- gimple phi = gsi_stmt (si);
+ gimple_phi phi = si.phi ();
dfa_stats_p->num_phis++;
dfa_stats_p->num_phi_args += gimple_phi_num_args (phi);
if (gimple_phi_num_args (phi) > dfa_stats_p->max_num_phi_args)
dfa_stats_p->max_num_phi_args = gimple_phi_num_args (phi);
}
- 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 = gsi_stmt (si);
dfa_stats_p->num_defs += NUM_SSA_OPERANDS (stmt, SSA_OP_DEF);
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 5e4eef8..6bfd973 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -3523,14 +3523,15 @@ sink_clobbers (basic_block bb)
/* See if there is a virtual PHI node to take an updated virtual
operand from. */
- gimple vphi = NULL;
+ gimple_phi vphi = NULL;
tree vuse = NULL_TREE;
- for (gsi = gsi_start_phis (succbb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gpi = gsi_start_phis (succbb);
+ !gsi_end_p (gpi); gsi_next (&gpi))
{
- tree res = gimple_phi_result (gsi_stmt (gsi));
+ tree res = gimple_phi_result (gpi.phi ());
if (virtual_operand_p (res))
{
- vphi = gsi_stmt (gsi);
+ vphi = gpi.phi ();
vuse = res;
break;
}
@@ -4094,9 +4095,10 @@ unsplit_eh (eh_landing_pad lp)
that doesn't appear to handle virtuals. Propagate by hand. */
if (!gimple_seq_empty_p (phi_nodes (bb)))
{
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); )
+ for (gimple_phi_iterator gpi = gsi_start_phis (bb); !gsi_end_p (gpi); )
{
- gimple use_stmt, phi = gsi_stmt (gsi);
+ gimple use_stmt;
+ gimple_phi phi = gpi.phi ();
tree lhs = gimple_phi_result (phi);
tree rhs = gimple_phi_arg_def (phi, 0);
use_operand_p use_p;
@@ -4111,7 +4113,7 @@ unsplit_eh (eh_landing_pad lp)
if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs))
SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs) = 1;
- remove_phi_node (&gsi, true);
+ remove_phi_node (&gpi, true);
}
}
@@ -4254,7 +4256,7 @@ cleanup_empty_eh_merge_phis (basic_block new_bb, basic_block old_bb,
we don't know what values from the other edges into NEW_BB to use. */
for (ogsi = gsi_start_phis (old_bb); !gsi_end_p (ogsi); gsi_next (&ogsi))
{
- gimple ophi = gsi_stmt (ogsi);
+ gimple_phi ophi = ogsi.phi ();
tree oresult = gimple_phi_result (ophi);
if (!bitmap_bit_p (ophi_handled, SSA_NAME_VERSION (oresult)))
goto fail;
diff --git a/gcc/tree-emutls.c b/gcc/tree-emutls.c
index 993eaf7..76ff411 100644
--- a/gcc/tree-emutls.c
+++ b/gcc/tree-emutls.c
@@ -588,7 +588,8 @@ lower_emutls_stmt (gimple stmt, struct lower_emutls_data *d)
/* Lower the I'th operand of PHI. */
static void
-lower_emutls_phi_arg (gimple phi, unsigned int i, struct lower_emutls_data *d)
+lower_emutls_phi_arg (gimple_phi phi, unsigned int i,
+ struct lower_emutls_data *d)
{
struct walk_stmt_info wi;
struct phi_arg_d *pd = gimple_phi_arg (phi, i);
@@ -640,7 +641,6 @@ lower_emutls_function_body (struct cgraph_node *node)
FOR_EACH_BB_FN (d.bb, cfun)
{
- gimple_stmt_iterator gsi;
unsigned int i, nedge;
/* Lower each of the PHI nodes of the block, as we may have
@@ -662,10 +662,10 @@ lower_emutls_function_body (struct cgraph_node *node)
clear_access_vars ();
d.seq = NULL;
- for (gsi = gsi_start_phis (d.bb);
+ for (gimple_phi_iterator gsi = gsi_start_phis (d.bb);
!gsi_end_p (gsi);
gsi_next (&gsi))
- lower_emutls_phi_arg (gsi_stmt (gsi), i, &d);
+ lower_emutls_phi_arg (gsi.phi (), i, &d);
/* Insert all statements generated by all phi nodes for this
particular edge all at once. */
@@ -683,7 +683,8 @@ lower_emutls_function_body (struct cgraph_node *node)
clear_access_vars ();
/* Lower each of the statements of the block. */
- for (gsi = gsi_start_bb (d.bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (d.bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
d.seq = NULL;
lower_emutls_stmt (gsi_stmt (gsi), &d);
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 6fe69ae..9fefc2c 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -1400,7 +1400,7 @@ find_phi_replacement_condition (basic_block bb, tree *cond,
TRUE_BB is selected. */
static void
-predicate_scalar_phi (gimple phi, tree cond,
+predicate_scalar_phi (gimple_phi phi, tree cond,
basic_block true_bb,
gimple_stmt_iterator *gsi)
{
@@ -1468,9 +1468,10 @@ predicate_all_scalar_phis (struct loop *loop)
for (i = 1; i < orig_loop_num_nodes; i++)
{
- gimple phi;
+ gimple_phi phi;
tree cond = NULL_TREE;
- gimple_stmt_iterator gsi, phi_gsi;
+ gimple_stmt_iterator gsi;
+ gimple_phi_iterator phi_gsi;
basic_block true_bb = NULL;
bb = ifc_bbs[i];
@@ -1488,7 +1489,7 @@ predicate_all_scalar_phis (struct loop *loop)
while (!gsi_end_p (phi_gsi))
{
- phi = gsi_stmt (phi_gsi);
+ phi = phi_gsi.phi ();
predicate_scalar_phi (phi, cond, true_bb, &gsi);
release_phi_node (phi);
gsi_next (&phi_gsi);
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index 47f6832..c7f841d 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -1433,8 +1433,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);
@@ -1444,7 +1442,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 (gimple_phi_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));
@@ -1454,7 +1453,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.
@@ -2083,7 +2083,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",
@@ -2104,10 +2103,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 (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
tree lhs, lhs_sym;
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
if (!register_defs_p (phi))
continue;
@@ -2139,7 +2139,8 @@ 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); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
rewrite_update_stmt (gsi_stmt (gsi), gsi);
}
@@ -2499,7 +2500,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;
@@ -2507,9 +2507,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 (gimple_phi_iterator si = gsi_start_phis (bb); !gsi_end_p (si);
+ gsi_next (&si))
{
- gimple phi = gsi_stmt (si);
+ gimple_phi phi = si.phi ();
tree lhs_sym, lhs = gimple_phi_result (phi);
if (TREE_CODE (lhs) == SSA_NAME
@@ -2533,7 +2534,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;
@@ -2912,7 +2914,7 @@ mark_virtual_operand_for_renaming (tree name)
removed. */
void
-mark_virtual_phi_result_for_renaming (gimple phi)
+mark_virtual_phi_result_for_renaming (gimple_phi phi)
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
diff --git a/gcc/tree-into-ssa.h b/gcc/tree-into-ssa.h
index 977f6e7..8d82074 100644
--- a/gcc/tree-into-ssa.h
+++ b/gcc/tree-into-ssa.h
@@ -26,7 +26,7 @@ void delete_update_ssa (void);
tree create_new_def_for (tree, gimple, def_operand_p);
void mark_virtual_operands_for_renaming (struct function *);
void mark_virtual_operand_for_renaming (tree);
-void mark_virtual_phi_result_for_renaming (gimple);
+void mark_virtual_phi_result_for_renaming (gimple_phi);
bool need_ssa_update_p (struct function *);
bool name_registered_for_update_p (tree);
void release_ssa_name_after_update_ssa (tree);
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index 2d25277..6834e46 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -393,16 +393,16 @@ stmts_from_loop (struct loop *loop, vec<gimple> *stmts)
for (i = 0; i < loop->num_nodes; i++)
{
basic_block bb = bbs[i];
- gimple_stmt_iterator bsi;
- gimple stmt;
- for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
- if (!virtual_operand_p (gimple_phi_result (gsi_stmt (bsi))))
- stmts->safe_push (gsi_stmt (bsi));
+ for (gimple_phi_iterator bsi = gsi_start_phis (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
+ if (!virtual_operand_p (gimple_phi_result (bsi.phi ())))
+ stmts->safe_push (bsi.phi ());
- for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_stmt_iterator bsi = gsi_start_bb (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
- stmt = gsi_stmt (bsi);
+ gimple stmt = gsi_stmt (bsi);
if (gimple_code (stmt) != GIMPLE_LABEL && !is_gimple_debug (stmt))
stmts->safe_push (stmt);
}
@@ -620,7 +620,6 @@ generate_loops_for_partition (struct loop *loop, partition_t partition,
bool copy_p)
{
unsigned i;
- gimple_stmt_iterator bsi;
basic_block *bbs;
if (copy_p)
@@ -639,15 +638,16 @@ generate_loops_for_partition (struct loop *loop, partition_t partition,
{
basic_block bb = bbs[i];
- for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_phi_iterator bsi = gsi_start_phis (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
- gimple phi = gsi_stmt (bsi);
+ gimple_phi phi = bsi.phi ();
if (!virtual_operand_p (gimple_phi_result (phi))
&& !bitmap_bit_p (partition->stmts, gimple_uid (phi)))
reset_debug_uses (phi);
}
- for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_stmt_iterator bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
{
gimple stmt = gsi_stmt (bsi);
if (gimple_code (stmt) != GIMPLE_LABEL
@@ -661,9 +661,9 @@ generate_loops_for_partition (struct loop *loop, partition_t partition,
{
basic_block bb = bbs[i];
- for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi);)
+ for (gimple_phi_iterator bsi = gsi_start_phis (bb); !gsi_end_p (bsi);)
{
- gimple phi = gsi_stmt (bsi);
+ gimple_phi phi = bsi.phi ();
if (!virtual_operand_p (gimple_phi_result (phi))
&& !bitmap_bit_p (partition->stmts, gimple_uid (phi)))
remove_phi_node (&bsi, true);
@@ -671,7 +671,7 @@ generate_loops_for_partition (struct loop *loop, partition_t partition,
gsi_next (&bsi);
}
- for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi);)
+ for (gimple_stmt_iterator bsi = gsi_start_bb (bb); !gsi_end_p (bsi);)
{
gimple stmt = gsi_stmt (bsi);
if (gimple_code (stmt) != GIMPLE_LABEL
@@ -902,14 +902,15 @@ destroy_loop (struct loop *loop)
Make sure we replace all uses of virtual defs that will remain
outside of the loop with the bare symbol as delete_basic_block
will release them. */
- gimple_stmt_iterator gsi;
- for (gsi = gsi_start_phis (bbs[i]); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bbs[i]); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
if (virtual_operand_p (gimple_phi_result (phi)))
mark_virtual_phi_result_for_renaming (phi);
}
- for (gsi = gsi_start_bb (bbs[i]); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bbs[i]); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
tree vdef = gimple_vdef (stmt);
@@ -1709,10 +1710,11 @@ tree_loop_distribution (void)
bbs = get_loop_body_in_dom_order (loop);
for (i = 0; i < loop->num_nodes; ++i)
{
- gimple_stmt_iterator gsi;
- for (gsi = gsi_start_phis (bbs[i]); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bbs[i]);
+ !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
if (virtual_operand_p (gimple_phi_result (phi)))
continue;
/* Distribute stmts which have defs that are used outside of
@@ -1721,7 +1723,9 @@ tree_loop_distribution (void)
continue;
work_list.safe_push (phi);
}
- for (gsi = gsi_start_bb (bbs[i]); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bbs[i]);
+ !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index 521e050..ddd7d66 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -1939,12 +1939,12 @@ loop_has_vector_phi_nodes (struct loop *loop ATTRIBUTE_UNUSED)
{
unsigned i;
basic_block *bbs = get_loop_body_in_dom_order (loop);
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
bool res = true;
for (i = 0; i < loop->num_nodes; i++)
for (gsi = gsi_start_phis (bbs[i]); !gsi_end_p (gsi); gsi_next (&gsi))
- if (TREE_CODE (TREE_TYPE (PHI_RESULT (gsi_stmt (gsi)))) == VECTOR_TYPE)
+ if (TREE_CODE (TREE_TYPE (PHI_RESULT (gsi.phi ()))) == VECTOR_TYPE)
goto end;
res = false;
diff --git a/gcc/tree-phinodes.c b/gcc/tree-phinodes.c
index 5594cd4..06ce540 100644
--- a/gcc/tree-phinodes.c
+++ b/gcc/tree-phinodes.c
@@ -479,7 +479,7 @@ remove_phi_nodes (basic_block bb)
NULL. */
tree
-degenerate_phi_result (gimple phi)
+degenerate_phi_result (gimple_phi phi)
{
tree lhs = gimple_phi_result (phi);
tree val = NULL;
diff --git a/gcc/tree-phinodes.h b/gcc/tree-phinodes.h
index dcde99e..0ff7fda 100644
--- a/gcc/tree-phinodes.h
+++ b/gcc/tree-phinodes.h
@@ -29,7 +29,7 @@ extern void add_phi_arg (gimple_phi, tree, edge, source_location);
extern void remove_phi_args (edge);
extern void remove_phi_node (gimple_stmt_iterator *, bool);
extern void remove_phi_nodes (basic_block);
-extern tree degenerate_phi_result (gimple);
+extern tree degenerate_phi_result (gimple_phi);
extern void set_phi_nodes (basic_block, gimple_seq);
static inline use_operand_p
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index 998c06c..4fa3709 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -1599,7 +1599,7 @@ analyze_initial_condition (gimple_phi loop_phi_node)
gimple def = SSA_NAME_DEF_STMT (init_cond);
tree res;
if (gimple_code (def) == GIMPLE_PHI
- && (res = degenerate_phi_result (def)) != NULL_TREE
+ && (res = degenerate_phi_result (def->as_a_gimple_phi ())) != NULL_TREE
/* Only allow invariants here, otherwise we may break
loop-closed SSA form. */
&& is_gimple_min_invariant (res))
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index c79d981..484996a 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -815,11 +815,11 @@ ccp_initialize (void)
except for phi nodes for virtual operands when we do not do store ccp. */
FOR_EACH_BB_FN (bb, cfun)
{
- gimple_stmt_iterator i;
+ gimple_phi_iterator i;
for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i))
{
- gimple phi = gsi_stmt (i);
+ gimple_phi phi = i.phi ();
if (virtual_operand_p (gimple_phi_result (phi)))
prop_set_simulate_again (phi, false);
diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c
index cd4f5a1..ee076bd 100644
--- a/gcc/tree-ssa-coalesce.c
+++ b/gcc/tree-ssa-coalesce.c
@@ -823,12 +823,11 @@ build_ssa_conflict_graph (tree_live_info_p liveinfo)
FOR_EACH_BB_FN (bb, cfun)
{
- gimple_stmt_iterator gsi;
-
/* Start with live on exit temporaries. */
live_track_init (live, live_on_exit (liveinfo, bb));
- for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi); gsi_prev (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_last_bb (bb); !gsi_end_p (gsi);
+ gsi_prev (&gsi))
{
tree var;
gimple stmt = gsi_stmt (gsi);
@@ -865,9 +864,10 @@ build_ssa_conflict_graph (tree_live_info_p liveinfo)
There must be a conflict recorded between the result of the PHI and
any variables that are live. Otherwise the out-of-ssa translation
may create incorrect code. */
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree result = PHI_RESULT (phi);
if (live_track_live_p (live, result))
live_track_process_def (live, result, graph);
diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c
index 0892126..1ff296b 100644
--- a/gcc/tree-ssa-copy.c
+++ b/gcc/tree-ssa-copy.c
@@ -471,10 +471,10 @@ init_copy_prop (void)
FOR_EACH_BB_FN (bb, cfun)
{
- gimple_stmt_iterator si;
int depth = bb_loop_depth (bb);
- 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 = gsi_stmt (si);
ssa_op_iter iter;
@@ -509,9 +509,10 @@ init_copy_prop (void)
set_copy_of_val (def, def);
}
- for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
+ for (gimple_phi_iterator si = gsi_start_phis (bb); !gsi_end_p (si);
+ gsi_next (&si))
{
- gimple phi = gsi_stmt (si);
+ gimple_phi phi = si.phi ();
tree def;
def = gimple_phi_result (phi);
diff --git a/gcc/tree-ssa-copyrename.c b/gcc/tree-ssa-copyrename.c
index bc947b6..2608123 100644
--- a/gcc/tree-ssa-copyrename.c
+++ b/gcc/tree-ssa-copyrename.c
@@ -310,9 +310,8 @@ rename_ssa_copies (void)
{
var_map map;
basic_block bb;
- gimple_stmt_iterator gsi;
tree var, part_var;
- gimple stmt, phi;
+ gimple stmt;
unsigned x;
FILE *debug;
@@ -328,7 +327,8 @@ rename_ssa_copies (void)
FOR_EACH_BB_FN (bb, cfun)
{
/* Scan for real copies. */
- 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))
{
stmt = gsi_stmt (gsi);
if (gimple_assign_ssa_name_copy_p (stmt))
@@ -344,12 +344,12 @@ rename_ssa_copies (void)
FOR_EACH_BB_FN (bb, cfun)
{
/* Treat PHI nodes as copies between the result and each argument. */
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
size_t i;
tree res;
-
- phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
res = gimple_phi_result (phi);
/* Do not process virtual SSA_NAMES. */
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index 907db1a..9609faf 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -1273,13 +1273,15 @@ eliminate_unnecessary_stmts (void)
if (!bitmap_bit_p (bb_contains_live_stmts, bb->index)
|| !(bb->flags & BB_REACHABLE))
{
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- if (virtual_operand_p (gimple_phi_result (gsi_stmt (gsi))))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
+ if (virtual_operand_p (gimple_phi_result (gsi.phi ())))
{
bool found = false;
imm_use_iterator iter;
- FOR_EACH_IMM_USE_STMT (stmt, iter, gimple_phi_result (gsi_stmt (gsi)))
+ FOR_EACH_IMM_USE_STMT (stmt, iter,
+ gimple_phi_result (gsi.phi ()))
{
if (!(gimple_bb (stmt)->flags & BB_REACHABLE))
continue;
@@ -1291,7 +1293,7 @@ eliminate_unnecessary_stmts (void)
}
}
if (found)
- mark_virtual_phi_result_for_renaming (gsi_stmt (gsi));
+ mark_virtual_phi_result_for_renaming (gsi.phi ());
}
if (!(bb->flags & BB_REACHABLE))
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 82e937e..a0ee43b 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -2660,7 +2660,7 @@ static tree
get_rhs_or_phi_arg (gimple stmt)
{
if (gimple_code (stmt) == GIMPLE_PHI)
- return degenerate_phi_result (stmt);
+ return degenerate_phi_result (stmt->as_a_gimple_phi ());
else if (gimple_assign_single_p (stmt))
return gimple_assign_rhs1 (stmt);
else
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index c0087e3..19029f4 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -1068,12 +1068,10 @@ propagate_into_all_uses (tree ssa_name, tree val)
static void
propagate_constants_for_unrolling (basic_block bb)
{
- gimple_stmt_iterator gsi;
-
/* Look for degenerate PHI nodes with constant argument. */
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); )
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi); )
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree result = gimple_phi_result (phi);
tree arg = gimple_phi_arg_def (phi, 0);
@@ -1088,7 +1086,7 @@ propagate_constants_for_unrolling (basic_block bb)
}
/* Look for assignments to SSA names with constant RHS. */
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
{
gimple stmt = gsi_stmt (gsi);
tree lhs;
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index fe63700..6ab7a64 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -431,20 +431,21 @@ find_uses_to_rename_stmt (gimple stmt, bitmap *use_blocks, bitmap need_phis)
static void
find_uses_to_rename_bb (basic_block bb, bitmap *use_blocks, bitmap need_phis)
{
- gimple_stmt_iterator bsi;
edge e;
edge_iterator ei;
FOR_EACH_EDGE (e, ei, bb->succs)
- for (bsi = gsi_start_phis (e->dest); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_phi_iterator bsi = gsi_start_phis (e->dest); !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
- gimple phi = gsi_stmt (bsi);
+ gimple_phi phi = bsi.phi ();
if (! virtual_operand_p (gimple_phi_result (phi)))
find_uses_to_rename_use (bb, PHI_ARG_DEF_FROM_EDGE (phi, e),
use_blocks, need_phis);
}
- for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_stmt_iterator bsi = gsi_start_bb (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
find_uses_to_rename_stmt (gsi_stmt (bsi), use_blocks, need_phis);
}
@@ -590,8 +591,6 @@ DEBUG_FUNCTION void
verify_loop_closed_ssa (bool verify_ssa_p)
{
basic_block bb;
- gimple_stmt_iterator bsi;
- gimple phi;
edge e;
edge_iterator ei;
@@ -605,15 +604,17 @@ verify_loop_closed_ssa (bool verify_ssa_p)
FOR_EACH_BB_FN (bb, cfun)
{
- for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_phi_iterator bsi = gsi_start_phis (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
- phi = gsi_stmt (bsi);
+ gimple_phi phi = bsi.phi ();
FOR_EACH_EDGE (e, ei, bb->preds)
check_loop_closed_ssa_use (e->src,
PHI_ARG_DEF_FROM_EDGE (phi, e));
}
- for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_stmt_iterator bsi = gsi_start_bb (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
check_loop_closed_ssa_stmt (bb, gsi_stmt (bsi));
}
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 8102768..a557a75 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -542,20 +542,20 @@ execute_cse_reciprocals (void)
FOR_EACH_BB_FN (bb, cfun)
{
- gimple_stmt_iterator gsi;
- gimple phi;
tree def;
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
def = PHI_RESULT (phi);
if (! virtual_operand_p (def)
&& FLOAT_TYPE_P (TREE_TYPE (def)))
execute_cse_reciprocals_1 (NULL, def);
}
- for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_after_labels (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
@@ -570,7 +570,8 @@ execute_cse_reciprocals (void)
continue;
/* Scan for a/func(b) and convert it to reciprocal a*rfunc(b). */
- for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_after_labels (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
tree fndecl;
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index b8047a4..e90184a 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -3741,7 +3741,6 @@ compute_avail (void)
/* Loop until the worklist is empty. */
while (sp)
{
- gimple_stmt_iterator gsi;
gimple stmt;
basic_block dom;
@@ -3755,9 +3754,10 @@ compute_avail (void)
bitmap_set_copy (AVAIL_OUT (block), AVAIL_OUT (dom));
/* Generate values for PHI nodes. */
- for (gsi = gsi_start_phis (block); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (block); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- tree result = gimple_phi_result (gsi_stmt (gsi));
+ tree result = gimple_phi_result (gsi.phi ());
/* We have no need for virtual phis, as they don't represent
actual computations. */
@@ -3774,7 +3774,8 @@ compute_avail (void)
/* Now compute value numbers and populate value sets with all
the expressions computed in BLOCK. */
- for (gsi = gsi_start_bb (block); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (block); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
ssa_op_iter iter;
tree op;
@@ -4069,15 +4070,13 @@ public:
void
eliminate_dom_walker::before_dom_children (basic_block b)
{
- gimple_stmt_iterator gsi;
- gimple stmt;
-
/* Mark new bb. */
el_avail_stack.safe_push (NULL_TREE);
- for (gsi = gsi_start_phis (b); !gsi_end_p (gsi);)
+ for (gimple_phi_iterator gsi = gsi_start_phis (b); !gsi_end_p (gsi);)
{
- gimple stmt, phi = gsi_stmt (gsi);
+ gimple stmt;
+ gimple_phi phi = gsi.phi ();
tree sprime = NULL_TREE, res = PHI_RESULT (phi);
gimple_stmt_iterator gsi2;
@@ -4139,12 +4138,13 @@ eliminate_dom_walker::before_dom_children (basic_block b)
pre_stats.eliminations++;
}
- for (gsi = gsi_start_bb (b); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (b); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
tree lhs = NULL_TREE;
tree rhs = NULL_TREE;
- stmt = gsi_stmt (gsi);
+ gimple stmt = gsi_stmt (gsi);
if (gimple_has_lhs (stmt))
lhs = gimple_get_lhs (stmt);
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
index f55b7ee..4a381e4 100644
--- a/gcc/tree-ssa-strlen.c
+++ b/gcc/tree-ssa-strlen.c
@@ -1958,7 +1958,6 @@ public:
void
strlen_dom_walker::before_dom_children (basic_block bb)
{
- gimple_stmt_iterator gsi;
basic_block dombb = get_immediate_dominator (CDI_DOMINATORS, bb);
if (dombb == NULL)
@@ -1968,9 +1967,10 @@ strlen_dom_walker::before_dom_children (basic_block bb)
stridx_to_strinfo = ((vec<strinfo, va_heap, vl_embed> *) dombb->aux);
if (stridx_to_strinfo)
{
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
if (virtual_operand_p (gimple_phi_result (phi)))
{
bitmap visited = BITMAP_ALLOC (NULL);
@@ -2007,9 +2007,10 @@ strlen_dom_walker::before_dom_children (basic_block bb)
/* If all PHI arguments have the same string index, the PHI result
has it as well. */
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree result = gimple_phi_result (phi);
if (!virtual_operand_p (result) && POINTER_TYPE_P (TREE_TYPE (result)))
{
@@ -2027,7 +2028,7 @@ strlen_dom_walker::before_dom_children (basic_block bb)
}
/* Attempt to optimize individual statements. */
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
if (strlen_optimize_stmt (&gsi))
gsi_next (&gsi);
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index fa77c30..22eab13 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -6810,17 +6810,17 @@ compute_points_to_sets (void)
/* Now walk all statements and build the constraint set. */
FOR_EACH_BB_FN (bb, cfun)
{
- gimple_stmt_iterator gsi;
-
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
if (! virtual_operand_p (gimple_phi_result (phi)))
find_func_aliases (phi);
}
- 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))
{
gimple stmt = gsi_stmt (gsi);
@@ -7218,18 +7218,17 @@ ipa_pta_execute (void)
/* Build constriants for the function body. */
FOR_EACH_BB_FN (bb, func)
{
- gimple_stmt_iterator gsi;
-
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
if (! virtual_operand_p (gimple_phi_result (phi)))
find_func_aliases (phi);
}
- 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))
{
gimple stmt = gsi_stmt (gsi);
diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c
index 7727cdf..b6d677c 100644
--- a/gcc/tree-ssa-tail-merge.c
+++ b/gcc/tree-ssa-tail-merge.c
@@ -456,13 +456,12 @@ same_succ_hash (const_same_succ e)
unsigned int first = bitmap_first_set_bit (e->bbs);
basic_block bb = BASIC_BLOCK_FOR_FN (cfun, first);
int size = 0;
- gimple_stmt_iterator gsi;
gimple stmt;
tree arg;
unsigned int s;
bitmap_iterator bs;
- for (gsi = gsi_start_nondebug_bb (bb);
+ for (gimple_stmt_iterator gsi = gsi_start_nondebug_bb (bb);
!gsi_end_p (gsi); gsi_next_nondebug (&gsi))
{
stmt = gsi_stmt (gsi);
@@ -503,10 +502,12 @@ same_succ_hash (const_same_succ e)
EXECUTE_IF_SET_IN_BITMAP (e->succs, 0, s, bs)
{
int n = find_edge (bb, BASIC_BLOCK_FOR_FN (cfun, s))->dest_idx;
- for (gsi = gsi_start_phis (BASIC_BLOCK_FOR_FN (cfun, s)); !gsi_end_p (gsi);
+ for (gimple_phi_iterator gsi =
+ gsi_start_phis (BASIC_BLOCK_FOR_FN (cfun, s));
+ !gsi_end_p (gsi);
gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree lhs = gimple_phi_result (phi);
tree val = gimple_phi_arg_def (phi, n);
@@ -842,9 +843,8 @@ same_succ_flush_bbs (bitmap bbs)
static void
release_last_vdef (basic_block bb)
{
- gimple_stmt_iterator i;
-
- for (i = gsi_last_bb (bb); !gsi_end_p (i); gsi_prev_nondebug (&i))
+ for (gimple_stmt_iterator i = gsi_last_bb (bb); !gsi_end_p (i);
+ gsi_prev_nondebug (&i))
{
gimple stmt = gsi_stmt (i);
if (gimple_vdef (stmt) == NULL_TREE)
@@ -854,9 +854,10 @@ release_last_vdef (basic_block bb)
return;
}
- for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i))
+ for (gimple_phi_iterator i = gsi_start_phis (bb); !gsi_end_p (i);
+ gsi_next (&i))
{
- gimple phi = gsi_stmt (i);
+ gimple_phi phi = i.phi ();
tree res = gimple_phi_result (phi);
if (!virtual_operand_p (res))
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index bbf042c..8713f89 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -399,7 +399,7 @@ insert_debug_temp_for_var_def (gimple_stmt_iterator *gsi, tree var)
we'll have to drop debug information. */
if (gimple_code (def_stmt) == GIMPLE_PHI)
{
- value = degenerate_phi_result (def_stmt);
+ value = degenerate_phi_result (def_stmt->as_a_gimple_phi ());
if (value && walk_tree (&value, find_released_ssa_name, NULL, NULL))
value = NULL;
/* error_mark_node is what fixup_noreturn_call changes PHI arguments
@@ -871,7 +871,7 @@ verify_use (basic_block bb, basic_block def_bb, use_operand_p use_p,
definition of SSA_NAME. */
static bool
-verify_phi_args (gimple phi, basic_block bb, basic_block *definition_block)
+verify_phi_args (gimple_phi phi, basic_block bb, basic_block *definition_block)
{
edge e;
bool err = false;
@@ -1002,9 +1002,7 @@ verify_ssa (bool check_modified_stmt)
FOR_EACH_BB_FN (bb, cfun)
{
edge e;
- gimple phi;
edge_iterator ei;
- gimple_stmt_iterator gsi;
/* Make sure that all edges have a clear 'aux' field. */
FOR_EACH_EDGE (e, ei, bb->preds)
@@ -1018,9 +1016,9 @@ verify_ssa (bool check_modified_stmt)
}
/* Verify the arguments for every PHI node in the block. */
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
if (verify_phi_args (phi, bb, definition_block))
goto err;
@@ -1029,7 +1027,8 @@ verify_ssa (bool check_modified_stmt)
}
/* Now verify all the uses and vuses in every statement of the block. */
- 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))
{
gimple stmt = gsi_stmt (gsi);
use_operand_p use_p;
@@ -1444,7 +1443,6 @@ maybe_optimize_var (tree var, bitmap addresses_taken, bitmap not_reg_needs,
void
execute_update_addresses_taken (void)
{
- gimple_stmt_iterator gsi;
basic_block bb;
bitmap addresses_taken = BITMAP_ALLOC (NULL);
bitmap not_reg_needs = BITMAP_ALLOC (NULL);
@@ -1458,7 +1456,8 @@ execute_update_addresses_taken (void)
the function body. */
FOR_EACH_BB_FN (bb, cfun)
{
- 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))
{
gimple stmt = gsi_stmt (gsi);
enum gimple_code code = gimple_code (stmt);
@@ -1528,10 +1527,11 @@ execute_update_addresses_taken (void)
}
}
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
size_t i;
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
for (i = 0; i < gimple_phi_num_args (phi); i++)
{
@@ -1560,7 +1560,7 @@ execute_update_addresses_taken (void)
if (!bitmap_empty_p (suitable_for_renaming))
{
FOR_EACH_BB_FN (bb, cfun)
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
{
gimple stmt = gsi_stmt (gsi);
diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c
index feb6ece..f1e097c 100644
--- a/gcc/tree-stdarg.c
+++ b/gcc/tree-stdarg.c
@@ -538,14 +538,13 @@ check_all_va_list_escapes (struct stdarg_info *si)
FOR_EACH_BB_FN (bb, cfun)
{
- gimple_stmt_iterator i;
-
- for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i))
+ for (gimple_phi_iterator i = gsi_start_phis (bb); !gsi_end_p (i);
+ gsi_next (&i))
{
tree lhs;
use_operand_p uop;
ssa_op_iter soi;
- gimple phi = gsi_stmt (i);
+ gimple_phi phi = i.phi ();
lhs = PHI_RESULT (phi);
if (virtual_operand_p (lhs)
@@ -571,7 +570,8 @@ check_all_va_list_escapes (struct stdarg_info *si)
}
}
- for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
+ for (gimple_stmt_iterator i = gsi_start_bb (bb); !gsi_end_p (i);
+ gsi_next (&i))
{
gimple stmt = gsi_stmt (i);
tree use;
@@ -815,8 +815,6 @@ execute_optimize_stdarg (void)
FOR_EACH_BB_FN (bb, cfun)
{
- gimple_stmt_iterator i;
-
si.compute_sizes = -1;
si.bb = bb;
@@ -830,9 +828,10 @@ execute_optimize_stdarg (void)
use_operand_p uop;
ssa_op_iter soi;
- for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i))
+ for (gimple_phi_iterator i = gsi_start_phis (bb); !gsi_end_p (i);
+ gsi_next (&i))
{
- gimple phi = gsi_stmt (i);
+ gimple_phi phi = i.phi ();
lhs = PHI_RESULT (phi);
if (virtual_operand_p (lhs))
@@ -862,7 +861,7 @@ execute_optimize_stdarg (void)
}
}
- for (i = gsi_start_bb (bb);
+ for (gimple_stmt_iterator i = gsi_start_bb (bb);
!gsi_end_p (i) && !va_list_escapes;
gsi_next (&i))
{
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index e84d0b5..f7b2dcb 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -1026,7 +1026,7 @@ array_value_type (gimple_switch swtch, tree type, int num,
static void
build_one_array (gimple_switch swtch, int num, tree arr_index_type,
- gimple phi, tree tidx, struct switch_conv_info *info)
+ gimple_phi phi, tree tidx, struct switch_conv_info *info)
{
tree name, cst;
gimple load;
@@ -1097,6 +1097,7 @@ build_arrays (gimple_switch swtch, struct switch_conv_info *info)
tree tidx, sub, utype;
gimple stmt;
gimple_stmt_iterator gsi;
+ gimple_phi_iterator gpi;
int i;
location_t loc = gimple_location (swtch);
@@ -1122,9 +1123,9 @@ build_arrays (gimple_switch swtch, struct switch_conv_info *info)
update_stmt (stmt);
info->arr_ref_first = stmt;
- for (gsi = gsi_start_phis (info->final_bb), i = 0;
- !gsi_end_p (gsi); gsi_next (&gsi), i++)
- build_one_array (swtch, i, arr_index_type, gsi_stmt (gsi), tidx, info);
+ for (gpi = gsi_start_phis (info->final_bb), i = 0;
+ !gsi_end_p (gpi); gsi_next (&gpi), i++)
+ build_one_array (swtch, i, arr_index_type, gpi.phi (), tidx, info);
}
/* Generates and appropriately inserts loads of default values at the position
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index 686bc57..cd54377 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -85,7 +85,6 @@ rename_use_op (use_operand_p op_p)
static void
rename_variables_in_bb (basic_block bb)
{
- gimple_stmt_iterator gsi;
gimple stmt;
use_operand_p use_p;
ssa_op_iter iter;
@@ -93,7 +92,8 @@ rename_variables_in_bb (basic_block bb)
edge_iterator ei;
struct loop *loop = bb->loop_father;
- 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))
{
stmt = gsi_stmt (gsi);
FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_ALL_USES)
@@ -104,8 +104,9 @@ rename_variables_in_bb (basic_block bb)
{
if (!flow_bb_inside_loop_p (loop, e->src))
continue;
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- rename_use_op (PHI_ARG_DEF_PTR_FROM_EDGE (gsi_stmt (gsi), e));
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
+ rename_use_op (PHI_ARG_DEF_PTR_FROM_EDGE (gsi.phi (), e));
}
}
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 27627e4..3823c12 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -187,10 +187,9 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
int nbbs = loop->num_nodes;
- gimple_stmt_iterator si;
unsigned int vectorization_factor = 0;
tree scalar_type;
- gimple phi;
+ gimple_phi phi;
tree vectype;
unsigned int nunits;
stmt_vec_info stmt_info;
@@ -209,9 +208,10 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
{
basic_block bb = bbs[i];
- for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
+ for (gimple_phi_iterator si = gsi_start_phis (bb); !gsi_end_p (si);
+ gsi_next (&si))
{
- phi = gsi_stmt (si);
+ phi = si.phi ();
stmt_info = vinfo_for_stmt (phi);
if (dump_enabled_p ())
{
@@ -269,7 +269,8 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
}
}
- for (si = gsi_start_bb (bb); !gsi_end_p (si) || analyze_pattern_stmt;)
+ for (gimple_stmt_iterator si = gsi_start_bb (bb);
+ !gsi_end_p (si) || analyze_pattern_stmt;)
{
tree vf_vectype;
@@ -1333,10 +1334,8 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
int nbbs = loop->num_nodes;
- gimple_stmt_iterator si;
unsigned int vectorization_factor = 0;
int i;
- gimple phi;
stmt_vec_info stmt_info;
bool need_to_vectorize = false;
int min_profitable_iters;
@@ -1363,7 +1362,8 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
for (i = 0; i < nbbs; i++)
{
basic_block bb = bbs[i];
- 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 = gsi_stmt (si);
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
@@ -1393,9 +1393,10 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
{
basic_block bb = bbs[i];
- for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
+ for (gimple_phi_iterator si = gsi_start_phis (bb); !gsi_end_p (si);
+ gsi_next (&si))
{
- phi = gsi_stmt (si);
+ gimple_phi phi = si.phi ();
ok = true;
stmt_info = vinfo_for_stmt (phi);
@@ -1498,7 +1499,8 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
}
}
- 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 = gsi_stmt (si);
if (!gimple_clobber_p (stmt)
@@ -5751,7 +5753,6 @@ vect_transform_loop (loop_vec_info loop_vinfo)
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
int nbbs = loop->num_nodes;
- gimple_stmt_iterator si;
int i;
tree ratio = NULL;
int vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
@@ -5862,11 +5863,11 @@ vect_transform_loop (loop_vec_info loop_vinfo)
{
basic_block bb = bbs[i];
stmt_vec_info stmt_info;
- gimple phi;
- for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
+ for (gimple_phi_iterator si = gsi_start_phis (bb); !gsi_end_p (si);
+ gsi_next (&si))
{
- phi = gsi_stmt (si);
+ gimple_phi phi = si.phi ();
if (dump_enabled_p ())
{
dump_printf_loc (MSG_NOTE, vect_location,
@@ -5900,7 +5901,8 @@ vect_transform_loop (loop_vec_info loop_vinfo)
}
pattern_stmt = NULL;
- for (si = gsi_start_bb (bb); !gsi_end_p (si) || transform_pattern_stmt;)
+ for (gimple_stmt_iterator si = gsi_start_bb (bb);
+ !gsi_end_p (si) || transform_pattern_stmt;)
{
bool is_store;
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 5b701a6..5345b9b 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -5813,7 +5813,6 @@ find_switch_asserts (basic_block bb, gimple_switch last)
static bool
find_assert_locations_1 (basic_block bb, sbitmap live)
{
- gimple_stmt_iterator si;
gimple last;
bool need_assert;
@@ -5837,7 +5836,8 @@ find_assert_locations_1 (basic_block bb, sbitmap live)
/* Traverse all the statements in BB marking used names and looking
for statements that may infer assertions for their used operands. */
- for (si = gsi_last_bb (bb); !gsi_end_p (si); gsi_prev (&si))
+ for (gimple_stmt_iterator si = gsi_last_bb (bb); !gsi_end_p (si);
+ gsi_prev (&si))
{
gimple stmt;
tree op;
@@ -5910,11 +5910,12 @@ find_assert_locations_1 (basic_block bb, sbitmap live)
}
/* Traverse all PHI nodes in BB, updating live. */
- for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
+ for (gimple_phi_iterator si = gsi_start_phis (bb); !gsi_end_p (si);
+ gsi_next (&si))
{
use_operand_p arg_p;
ssa_op_iter i;
- gimple phi = gsi_stmt (si);
+ gimple_phi phi = si.phi ();
tree res = gimple_phi_result (phi);
if (virtual_operand_p (res))
@@ -6716,11 +6717,10 @@ vrp_initialize (void)
FOR_EACH_BB_FN (bb, cfun)
{
- gimple_stmt_iterator si;
-
- for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
+ for (gimple_phi_iterator si = gsi_start_phis (bb); !gsi_end_p (si);
+ gsi_next (&si))
{
- gimple phi = gsi_stmt (si);
+ gimple_phi phi = si.phi ();
if (!stmt_interesting_for_vrp (phi))
{
tree lhs = PHI_RESULT (phi);
@@ -6731,7 +6731,8 @@ vrp_initialize (void)
prop_set_simulate_again (phi, true);
}
- 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 = gsi_stmt (si);
--
1.8.5.3