From: Steven Bosscher Date: Wed, 16 Jun 2004 23:03:34 +0000 (+0000) Subject: tree.h (PHI_CHAIN): New. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=17192884645f6c9e6135af2e691418734bdb6aac;p=gcc.git tree.h (PHI_CHAIN): New. * tree.h (PHI_CHAIN): New. * (tree-cfg.c, tree-dfa.c, tree-flow-inline.h, tree-into-ssa.c, tree-outof-ssa.c, tree-phinodes.c, tree-pretty-print.c, tree-ssa-alias.c, tree-ssa-ccp.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-live.c, tree-ssa-loop.c, tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa.c, tree-tailcall.c): Use PHI_CHAIN instead of TREE_CHAIN when traversing a list of PHI_NODEs. From-SVN: r83273 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e013ceb39bf..7745ee927eb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2004-06-16 Steven Bosscher + + * tree.h (PHI_CHAIN): New. + * (tree-cfg.c, tree-dfa.c, tree-flow-inline.h, tree-into-ssa.c, + tree-outof-ssa.c, tree-phinodes.c, tree-pretty-print.c, + tree-ssa-alias.c, tree-ssa-ccp.c, tree-ssa-dom.c, tree-ssa-dse.c, + tree-ssa-live.c, tree-ssa-loop.c, tree-ssa-phiopt.c, tree-ssa-pre.c, + tree-ssa.c, tree-tailcall.c): Use PHI_CHAIN instead of TREE_CHAIN + when traversing a list of PHI_NODEs. + 2004-06-16 Bernardo Innocenti PR target/13292 @@ -72,8 +82,8 @@ 2004-06-16 Dale Johannesen - * loop.c (loop_givs_reduce): Avoid miscompilation of - loops entered at bottom. + * loop.c (loop_givs_reduce): Avoid miscompilation of + loops entered at bottom. 2004-06-16 J"orn Rennecke @@ -559,7 +569,7 @@ automake 1.8.5. 2004-06-15 Eric Botcazou - Olivier Hainque + Olivier Hainque * function.c (fixup_var_refs): Also adjust the start of sequence after fixing up the insns. diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index efe41ffcb2d..0624ade3db3 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -1768,7 +1768,7 @@ remove_phi_nodes_and_edges_for_unreachable_block (basic_block bb) phi = phi_nodes (bb); while (phi) { - tree next = TREE_CHAIN (phi); + tree next = PHI_CHAIN (phi); remove_phi_node (phi, NULL_TREE, bb); phi = next; } @@ -2113,7 +2113,7 @@ phi_alternatives_equal (basic_block dest, edge e1, edge e2) tree phi, val1, val2; int n1, n2; - for (phi = phi_nodes (dest); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (dest); phi; phi = PHI_CHAIN (phi)) { n1 = phi_arg_from_edge (phi, e1); n2 = phi_arg_from_edge (phi, e2); @@ -3100,7 +3100,7 @@ tree_split_edge (edge edge_in) /* Find all the PHI arguments on the original edge, and change them to the new edge. Do it before redirection, so that the argument does not get removed. */ - for (phi = phi_nodes (dest); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (dest); phi; phi = PHI_CHAIN (phi)) { num_elem = PHI_NUM_ARGS (phi); for (i = 0; i < num_elem; i++) @@ -3386,7 +3386,7 @@ verify_stmts (void) tree phi; int i; - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) { int phi_num_args = PHI_NUM_ARGS (phi); @@ -3733,7 +3733,7 @@ tree_make_forwarder_block (edge fallthru) { edge e; basic_block dummy, bb; - tree phi, new_phi, var; + tree phi, new_phi, var, prev, next; dummy = fallthru->src; bb = fallthru->dest; @@ -3743,7 +3743,7 @@ tree_make_forwarder_block (edge fallthru) /* If we redirected a branch we must create new phi nodes at the start of BB. */ - for (phi = phi_nodes (dummy); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (dummy); phi; phi = PHI_CHAIN (phi)) { var = PHI_RESULT (phi); new_phi = create_phi_node (var, bb); @@ -3752,8 +3752,15 @@ tree_make_forwarder_block (edge fallthru) add_phi_arg (&new_phi, PHI_RESULT (phi), fallthru); } - /* Ensure that the PHI node chains are in the same order. */ - set_phi_nodes (bb, nreverse (phi_nodes (bb))); + /* Ensure that the PHI node chain is in the same order. */ + prev = NULL; + for (phi = phi_nodes (bb); phi; phi = next) + { + next = PHI_CHAIN (phi); + PHI_CHAIN (phi) = prev; + prev = phi; + } + set_phi_nodes (bb, prev); /* Add the arguments we have stored on edges. */ for (e = bb->pred; e; e = e->pred_next) @@ -3763,7 +3770,7 @@ tree_make_forwarder_block (edge fallthru) for (phi = phi_nodes (bb), var = PENDING_STMT (e); phi; - phi = TREE_CHAIN (phi), var = TREE_CHAIN (var)) + phi = PHI_CHAIN (phi), var = TREE_CHAIN (var)) add_phi_arg (&phi, TREE_VALUE (var), e); PENDING_STMT (e) = NULL; @@ -3944,7 +3951,7 @@ thread_jumps (void) /* Update PHI nodes. We know that the new argument should have the same value as the argument associated with LAST. Otherwise we would have changed our target block above. */ - for (phi = phi_nodes (dest); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (dest); phi; phi = PHI_CHAIN (phi)) { arg = phi_arg_from_edge (phi, last); if (arg < 0) diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index a2b8a698af2..ca8004387ee 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -181,7 +181,7 @@ compute_immediate_uses (int flags, bool (*calc_for)(tree)) { tree phi; - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) compute_immediate_uses_for_phi (phi, calc_for); for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si)) @@ -227,7 +227,7 @@ free_df (void) { tree phi; - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) free_df_for_stmt (phi); for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si)) @@ -636,7 +636,7 @@ dump_immediate_uses (FILE *file) { tree phi; - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) dump_immediate_uses_for (file, phi); for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si)) @@ -818,7 +818,7 @@ collect_dfa_stats (struct dfa_stats_d *dfa_stats_p) FOR_EACH_BB (bb) { tree phi; - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) { dfa_stats_p->num_phis++; dfa_stats_p->num_phi_args += PHI_NUM_ARGS (phi); diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h index 17eb6db7365..4fe44ef112e 100644 --- a/gcc/tree-flow-inline.h +++ b/gcc/tree-flow-inline.h @@ -427,7 +427,7 @@ set_phi_nodes (basic_block bb, tree l) tree phi; bb_ann (bb)->phi_nodes = l; - for (phi = l; phi; phi = TREE_CHAIN (phi)) + for (phi = l; phi; phi = PHI_CHAIN (phi)) set_bb_for_stmt (phi, bb); } diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index e07258a2894..0f926860427 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -514,7 +514,7 @@ rewrite_initialize_block (struct dom_walk_data *walk_data, 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 (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) { tree result = PHI_RESULT (phi); @@ -538,7 +538,7 @@ rewrite_add_phi_arguments (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED, { tree phi; - for (phi = phi_nodes (e->dest); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (e->dest); phi; phi = PHI_CHAIN (phi)) { tree currdef; diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c index 3d0ec5267c1..ec52f6939fb 100644 --- a/gcc/tree-outof-ssa.c +++ b/gcc/tree-outof-ssa.c @@ -343,7 +343,7 @@ eliminate_build (elim_graph g, basic_block B, int i) clear_elim_graph (g); - for (phi = phi_nodes (B); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (B); phi; phi = PHI_CHAIN (phi)) { T0 = var_to_partition_to_var (g->map, PHI_RESULT (phi)); @@ -588,7 +588,7 @@ coalesce_abnormal_edges (var_map map, conflict_graph graph, root_var_p rv) FOR_EACH_BB (bb) for (e = bb->succ; e; e = e->succ_next) if (e->dest != EXIT_BLOCK_PTR && e->flags & EDGE_ABNORMAL) - for (phi = phi_nodes (e->dest); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (e->dest); phi; phi = PHI_CHAIN (phi)) { /* Visit each PHI on the destination side of this abnormal edge, and attempt to coalesce the argument with the result. */ @@ -698,7 +698,7 @@ coalesce_ssa_name (var_map map, int flags) /* Add all potential copies via PHI arguments to the list. */ FOR_EACH_BB (bb) { - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) { tree res = PHI_RESULT (phi); int p = var_to_partition (map, res); @@ -970,7 +970,7 @@ eliminate_virtual_phis (void) { for (phi = phi_nodes (bb); phi; phi = next) { - next = TREE_CHAIN (phi); + next = PHI_CHAIN (phi); if (!is_gimple_reg (SSA_NAME_VAR (PHI_RESULT (phi)))) { #ifdef ENABLE_CHECKING @@ -1031,7 +1031,7 @@ coalesce_vars (var_map map, tree_live_info_p liveinfo) { tree phi, arg; int p; - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) { p = var_to_partition (map, PHI_RESULT (phi)); @@ -1794,7 +1794,7 @@ rewrite_trees (var_map map, tree *values) { tree phi; - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) { tree T0 = var_to_partition_to_var (map, PHI_RESULT (phi)); @@ -1987,7 +1987,7 @@ remove_ssa_form (FILE *dump, var_map map, int flags) { for (phi = phi_nodes (bb); phi; phi = next) { - next = TREE_CHAIN (phi); + next = PHI_CHAIN (phi); if ((flags & SSANORM_REMOVE_ALL_PHIS) || var_to_partition (map, PHI_RESULT (phi)) != NO_PARTITION) remove_phi_node (phi, NULL_TREE, bb); @@ -2029,7 +2029,7 @@ rewrite_vars_out_of_ssa (bitmap vars) to manually take variables out of SSA form here. */ FOR_EACH_BB (bb) { - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) { tree result = SSA_NAME_VAR (PHI_RESULT (phi)); diff --git a/gcc/tree-phinodes.c b/gcc/tree-phinodes.c index 4e2d0c1fb34..1b98fcd05bc 100644 --- a/gcc/tree-phinodes.c +++ b/gcc/tree-phinodes.c @@ -183,7 +183,7 @@ make_phi_node (tree var, int len) { free_phinode_count--; phi = free_phinodes[bucket]; - free_phinodes[bucket] = TREE_CHAIN (free_phinodes[bucket]); + free_phinodes[bucket] = PHI_CHAIN (free_phinodes[bucket]); #ifdef GATHER_STATISTICS phi_nodes_reused++; #endif @@ -220,7 +220,7 @@ release_phi_node (tree phi) bucket = len > NUM_BUCKETS - 1 ? NUM_BUCKETS - 1 : len; bucket -= 2; - TREE_CHAIN (phi) = free_phinodes[bucket]; + PHI_CHAIN (phi) = free_phinodes[bucket]; free_phinodes[bucket] = phi; free_phinode_count++; } @@ -256,7 +256,7 @@ resize_phi_node (tree *phi, int len) { free_phinode_count--; new_phi = free_phinodes[bucket]; - free_phinodes[bucket] = TREE_CHAIN (free_phinodes[bucket]); + free_phinodes[bucket] = PHI_CHAIN (free_phinodes[bucket]); #ifdef GATHER_STATISTICS phi_nodes_reused++; #endif @@ -300,7 +300,7 @@ create_phi_node (tree var, basic_block bb) PHI_REWRITTEN (phi) = 0; /* Add the new PHI node to the list of PHI nodes for block BB. */ - TREE_CHAIN (phi) = phi_nodes (bb); + PHI_CHAIN (phi) = phi_nodes (bb); bb_ann (bb)->phi_nodes = phi; /* Associate BB to the PHI node. */ @@ -345,14 +345,14 @@ add_phi_arg (tree *phi, tree def, edge e) tree p; for (p = phi_nodes (e->dest); - p && TREE_CHAIN (p) != old_phi; - p = TREE_CHAIN (p)) + p && PHI_CHAIN (p) != old_phi; + p = PHI_CHAIN (p)) ; if (!p) abort (); - TREE_CHAIN (p) = *phi; + PHI_CHAIN (p) = *phi; } } } @@ -434,7 +434,7 @@ remove_phi_node (tree phi, tree prev, basic_block bb) if (prev) { /* Rewire the list if we are given a PREV pointer. */ - TREE_CHAIN (prev) = TREE_CHAIN (phi); + PHI_CHAIN (prev) = PHI_CHAIN (phi); /* If we are deleting the PHI node, then we should release the SSA_NAME node so that it can be reused. */ @@ -444,7 +444,7 @@ remove_phi_node (tree phi, tree prev, basic_block bb) else if (phi == phi_nodes (bb)) { /* Update the list head if removing the first element. */ - bb_ann (bb)->phi_nodes = TREE_CHAIN (phi); + bb_ann (bb)->phi_nodes = PHI_CHAIN (phi); /* If we are deleting the PHI node, then we should release the SSA_NAME node so that it can be reused. */ @@ -456,7 +456,7 @@ remove_phi_node (tree phi, tree prev, basic_block bb) /* Traverse the list looking for the node to remove. */ tree prev, t; prev = NULL_TREE; - for (t = phi_nodes (bb); t && t != phi; t = TREE_CHAIN (t)) + for (t = phi_nodes (bb); t && t != phi; t = PHI_CHAIN (t)) prev = t; if (t) remove_phi_node (t, prev, bb); @@ -481,7 +481,7 @@ remove_all_phi_nodes_for (bitmap vars) { tree var = SSA_NAME_VAR (PHI_RESULT (phi)); - next = TREE_CHAIN (phi); + next = PHI_CHAIN (phi); /* Only add PHI nodes for variables not in VARS. */ if (!bitmap_bit_p (vars, var_ann (var)->uid)) { @@ -494,7 +494,7 @@ remove_all_phi_nodes_for (bitmap vars) new_phi_list = last_phi = phi; else { - TREE_CHAIN (last_phi) = phi; + PHI_CHAIN (last_phi) = phi; last_phi = phi; } } @@ -509,11 +509,11 @@ remove_all_phi_nodes_for (bitmap vars) /* Make sure the last node in the new list has no successors. */ if (last_phi) - TREE_CHAIN (last_phi) = NULL_TREE; + PHI_CHAIN (last_phi) = NULL_TREE; bb_ann (bb)->phi_nodes = new_phi_list; #if defined ENABLE_CHECKING - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) { tree var = SSA_NAME_VAR (PHI_RESULT (phi)); if (bitmap_bit_p (vars, var_ann (var)->uid)) diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index c38131d39d5..4b8d2d40080 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -2123,7 +2123,7 @@ dump_phi_nodes (pretty_printer *buffer, basic_block bb, int indent, int flags) if (!phi) return; - for (; phi; phi = TREE_CHAIN (phi)) + for (; phi; phi = PHI_CHAIN (phi)) { if (is_gimple_reg (PHI_RESULT (phi)) || (flags & TDF_VOPS)) { diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index e980aa2d3a7..75c98e12d3d 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -2094,7 +2094,7 @@ dump_points_to_info (FILE *file) { tree phi; - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) { tree ptr = PHI_RESULT (phi); if (POINTER_TYPE_P (TREE_TYPE (ptr))) diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 98c04970d85..405591fd4aa 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -289,7 +289,7 @@ simulate_block (basic_block block) /* Always simulate PHI nodes, even if we have simulated this block before. */ - for (phi = phi_nodes (block); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (block); phi; phi = PHI_CHAIN (phi)) visit_phi_node (phi); /* If this is the first time we've simulated this block, then we @@ -382,7 +382,7 @@ substitute_and_fold (void) tree phi; /* Propagate our known constants into PHI nodes. */ - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) { int i; @@ -1184,7 +1184,7 @@ initialize (void) { tree phi, var; int x; - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) { value *val; val = get_value (PHI_RESULT (phi)); diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c index 79015163fc4..71574d4df00 100644 --- a/gcc/tree-ssa-copy.c +++ b/gcc/tree-ssa-copy.c @@ -313,7 +313,7 @@ cprop_into_successor_phis (basic_block bb, the entries. */ phi_num_args = PHI_NUM_ARGS (phi); hint = phi_num_args; - for ( ; phi; phi = TREE_CHAIN (phi)) + for ( ; phi; phi = PHI_CHAIN (phi)) { int i; tree new; diff --git a/gcc/tree-ssa-copyrename.c b/gcc/tree-ssa-copyrename.c index f74b2e402e5..a355b2d5b7d 100644 --- a/gcc/tree-ssa-copyrename.c +++ b/gcc/tree-ssa-copyrename.c @@ -320,7 +320,7 @@ rename_ssa_copies (void) FOR_EACH_BB (bb) { /* Treat PHI nodes as copies between the result and each argument. */ - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) { int i; tree res = PHI_RESULT (phi); diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c index 36007a43c84..344f2249ada 100644 --- a/gcc/tree-ssa-dce.c +++ b/gcc/tree-ssa-dce.c @@ -432,7 +432,7 @@ find_obviously_necessary_stmts (struct edge_list *el) tree phi; /* Check any PHI nodes in the block. */ - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) { NECESSARY (phi) = 0; @@ -664,7 +664,7 @@ remove_dead_phis (basic_block bb) if (! NECESSARY (phi)) { - tree next = TREE_CHAIN (phi); + tree next = PHI_CHAIN (phi); if (dump_file && (dump_flags & TDF_DETAILS)) { @@ -680,7 +680,7 @@ remove_dead_phis (basic_block bb) else { prev = phi; - phi = TREE_CHAIN (phi); + phi = PHI_CHAIN (phi); } } } diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index 3a0c1aab6a0..636af8e5834 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -331,7 +331,7 @@ redirect_edges_and_update_ssa_graph (varray_type redirection_edges) /* All variables referenced in PHI nodes we bypass must be renamed. */ - for (phi = phi_nodes (e->dest); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (e->dest); phi; phi = PHI_CHAIN (phi)) { tree result = SSA_NAME_VAR (PHI_RESULT (phi)); @@ -381,7 +381,7 @@ redirect_edges_and_update_ssa_graph (varray_type redirection_edges) /* Finally, any variables in PHI nodes at our final destination must also be taken our of SSA form. */ - for (phi = phi_nodes (tgt); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (tgt); phi; phi = PHI_CHAIN (phi)) { tree result = SSA_NAME_VAR (PHI_RESULT (phi)); @@ -515,7 +515,7 @@ redirect_edges_and_update_ssa_graph (varray_type redirection_edges) { tree result = PHI_RESULT (phi); - next = TREE_CHAIN (phi); + next = PHI_CHAIN (phi); if (bitmap_bit_p (virtuals_to_rename, var_ann (SSA_NAME_VAR (result))->uid)) @@ -698,7 +698,7 @@ thread_across_edge (struct dom_walk_data *walk_data, edge e) tree phi; /* Each PHI creates a temporary equivalence, record them. */ - for (phi = phi_nodes (e->dest); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (e->dest); phi; phi = PHI_CHAIN (phi)) { tree src = PHI_ARG_DEF (phi, phi_arg_from_edge (phi, e)); tree dst = PHI_RESULT (phi); @@ -1334,7 +1334,7 @@ record_equivalences_from_phis (struct dom_walk_data *walk_data, basic_block bb) = VARRAY_TOP_GENERIC_PTR (walk_data->block_data_stack); tree phi; - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) { tree lhs = PHI_RESULT (phi); tree rhs = NULL; diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c index 88ca1363c87..e5ba66f56aa 100644 --- a/gcc/tree-ssa-dse.c +++ b/gcc/tree-ssa-dse.c @@ -333,7 +333,7 @@ dse_record_phis (struct dom_walk_data *walk_data, basic_block bb) struct dse_global_data *dse_gd = walk_data->global_data; tree phi; - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) if (need_imm_uses_for (PHI_RESULT (phi))) record_voperand_set (dse_gd->stores, &bd->stores, @@ -373,7 +373,7 @@ tree_ssa_dse (void) for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi)) stmt_ann (bsi_stmt (bsi))->uid = uid++; - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) stmt_ann (phi)->uid = uid++; } diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c index 549211d2979..2f9288b7114 100644 --- a/gcc/tree-ssa-live.c +++ b/gcc/tree-ssa-live.c @@ -329,7 +329,7 @@ create_ssa_var_map (int flags) FOR_EACH_BB (bb) { tree phi, arg; - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) { int i; register_ssa_partition (map, PHI_RESULT (phi), false); @@ -578,7 +578,7 @@ calculate_live_on_entry (var_map map) { bitmap_clear (saw_def); - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) { for (i = 0; i < PHI_NUM_ARGS (phi); i++) { @@ -603,7 +603,7 @@ calculate_live_on_entry (var_map map) The a_3 referred to in b_3's PHI node is the one incoming on the edge, *not* the PHI node just seen. */ - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) { var = PHI_RESULT (phi); set_if_valid (map, saw_def, var); @@ -701,7 +701,7 @@ calculate_live_on_entry (var_map map) int z, ok = 0; for (phi = phi_nodes (e->dest); phi && !ok; - phi = TREE_CHAIN (phi)) + phi = PHI_CHAIN (phi)) { for (z = 0; z < PHI_NUM_ARGS (phi); z++) if (var == PHI_ARG_DEF (phi, z)) @@ -751,7 +751,7 @@ calculate_live_on_exit (tree_live_info_p liveinfo) /* Set all the live-on-exit bits for uses in PHIs. */ FOR_EACH_BB (bb) { - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) for (i = 0; i < PHI_NUM_ARGS (phi); i++) { t = PHI_ARG_DEF (phi, i); @@ -1418,7 +1418,7 @@ build_tree_conflict_graph (tree_live_info_p liveinfo, tpa_p tpa, going to be translated out of SSA form we must record a conflict between the result of the PHI and any variables with are live. Otherwise the out-of-ssa translation may create incorrect code. */ - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) { tree result = PHI_RESULT (phi); int p = var_to_partition (map, result); @@ -1837,7 +1837,7 @@ register_ssa_partitions_for_vars (bitmap vars, var_map map) { tree result = SSA_NAME_VAR (PHI_RESULT (phi)); - next = TREE_CHAIN (phi); + next = PHI_CHAIN (phi); if (bitmap_bit_p (vars, var_ann (result)->uid)) { if (! is_gimple_reg (result)) diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c index bbcba9c98db..89692a27705 100644 --- a/gcc/tree-ssa-loop.c +++ b/gcc/tree-ssa-loop.c @@ -109,7 +109,7 @@ mark_defs_for_rewrite (basic_block bb) v_must_def_optype v_must_defs; unsigned i; - for (stmt = phi_nodes (bb); stmt; stmt = TREE_CHAIN (stmt)) + for (stmt = phi_nodes (bb); stmt; stmt = PHI_CHAIN (stmt)) { var = SSA_NAME_VAR (PHI_RESULT (stmt)); bitmap_set_bit (vars_to_rename, var_ann (var)->uid); @@ -223,7 +223,7 @@ duplicate_blocks (varray_type bbs_to_duplicate) for (e1 = new_header->succ; e1->dest != e->dest; e1 = e1->succ_next) continue; - for (phi = phi_nodes (e->dest); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (e->dest); phi; phi = PHI_CHAIN (phi)) { tree def = phi_element_for_edge (phi, e)->def; add_phi_arg (&phi, def, e1); diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index fa342700d65..bc14dc48d80 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -121,7 +121,7 @@ tree_ssa_phiopt (void) /* We're searching for blocks with one PHI node which has two arguments. */ phi = phi_nodes (bb); - if (phi && TREE_CHAIN (phi) == NULL + if (phi && PHI_CHAIN (phi) == NULL && PHI_NUM_ARGS (phi) == 2) { arg0 = PHI_ARG_DEF (phi, 0); diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index c2853296cf5..3d4371e413f 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -1606,7 +1606,7 @@ compute_avail (basic_block block) dom = get_immediate_dominator (CDI_DOMINATORS, block); if (dom) set_copy (AVAIL_OUT (block), AVAIL_OUT (dom)); - for (phi = phi_nodes (block); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (block); phi; phi = PHI_CHAIN (phi)) { /* Ignore virtual PHIs until we can do PRE on expressions with virtual operands. */ diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 9cec5d5087f..175ce4878a7 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -58,7 +58,7 @@ ssa_remove_edge (edge e) /* Remove the appropriate PHI arguments in E's destination block. */ for (phi = phi_nodes (e->dest); phi; phi = next) { - next = TREE_CHAIN (phi); + next = PHI_CHAIN (phi); remove_phi_arg (phi, e->src); } @@ -80,7 +80,7 @@ ssa_redirect_edge (edge e, basic_block dest) /* Remove the appropriate PHI arguments in E's destination block. */ for (phi = phi_nodes (e->dest); phi; phi = next) { - next = TREE_CHAIN (phi); + next = PHI_CHAIN (phi); i = phi_arg_from_edge (phi, e); if (i < 0) @@ -305,7 +305,7 @@ verify_ssa (void) tree phi; block_stmt_iterator bsi; - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) err |= verify_def (bb, definition_block, PHI_RESULT (phi), phi); for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi)) @@ -389,7 +389,7 @@ verify_ssa (void) } /* Verify the arguments for every PHI node in the block. */ - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) err |= verify_phi_args (phi, bb, definition_block); /* Now verify all the uses and vuses in every statement of the block. @@ -881,7 +881,7 @@ kill_redundant_phi_nodes (void) FOR_EACH_BB (bb) { - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) { var = PHI_RESULT (phi); @@ -1077,7 +1077,7 @@ execute_late_warn_uninitialized (void) execute_early_warn_uninitialized (); FOR_EACH_BB (bb) - for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) warn_uninitialized_phi (phi); } diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c index 92626860f23..379594e9321 100644 --- a/gcc/tree-tailcall.c +++ b/gcc/tree-tailcall.c @@ -339,7 +339,7 @@ propagate_through_phis (tree var, edge e) basic_block dest = e->dest; tree phi; - for (phi = phi_nodes (dest); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (dest); phi; phi = PHI_CHAIN (phi)) if (phi_element_for_edge (phi, e)->def == var) return PHI_RESULT (phi); @@ -558,7 +558,7 @@ adjust_accumulator_values (block_stmt_iterator bsi, tree m, tree a, edge back) if (a_acc) { - for (phi = phi_nodes (back->dest); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (back->dest); phi; phi = PHI_CHAIN (phi)) if (PHI_RESULT (phi) == a_acc) break; @@ -567,7 +567,7 @@ adjust_accumulator_values (block_stmt_iterator bsi, tree m, tree a, edge back) if (m_acc) { - for (phi = phi_nodes (back->dest); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (back->dest); phi; phi = PHI_CHAIN (phi)) if (PHI_RESULT (phi) == m_acc) break; @@ -684,7 +684,7 @@ eliminate_tail_call (struct tailcall *t) args = TREE_CHAIN (args)) { - for (phi = phi_nodes (first); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (first); phi; phi = PHI_CHAIN (phi)) if (param == SSA_NAME_VAR (PHI_RESULT (phi))) break; @@ -701,7 +701,7 @@ eliminate_tail_call (struct tailcall *t) for (i = 0; i < NUM_V_MAY_DEFS (v_may_defs); i++) { param = SSA_NAME_VAR (V_MAY_DEF_RESULT (v_may_defs, i)); - for (phi = phi_nodes (first); phi; phi = TREE_CHAIN (phi)) + for (phi = phi_nodes (first); phi; phi = PHI_CHAIN (phi)) if (param == SSA_NAME_VAR (PHI_RESULT (phi))) break; diff --git a/gcc/tree.h b/gcc/tree.h index b43899717f0..5a87055ff31 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -1208,6 +1208,11 @@ struct tree_ssa_name GTY(()) /* In a PHI_NODE node. */ #define PHI_RESULT(NODE) PHI_NODE_CHECK (NODE)->phi.result +/* PHI_NODEs for each basic block are chained together in a single linked + list. The head of the list is linked from the block annotation, and + the link to the next PHI is in PHI_CHAIN. */ +#define PHI_CHAIN(NODE) TREE_CHAIN (PHI_NODE_CHECK (NODE)) + /* Nonzero if the PHI node was rewritten by a previous pass through the SSA renamer. */ #define PHI_REWRITTEN(NODE) PHI_NODE_CHECK (NODE)->phi.rewritten