summaryrefslogtreecommitdiff
path: root/libgcc/libgcov-profiler.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2019-07-03 14:42:23 +0200
committerMartin Liska <marxin@gcc.gnu.org>2019-07-03 12:42:23 +0000
commit596341c741a4a746497a1da8322fce0ad625e26b (patch)
tree2161db916022c10dfedcbf3106d2e14523a81620 /libgcc/libgcov-profiler.c
parent1b309ca5edddd6bf8051993876df5f123394bc79 (diff)
Rename SINGE_VALUE to TOPN_VALUES counters.
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
Diffstat (limited to 'libgcc/libgcov-profiler.c')
-rw-r--r--libgcc/libgcov-profiler.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/libgcc/libgcov-profiler.c b/libgcc/libgcov-profiler.c
index 04d6f9c0e40..8f877a95980 100644
--- a/libgcc/libgcov-profiler.c
+++ b/libgcc/libgcov-profiler.c
@@ -106,17 +106,11 @@ __gcov_pow2_profiler_atomic (gcov_type *counters, gcov_type value)
#endif
-/* Tries to determine the most common value among its inputs. Checks if the
- value stored in COUNTERS[0] matches VALUE. If this is the case, COUNTERS[1]
- is incremented. If this is not the case and COUNTERS[1] is not zero,
- COUNTERS[1] is decremented. Otherwise COUNTERS[1] is set to one and
- VALUE is stored to COUNTERS[0]. This algorithm guarantees that if this
- function is called more than 50% of the time with one value, this value
- will be in COUNTERS[0] in the end. */
+/* Tries to determine N most commons value among its inputs. */
static inline void
-__gcov_one_value_profiler_body (gcov_type *counters, gcov_type value,
- int use_atomic)
+__gcov_topn_values_profiler_body (gcov_type *counters, gcov_type value,
+ int use_atomic)
{
if (use_atomic)
__atomic_fetch_add (&counters[0], 1, __ATOMIC_RELAXED);
@@ -125,11 +119,11 @@ __gcov_one_value_profiler_body (gcov_type *counters, gcov_type value,
++counters;
- /* We have GCOV_DISK_SINGLE_VALUES as we can keep multiple values
+ /* We have GCOV_TOPN_VALUES as we can keep multiple values
next to each other. */
unsigned sindex = 0;
- for (unsigned i = 0; i < GCOV_DISK_SINGLE_VALUES; i++)
+ for (unsigned i = 0; i < GCOV_TOPN_VALUES; i++)
{
if (value == counters[2 * i])
{
@@ -158,15 +152,15 @@ __gcov_one_value_profiler_body (gcov_type *counters, gcov_type value,
counters[2 * sindex + 1]--;
}
-#ifdef L_gcov_one_value_profiler_v2
+#ifdef L_gcov_topn_values_profiler
void
-__gcov_one_value_profiler_v2 (gcov_type *counters, gcov_type value)
+__gcov_topn_values_profiler (gcov_type *counters, gcov_type value)
{
- __gcov_one_value_profiler_body (counters, value, 0);
+ __gcov_topn_values_profiler_body (counters, value, 0);
}
#endif
-#if defined(L_gcov_one_value_profiler_v2_atomic) && GCOV_SUPPORTS_ATOMIC
+#if defined(L_gcov_topn_values_profiler_atomic) && GCOV_SUPPORTS_ATOMIC
/* Update one value profilers (COUNTERS) for a given VALUE.
@@ -178,9 +172,9 @@ __gcov_one_value_profiler_v2 (gcov_type *counters, gcov_type value)
https://gcc.gnu.org/ml/gcc-patches/2016-08/msg00024.html. */
void
-__gcov_one_value_profiler_v2_atomic (gcov_type *counters, gcov_type value)
+__gcov_topn_values_profiler_atomic (gcov_type *counters, gcov_type value)
{
- __gcov_one_value_profiler_body (counters, value, 1);
+ __gcov_topn_values_profiler_body (counters, value, 1);
}
#endif
@@ -214,7 +208,7 @@ __gcov_indirect_call_profiler_v4 (gcov_type value, void* cur_func)
if (cur_func == __gcov_indirect_call.callee
|| (__LIBGCC_VTABLE_USES_DESCRIPTORS__
&& *(void **) cur_func == *(void **) __gcov_indirect_call.callee))
- __gcov_one_value_profiler_body (__gcov_indirect_call.counters, value, 0);
+ __gcov_topn_values_profiler_body (__gcov_indirect_call.counters, value, 0);
__gcov_indirect_call.callee = NULL;
}