On 4/9/07, Andrew Pinski <[EMAIL PROTECTED]> wrote:
Also I noticed in your pdf, you have "PHI NODE" as 12%, we can improve the memory usage for this statement by removing the usage of TREE_CHAIN/TREE_TYPE, so we can save 4/8 bytes for those 12% without doing much work. I can send a patch in the next week or so (I am busy at a conference the next two days but I can start writting a patch tomorrow).
Here is the quick patch (thanks to the work done for gimple tuple) which does this, removes the unneeded type from phi nodes. I have not tested it except for a quick test on some small testcases so there might be more places which use TREE_CHAIN instead of PHI_CHAIN. -- Pinski
Index: tree.h =================================================================== --- tree.h (revision 123691) +++ tree.h (working copy) @@ -951,7 +951,7 @@ (TREE_CODE_CLASS (TREE_CODE ((NODE))) == tcc_gimple_stmt) /* Nonzero if NODE is a GIMPLE tuple. */ -#define GIMPLE_TUPLE_P(NODE) (GIMPLE_STMT_P (NODE)) +#define GIMPLE_TUPLE_P(NODE) (GIMPLE_STMT_P (NODE) || TREE_CODE (NODE) == PHI_NODE) /* A GIMPLE tuple that has a ``locus'' field. */ #define GIMPLE_TUPLE_HAS_LOCUS_P(NODE) GIMPLE_STMT_P ((NODE)) @@ -1866,7 +1866,7 @@ /* 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)) +#define PHI_CHAIN(NODE) PHI_NODE_CHECK (NODE)->phi.chain #define PHI_NUM_ARGS(NODE) PHI_NODE_CHECK (NODE)->phi.num_args #define PHI_ARG_CAPACITY(NODE) PHI_NODE_CHECK (NODE)->phi.capacity @@ -1885,7 +1885,8 @@ struct tree_phi_node GTY(()) { - struct tree_common common; + struct tree_base common; + tree chain; tree result; int num_args; int capacity; Index: tree-ssa-structalias.c =================================================================== --- tree-ssa-structalias.c (revision 123691) +++ tree-ssa-structalias.c (working copy) @@ -4730,7 +4730,7 @@ block_stmt_iterator bsi; tree phi; - 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))) { @@ -4882,7 +4882,7 @@ block_stmt_iterator bsi; tree phi; - 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))) { Index: tree-phinodes.c =================================================================== --- tree-phinodes.c (revision 123691) +++ tree-phinodes.c (working copy) @@ -218,7 +218,6 @@ TREE_SET_CODE (phi, PHI_NODE); PHI_NUM_ARGS (phi) = len; PHI_ARG_CAPACITY (phi) = capacity; - TREE_TYPE (phi) = TREE_TYPE (var); if (TREE_CODE (var) == SSA_NAME) SET_PHI_RESULT (phi, var); else