aboutsummaryrefslogtreecommitdiff
path: root/gcc/profile-count.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2017-11-13 18:23:25 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2017-11-13 17:23:25 +0000
commit41f0e8194de366399afb726a6862843d81f896a3 (patch)
tree6ecf459f42e8a834a49fe66dca8ae9575c9b5b31 /gcc/profile-count.c
parent8f2b097ed54816d28cd51254c8e4616404ae348e (diff)
downloadgcc-41f0e8194de366399afb726a6862843d81f896a3.zip
gcc-41f0e8194de366399afb726a6862843d81f896a3.tar.gz
gcc-41f0e8194de366399afb726a6862843d81f896a3.tar.bz2
cgraph.c (cgraph_edge::sreal_frequency): New function.
* cgraph.c (cgraph_edge::sreal_frequency): New function. * cgraph.h (cgraph_edge::sreal_frequency): Declare. * ipa-fnsummary.c (dump_ipa_call_summary): Use sreal_frequency. (estimate_edge_size_and_time): Likewise. (ipa_merge_fn_summary_after_inlining): Likewise. * ipa-inline.c (cgraph_freq_base_rec): Remove. (compute_uninlined_call_time): Use sreal_frequency. (compute_inlined_call_time): Likewise. (ipa_inline): Do not initialize cgraph_freq_base_rec. * profile-count.c: Include sreal.h. (profile_count::to_sreal_scale): New. * profile-count.h: Forward declare sreal. (profile_count::to_sreal_scale): Declare. From-SVN: r254696
Diffstat (limited to 'gcc/profile-count.c')
-rw-r--r--gcc/profile-count.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/profile-count.c b/gcc/profile-count.c
index 9c57323..51c3b74 100644
--- a/gcc/profile-count.c
+++ b/gcc/profile-count.c
@@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see
#include "data-streamer.h"
#include "cgraph.h"
#include "wide-int.h"
+#include "sreal.h"
/* Dump THIS to F. */
@@ -256,6 +257,32 @@ profile_count::to_cgraph_frequency (profile_count entry_bb_count) const
return MIN (scale, CGRAPH_FREQ_MAX);
}
+/* Return THIS/IN as sreal value. */
+
+sreal
+profile_count::to_sreal_scale (profile_count in, bool *known) const
+{
+ if (!initialized_p ())
+ {
+ if (known)
+ *known = false;
+ return CGRAPH_FREQ_BASE;
+ }
+ if (known)
+ *known = true;
+ if (*this == profile_count::zero ())
+ return 0;
+ gcc_checking_assert (in.initialized_p ());
+
+ if (!in.m_val)
+ {
+ if (!m_val)
+ return 1;
+ return m_val * 4;
+ }
+ return (sreal)m_val / (sreal)in.m_val;
+}
+
/* We want to scale profile across function boundary from NUM to DEN.
Take care of the side case when DEN is zeros. We still want to behave
sanely here which means