This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] tree-*.c: Replace TREE_CHAIN with PHI_CHAIN whereappropriate.


Hi,

Attached is a patch to replace TREE_CHAIN with PHI_CHAIN where
appropriate.

Tested on i686-pc-linux-gnu.  OK to apply?

Kazu Hirata

2004-11-08  Kazu Hirata  <kazu@cs.umass.edu>

	* tree-cfg.c, tree-if-conv.c, tree-into-ssa.c,
	tree-scalar-evolution.c, tree-ssa-loop-im.c,
	tree-ssa-loop-ivopts.c, tree-ssa-loop-manip.c, tree-ssa.c,
	tree-vectorizer.c: Replace TREE_CHAIN with PHI_CHAIN where
	appropriate.

Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
retrieving revision 2.101
diff -u -d -p -r2.101 tree-cfg.c
--- tree-cfg.c	6 Nov 2004 15:57:25 -0000	2.101
+++ tree-cfg.c	6 Nov 2004 20:11:26 -0000
@@ -4279,7 +4279,7 @@ tree_duplicate_bb (basic_block bb)
   /* First copy the phi nodes.  We do not copy phi node arguments here,
      since the edges are not ready yet.  Keep the chain of phi nodes in
      the same order, so that we can add them later.  */
-  for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
+  for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
     {
       mark_for_rewrite (PHI_RESULT (phi));
       create_phi_node (PHI_RESULT (phi), new_bb);
@@ -4501,7 +4501,7 @@ rewrite_to_new_ssa_names_bb (basic_block
     if (e->flags & EDGE_ABNORMAL)
       break;
 
-  for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
+  for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
     {
       rewrite_to_new_ssa_names_def (PHI_RESULT_PTR (phi), phi, map);
       if (e)
@@ -4546,7 +4546,7 @@ rewrite_to_new_ssa_names_bb (basic_block
     }
 
   FOR_EACH_EDGE (e, ei, bb->succs)
-    for (phi = phi_nodes (e->dest); phi; phi = TREE_CHAIN (phi))
+    for (phi = phi_nodes (e->dest); phi; phi = PHI_CHAIN (phi))
       {
 	rewrite_to_new_ssa_names_use
 		(PHI_ARG_DEF_PTR_FROM_EDGE (phi, e), map);
Index: tree-if-conv.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-if-conv.c,v
retrieving revision 2.11
diff -u -d -p -r2.11 tree-if-conv.c
--- tree-if-conv.c	14 Oct 2004 18:19:46 -0000	2.11
+++ tree-if-conv.c	6 Nov 2004 20:11:27 -0000
@@ -591,7 +591,7 @@ if_convertable_loop_p (struct loop *loop
       /* ??? Check data dependency for vectorizer.  */
 
       /* What about phi nodes ? */
-      for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
+      for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
 	if (!if_convertable_phi_p (loop, bb, phi))
 	  return false;
 
Index: tree-into-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-into-ssa.c,v
retrieving revision 2.29
diff -u -d -p -r2.29 tree-into-ssa.c
--- tree-into-ssa.c	4 Nov 2004 08:41:13 -0000	2.29
+++ tree-into-ssa.c	6 Nov 2004 20:11:29 -0000
@@ -298,7 +298,7 @@ ssa_mark_def_sites_initialize_block (str
 
   sbitmap_zero (kills);
 
-  for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
+  for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
     {
       def = PHI_RESULT (phi);
       def_uid = SSA_NAME_VERSION (def);
@@ -328,7 +328,7 @@ ssa_mark_phi_uses (struct dom_walk_data 
       if (e->dest == EXIT_BLOCK_PTR)
 	continue;
 
-      for (phi = phi_nodes (e->dest); phi; phi = TREE_CHAIN (phi))
+      for (phi = phi_nodes (e->dest); phi; phi = PHI_CHAIN (phi))
 	{
 	  use = PHI_ARG_DEF_FROM_EDGE (phi, e);
 	  if (TREE_CODE (use) != SSA_NAME)
@@ -748,7 +748,7 @@ ssa_rewrite_initialize_block (struct dom
   /* 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);
 
@@ -783,7 +783,7 @@ rewrite_add_phi_arguments (struct dom_wa
     {
       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;
 
@@ -818,7 +818,7 @@ rewrite_virtual_phi_arguments (struct do
       if (e->dest == EXIT_BLOCK_PTR)
 	continue;
 
-      for (phi = phi_nodes (e->dest); phi; phi = TREE_CHAIN (phi))
+      for (phi = phi_nodes (e->dest); phi; phi = PHI_CHAIN (phi))
 	{
 	  tree result = PHI_RESULT (phi);
 	  op = PHI_ARG_DEF_PTR_FROM_EDGE (phi, e);
@@ -852,7 +852,7 @@ ssa_rewrite_phi_arguments (struct dom_wa
       if (e->dest == EXIT_BLOCK_PTR)
 	continue;
 
-      for (phi = phi_nodes (e->dest); phi; phi = TREE_CHAIN (phi))
+      for (phi = phi_nodes (e->dest); phi; phi = PHI_CHAIN (phi))
 	{
 	  op = PHI_ARG_DEF_PTR_FROM_EDGE (phi, e);
 	  if (TREE_CODE (USE_FROM_PTR (op)) != SSA_NAME)
Index: tree-scalar-evolution.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-scalar-evolution.c,v
retrieving revision 2.9
diff -u -d -p -r2.9 tree-scalar-evolution.c
--- tree-scalar-evolution.c	22 Oct 2004 17:05:07 -0000	2.9
+++ tree-scalar-evolution.c	6 Nov 2004 20:11:31 -0000
@@ -2374,7 +2374,7 @@ analyze_scalar_evolution_for_all_loop_ph
       loop = loop_containing_stmt (VARRAY_TREE (exit_conditions, i));
       bb = loop->header;
       
-      for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
+      for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
 	if (is_gimple_reg (PHI_RESULT (phi)))
 	  {
 	    chrec = instantiate_parameters 
Index: tree-ssa-loop-im.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-im.c,v
retrieving revision 2.20
diff -u -d -p -r2.20 tree-ssa-loop-im.c
--- tree-ssa-loop-im.c	29 Oct 2004 08:41:04 -0000	2.20
+++ tree-ssa-loop-im.c	6 Nov 2004 20:11:32 -0000
@@ -1239,7 +1239,7 @@ determine_lsm_loop (struct loop *loop)
       return;
     }
 
-  for (phi = phi_nodes (loop->header); phi; phi = TREE_CHAIN (phi))
+  for (phi = phi_nodes (loop->header); phi; phi = PHI_CHAIN (phi))
     determine_lsm_reg (loop, exits, n_exits, PHI_RESULT (phi));
 
   free (exits);
Index: tree-ssa-loop-ivopts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-ivopts.c,v
retrieving revision 2.24
diff -u -d -p -r2.24 tree-ssa-loop-ivopts.c
--- tree-ssa-loop-ivopts.c	4 Nov 2004 08:57:55 -0000	2.24
+++ tree-ssa-loop-ivopts.c	6 Nov 2004 20:11:37 -0000
@@ -805,7 +805,7 @@ find_bivs (struct ivopts_data *data)
   bool found = false;
   struct loop *loop = data->current_loop;
 
-  for (phi = phi_nodes (loop->header); phi; phi = TREE_CHAIN (phi))
+  for (phi = phi_nodes (loop->header); phi; phi = PHI_CHAIN (phi))
     {
       if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (PHI_RESULT (phi)))
 	continue;
@@ -848,7 +848,7 @@ mark_bivs (struct ivopts_data *data)
   struct loop *loop = data->current_loop;
   basic_block incr_bb;
 
-  for (phi = phi_nodes (loop->header); phi; phi = TREE_CHAIN (phi))
+  for (phi = phi_nodes (loop->header); phi; phi = PHI_CHAIN (phi))
     {
       iv = get_iv (data, PHI_RESULT (phi));
       if (!iv)
@@ -1510,7 +1510,7 @@ find_interesting_uses_outside (struct iv
 {
   tree phi, def;
 
-  for (phi = phi_nodes (exit->dest); phi; phi = TREE_CHAIN (phi))
+  for (phi = phi_nodes (exit->dest); phi; phi = PHI_CHAIN (phi))
     {
       def = PHI_ARG_DEF_FROM_EDGE (phi, exit);
       find_interesting_uses_outer (data, def);
@@ -1543,7 +1543,7 @@ find_interesting_uses (struct ivopts_dat
 	    && !flow_bb_inside_loop_p (data->current_loop, e->dest))
 	  find_interesting_uses_outside (data, e);
 
-      for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
+      for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
 	find_interesting_uses_stmt (data, phi);
       for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
 	find_interesting_uses_stmt (data, bsi_stmt (bsi));
@@ -3415,7 +3415,7 @@ determine_set_costs (struct ivopts_data 
     }
 
   n = 0;
-  for (phi = phi_nodes (loop->header); phi; phi = TREE_CHAIN (phi))
+  for (phi = phi_nodes (loop->header); phi; phi = PHI_CHAIN (phi))
     {
       op = PHI_RESULT (phi);
 
@@ -4169,7 +4169,7 @@ protect_loop_closed_ssa_form_use (edge e
     return;
 
   /* Try finding a phi node that copies the value out of the loop.  */
-  for (phi = phi_nodes (exit->dest); phi; phi = TREE_CHAIN (phi))
+  for (phi = phi_nodes (exit->dest); phi; phi = PHI_CHAIN (phi))
     if (PHI_ARG_DEF_FROM_EDGE (phi, exit) == use)
       break;
 
@@ -4303,7 +4303,7 @@ rewrite_use_outer (struct ivopts_data *d
       if (stmts && name_info (data, tgt)->preserve_biv)
 	return;
 
-      for (phi = phi_nodes (exit->dest); phi; phi = TREE_CHAIN (phi))
+      for (phi = phi_nodes (exit->dest); phi; phi = PHI_CHAIN (phi))
 	{
 	  use_operand_p use_p = PHI_ARG_DEF_PTR_FROM_EDGE (phi, exit);
 
Index: tree-ssa-loop-manip.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-manip.c,v
retrieving revision 2.14
diff -u -d -p -r2.14 tree-ssa-loop-manip.c
--- tree-ssa-loop-manip.c	4 Nov 2004 08:41:16 -0000	2.14
+++ tree-ssa-loop-manip.c	6 Nov 2004 20:11:38 -0000
@@ -272,7 +272,7 @@ find_uses_to_rename (bitmap *use_blocks)
 
   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 < (unsigned) PHI_NUM_ARGS (phi); i++)
 	  find_uses_to_rename_use (PHI_ARG_EDGE (phi, i)->src,
 				   PHI_ARG_DEF (phi, i), use_blocks);
@@ -383,7 +383,7 @@ verify_loop_closed_ssa (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))
 	for (i = 0; i < (unsigned) PHI_NUM_ARGS (phi); i++)
 	  check_loop_closed_ssa_use (PHI_ARG_EDGE (phi, i)->src,
 				     PHI_ARG_DEF (phi, i));
@@ -404,7 +404,7 @@ split_loop_exit_edge (edge exit)
   tree phi, new_phi, new_name, name;
   use_operand_p op_p;
 
-  for (phi = phi_nodes (dest); phi; phi = TREE_CHAIN (phi))
+  for (phi = phi_nodes (dest); phi; phi = PHI_CHAIN (phi))
     {
       op_p = PHI_ARG_DEF_PTR_FROM_EDGE (phi, EDGE_SUCC (bb, 0));
 
@@ -567,7 +567,7 @@ set_phi_def_stmts (basic_block bb)
 {
   tree phi;
 
-  for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
+  for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
     SSA_NAME_DEF_STMT (PHI_RESULT (phi)) = phi;
 }
 
Index: tree-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa.c,v
retrieving revision 2.55
diff -u -d -p -r2.55 tree-ssa.c
--- tree-ssa.c	4 Nov 2004 20:10:59 -0000	2.55
+++ tree-ssa.c	6 Nov 2004 20:11:39 -0000
@@ -113,7 +113,7 @@ flush_pending_stmts (edge e)
 
   for (phi = phi_nodes (e->dest), arg = PENDING_STMT (e);
        phi;
-       phi = TREE_CHAIN (phi), arg = TREE_CHAIN (arg))
+       phi = PHI_CHAIN (phi), arg = TREE_CHAIN (arg))
     {
       tree def = TREE_VALUE (arg);
       add_phi_arg (&phi, def, e);
@@ -1281,7 +1281,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);
 	  check_phi_redundancy (phi, eq_to);
Index: tree-vectorizer.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-vectorizer.c,v
retrieving revision 2.24
diff -u -d -p -r2.24 tree-vectorizer.c
--- tree-vectorizer.c	4 Nov 2004 13:48:59 -0000	2.24
+++ tree-vectorizer.c	6 Nov 2004 20:11:46 -0000
@@ -353,7 +353,7 @@ rename_variables_in_bb (basic_block bb)
   edge e;
   edge_iterator ei;
 
-  for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
+  for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
     rename_def_op (PHI_RESULT_PTR (phi), phi);
 
   for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
@@ -390,7 +390,7 @@ rename_variables_in_bb (basic_block bb)
     }
 
   FOR_EACH_EDGE (e, ei, bb->succs)
-    for (phi = phi_nodes (e->dest); phi; phi = TREE_CHAIN (phi))
+    for (phi = phi_nodes (e->dest); phi; phi = PHI_CHAIN (phi))
       rename_use_op (PHI_ARG_DEF_PTR_FROM_EDGE (phi, e));
 }
 
@@ -449,8 +449,8 @@ copy_phi_nodes (struct loop *loop, struc
   for (phi = phi_nodes (loop->header),
 	 new_phi = phi_nodes (new_loop->header);
        phi;
-       phi = TREE_CHAIN (phi),
-	 new_phi = TREE_CHAIN (new_phi))
+       phi = PHI_CHAIN (phi),
+	 new_phi = PHI_CHAIN (new_phi))
     {
       new_e = loop_preheader_edge (new_loop);
       def = PHI_ARG_DEF_FROM_EDGE (phi, e);
@@ -557,7 +557,7 @@ update_phi_nodes_for_guard (edge guard_t
 {
   tree phi, phi1;
 
-  for (phi = phi_nodes (loop->header); phi; phi = TREE_CHAIN (phi))
+  for (phi = phi_nodes (loop->header); phi; phi = PHI_CHAIN (phi))
       {
 	tree new_phi;
 	tree phi_arg;
@@ -695,7 +695,7 @@ tree_duplicate_loop_to_edge_cfg (struct 
 
   /* Duplicating phi args at exit bbs as coming 
      also from exit of duplicated loop.  */
-  for (phi = phi_nodes (exit_dest); phi; phi = TREE_CHAIN (phi))
+  for (phi = phi_nodes (exit_dest); phi; phi = PHI_CHAIN (phi))
     {
       phi_arg = PHI_ARG_DEF_FROM_EDGE (phi, loop->exit_edges[0]);
       if (phi_arg)
@@ -736,7 +736,7 @@ tree_duplicate_loop_to_edge_cfg (struct 
 
       /* We have to add phi args to the loop->header here as coming 
 	 from new_exit_e edge.  */
-      for (phi = phi_nodes (loop->header); phi; phi = TREE_CHAIN (phi))
+      for (phi = phi_nodes (loop->header); phi; phi = PHI_CHAIN (phi))
 	{
 	  phi_arg = PHI_ARG_DEF_FROM_EDGE (phi, entry_e);
 	  if (phi_arg)
@@ -2913,7 +2913,7 @@ vect_update_ivs_after_vectorizer (struct
   
   loop->exit_edges[0] = EDGE_PRED (new_bb, 0);
   
-  for (phi = phi_nodes (loop->header); phi; phi = TREE_CHAIN (phi))
+  for (phi = phi_nodes (loop->header); phi; phi = PHI_CHAIN (phi))
     {
       tree access_fn = NULL;
       tree evolution_part;
@@ -3731,7 +3731,7 @@ vect_analyze_scalar_cycles (loop_vec_inf
   if (vect_debug_details (NULL))
     fprintf (dump_file, "\n<<vect_analyze_scalar_cycles>>\n");
 
-  for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
+  for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
     {
       tree access_fn = NULL;
 
@@ -5351,7 +5351,7 @@ vect_analyze_loop_with_symbolic_num_of_i
    
   /* Analyze phi functions of the loop header.  */
 
-  for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
+  for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
     {
       tree access_fn = NULL;
       tree evolution_part;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]