diff options
author | Steven Bosscher <steven@gcc.gnu.org> | 2012-07-24 09:49:56 +0000 |
---|---|---|
committer | Steven Bosscher <steven@gcc.gnu.org> | 2012-07-24 09:49:56 +0000 |
commit | 7aa6d18a7c51ff7b19149d1e03db839b6b1033dc (patch) | |
tree | 7524c306e4effe5958489e003d2bb147a0439144 /gcc/cp | |
parent | 38ad2d079800cafd77f35c32a335697f643fa1a3 (diff) | |
download | gcc-7aa6d18a7c51ff7b19149d1e03db839b6b1033dc.zip gcc-7aa6d18a7c51ff7b19149d1e03db839b6b1033dc.tar.gz gcc-7aa6d18a7c51ff7b19149d1e03db839b6b1033dc.tar.bz2 |
sbitmap.h (SBITMAP_ELT_BITS): Use "1u" trick as for BITMAP_WORD_BITS.
gcc/
* sbitmap.h (SBITMAP_ELT_BITS): Use "1u" trick as for BITMAP_WORD_BITS.
Move test to check that there is a popcount function for the the number
of bits in SBITMAP_ELT_BITS to sbitmap.c.
* sbitmap.c: Test SBITMAP_ELT_BITS, not HOST_BITS_PER_WIDEST_FAST_INT.
MEM_STAT_INFO): Define in terms of their ALONE counterparts.
* configure.ac (GATHER_STATISTICS): Always define, non-zero if enabled.
* configure: Regenerate.
* statistics.h (GATHER_STATISTICS): Error out if it is not defined.
(GCC_MEM_STAT_ARGUMENTS): New define.
(ALONE_MEM_STAT_DECL): Define in terms of GCC_MEM_STAT_ARGUMENTS.
(ALONE_FINAL_MEM_STAT_DECL, ALONE_FINAL_PASS_MEM_STAT): New defines.
(MEM_STAT_DECL, FINAL_MEM_STAT_DECL, PASS_MEM_STAT, FINAL_PASS_MEM_STAT,
* ggc-internal.h (ggc_record_overhead): Use FINAL_MEM_STAT_DECL.
* ggc.h (ggc_record_overhead, ggc_free_overhead,
ggc_prune_overhead_list): Remove internal prototypes, they are defined
already in ggc-internal.h.
* ggc-common.c (struct loc_descriptor): Remove #ifdef GATHER_STATISTICS
wrappers.
(add_statistics): Likewise.
(dump_ggc_loc_statistics): Likewise. Return if GATHER_STATISTICS is 0.
* ggc-zone.c (struct page_entry): Remove #ifdef GATHER_STATISTICS
wrappers around "survived" and "stats" members.
(alloc_large_page): Always initialize survived.
(ggc_internal_alloc_zone_stat): Likewise.
Remove #ifdef GATHER_STATISTICS wrappers. Record overhead if
GATHER_STATISTICS is non-0.
(ggc_free): Convert #ifdef GATHER_STATISTICS to if-code.
(sweep_pages): Always increase survived.
(ggc_collect_1): Convert #ifdef GATHER_STATISTICS to if-code.
(calculate_average_page_survival): Always define.
(ggc_collect): Convert #ifdef GATHER_STATISTICS to if-code.
(ggc_print_statistics): Likewise.
(ggc_pch_read): Likewise.
* ggc-page.c (struct globals): Always define "stats" member.
(ggc_internal_alloc_stat): Convert #ifdef GATHER_STATISTICS to if-code.
(ggc_free): Likewise.
(ggc_collec): Likewise.
(ggc_print_statistics): Likewise.
* bitmap.h (struct bitmap_head_def): Always define "desc" member.
(bitmap_initialize_stat): Convert #ifdef GATHER_STATISTICS to if-code.
* gimple.h (enum gimple_alloc_kind): Always define.
(gimple_alloc_kind): Likewise.
* tree-flow.h (phinodes_print_statistics): Always define.
(ssanames_print_statistics): Likewise.
* vec.h (vec_heap_free): Always define.
(VEC_stack_alloc): Define if GATHER_STATISTICS is non-0.
* alloc-pool.c (alloc_pool_descriptor): Always define.
(create_alloc_pool): Convert #ifdef GATHER_STATISTICS to if-code.
(empty_alloc_pool): Likewise.
(pool_alloc): Likewise.
(pool_free): Likewise.
(dump_alloc_pool_statistics): Likewise.
(print_statistics): Always define.
* bitmap.c (struct bitmap_descriptor): Always define.
(bitmap_register): Pass ALONE_FINAL_PASS_MEM_STAT.
(register_overhead): Always define.
(bitmap_element_free): Convert #ifdef GATHER_STATISTICS to if-code.
(bitmap_element_allocate): Likewise.
(bitmap_elt_clear_from): Likewise.
(bitmap_obstack_alloc_stat): Likewise.
(bitmap_gc_alloc_stat): Likewise.
(bitmap_obstack_free): Likewise.
(bitmap_find_bit): Likewise.
(bitmap_ior_and_into): Likewise.
(bitmap_print): Likewise.
(dump_bitmap_statistics): Likewise. Return if GATHER_STATISTICS is 0.
* gimple.c (gimple_alloc_counts, gimple_alloc_sizes): Always define.
(gimple_alloc_kind_names): Likewise.
(gimple_alloc_stat): Convert #ifdef GATHER_STATISTICS to if-code.
(dump_gimple_statistics): Likewise. Return if GATHER_STATISTICS is 0.
* rtl.c (rtx_alloc_counts, rtx_alloc_sizes, rtvec_alloc_counts,
rtvec_alloc_sizes): Always define.
(rvec_alloc): Convert #ifdef GATHER_STATISTICS to if-code.
(rtx_alloc_stat): Likewise.
(dump_rtx_statistics): Likewise. Return if GATHER_STATISTICS is 0.
* tree.c (_obstack_allocated_p, tree_code_counts, tree_node_counts,
tree_node_sizes, tree_node_kind_names): Always define.
(record_node_allocation_statistics): Convert #ifdef GATHER_STATISTICS
to if-code.
(type_hash_canon): Likewise.
(dump_tree_statistics): Likewise.
* tree-ssanames.c (ssa_name_nodes_reused, ssa_name_nodes_created):
Always define.
(ssanames_print_statistics): Likewise.
(make_ssa_name_fn): Convert #ifdef GATHER_STATISTICS to if-code.
* tree-phinodes.c (phi_nodes_reused, phi_nodes_created): Always define.
(phinodes_print_statistics): Likewise.
(allocate_phi_node): Convert #ifdef GATHER_STATISTICS to if-code.
* vec.c (struct vec_descriptor): Always define.
(hash_descriptor, eq_descriptor, ptr_hash_entry, hash_ptr, eq_ptr,
vec_descriptor, rester_overhead, free_overhead): Likewise.
(cmp_statistic): Likewise.
(vec_heap_free): Convert #ifdef GATHER_STATISTICS to if-code.
(vec_heap_o_reserve_1): Likewise.
(dump_vec_loc_statistics): Likewise.
cp/
* cp/class.c (n_vtables, n_vtable_entries, n_vtable_searches,
n_vtable_elems, n_convert_harshness, n_compute_conversion_costs,
n_inner_fields_searched): Always define.
(build_primary_vtable): Convert #ifdef GATHER_STATISTICS to if-code.
(print_class_statistics): Convert #ifdef GATHER_STATISTICS to if-code.
* cp/tree.c (depth_reached): Always define global.
(cxx_print_statistics): Convert #ifdef GATHER_STATISTICS to if-code.
* cp/pt.c (depth_reached): Always define.
(push_tinst_level): Convert #ifdef GATHER_STATISTICS to if-code.
* cp/search.c (n_fields_searched, n_calls_lookup_field,
n_calls_lookup_field_1, n_calls_lookup_fnfields,
n_calls_lookup_fnfields_1, n_calls_get_base_type,
n_outer_fields_searched, n_contexts_saved): Always define.
(lookup_field_1): Convert #ifdef GATHER_STATISTICS to if-code.
(lookup_member): Likewise.
(lookup_fnfields_idx_nolazy): Likewise.
(print_search_statistics): Likewise.
(reinit_search_statistics): Unconditionally re-set counters.
* cp/lex.c (retrofit_lang_decl): Convert #ifdef GATHER_STATISTICS
to if-code.
(cxx_dup_lang_specific_decl): Likewise.
(copy_lang_type): Likewise.
(cxx_make_type): Likewise.
From-SVN: r189803
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 26 | ||||
-rw-r--r-- | gcc/cp/class.c | 16 | ||||
-rw-r--r-- | gcc/cp/lex.c | 36 | ||||
-rw-r--r-- | gcc/cp/pt.c | 7 | ||||
-rw-r--r-- | gcc/cp/search.c | 51 | ||||
-rw-r--r-- | gcc/cp/tree.c | 9 |
6 files changed, 81 insertions, 64 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 07ed0a0..90064b2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,29 @@ +2012-07-24 Steven Bosscher <steven@gcc.gnu.org> + + * cp/class.c (n_vtables, n_vtable_entries, n_vtable_searches, + n_vtable_elems, n_convert_harshness, n_compute_conversion_costs, + n_inner_fields_searched): Always define. + (build_primary_vtable): Convert #ifdef GATHER_STATISTICS to if-code. + (print_class_statistics): Convert #ifdef GATHER_STATISTICS to if-code. + * cp/tree.c (depth_reached): Always define global. + (cxx_print_statistics): Convert #ifdef GATHER_STATISTICS to if-code. + * cp/pt.c (depth_reached): Always define. + (push_tinst_level): Convert #ifdef GATHER_STATISTICS to if-code. + * cp/search.c (n_fields_searched, n_calls_lookup_field, + n_calls_lookup_field_1, n_calls_lookup_fnfields, + n_calls_lookup_fnfields_1, n_calls_get_base_type, + n_outer_fields_searched, n_contexts_saved): Always define. + (lookup_field_1): Convert #ifdef GATHER_STATISTICS to if-code. + (lookup_member): Likewise. + (lookup_fnfields_idx_nolazy): Likewise. + (print_search_statistics): Likewise. + (reinit_search_statistics): Unconditionally re-set counters. + * cp/lex.c (retrofit_lang_decl): Convert #ifdef GATHER_STATISTICS + to if-code. + (cxx_dup_lang_specific_decl): Likewise. + (copy_lang_type): Likewise. + (cxx_make_type): Likewise. + 2012-07-20 Jason Merrill <jason@redhat.com> PR c++/54038 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 96a7420..7ccbccb 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -212,7 +212,6 @@ static tree get_vcall_index (tree, tree); /* Variables shared between class.c and call.c. */ -#ifdef GATHER_STATISTICS int n_vtables = 0; int n_vtable_entries = 0; int n_vtable_searches = 0; @@ -220,7 +219,6 @@ int n_vtable_elems = 0; int n_convert_harshness = 0; int n_compute_conversion_costs = 0; int n_inner_fields_searched = 0; -#endif /* Convert to or from a base subobject. EXPR is an expression of type `A' or `A*', an expression of type `B' or `B*' is returned. To @@ -836,10 +834,11 @@ build_primary_vtable (tree binfo, tree type) virtuals = NULL_TREE; } -#ifdef GATHER_STATISTICS - n_vtables += 1; - n_vtable_elems += list_length (virtuals); -#endif + if (GATHER_STATISTICS) + { + n_vtables += 1; + n_vtable_elems += list_length (virtuals); + } /* Initialize the association list for this type, based on our first approximation. */ @@ -7332,7 +7331,9 @@ get_vfield_name (tree type) void print_class_statistics (void) { -#ifdef GATHER_STATISTICS + if (! GATHER_STATISTICS) + return; + fprintf (stderr, "convert_harshness = %d\n", n_convert_harshness); fprintf (stderr, "compute_conversion_costs = %d\n", n_compute_conversion_costs); if (n_vtables) @@ -7342,7 +7343,6 @@ print_class_statistics (void) fprintf (stderr, "vtable entries = %d; vtable elems = %d\n", n_vtable_entries, n_vtable_elems); } -#endif } /* Build a dummy reference to ourselves so Derived::Base (and A::A) works, diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 743f475..54021f1 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -571,10 +571,11 @@ retrofit_lang_decl (tree t) else gcc_unreachable (); -#ifdef GATHER_STATISTICS - tree_node_counts[(int)lang_decl] += 1; - tree_node_sizes[(int)lang_decl] += size; -#endif + if (GATHER_STATISTICS) + { + tree_node_counts[(int)lang_decl] += 1; + tree_node_sizes[(int)lang_decl] += size; + } } void @@ -601,10 +602,11 @@ cxx_dup_lang_specific_decl (tree node) memcpy (ld, DECL_LANG_SPECIFIC (node), size); DECL_LANG_SPECIFIC (node) = ld; -#ifdef GATHER_STATISTICS - tree_node_counts[(int)lang_decl] += 1; - tree_node_sizes[(int)lang_decl] += size; -#endif + if (GATHER_STATISTICS) + { + tree_node_counts[(int)lang_decl] += 1; + tree_node_sizes[(int)lang_decl] += size; + } } /* Copy DECL, including any language-specific parts. */ @@ -638,10 +640,11 @@ copy_lang_type (tree node) memcpy (lt, TYPE_LANG_SPECIFIC (node), size); TYPE_LANG_SPECIFIC (node) = lt; -#ifdef GATHER_STATISTICS - tree_node_counts[(int)lang_type] += 1; - tree_node_sizes[(int)lang_type] += size; -#endif + if (GATHER_STATISTICS) + { + tree_node_counts[(int)lang_type] += 1; + tree_node_sizes[(int)lang_type] += size; + } } /* Copy TYPE, including any language-specific parts. */ @@ -671,10 +674,11 @@ cxx_make_type (enum tree_code code) TYPE_LANG_SPECIFIC (t) = pi; pi->u.c.h.is_lang_type_class = 1; -#ifdef GATHER_STATISTICS - tree_node_counts[(int)lang_type] += 1; - tree_node_sizes[(int)lang_type] += sizeof (struct lang_type); -#endif + if (GATHER_STATISTICS) + { + tree_node_counts[(int)lang_type] += 1; + tree_node_sizes[(int)lang_type] += sizeof (struct lang_type); + } } /* Set up some flags that give proper default behavior. */ diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 0d25398..1e70213 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -7754,9 +7754,8 @@ limit_bad_template_recursion (tree decl) static int tinst_depth; extern int max_tinst_depth; -#ifdef GATHER_STATISTICS int depth_reached; -#endif + static GTY(()) struct tinst_level *last_error_tinst_level; /* We're starting to instantiate D; record the template instantiation context @@ -7799,10 +7798,8 @@ push_tinst_level (tree d) current_tinst_level = new_level; ++tinst_depth; -#ifdef GATHER_STATISTICS - if (tinst_depth > depth_reached) + if (GATHER_STATISTICS && (tinst_depth > depth_reached)) depth_reached = tinst_depth; -#endif return 1; } diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 048fdf3..dc802e4 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -66,14 +66,12 @@ static tree dfs_get_pure_virtuals (tree, void *); /* Variables for gathering statistics. */ -#ifdef GATHER_STATISTICS static int n_fields_searched; static int n_calls_lookup_field, n_calls_lookup_field_1; static int n_calls_lookup_fnfields, n_calls_lookup_fnfields_1; static int n_calls_get_base_type; static int n_outer_fields_searched; static int n_contexts_saved; -#endif /* GATHER_STATISTICS */ /* Data for lookup_base and its workers. */ @@ -407,9 +405,8 @@ lookup_field_1 (tree type, tree name, bool want_type) { i = (lo + hi) / 2; -#ifdef GATHER_STATISTICS - n_fields_searched++; -#endif /* GATHER_STATISTICS */ + if (GATHER_STATISTICS) + n_fields_searched++; if (DECL_NAME (fields[i]) > name) hi = i; @@ -454,16 +451,16 @@ lookup_field_1 (tree type, tree name, bool want_type) field = TYPE_FIELDS (type); -#ifdef GATHER_STATISTICS - n_calls_lookup_field_1++; -#endif /* GATHER_STATISTICS */ + if (GATHER_STATISTICS) + n_calls_lookup_field_1++; + for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field)) { tree decl = field; -#ifdef GATHER_STATISTICS - n_fields_searched++; -#endif /* GATHER_STATISTICS */ + if (GATHER_STATISTICS) + n_fields_searched++; + gcc_assert (DECL_P (field)); if (DECL_NAME (field) == NULL_TREE && ANON_AGGR_TYPE_P (TREE_TYPE (field))) @@ -1203,9 +1200,8 @@ lookup_member (tree xbasetype, tree name, int protect, bool want_type, if (!basetype_path) return NULL_TREE; -#ifdef GATHER_STATISTICS - n_calls_lookup_field++; -#endif /* GATHER_STATISTICS */ + if (GATHER_STATISTICS) + n_calls_lookup_field++; memset (&lfi, 0, sizeof (lfi)); lfi.type = type; @@ -1370,9 +1366,8 @@ lookup_fnfields_idx_nolazy (tree type, tree name) if (!method_vec) return -1; -#ifdef GATHER_STATISTICS - n_calls_lookup_fnfields_1++; -#endif /* GATHER_STATISTICS */ + if (GATHER_STATISTICS) + n_calls_lookup_fnfields_1++; /* Constructors are first... */ if (name == ctor_identifier) @@ -1408,9 +1403,8 @@ lookup_fnfields_idx_nolazy (tree type, tree name) { i = (lo + hi) / 2; -#ifdef GATHER_STATISTICS - n_outer_fields_searched++; -#endif /* GATHER_STATISTICS */ + if (GATHER_STATISTICS) + n_outer_fields_searched++; tmp = VEC_index (tree, method_vec, i); tmp = DECL_NAME (OVL_CURRENT (tmp)); @@ -1425,9 +1419,8 @@ lookup_fnfields_idx_nolazy (tree type, tree name) else for (; VEC_iterate (tree, method_vec, i, fn); ++i) { -#ifdef GATHER_STATISTICS - n_outer_fields_searched++; -#endif /* GATHER_STATISTICS */ + if (GATHER_STATISTICS) + n_outer_fields_searched++; if (DECL_NAME (OVL_CURRENT (fn)) == name) return i; } @@ -2207,28 +2200,28 @@ note_debug_info_needed (tree type) void print_search_statistics (void) { -#ifdef GATHER_STATISTICS + if (! GATHER_STATISTICS) + { + fprintf (stderr, "no search statistics\n"); + return; + } + fprintf (stderr, "%d fields searched in %d[%d] calls to lookup_field[_1]\n", n_fields_searched, n_calls_lookup_field, n_calls_lookup_field_1); fprintf (stderr, "%d fnfields searched in %d calls to lookup_fnfields\n", n_outer_fields_searched, n_calls_lookup_fnfields); fprintf (stderr, "%d calls to get_base_type\n", n_calls_get_base_type); -#else /* GATHER_STATISTICS */ - fprintf (stderr, "no search statistics\n"); -#endif /* GATHER_STATISTICS */ } void reinit_search_statistics (void) { -#ifdef GATHER_STATISTICS n_fields_searched = 0; n_calls_lookup_field = 0, n_calls_lookup_field_1 = 0; n_calls_lookup_fnfields = 0, n_calls_lookup_fnfields_1 = 0; n_calls_get_base_type = 0; n_outer_fields_searched = 0; n_contexts_saved = 0; -#endif /* GATHER_STATISTICS */ } /* Helper for lookup_conversions_r. TO_TYPE is the type converted to diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 83b8ca7..26e7fce 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -2044,9 +2044,7 @@ no_linkage_check (tree t, bool relaxed_p) } } -#ifdef GATHER_STATISTICS extern int depth_reached; -#endif void cxx_print_statistics (void) @@ -2054,10 +2052,9 @@ cxx_print_statistics (void) print_search_statistics (); print_class_statistics (); print_template_statistics (); -#ifdef GATHER_STATISTICS - fprintf (stderr, "maximum template instantiation depth reached: %d\n", - depth_reached); -#endif + if (GATHER_STATISTICS) + fprintf (stderr, "maximum template instantiation depth reached: %d\n", + depth_reached); } /* Return, as an INTEGER_CST node, the number of elements for TYPE |