aboutsummaryrefslogtreecommitdiff
path: root/libgcc/libgcov.h
AgeCommit message (Collapse)AuthorFilesLines
2022-10-12gcov: rename gcov_write_summaryMartin Liska1-3/+2
gcc/ChangeLog: * gcov-io.cc (gcov_write_summary): Rename to ... (gcov_write_object_summary): ... this. * gcov-io.h (GCOV_TAG_OBJECT_SUMMARY_LENGTH): Rename from ... (GCOV_TAG_SUMMARY_LENGTH): ... this. libgcc/ChangeLog: * libgcov-driver.c: Use new function. * libgcov.h (gcov_write_summary): Rename to ... (gcov_write_object_summary): ... this.
2022-05-10libgcov: use proper type for n_functionsMartin Liska1-1/+1
gcov_info::n_functions type is initialized by generated code in build_info_type: /* n_functions */ field = build_decl (BUILTINS_LOCATION, FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ()); It uses gcov_unsigned_t, but the struct definition in libgcov.h uses unsigned type. That brings troubled on 16-bit targets. PR gcov-profile/105535 libgcc/ChangeLog: * libgcov.h (struct gcov_info): Use gcov_unsigned_t for n_functions. Co-Authored-By: Hans-Peter Helfert <peter-helfert@t-online.de>
2022-04-28gcov: Make gcov_seek() staticSebastian Huber1-2/+0
This function is only used by gcov_write_length() in the gcov-io.cc file. gcc/ * gcov-io.cc (gcov_seek): Make it static. * gcov-io.h (struct gcov_summary): Do not mention gcov_seek(). libgcc/ * libgcov.h (gcov_seek): Remove define and declaration.
2022-04-28gcov: Add mode to all gcov_open()Sebastian Huber1-1/+0
gcc/ * gcov-io.cc (gcov_open): Always use the mode parameter. * gcov-io.h (gcov_open): Declare it unconditionally. libgcc/ * libgcov-driver-system.c (gcov_exit_open_gcda_file): Open file for reading and writing. * libgcov-util.c (read_gcda_file): Open file for reading. * libgcov.h (gcov_open): Delete declaration.
2022-01-03Update copyright years.Jakub Jelinek1-1/+1
2021-10-13gcov: make profile merging smarterMartin Liska1-0/+1
Support merging of profiles that are built from a different .o files but belong to the same source file. Moreover, a checksum is verified during profile merging and so we can safely combine such profile. PR gcov-profile/90364 gcc/ChangeLog: * coverage.c (build_info): Emit checksum to the global variable. (build_info_type): Add new field for checksum. (coverage_obj_finish): Pass object_checksum. (coverage_init): Use 0 as checksum for .gcno files. * gcov-dump.c (dump_gcov_file): Dump also new checksum field. * gcov.c (read_graph_file): Read also checksum. * doc/invoke.texi: Document the behaviour change. libgcc/ChangeLog: * libgcov-driver.c (merge_one_data): Skip timestamp and verify checksums. (write_one_data): Write also checksum. * libgcov-util.c (read_gcda_file): Read also checksum field. * libgcov.h (struct gcov_info): Add new field.
2021-08-16gcov: Add TARGET_GCOV_TYPE_SIZE target hookSebastian Huber1-3/+3
If -fprofile-update=atomic is used, then the target must provide atomic operations for the counters of the type returned by get_gcov_type(). This is a 64-bit type for targets which have a 64-bit long long type. On 32-bit targets this could be an issue since they may not provide 64-bit atomic operations. Allow targets to override the default type size with the new TARGET_GCOV_TYPE_SIZE target hook. If a 32-bit gcov type size is used, then there is currently a warning in libgcov-driver.c in a dead code block due to sizeof (counter) == sizeof (gcov_unsigned_t): libgcc/libgcov-driver.c: In function 'dump_counter': libgcc/libgcov-driver.c:401:46: warning: right shift count >= width of type [-Wshift-count-overflow] 401 | dump_unsigned ((gcov_unsigned_t)(counter >> 32), dump_fn, arg); | ^~ gcc/c-family/ * c-cppbuiltin.c (c_cpp_builtins): Define __LIBGCC_GCOV_TYPE_SIZE if flag_building_libgcc is true. gcc/ * config/sparc/rtemself.h (SPARC_GCOV_TYPE_SIZE): Define. * config/sparc/sparc.c (sparc_gcov_type_size): New. (TARGET_GCOV_TYPE_SIZE): Redefine if SPARC_GCOV_TYPE_SIZE is defined. * coverage.c (get_gcov_type): Use targetm.gcov_type_size(). * doc/tm.texi (TARGET_GCOV_TYPE_SIZE): Add hook under "Misc". * doc/tm.texi.in: Regenerate. * target.def (gcov_type_size): New target hook. * targhooks.c (default_gcov_type_size): New. * targhooks.h (default_gcov_type_size): Declare. * tree-profile.c (gimple_gen_edge_profiler): Use precision of gcov_type_node. (gimple_gen_time_profiler): Likewise. libgcc/ * libgcov.h (gcov_type): Define using __LIBGCC_GCOV_TYPE_SIZE. (gcov_type_unsigned): Likewise.
2021-08-06gcov: Add __gcov_info_to_gdca()Sebastian Huber1-5/+0
Add __gcov_info_to_gcda() to libgcov to get the gcda data for a gcda info in a freestanding environment. It is intended to be used with the -fprofile-info-section option. A crude test program which doesn't use a linker script is (use "gcc -coverage -fprofile-info-section -lgcov test.c" to compile it): #include <gcov.h> #include <stdio.h> #include <stdlib.h> extern const struct gcov_info *my_info; static void filename (const char *f, void *arg) { printf("filename: %s\n", f); } static void dump (const void *d, unsigned n, void *arg) { const unsigned char *c = d; for (unsigned i = 0; i < n; ++i) printf ("%02x", c[i]); } static void * allocate (unsigned length, void *arg) { return malloc (length); } int main() { __asm__ volatile (".set my_info, .LPBX2"); __gcov_info_to_gcda (my_info, filename, dump, allocate, NULL); return 0; } With this patch, <stdint.h> is included in libgcov-driver.c even if inhibit_libc is defined. This header file should be also available for freestanding environments. If this is not the case, then we have to define intptr_t somehow. The patch removes one use of memset() which makes the <string.h> include superfluous. gcc/ * gcov-io.h (gcov_write): Declare. * gcov-io.c (gcov_write): New. (gcov_write_counter): Remove. (gcov_write_tag_length): Likewise. (gcov_write_summary): Replace gcov_write_tag_length() with calls to gcov_write_unsigned(). * doc/invoke.texi (fprofile-info-section): Mention __gcov_info_to_gdca(). gcc/testsuite/ * gcc.dg/gcov-info-to-gcda.c: New test. libgcc/ * Makefile.in (LIBGCOV_DRIVER): Add _gcov_info_to_gcda. * gcov.h (gcov_info): Declare. (__gcov_info_to_gdca): Likewise. * libgcov.h (gcov_write_counter): Remove. (gcov_write_tag_length): Likewise. * libgcov-driver.c (#include <stdint.h>): New. (#include <string.h>): Remove. (NEED_L_GCOV): Conditionally define. (NEED_L_GCOV_INFO_TO_GCDA): Likewise. (are_all_counters_zero): New. (gcov_dump_handler): Likewise. (gcov_allocate_handler): Likewise. (dump_unsigned): Likewise. (dump_counter): Likewise. (write_topn_counters): Add dump_fn, allocate_fn, and arg parameters. Use dump_unsigned() and dump_counter(). (write_one_data): Add dump_fn, allocate_fn, and arg parameters. Use dump_unsigned(), dump_counter(), and are_all_counters_zero(). (__gcov_info_to_gcda): New.
2021-04-29Add parallelism support to gcov for MinGW platformsEric Botcazou1-0/+13
If you attempt a profiled bootstrap on the MinGW platforms with -jN, N > 1, it miserably fails because of profile mismatches all over the place, the reason being that gcov has no support for parallelism on these platforms. libgcc/ * libgcov.h: For the target, define GCOV_LOCKED_WITH_LOCKING if __MSVCRT__ and, for the host, define it if HOST_HAS_LK_LOCK. * libgcov-driver.c: Add directives if GCOV_LOCKED_WITH_LOCKING. gcc/ * configure.ac: Check for the presence of sys/locking.h header and for whether _LK_LOCK is supported by _locking. * configure: Regenerate. * config.in: Likewise. * gcov-io.h: Define GCOV_LOCKED_WITH_LOCKING if HOST_HAS_LK_LOCK. * gcov-io.c (gcov_open): Add support for GCOV_LOCKED_WITH_LOCKING. * system.h: Include <sys/locking.h> if HAVE_SYS_LOCKING_H.
2021-03-06libgcov: Fix build on Darwin [PR99406]Jakub Jelinek1-0/+10
As reported, bootstrap currently fails on older Darwin because MAP_ANONYMOUS is not defined. The following is what gcc/system.h does, so I think it should work for libgcov. 2021-03-06 Jakub Jelinek <jakub@redhat.com> PR gcov-profile/99406 * libgcov.h (MAP_FAILED, MAP_ANONYMOUS): If HAVE_SYS_MMAN_H is defined, define these macros if not defined already.
2021-03-04profiling: fix streaming of TOPN countersMartin Liska1-3/+14
libgcc/ChangeLog: PR gcov-profile/99105 * libgcov-driver.c (write_top_counters): Rename to ... (write_topn_counters): ... this. (write_one_data): Pre-allocate buffer for number of items in the corresponding linked lists. * libgcov.h (malloc_mmap): New function. (allocate_gcov_kvp): Use it. gcc/testsuite/ChangeLog: PR gcov-profile/99105 * gcc.dg/tree-prof/indir-call-prof-malloc.c: Use profile correction as the wrapped malloc is called one more time from libgcov. * gcc.dg/tree-prof/pr97461.c: Likewise.
2021-03-04gcov: call mmap MAP_ANONYMOUS with fd equal to -1Martin Liska1-1/+1
libgcc/ChangeLog: PR gcov-profile/99385 * libgcov.h (allocate_gcov_kvp): Call mmap with fd equal to -1.
2021-03-03gcov: use mmap pools for KVP.Martin Liska1-9/+33
gcc/ChangeLog: PR gcov-profile/97461 * gcov-io.h (GCOV_PREALLOCATED_KVP): Remove. libgcc/ChangeLog: PR gcov-profile/97461 * config.in: Regenerate. * configure: Likewise. * configure.ac: Check sys/mman.h header file * libgcov-driver.c (struct gcov_kvp): Remove static pre-allocated pool and use a dynamic one. * libgcov.h (MMAP_CHUNK_SIZE): New. (gcov_counter_add): Use mmap to allocate pool for struct gcov_kvp.
2021-01-26libgcov: improve profile reproducibilityMartin Liska1-1/+7
libgcc/ChangeLog: PR gcov-profile/98739 * libgcov.h (gcov_topn_add_value): Do not train when we have a merged profile with a negative number of total value.
2021-01-25Restore profile reproducibility.Martin Liska1-4/+9
gcc/ChangeLog: PR gcov-profile/98739 * common.opt: Add missing sign symbol. * value-prof.c (get_nth_most_common_value): Restore handling of PROFILE_REPRODUCIBILITY_PARALLEL_RUNS and PROFILE_REPRODUCIBILITY_MULTITHREADED. libgcc/ChangeLog: PR gcov-profile/98739 * libgcov-merge.c (__gcov_merge_topn): Mark when merging ends with a dropped counter. * libgcov.h (gcov_topn_add_value): Add return value.
2021-01-04Update copyright years.Jakub Jelinek1-1/+1
2020-10-27gcov-profile: use static pool for TOPN firstMartin Liska1-18/+6
gcc/ChangeLog: PR gcov-profile/97461 * gcov-io.h (GCOV_PREALLOCATED_KVP): Pre-allocate 64 static counters. libgcc/ChangeLog: PR gcov-profile/97461 * libgcov.h (gcov_counter_add): Use first static counters as it should help to have malloc wrappers set up. gcc/testsuite/ChangeLog: PR gcov-profile/97461 * gcc.dg/tree-prof/pr97461.c: New test.
2020-07-31libgcov: support overloaded mallocMartin Liska1-2/+47
gcc/ChangeLog: * gcov-io.h (GCOV_PREALLOCATED_KVP): New. libgcc/ChangeLog: * libgcov-driver.c: Add __gcov_kvp_pool and __gcov_kvp_pool_index variables. * libgcov.h (allocate_gcov_kvp): New. (gcov_topn_add_value): Use it. gcc/testsuite/ChangeLog: * gcc.dg/tree-prof/indir-call-prof-malloc.c: New test.
2020-06-25gcov-tool: fix merge operation for summaryMartin Liska1-0/+1
libgcc/ChangeLog: * libgcov-driver.c (merge_summary): Remove function as its name is misleading and doing something different. (dump_one_gcov): Add ATTRIBUTE_UNUSED for 2 args. Take read summary in gcov-tool. * libgcov-util.c (curr_object_summary): Remove. (read_gcda_file): Remove unused curr_object_summary. (gcov_merge): Merge summaries. * libgcov.h: Add summary argument for gcov_info struct.
2020-06-17gcov: fix gcov-tool merge for TOPN countersMartin Liska1-1/+1
libgcc/ChangeLog: * libgcov-util.c (read_gcda_finalize): Remove const operator. (merge_wrapper): Add both counts and use them properly. (topn_to_memory_representation): New function. (gcov_merge): Covert on disk representation to in memory representation. * libgcov.h: Remove const operator.
2020-06-09libgcov: fix TOPN type castingMartin Liska1-22/+27
The patch fixes tree-prof.exp tests on solaris11 and i686-linux-gnu, problem was that sizeof of a pointer is different from sizeof gcov_type. I'm going to install it if there are no objections. Thanks, Martin libgcc/ChangeLog: PR gcov-profile/95494 * libgcov-driver.c (write_top_counters): Cast first to intptr_t as sizeof(*) != sizeof(gcov_type). * libgcov.h (gcov_counter_set_if_null): Remove. (gcov_topn_add_value): Cast first to intptr_t and update linked list directly.
2020-06-03gcov: Fix build on AIXMartin Liska1-2/+20
We must guard used atomic builtins with GCOV_SUPPORTS_ATOMIC. The patch is tested on AIX and I'm going to push it. libgcc/ChangeLog: PR gcov-profile/95480 * libgcov-profiler.c (GCOV_SUPPORTS_ATOMIC): Move to... * libgcov.h (GCOV_SUPPORTS_ATOMIC): ...here. (gcov_counter_add): Use GCOV_SUPPORTS_ATOMIC guard. (gcov_counter_set_if_null): Likewise.
2020-06-02libgcov: replace malloc and calloc.Martin Liska1-1/+1
The calloc was in the original tested version of the patch and I made accidental last minute change. Installed to master as obvious. libgcc/ChangeLog: * libgcov.h (gcov_topn_add_value): Use xcalloc instead of xmalloc.
2020-06-02Make TOPN counter dynamically allocated.Martin Liska1-0/+87
gcc/ChangeLog: * coverage.c (get_coverage_counts): Skip sanity check for TOP N counters as they have variable number of counters. * gcov-dump.c (main): Add new option -r. (print_usage): Likewise. (tag_counters): All new raw format. * gcov-io.h (struct gcov_kvp): New. (GCOV_TOPN_VALUES): Remove. (GCOV_TOPN_VALUES_COUNTERS): Likewise. (GCOV_TOPN_MEM_COUNTERS): New. (GCOV_TOPN_DISK_COUNTERS): Likewise. (GCOV_TOPN_MAXIMUM_TRACKED_VALUES): Likewise. * ipa-profile.c (ipa_profile_generate_summary): Use GCOV_TOPN_MAXIMUM_TRACKED_VALUES. (ipa_profile_write_edge_summary): Likewise. (ipa_profile_read_edge_summary): Likewise. (ipa_profile): Remove usage of GCOV_TOPN_VALUES. * profile.c (sort_hist_values): Sort variable number of counters. (compute_value_histograms): Special case for TOP N counters that have dynamic number of key-value pairs. * value-prof.c (dump_histogram_value): Dump variable number of key-value pairs. (stream_in_histogram_value): Stream in variable number of key-value pairs for TOP N counter. (get_nth_most_common_value): Deal with variable number of key-value pairs. (dump_ic_profile): Use GCOV_TOPN_MAXIMUM_TRACKED_VALUES for loop iteration. (gimple_find_values_to_profile): Set GCOV_TOPN_MEM_COUNTERS to n_counters. * doc/gcov-dump.texi: Document new -r option. libgcc/ChangeLog: * libgcov-driver.c (prune_topn_counter): Remove. (prune_counters): Likewise. (merge_one_data): Special case TOP N counters as they have variable length. (write_top_counters): New. (write_one_data): Special case TOP N. (dump_one_gcov): Do not prune TOP N counters. * libgcov-merge.c (merge_topn_values_set): Remove. (__gcov_merge_topn): Use gcov_topn_add_value. * libgcov-profiler.c (__gcov_topn_values_profiler_body): Likewise here. * libgcov.h (gcov_counter_add): New. (gcov_counter_set_if_null): Likewise. (gcov_topn_add_value): New.
2020-05-28gcov-tool: Flexible endian adjustment for merging coverage dataMartin Liska1-1/+1
gcc/ChangeLog: 2020-05-27 Dong JianQiang <dongjianqiang2@huawei.com> PR gcov-profile/95332 * gcov-io.c (gcov_var::endian): Move field. (from_file): Add IN_GCOV_TOOL check. * gcov-io.h (gcov_magic): Ditto. libgcc/ChangeLog: 2020-05-27 Dong JianQiang <dongjianqiang2@huawei.com> PR gcov-profile/95332 * libgcov-util.c (read_gcda_file): Call gcov_magic. * libgcov.h (gcov_magic): Disable GCC poison.
2020-05-05Do locking for __gcov_dump and __gcov_reset as well.Martin Liska1-0/+6
PR gcov-profile/93623 * Makefile.in: Add _gcov_lock_unlock to LIBGCOV_INTERFACE. * libgcov-interface.c (ALIAS_void_fn): Remove. (__gcov_lock): New. (__gcov_unlock): New. (__gcov_flush): Use __gcov_lock and __gcov_unlock. (__gcov_reset): Likewise. (__gcov_dump): Likewise. * libgcov.h (__gcov_lock): New declaration. (__gcov_unlock): Likewise.
2020-01-27Add __gcov_indirect_call_profiler_v4_atomic.Martin Liska1-0/+1
PR gcov-profile/93403 * tree-profile.c (gimple_init_gcov_profiler): Generate both __gcov_indirect_call_profiler_v4 and __gcov_indirect_call_profiler_v4_atomic. PR gcov-profile/93403 * libgcov-profiler.c (__gcov_indirect_call_profiler_v4): Call __gcov_indirect_call_profiler_body. (__gcov_indirect_call_profiler_body): New. (__gcov_indirect_call_profiler_v4_atomic): New. * libgcov.h (__gcov_indirect_call_profiler_v4_atomic): New declaration.
2020-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r279813
2019-07-03Rename SINGE_VALUE to TOPN_VALUES counters.Martin Liska1-5/+5
2019-07-03 Martin Liska <mliska@suse.cz> * gcov-counter.def (GCOV_COUNTER_V_SINGLE): Remove. (GCOV_COUNTER_V_TOPN): New. (GCOV_COUNTER_V_INDIR): Use _topn. * gcov-io.h (GCOV_DISK_SINGLE_VALUES): Remove. (GCOV_TOPN_VALUES): New. (GCOV_SINGLE_VALUE_COUNTERS): Remove. (GCOV_TOPN_VALUES_COUNTERS): New. * profile.c (instrument_values): Use HIST_TYPE_TOPN_VALUES. * tree-profile.c: (gimple_init_gcov_profiler): Rename variables from one_value to topn_values. (gimple_gen_one_value_profiler): Remove. (gimple_gen_topn_values_profiler): New function. * value-prof.c (dump_histogram_value): Use TOPN_VALUES names instead of SINGLE_VALUE. (stream_out_histogram_value): Likewise. (stream_in_histogram_value): Likewise. (get_most_common_single_value): Likewise. (gimple_divmod_fixed_value_transform): Likewise. (gimple_stringops_transform): Likewise. (gimple_divmod_values_to_profile): Likewise. (gimple_stringops_values_to_profile): Likewise. (gimple_find_values_to_profile): Likewise. * value-prof.h (enum hist_type): Rename to TOPN. (gimple_gen_one_value_profiler): Remove. (gimple_gen_topn_values_profiler): New. 2019-07-03 Martin Liska <mliska@suse.cz> * Makefile.in: Use topn_values instead of one_value names. * libgcov-merge.c (__gcov_merge_single): Move to ... (__gcov_merge_topn): ... this. (merge_single_value_set): Move to ... (merge_topn_values_set): ... this. * libgcov-profiler.c (__gcov_one_value_profiler_body): Move to ... (__gcov_topn_values_profiler_body): ... this. (__gcov_one_value_profiler_v2): Move to ... (__gcov_topn_values_profiler): ... this. (__gcov_one_value_profiler_v2_atomic): Move to ... (__gcov_topn_values_profiler_atomic): ... this. (__gcov_indirect_call_profiler_v4): Remove. * libgcov-util.c (__gcov_single_counter_op): Move to ... (__gcov_topn_counter_op): ... this. * libgcov.h (L_gcov_merge_single): Remove. (L_gcov_merge_topn): New. (__gcov_merge_single): Remove. (__gcov_merge_topn): New. (__gcov_one_value_profiler_v2): Move to .. (__gcov_topn_values_profiler): ... this. (__gcov_one_value_profiler_v2_atomic): Move to ... (__gcov_topn_values_profiler_atomic): ... this. From-SVN: r273005
2019-06-10Add missing ATTR_UNUSED (PR bootstrap/90808).Martin Liska1-1/+1
2019-06-10 Martin Liska <mliska@suse.cz> PR bootstrap/90808 * libgcov.h: Add ATTRIBUTE_UNUSED. From-SVN: r272114
2019-06-10Implement N disk counters for single value and indirect call counters.Martin Liska1-3/+26
2019-06-10 Martin Liska <mliska@suse.cz> * gcov-io.h (GCOV_DISK_SINGLE_VALUES): New. (GCOV_SINGLE_VALUE_COUNTERS): Likewise. * ipa-profile.c (ipa_profile_generate_summary): Use get_most_common_single_value. * tree-profile.c (gimple_init_gcov_profiler): Instrument with __gcov_one_value_profiler_v2 and __gcov_indirect_call_profiler_v4. * value-prof.c (dump_histogram_value): Print all values for HIST_TYPE_SINGLE_VALUE. (stream_out_histogram_value): Update assert for N values. (stream_in_histogram_value): Set number of counters for HIST_TYPE_SINGLE_VALUE. (get_most_common_single_value): New. (gimple_divmod_fixed_value_transform): Use get_most_common_single_value. (gimple_ic_transform): Likewise. (gimple_stringops_transform): Likewise. (gimple_find_values_to_profile): Set number of counters for HIST_TYPE_SINGLE_VALUE. * value-prof.h (get_most_common_single_value): New. 2019-06-10 Martin Liska <mliska@suse.cz> * Makefile.in: Add __gcov_one_value_profiler_v2, __gcov_one_value_profiler_v2_atomic and __gcov_indirect_call_profiler_v4. * libgcov-merge.c (__gcov_merge_single): Change function signature. (merge_single_value_set): New. * libgcov-profiler.c (__gcov_one_value_profiler_body): Update functionality. (__gcov_one_value_profiler): Remove. (__gcov_one_value_profiler_v2): ... this. (__gcov_one_value_profiler_atomic): Rename to ... (__gcov_one_value_profiler_v2_atomic): this. (__gcov_indirect_call_profiler_v3): Rename to ... (__gcov_indirect_call_profiler_v4): ... this. * libgcov.h (__gcov_one_value_profiler): Remove. (__gcov_one_value_profiler_atomic): Remove. (__gcov_one_value_profiler_v2_atomic): New. (__gcov_indirect_call_profiler_v3): Remove. (__gcov_one_value_profiler_v2): New. (__gcov_indirect_call_profiler_v4): New. (gcov_get_counter_ignore_scaling): New function. From-SVN: r272106
2019-06-07Remove indirect call top N counter type.Martin Liska1-7/+0
2019-06-07 Martin Liska <mliska@suse.cz> * doc/invoke.texi: Remove param. * gcov-counter.def (GCOV_COUNTER_ICALL_TOPNV): Remove. * gcov-io.h (GCOV_ICALL_TOPN_VAL): Likewise. (GCOV_ICALL_TOPN_NCOUNTS): Likewise. * params.def (PARAM_INDIR_CALL_TOPN_PROFILE): Likewise. * profile.c (instrument_values): Remove HIST_TYPE_INDIR_CALL_TOPN. * tree-profile.c (init_ic_make_global_vars): Always build __gcov_indirect_call only. (gimple_init_gcov_profiler): Remove usage of PARAM_INDIR_CALL_TOPN_PROFILE. (gimple_gen_ic_profiler): Likewise. * value-prof.c (dump_histogram_value): Likewise. (stream_in_histogram_value): Likewise. (gimple_indirect_call_to_profile): Likewise. (gimple_find_values_to_profile): Likewise. * value-prof.h (enum hist_type): Likewise. 2019-06-07 Martin Liska <mliska@suse.cz> * Makefile.in: Remove usage of _gcov_merge_icall_topn. * libgcov-driver.c (gcov_sort_n_vals): Remove. (gcov_sort_icall_topn_counter): Likewise. (gcov_sort_topn_counter_arrays): Likewise. (dump_one_gcov): Remove call to gcov_sort_topn_counter_arrays. * libgcov-merge.c (__gcov_merge_icall_topn): Remove. * libgcov-profiler.c (__gcov_topn_value_profiler_body): Likewise. (GCOV_ICALL_COUNTER_CLEAR_THRESHOLD): Remove. (struct indirect_call_tuple): Remove. (__gcov_indirect_call_topn_profiler): Remove. * libgcov-util.c (__gcov_icall_topn_counter_op): Remove. * libgcov.h (gcov_sort_n_vals): Remove. (L_gcov_merge_icall_topn): Likewise. (__gcov_merge_icall_topn): Likewise. (__gcov_indirect_call_topn_profiler): Likewise. From-SVN: r272030
2019-01-18Bump version of __gcov_indirect_call_profiler function as there was ABI change.Martin Liska1-1/+1
2019-01-18 Martin Liska <mliska@suse.cz> * params.def: Fix comment. * tree-profile.c (gimple_init_gcov_profiler): Bump function name. (gimple_gen_ic_func_profiler): Likewise. 2019-01-18 Martin Liska <mliska@suse.cz> * gcc.dg/no_profile_instrument_function-attr-1.c: Update expected function name. 2019-01-18 Martin Liska <mliska@suse.cz> * libgcov-profiler.c (__gcov_indirect_call_profiler_v2): Rename to ... (__gcov_indirect_call_profiler_v3): ... this. * libgcov.h (__gcov_indirect_call_profiler_v2): Likewise. (__gcov_indirect_call_profiler_v3): Likewise. * Makefile.in: Bump function name. From-SVN: r268071
2019-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r267494
2018-10-04Fix divergence in indirect profiling (PR gcov-profile/84107).Martin Liska1-0/+9
2018-10-04 Martin Liska <mliska@suse.cz> PR gcov-profile/84107 * tree-profile.c (init_ic_make_global_vars): Remove ic_void_ptr_var and ic_gcov_type_ptr_var. Come up with new ic_tuple* variables. Emit __gcov_indirect_call{,_topn} variables. (gimple_gen_ic_profiler): Access the variable and emit gimple. (gimple_gen_ic_func_profiler): Access __gcov_indirect_call.callee field. (gimple_init_gcov_profiler): Use ptr_type_node. * value-prof.c (gimple_ic): Use ptr_type_node. 2018-10-04 Martin Liska <mliska@suse.cz> PR gcov-profile/84107 * libgcov-profiler.c (__gcov_indirect_call): Change type to indirect_call_tuple. (struct indirect_call_tuple): New struct. (__gcov_indirect_call_topn_profiler): Change type. (__gcov_indirect_call_profiler_v2): Use the new variables. * libgcov.h (struct indirect_call_tuple): New struct definition. From-SVN: r264840
2018-01-03Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r256169
2017-06-21re PR gcov-profile/81080 (target libgcov not built with large file support)Richard Biener1-0/+1
2017-06-21 Richard Biener <rguenther@suse.de> PR gcov-profile/81080 * configure.ac: Add AC_SYS_LARGEFILE. * libgcov.h: Include auto-target.h before tsystem.h to pick up _FILE_OFFSET_BITS which might differ for multilibs. * config.in: Regenerate. * configure: Likewise. From-SVN: r249435
2017-04-19Introduce gcov.h header file (PR gcov-profile/80435).Martin Liska1-5/+1
2017-04-19 Martin Liska <mliska@suse.cz> PR gcov-profile/80435 * Makefile.in: Install gcov.h. * gcov.h: New file. * libgcov.h: Use the header and make __gcov_flush publicly visible. From-SVN: r246990
2017-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r243994
2016-09-27gcov: dump in a static dtor instead of in an atexit handlerMartin Liska1-0/+3
PR gcov-profile/7970 PR gcov-profile/16855 PR gcov-profile/44779 * g++.dg/gcov/pr16855.C: New test. * coverage.c (build_gcov_exit_decl): New function. (coverage_obj_init): Call the function and generate __gcov_exit destructor. * doc/gcov.texi: Document when __gcov_exit function is called. * libgcov-driver.c (__gcov_init): Do not register a atexit handler. (__gcov_exit): Rename from gcov_exit. * libgcov.h (__gcov_exit): Declare. From-SVN: r240529
2016-09-27Remove __gcov_merge_delta (PR bootstrap/77749)Martin Liska1-5/+0
PR bootstrap/77749 * gcov-counter.def: Remove GCOV_COUNTER_V_DELTA. PR bootstrap/77749 * Makefile.in: Remove _gcov_merge_delta. * libgcov-merge.c (void __gcov_merge_delta): Remove. * libgcov-util.c (__gcov_delta_counter_op): Remove. * libgcov.h: Remove declaration of __gcov_merge_delta. From-SVN: r240524
2016-08-10Add new *_atomic counter update functionMartin Liska1-0/+7
PR gcov-profile/58306 * Makefile.in: New functions (modules) are added. * libgcov-profiler.c (__gcov_interval_profiler_atomic): New function. (__gcov_pow2_profiler_atomic): New function. (__gcov_one_value_profiler_body): New argument is instroduced. (__gcov_one_value_profiler): Call with the new argument. (__gcov_one_value_profiler_atomic): Likewise. (__gcov_indirect_call_profiler_v2): Likewise. (__gcov_time_profiler_atomic): New function. (__gcov_average_profiler_atomic): Likewise. (__gcov_ior_profiler_atomic): Likewise. * libgcov.h: Declare the aforementioned functions. PR gcov-profile/58306 * gcc.dg/tree-prof/val-profiler-threads-1.c: New test. PR gcov-profile/58306 * tree-profile.c (gimple_init_edge_profiler): Create conditionally atomic variants of profile update functions. From-SVN: r239324
2016-08-09Remove __gcov_indirect_call_profilerMartin Liska1-2/+0
* Makefile.in: Remove __gcov_indirect_call_profiler. * libgcov-profiler.c (__gcov_indirect_call_profiler): Remove function. * libgcov.h: And the declaration of the function. From-SVN: r239306
2016-01-04Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r232055
2015-11-07replace BITS_PER_UNIT with __CHAR_BIT__ in target libsTrevor Saunders1-2/+2
libgcc/ChangeLog: 2015-11-07 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * config/visium/lib2funcs.c (__set_trampoline_parity): Use __CHAR_BIT__ instead of BITS_PER_UNIT. * fixed-bit.h: Likewise. * fp-bit.h: Likewise. * libgcc2.c (__popcountSI2): Likewise. (__popcountDI2): Likewise. * libgcc2.h: Likewise. * libgcov.h: Likewise. libobjc/ChangeLog: 2015-11-07 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> PR libobjc/24775 * encoding.c (_darwin_rs6000_special_round_type_align): Use __CHAR_BIT__ instead of BITS_PER_UNIT. (objc_sizeof_type): Likewise. (objc_layout_structure): Likewise. (objc_layout_structure_next_member): Likewise. (objc_layout_finish_structure): Likewise. (objc_layout_structure_get_info): Likewise. From-SVN: r229936
2015-01-05Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r219188
2014-10-07Makefile.in: Fix dependence.Rong Xu1-0/+7
2014-10-06 Rong Xu <xur@google.com> * gcc/Makefile.in: Fix dependence. * gcc/gcov-counter.def (GCOV_COUNTER_ICALL_TOPNV): Add indirect call topn profiler. * gcc/gcov-io.h: Ditto. * libgcc/Makefile.in: Ditto. * libgcc/libgcov-driver.c (gcov_sort_n_vals): New utility function. (gcov_sort_icall_topn_counter): Ditto. (gcov_sort_topn_counter_arrays): Ditto. (dump_one_gcov): Sort indirect_call topn counters. * libgcc/libgcov-merge.c (__gcov_merge_icall_topn): New merge function. * libgcc/libgcov-profiler.c (__gcov_topn_value_profiler_body): New utility function. (__gcov_indirect_call_topn_profiler): New profiler function. * libgcc/libgcov-util.c (__gcov_icall_topn_counter_op): New. * libgcc/libgcov.h: New decls. From-SVN: r215962
2014-09-17Makefile.in (LIBGCOV_INTERFACE): Add _gcov_dump from ...Nathan Sidwell1-1/+13
* Makefile.in (LIBGCOV_INTERFACE): Add _gcov_dump from ... (LIBGCOV_DRIVER): ... here. * libgcov-driver.c (gcov_master): New. (gcov_exit): Remove from master chain. (__gcov_init): Add to master chain if version compatible. Don't clear the version. * libgcov_interface (__gcov_flust): Call gcov_dump_int. (gcov_reset_int): Clear master chain, if compatible. (gcov_dump_int): New internal interface. Dump master chain, if compatible. (gcov_dump): Alias for gcov_dump_int. * libgcov.h (struct gcov_root): Add next and prev fields. (struct gcov_master): New struct. (__gcov_master): New. (gcov_dump_int): Declare. From-SVN: r215337
2014-09-03libgcov-interface.c (STRONG_ALIAS): New.Nathan Sidwell1-1/+3
* libgcov-interface.c (STRONG_ALIAS): New. (__gcov_flush): Call __gcov_reset_int. (__gcov_reset): Strong alias for ... (__gcov_reset_ing): ... this renamed hidden version. * libgcov.h (__gcov_reset_int): New declaration. From-SVN: r214840
2014-08-07Makefile.in (LIBGCOV_INTERFACE): Move _gcov_dump ...Nathan Sidwell1-1/+13
* Makefile.in (LIBGCOV_INTERFACE): Move _gcov_dump ... (LIBGCOV_DRIVER): ... to here. * libgcov.h (gcov_do_dump): New #define. (struct gcov_root): New. (__gcov_root): New declaration. (__gcov_dump_one): Declare. * libgcov-driver.c (gcov_list, gcov_dump_complete, run_accounted): Delete. (gcov_compute_histogram): Add LIST argument, adjust. (compute_summary): Adjust gcov_compute_histogram call. (gcov_do_dump): Not hidden, static in libgcov. (gcov_clear): Move to interface.c. (__gcov_dump_one): New, broken out of ... (gcov_exit): ... here. Make static. (__gcov_root): New. (__gcov_init): Adjust. * libgcov-interface.c (gcov_clear, gcov_exit): Remove declarations. (__gcov_flush): Use __gcov_dump_one and __gcov_reset. (gcov_clear): Moved from driver.c. Add LIST argument. (__gcov_reset): Adjust for changed interfaces. (__gcov_fork): Remove local declaration of __gcov_flush_mx. From-SVN: r213719