aboutsummaryrefslogtreecommitdiff
path: root/gcc/value-prof.h
diff options
context:
space:
mode:
authorXiong Hu Luo <luoxhu@linux.ibm.com>2019-07-25 09:20:13 +0000
committerXiong Hu Luo <luoxhu@gcc.gnu.org>2019-07-25 09:20:13 +0000
commit982b149787057bb288caed389f231c4979e969dc (patch)
tree2a07f4c7042d98ef450b5c6e62c0f08bb7e143f4 /gcc/value-prof.h
parent25b46fc9185402b36eeab7e2ec12931bfec378ba (diff)
downloadgcc-982b149787057bb288caed389f231c4979e969dc.zip
gcc-982b149787057bb288caed389f231c4979e969dc.tar.gz
gcc-982b149787057bb288caed389f231c4979e969dc.tar.bz2
Generalize get_most_common_single_value to return n_th value & count
Currently get_most_common_single_value could only return the max hist <value, count>, add sort after reading from disk, then it return nth value in later use. Rename it to get_nth_most_common_value. gcc/ChangeLog: 2019-07-15 Xiong Hu Luo <luoxhu@linux.ibm.com> * ipa-profile.c (get_most_common_single_value): Use get_nth_most_common_value. * profile.c (sort_hist_value): New function. (compute_value_histograms): Call sort_hist_value to sort the values after loading from disk. * value-prof.c (get_most_common_single_value): Rename to ... get_nth_most_common_value. Add input params n, return the n_th value and count. (gimple_divmod_fixed_value_transform): Use get_nth_most_common_value. (gimple_ic_transform): Likewise. (gimple_stringops_transform): Likewise. * value-prof.h (get_most_common_single_value): Add input params n, default to 0. From-SVN: r273789
Diffstat (limited to 'gcc/value-prof.h')
-rw-r--r--gcc/value-prof.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/gcc/value-prof.h b/gcc/value-prof.h
index ca846d0..1078722 100644
--- a/gcc/value-prof.h
+++ b/gcc/value-prof.h
@@ -89,11 +89,10 @@ void free_histograms (function *);
void stringop_block_profile (gimple *, unsigned int *, HOST_WIDE_INT *);
gcall *gimple_ic (gcall *, struct cgraph_node *, profile_probability);
bool check_ic_target (gcall *, struct cgraph_node *);
-bool get_most_common_single_value (gimple *stmt, const char *counter_type,
- histogram_value hist,
- gcov_type *value, gcov_type *count,
- gcov_type *all);
-
+bool get_nth_most_common_value (gimple *stmt, const char *counter_type,
+ histogram_value hist, gcov_type *value,
+ gcov_type *count, gcov_type *all,
+ unsigned n = 0);
/* In tree-profile.c. */
extern void gimple_init_gcov_profiler (void);