tree-flow.h: Remove the prototype for remove_phi_arg.
authorKazu Hirata <kazu@cs.umass.edu>
Mon, 22 Nov 2004 22:01:11 +0000 (22:01 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Mon, 22 Nov 2004 22:01:11 +0000 (22:01 +0000)
* tree-flow.h: Remove the prototype for remove_phi_arg.
Add a prototype for remove_phi_args.
* tree-phinodes.c (remove_phi_arg): Remove.
(remove_phi_args): New.
* tree-ssa.c (ssa_remove_edge): Call remove_phi_args instead
of remove_phi_arg.

From-SVN: r91034

gcc/ChangeLog
gcc/tree-flow.h
gcc/tree-phinodes.c
gcc/tree-ssa.c

index 113616f6eebb12236aabe7024fad2aa485a2a12b..316ad25a1f226f477dfff7db09c6680cff3ae4f7 100644 (file)
@@ -1,3 +1,12 @@
+2004-11-22  Kazu Hirata  <kazu@cs.umass.edu>
+
+       * tree-flow.h: Remove the prototype for remove_phi_arg.
+       Add a prototype for remove_phi_args.
+       * tree-phinodes.c (remove_phi_arg): Remove.
+       (remove_phi_args): New.
+       * tree-ssa.c (ssa_remove_edge): Call remove_phi_args instead
+       of remove_phi_arg.
+
 2004-11-23  Ben Elliston  <bje@au.ibm.com>
 
        * doc/cfg.texi (Maintaining the CFG): Use @ftable instead of
index da68b32fdf121f8e38b959f82eedd6d108851e5c..4b9a3ed5cf4f3cdcb4dbe446df027eb63995fb33 100644 (file)
@@ -510,7 +510,7 @@ extern stmt_ann_t create_stmt_ann (tree);
 extern tree_ann_t create_tree_ann (tree);
 extern tree create_phi_node (tree, basic_block);
 extern void add_phi_arg (tree *, tree, edge);
-extern void remove_phi_arg (tree, basic_block);
+extern void remove_phi_args (edge);
 extern void remove_phi_arg_num (tree, int);
 extern void remove_phi_node (tree, tree, basic_block);
 extern void remove_all_phi_nodes_for (bitmap);
index a38a57273be2f4801a7373d081f37ae57195b873..c4240e7cb69a157c0e60e65a22d9f47101c1f4f5 100644 (file)
@@ -349,29 +349,6 @@ add_phi_arg (tree *phi, tree def, edge e)
   PHI_NUM_ARGS (*phi)++;
 }
 
-/* Remove a PHI argument from PHI.  BLOCK is the predecessor block where
-   the PHI argument is coming from.  */
-
-void
-remove_phi_arg (tree phi, basic_block block)
-{
-  int i, num_elem = PHI_NUM_ARGS (phi);
-
-  for (i = 0; i < num_elem; i++)
-    {
-      basic_block src_bb;
-
-      src_bb = PHI_ARG_EDGE (phi, i)->src;
-
-      if (src_bb == block)
-       {
-         remove_phi_arg_num (phi, i);
-         return;
-       }
-    }
-}
-
-
 /* Remove the Ith argument from PHI's argument list.  This routine assumes
    ordering of alternatives in the vector is not important and implements
    removal by swapping the last alternative with the alternative we want to
@@ -400,6 +377,21 @@ remove_phi_arg_num (tree phi, int i)
   PHI_NUM_ARGS (phi)--;
 }
 
+/* Remove all PHI arguments associated with edge E.  */
+
+void
+remove_phi_args (edge e)
+{
+  tree phi;
+
+  for (phi = phi_nodes (e->dest); phi; phi = PHI_CHAIN (phi))
+    {
+      int index = phi_arg_from_edge (phi, e);
+      if (index >= 0)
+       remove_phi_arg_num (phi, index);
+    }
+}
+
 /* Remove PHI node PHI from basic block BB.  If PREV is non-NULL, it is
    used as the node immediately before PHI in the linked list.  */
 
index 5dfa8c7142232db83471ed79600c9e4abc8c4b95..1e2b59d44ccde3e4fc55ac654315f8e2d48cf397 100644 (file)
@@ -53,14 +53,8 @@ Boston, MA 02111-1307, USA.  */
 void
 ssa_remove_edge (edge e)
 {
-  tree phi, next;
-
-  /* Remove the appropriate PHI arguments in E's destination block.  */
-  for (phi = phi_nodes (e->dest); phi; phi = next)
-    {
-      next = PHI_CHAIN (phi);
-      remove_phi_arg (phi, e->src);
-    }
+  /* Remove all PHI arguments for E.  */
+  remove_phi_args (e);
 
   remove_edge (e);
 }