diff options
Diffstat (limited to 'gcc/profile-count.h')
-rw-r--r-- | gcc/profile-count.h | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/gcc/profile-count.h b/gcc/profile-count.h index 66a217d..2ffa33f 100644 --- a/gcc/profile-count.h +++ b/gcc/profile-count.h @@ -36,22 +36,24 @@ enum profile_quality { Never used by probabilities. */ profile_guessed_global0 = 1, + /* Same as profile_guessed_global0 but global count is adjusted 0. */ + profile_guessed_global0adjusted = 2, /* Profile is based on static branch prediction heuristics. It may or may not reflect the reality but it can be compared interprocedurally (for example, we inlined function w/o profile feedback into function with feedback and propagated from that). Never used by probablities. */ - profile_guessed = 2, + profile_guessed = 3, /* Profile was determined by autofdo. */ - profile_afdo = 3, + profile_afdo = 4, /* Profile was originally based on feedback but it was adjusted by code duplicating optimization. It may not precisely reflect the particular code path. */ - profile_adjusted = 4, + profile_adjusted = 5, /* Profile was read from profile feedback or determined by accurate static method. */ - profile_precise = 5 + profile_precise = 7 }; /* The base value for branch probability notes and edge probabilities. */ @@ -637,6 +639,13 @@ public: { return from_gcov_type (0); } + static profile_count adjusted_zero () + { + profile_count c; + c.m_val = 0; + c.m_quality = profile_adjusted; + return c; + } static profile_count guessed_zero () { profile_count c; @@ -978,7 +987,7 @@ public: return ret; } - /* We know that profile is globally0 but keep local profile if present. */ + /* We know that profile is globally 0 but keep local profile if present. */ profile_count global0 () const { profile_count ret = *this; @@ -988,6 +997,17 @@ public: return ret; } + /* We know that profile is globally adjusted 0 but keep local profile + if present. */ + profile_count global0adjusted () const + { + profile_count ret = *this; + if (!initialized_p ()) + return *this; + ret.m_quality = profile_guessed_global0adjusted; + return ret; + } + /* Return THIS with quality dropped to GUESSED. */ profile_count guessed () const { @@ -1000,10 +1020,12 @@ public: acorss functions. */ profile_count ipa () const { - if (m_quality > profile_guessed_global0) + if (m_quality > profile_guessed_global0adjusted) return *this; if (m_quality == profile_guessed_global0) return profile_count::zero (); + if (m_quality == profile_guessed_global0adjusted) + return profile_count::adjusted_zero (); return profile_count::uninitialized (); } @@ -1054,6 +1076,13 @@ public: kinds. */ static void adjust_for_ipa_scaling (profile_count *num, profile_count *den); + /* THIS is a count of bb which is known to be executed IPA times. + Combine this information into bb counter. This means returning IPA + if it is nonzero, not changing anything if IPA is uninitialized + and if IPA is zero, turning THIS into corresponding local profile with + global0. */ + profile_count combine_with_ipa_count (profile_count ipa); + /* LTO streaming support. */ static profile_count stream_in (struct lto_input_block *); void stream_out (struct output_block *); |