aboutsummaryrefslogtreecommitdiff
path: root/gcc/predict.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2013-03-29 19:07:34 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2013-03-29 18:07:34 +0000
commit0208f7dab09ed1ceb3fcfceff049e24cc05d69fa (patch)
tree9b74c5279cc4912f4df1c50d5e555c5dc9cf64ef /gcc/predict.c
parent5a6ccc943fa6c7f121a47e96a19d73a7531de311 (diff)
downloadgcc-0208f7dab09ed1ceb3fcfceff049e24cc05d69fa.zip
gcc-0208f7dab09ed1ceb3fcfceff049e24cc05d69fa.tar.gz
gcc-0208f7dab09ed1ceb3fcfceff049e24cc05d69fa.tar.bz2
lto-cgraph.c (output_profile_summary, [...]): Use gcov streaming; stream hot bb threshold to ltrans.
* lto-cgraph.c (output_profile_summary, input_profile_summary): Use gcov streaming; stream hot bb threshold to ltrans. * predict.c (get_hot_bb_threshold): Break out from .... (maybe_hot_count_p): ... here. (set_hot_bb_threshold): New function. * lto-section-in.c (lto_section_name): Add profile. * profile.h (get_hot_bb_threshold, set_hot_bb_threshold): Declare. * ipa.c: Include hash-table.h, tree-inline.h, profile.h, lto-streamer.h and data-streamer.h (histogram_entry): New structure. (histogram, histogram_pool): New global vars. (histogram_hash): New structure. (histogram_hash::hash): New method. (histogram_hash::equal): Likewise. (account_time_size): New function. (cmp_counts): New function. (dump_histogram): New function. (ipa_profile_generate_summary): New function. (ipa_profile_write_summary): New function. (ipa_profile_read_summary): New function. (ipa_profile): Decide on threshold. (pass_ipa_profile): Add ipa_profile_write_summary and ipa_profile_read_summary. * Makefile.in (ipa.o): Update dependencies. * lto-streamer.h (LTO_section_ipa_profile): New section. From-SVN: r197243
Diffstat (limited to 'gcc/predict.c')
-rw-r--r--gcc/predict.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/gcc/predict.c b/gcc/predict.c
index 57975d1..5394ef5 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -128,25 +128,42 @@ maybe_hot_frequency_p (struct function *fun, int freq)
return true;
}
+static gcov_type min_count = -1;
+
+/* Determine the threshold for hot BB counts. */
+
+gcov_type
+get_hot_bb_threshold ()
+{
+ gcov_working_set_t *ws;
+ if (min_count == -1)
+ {
+ ws = find_working_set (PARAM_VALUE (HOT_BB_COUNT_WS_PERMILLE));
+ gcc_assert (ws);
+ min_count = ws->min_counter;
+ }
+ return min_count;
+}
+
+/* Set the threshold for hot BB counts. */
+
+void
+set_hot_bb_threshold (gcov_type min)
+{
+ min_count = min;
+}
+
/* Return TRUE if frequency FREQ is considered to be hot. */
static inline bool
maybe_hot_count_p (struct function *fun, gcov_type count)
{
- gcov_working_set_t *ws;
- static gcov_type min_count = -1;
if (fun && profile_status_for_function (fun) != PROFILE_READ)
return true;
/* Code executed at most once is not hot. */
if (profile_info->runs >= count)
return false;
- if (min_count == -1)
- {
- ws = find_working_set (PARAM_VALUE (HOT_BB_COUNT_WS_PERMILLE));
- gcc_assert (ws);
- min_count = ws->min_counter;
- }
- return (count >= min_count);
+ return (count >= get_hot_bb_threshold ());
}
/* Return true in case BB can be CPU intensive and should be optimized