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] O(1) PHI argument look-up - Part 9/n


Hi,

Attached is a patch to part 9 of my O(1) PHI argument look-up patch.

Once a PHI array and the corresponding edge vector are lined up,
creating a PHI node requires us to set its PHI_NUM_ARGS to
EDGE_COUNT (bb->preds), which in turn requires us to remember
EDGE_COUNT (bb->preds).

The patch tries to preserve LEN by receiving the result of
ideal_phi_node_len with a new variable CAPACITY.

Tested on i686-pc-linux-gnu.  Committed as obvious.

Kazu Hirata

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

	* tree-phinode.c (make_phi_node): Use a new variable,
	capacity, to receive the return value of ideal_phi_node_len.

Index: tree-phinodes.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-phinodes.c,v
retrieving revision 2.24
diff -u -d -p -r2.24 tree-phinodes.c
--- tree-phinodes.c	23 Nov 2004 05:25:12 -0000	2.24
+++ tree-phinodes.c	23 Nov 2004 05:39:40 -0000
@@ -206,10 +206,11 @@ static tree
 make_phi_node (tree var, int len)
 {
   tree phi;
+  int capacity;
 
-  len = ideal_phi_node_len (len);
+  capacity = ideal_phi_node_len (len);
 
-  phi = allocate_phi_node (len);
+  phi = allocate_phi_node (capacity);
 
   /* We do not have to clear a part of the PHI node that stores PHI
      arguments, which is safe because we tell the garbage collector to
@@ -218,7 +219,7 @@ make_phi_node (tree var, int len)
      pointers in the unused portion of the array.  */
   memset (phi, 0, sizeof (struct tree_phi_node) - sizeof (struct phi_arg_d));
   TREE_SET_CODE (phi, PHI_NODE);
-  PHI_ARG_CAPACITY (phi) = len;
+  PHI_ARG_CAPACITY (phi) = capacity;
   TREE_TYPE (phi) = TREE_TYPE (var);
   if (TREE_CODE (var) == SSA_NAME)
     SET_PHI_RESULT (phi, var);


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