aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto-cgraph.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/lto-cgraph.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/lto-cgraph.c')
-rw-r--r--gcc/lto-cgraph.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 6d639a9..c619197 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -604,11 +604,11 @@ output_profile_summary (struct lto_simple_output_block *ob)
units. */
gcc_assert (profile_info->runs);
streamer_write_uhwi_stream (ob->main_stream, profile_info->runs);
- streamer_write_uhwi_stream (ob->main_stream, profile_info->sum_max);
+ streamer_write_gcov_count_stream (ob->main_stream, profile_info->sum_max);
/* sum_all is needed for computing the working set with the
histogram. */
- streamer_write_uhwi_stream (ob->main_stream, profile_info->sum_all);
+ streamer_write_gcov_count_stream (ob->main_stream, profile_info->sum_all);
/* Create and output a bitpack of non-zero histogram entries indices. */
bp = bitpack_create (ob->main_stream);
@@ -620,13 +620,18 @@ output_profile_summary (struct lto_simple_output_block *ob)
{
if (!profile_info->histogram[h_ix].num_counters)
continue;
- streamer_write_uhwi_stream (ob->main_stream,
+ streamer_write_gcov_count_stream (ob->main_stream,
profile_info->histogram[h_ix].num_counters);
- streamer_write_uhwi_stream (ob->main_stream,
+ streamer_write_gcov_count_stream (ob->main_stream,
profile_info->histogram[h_ix].min_value);
- streamer_write_uhwi_stream (ob->main_stream,
+ streamer_write_gcov_count_stream (ob->main_stream,
profile_info->histogram[h_ix].cum_value);
- }
+ }
+ /* IPA-profile computes hot bb threshold based on cumulated
+ whole program profile. We need to stream it down to ltrans. */
+ if (flag_wpa)
+ streamer_write_gcov_count_stream (ob->main_stream,
+ get_hot_bb_threshold ());
}
else
streamer_write_uhwi_stream (ob->main_stream, 0);
@@ -1259,8 +1264,8 @@ input_profile_summary (struct lto_input_block *ib,
if (runs)
{
file_data->profile_info.runs = runs;
- file_data->profile_info.sum_max = streamer_read_uhwi (ib);
- file_data->profile_info.sum_all = streamer_read_uhwi (ib);
+ file_data->profile_info.sum_max = streamer_read_gcov_count (ib);
+ file_data->profile_info.sum_all = streamer_read_gcov_count (ib);
memset (file_data->profile_info.histogram, 0,
sizeof (gcov_bucket_type) * GCOV_HISTOGRAM_SIZE);
@@ -1279,12 +1284,16 @@ input_profile_summary (struct lto_input_block *ib,
continue;
file_data->profile_info.histogram[h_ix].num_counters
- = streamer_read_uhwi (ib);
+ = streamer_read_gcov_count (ib);
file_data->profile_info.histogram[h_ix].min_value
- = streamer_read_uhwi (ib);
+ = streamer_read_gcov_count (ib);
file_data->profile_info.histogram[h_ix].cum_value
- = streamer_read_uhwi (ib);
+ = streamer_read_gcov_count (ib);
}
+ /* IPA-profile computes hot bb threshold based on cumulated
+ whole program profile. We need to stream it down to ltrans. */
+ if (flag_ltrans)
+ set_hot_bb_threshold (streamer_read_gcov_count (ib));
}
}