diff options
Diffstat (limited to 'gcc/profile-count.h')
-rw-r--r-- | gcc/profile-count.h | 46 |
1 files changed, 43 insertions, 3 deletions
diff --git a/gcc/profile-count.h b/gcc/profile-count.h index 7c66f8d..be6e2d5 100644 --- a/gcc/profile-count.h +++ b/gcc/profile-count.h @@ -185,7 +185,7 @@ public: static profile_probability very_unlikely () { /* Be consistent with PROB_VERY_UNLIKELY in predict.h. */ - profile_probability r = guessed_always ().apply_scale (1, 2000); + profile_probability r = guessed_always () / 2000; r.m_val--; return r; } @@ -193,14 +193,14 @@ public: static profile_probability unlikely () { /* Be consistent with PROB_VERY_LIKELY in predict.h. */ - profile_probability r = guessed_always ().apply_scale (1, 5); + profile_probability r = guessed_always () / 5; r.m_val--; return r; } static profile_probability even () { - return guessed_always ().apply_scale (1, 2); + return guessed_always () / 2; } static profile_probability very_likely () @@ -600,6 +600,26 @@ public: return initialized_p () && other.initialized_p () && m_val >= other.m_val; } + profile_probability operator* (int64_t num) const + { + return apply_scale (num, 1); + } + + profile_probability operator*= (int64_t den) const + { + return *this * den; + } + + profile_probability operator/ (int64_t den) const + { + return apply_scale (1, den); + } + + profile_probability operator/= (int64_t den) const + { + return *this / den; + } + /* Get the value of the count. */ uint32_t value () const { return m_val; } @@ -992,6 +1012,26 @@ public: return ipa ().initialized_p () && ipa ().m_val >= (uint64_t) other; } + profile_count operator* (int64_t num) const + { + return apply_scale (num, 1); + } + + profile_count operator*= (int64_t den) const + { + return *this * den; + } + + profile_count operator/ (int64_t den) const + { + return apply_scale (1, den); + } + + profile_count operator/= (int64_t den) const + { + return *this / den; + } + /* Return true when value is not zero and can be used for scaling. This is different from *this > 0 because that requires counter to be IPA. */ |