This patch makes us count individual tree codes instead of globbing
them only.

Bootstrapped on x86_64-unknown-linux-gnu, installed.

Richard.

2011-05-02  Richard Guenther  <rguent...@suse.de>

        * tree.c (tree_code_counts): New global array.
        (record_node_allocation_statistics): Count individual tree codes.
        (dump_tree_statistics): Dump individual code stats.

Index: gcc/tree.c
===================================================================
*** gcc/tree.c.orig     2011-04-29 12:59:38.000000000 +0200
--- gcc/tree.c  2011-05-02 12:36:41.000000000 +0200
*************** extern int _obstack_allocated_p (struct
*** 124,129 ****
--- 124,130 ----
  #ifdef GATHER_STATISTICS
  /* Statistics-gathering stuff.  */
  
+ static int tree_code_counts[MAX_TREE_CODES];
  int tree_node_counts[(int) all_kinds];
  int tree_node_sizes[(int) all_kinds];
  
*************** record_node_allocation_statistics (enum
*** 809,814 ****
--- 810,816 ----
        gcc_unreachable ();
      }
  
+   tree_code_counts[(int) code]++;
    tree_node_counts[(int) kind]++;
    tree_node_sizes[(int) kind] += length;
  #endif
*************** type_hash_canon (unsigned int hashcode,
*** 6196,6201 ****
--- 6198,6204 ----
    if (t1 != 0)
      {
  #ifdef GATHER_STATISTICS
+       tree_code_counts[(int) TREE_CODE (type)]--;
        tree_node_counts[(int) t_kind]--;
        tree_node_sizes[(int) t_kind] -= sizeof (struct tree_type);
  #endif
*************** dump_tree_statistics (void)
*** 8505,8510 ****
--- 8508,8518 ----
    fprintf (stderr, "---------------------------------------\n");
    fprintf (stderr, "%-20s %7d %10d\n", "Total", total_nodes, total_bytes);
    fprintf (stderr, "---------------------------------------\n");
+   fprintf (stderr, "Code                   Nodes\n");
+   fprintf (stderr, "----------------------------\n");
+   for (i = 0; i < (int) MAX_TREE_CODES; i++)
+     fprintf (stderr, "%-20s %7d\n", tree_code_name[i], tree_code_counts[i]);
+   fprintf (stderr, "----------------------------\n");
    ssanames_print_statistics ();
    phinodes_print_statistics ();
  #else

Reply via email to