This is the mail archive of the
mailing list for the GCC project.
[patch] O(1) PHI argument look-up - Part 9/n
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 23 Nov 2004 08:44:55 -0500 (EST)
- Subject: [patch] O(1) PHI argument look-up - Part 9/n
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
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.
2004-11-23 Kazu Hirata <firstname.lastname@example.org>
* tree-phinode.c (make_phi_node): Use a new variable,
capacity, to receive the return value of ideal_phi_node_len.
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)
+ 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);