diff options
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 74 |
1 files changed, 36 insertions, 38 deletions
@@ -121,7 +121,6 @@ const char *const tree_code_class_strings[] = /* obstack.[ch] explicitly declined to prototype this. */ extern int _obstack_allocated_p (struct obstack *h, void *obj); -#ifdef GATHER_STATISTICS /* Statistics-gathering stuff. */ static int tree_code_counts[MAX_TREE_CODES]; @@ -147,7 +146,6 @@ static const char * const tree_node_kind_names[] = { "lang_type kinds", "omp clauses", }; -#endif /* GATHER_STATISTICS */ /* Unique id for next decl created. */ static GTY(()) int next_decl_uid; @@ -751,10 +749,12 @@ static void record_node_allocation_statistics (enum tree_code code ATTRIBUTE_UNUSED, size_t length ATTRIBUTE_UNUSED) { -#ifdef GATHER_STATISTICS enum tree_code_class type = TREE_CODE_CLASS (code); tree_node_kind kind; + if (!GATHER_STATISTICS) + return; + switch (type) { case tcc_declaration: /* A decl node */ @@ -832,7 +832,6 @@ record_node_allocation_statistics (enum tree_code code ATTRIBUTE_UNUSED, tree_code_counts[(int) code]++; tree_node_counts[(int) kind]++; tree_node_sizes[(int) kind] += length; -#endif } /* Allocate and return a new UID from the DECL_UID namespace. */ @@ -6337,11 +6336,12 @@ type_hash_canon (unsigned int hashcode, tree type) t1 = type_hash_lookup (hashcode, type); 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_non_common); -#endif + if (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_non_common); + } return t1; } else @@ -8709,36 +8709,34 @@ get_callee_fndecl (const_tree call) void dump_tree_statistics (void) { -#ifdef GATHER_STATISTICS - int i; - int total_nodes, total_bytes; -#endif + if (GATHER_STATISTICS) + { + int i; + int total_nodes, total_bytes; + fprintf (stderr, "Kind Nodes Bytes\n"); + fprintf (stderr, "---------------------------------------\n"); + total_nodes = total_bytes = 0; + for (i = 0; i < (int) all_kinds; i++) + { + fprintf (stderr, "%-20s %7d %10d\n", tree_node_kind_names[i], + tree_node_counts[i], tree_node_sizes[i]); + total_nodes += tree_node_counts[i]; + total_bytes += tree_node_sizes[i]; + } + 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 + fprintf (stderr, "(No per-node statistics)\n"); - fprintf (stderr, "\n??? tree nodes created\n\n"); -#ifdef GATHER_STATISTICS - fprintf (stderr, "Kind Nodes Bytes\n"); - fprintf (stderr, "---------------------------------------\n"); - total_nodes = total_bytes = 0; - for (i = 0; i < (int) all_kinds; i++) - { - fprintf (stderr, "%-20s %7d %10d\n", tree_node_kind_names[i], - tree_node_counts[i], tree_node_sizes[i]); - total_nodes += tree_node_counts[i]; - total_bytes += tree_node_sizes[i]; - } - 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 - fprintf (stderr, "(No per-node statistics)\n"); -#endif print_type_hash_statistics (); print_debug_expr_statistics (); print_value_expr_statistics (); |