Commit e48dc99e by Martin Liska Committed by Martin Liska

Use capital letters for enum value names.

2019-05-20  Martin Liska  <mliska@suse.cz>

	* profile-count.h (enum profile_quality): Use capital letters
	for enum value names.  Use the adjusted names.
	* profile-count.c: Use the adjusted names.

From-SVN: r271397
parent bc374246
2019-05-20 Martin Liska <mliska@suse.cz>
* profile-count.h (enum profile_quality): Use capital letters
for enum value names. Use the adjusted names.
* profile-count.c: Use the adjusted names.
2019-05-19 Segher Boessenkool <segher@kernel.crashing.org> 2019-05-19 Segher Boessenkool <segher@kernel.crashing.org>
* config/rs6000/constraints.md (define_register_constraint "wH"): * config/rs6000/constraints.md (define_register_constraint "wH"):
......
...@@ -168,11 +168,11 @@ profile_probability::dump (FILE *f) const ...@@ -168,11 +168,11 @@ profile_probability::dump (FILE *f) const
fprintf (f, "always"); fprintf (f, "always");
else else
fprintf (f, "%3.1f%%", (double)m_val * 100 / max_probability); fprintf (f, "%3.1f%%", (double)m_val * 100 / max_probability);
if (m_quality == profile_adjusted) if (m_quality == ADJUSTED)
fprintf (f, " (adjusted)"); fprintf (f, " (adjusted)");
else if (m_quality == profile_afdo) else if (m_quality == AFDO)
fprintf (f, " (auto FDO)"); fprintf (f, " (auto FDO)");
else if (m_quality == profile_guessed) else if (m_quality == GUESSED)
fprintf (f, " (guessed)"); fprintf (f, " (guessed)");
} }
} }
......
...@@ -28,35 +28,35 @@ class profile_count; ...@@ -28,35 +28,35 @@ class profile_count;
inside of classes, this is in global namespace. */ inside of classes, this is in global namespace. */
enum profile_quality { enum profile_quality {
/* Uninitialized value. */ /* Uninitialized value. */
profile_uninitialized, UNINITIALIZED_PROFILE,
/* Profile is based on static branch prediction heuristics and may /* Profile is based on static branch prediction heuristics and may
or may not match reality. It is local to function and cannot be compared or may not match reality. It is local to function and cannot be compared
inter-procedurally. Never used by probabilities (they are always local). inter-procedurally. Never used by probabilities (they are always local).
*/ */
profile_guessed_local, GUESSED_LOCAL,
/* Profile was read by feedback and was 0, we used local heuristics to guess /* Profile was read by feedback and was 0, we used local heuristics to guess
better. This is the case of functions not run in profile fedback. better. This is the case of functions not run in profile fedback.
Never used by probabilities. */ Never used by probabilities. */
profile_guessed_global0, GUESSED_GLOBAL0,
/* Same as profile_guessed_global0 but global count is adjusted 0. */ /* Same as GUESSED_GLOBAL0 but global count is adjusted 0. */
profile_guessed_global0adjusted, GUESSED_GLOBAL0_ADJUSTED,
/* Profile is based on static branch prediction heuristics. It may or may /* Profile is based on static branch prediction heuristics. It may or may
not reflect the reality but it can be compared interprocedurally not reflect the reality but it can be compared interprocedurally
(for example, we inlined function w/o profile feedback into function (for example, we inlined function w/o profile feedback into function
with feedback and propagated from that). with feedback and propagated from that).
Never used by probablities. */ Never used by probablities. */
profile_guessed, GUESSED,
/* Profile was determined by autofdo. */ /* Profile was determined by autofdo. */
profile_afdo, AFDO,
/* Profile was originally based on feedback but it was adjusted /* Profile was originally based on feedback but it was adjusted
by code duplicating optimization. It may not precisely reflect the by code duplicating optimization. It may not precisely reflect the
particular code path. */ particular code path. */
profile_adjusted, ADJUSTED,
/* Profile was read from profile feedback or determined by accurate static /* Profile was read from profile feedback or determined by accurate static
method. */ method. */
profile_precise PRECISE
}; };
extern const char *profile_quality_as_string (enum profile_quality); extern const char *profile_quality_as_string (enum profile_quality);
...@@ -105,7 +105,7 @@ safe_scale_64bit (uint64_t a, uint64_t b, uint64_t c, uint64_t *res) ...@@ -105,7 +105,7 @@ safe_scale_64bit (uint64_t a, uint64_t b, uint64_t c, uint64_t *res)
values greater than 1 needs to be represented otherwise. values greater than 1 needs to be represented otherwise.
In addition to actual value the quality of profile is tracked and propagated In addition to actual value the quality of profile is tracked and propagated
through all operations. Special value UNINITIALIZED is used for probabilities through all operations. Special value UNINITIALIZED_PROFILE is used for probabilities
that has not been determined yet (for example bacause of that has not been determined yet (for example bacause of
-fno-guess-branch-probability) -fno-guess-branch-probability)
...@@ -152,7 +152,7 @@ class GTY((user)) profile_probability ...@@ -152,7 +152,7 @@ class GTY((user)) profile_probability
friend class profile_count; friend class profile_count;
public: public:
profile_probability (): m_val (uninitialized_probability), profile_probability (): m_val (uninitialized_probability),
m_quality (profile_guessed) m_quality (GUESSED)
{} {}
profile_probability (uint32_t val, profile_quality quality): profile_probability (uint32_t val, profile_quality quality):
...@@ -164,14 +164,14 @@ public: ...@@ -164,14 +164,14 @@ public:
{ {
profile_probability ret; profile_probability ret;
ret.m_val = 0; ret.m_val = 0;
ret.m_quality = profile_precise; ret.m_quality = PRECISE;
return ret; return ret;
} }
static profile_probability guessed_never () static profile_probability guessed_never ()
{ {
profile_probability ret; profile_probability ret;
ret.m_val = 0; ret.m_val = 0;
ret.m_quality = profile_guessed; ret.m_quality = GUESSED;
return ret; return ret;
} }
static profile_probability very_unlikely () static profile_probability very_unlikely ()
...@@ -206,14 +206,14 @@ public: ...@@ -206,14 +206,14 @@ public:
{ {
profile_probability ret; profile_probability ret;
ret.m_val = max_probability; ret.m_val = max_probability;
ret.m_quality = profile_guessed; ret.m_quality = GUESSED;
return ret; return ret;
} }
static profile_probability always () static profile_probability always ()
{ {
profile_probability ret; profile_probability ret;
ret.m_val = max_probability; ret.m_val = max_probability;
ret.m_quality = profile_precise; ret.m_quality = PRECISE;
return ret; return ret;
} }
/* Probabilities which has not been initialized. Either because /* Probabilities which has not been initialized. Either because
...@@ -222,7 +222,7 @@ public: ...@@ -222,7 +222,7 @@ public:
{ {
profile_probability c; profile_probability c;
c.m_val = uninitialized_probability; c.m_val = uninitialized_probability;
c.m_quality = profile_guessed; c.m_quality = GUESSED;
return c; return c;
} }
...@@ -235,7 +235,7 @@ public: ...@@ -235,7 +235,7 @@ public:
/* Return true if value can be trusted. */ /* Return true if value can be trusted. */
bool reliable_p () const bool reliable_p () const
{ {
return m_quality >= profile_adjusted; return m_quality >= ADJUSTED;
} }
/* Conversion from and to REG_BR_PROB_BASE integer fixpoint arithmetics. /* Conversion from and to REG_BR_PROB_BASE integer fixpoint arithmetics.
...@@ -245,7 +245,7 @@ public: ...@@ -245,7 +245,7 @@ public:
profile_probability ret; profile_probability ret;
gcc_checking_assert (v >= 0 && v <= REG_BR_PROB_BASE); gcc_checking_assert (v >= 0 && v <= REG_BR_PROB_BASE);
ret.m_val = RDIV (v * (uint64_t) max_probability, REG_BR_PROB_BASE); ret.m_val = RDIV (v * (uint64_t) max_probability, REG_BR_PROB_BASE);
ret.m_quality = profile_guessed; ret.m_quality = GUESSED;
return ret; return ret;
} }
int to_reg_br_prob_base () const int to_reg_br_prob_base () const
...@@ -286,7 +286,7 @@ public: ...@@ -286,7 +286,7 @@ public:
gcc_checking_assert (tmp <= max_probability); gcc_checking_assert (tmp <= max_probability);
ret.m_val = tmp; ret.m_val = tmp;
} }
ret.m_quality = profile_precise; ret.m_quality = PRECISE;
return ret; return ret;
} }
...@@ -362,7 +362,7 @@ public: ...@@ -362,7 +362,7 @@ public:
return profile_probability::uninitialized (); return profile_probability::uninitialized ();
profile_probability ret; profile_probability ret;
ret.m_val = RDIV ((uint64_t)m_val * other.m_val, max_probability); ret.m_val = RDIV ((uint64_t)m_val * other.m_val, max_probability);
ret.m_quality = MIN (MIN (m_quality, other.m_quality), profile_adjusted); ret.m_quality = MIN (MIN (m_quality, other.m_quality), ADJUSTED);
return ret; return ret;
} }
profile_probability &operator*= (const profile_probability &other) profile_probability &operator*= (const profile_probability &other)
...@@ -375,7 +375,7 @@ public: ...@@ -375,7 +375,7 @@ public:
else else
{ {
m_val = RDIV ((uint64_t)m_val * other.m_val, max_probability); m_val = RDIV ((uint64_t)m_val * other.m_val, max_probability);
m_quality = MIN (MIN (m_quality, other.m_quality), profile_adjusted); m_quality = MIN (MIN (m_quality, other.m_quality), ADJUSTED);
} }
return *this; return *this;
} }
...@@ -391,7 +391,7 @@ public: ...@@ -391,7 +391,7 @@ public:
{ {
ret.m_val = max_probability; ret.m_val = max_probability;
ret.m_quality = MIN (MIN (m_quality, other.m_quality), ret.m_quality = MIN (MIN (m_quality, other.m_quality),
profile_guessed); GUESSED);
return ret; return ret;
} }
else if (!m_val) else if (!m_val)
...@@ -403,7 +403,7 @@ public: ...@@ -403,7 +403,7 @@ public:
other.m_val), other.m_val),
max_probability); max_probability);
} }
ret.m_quality = MIN (MIN (m_quality, other.m_quality), profile_adjusted); ret.m_quality = MIN (MIN (m_quality, other.m_quality), ADJUSTED);
return ret; return ret;
} }
profile_probability &operator/= (const profile_probability &other) profile_probability &operator/= (const profile_probability &other)
...@@ -420,7 +420,7 @@ public: ...@@ -420,7 +420,7 @@ public:
{ {
m_val = max_probability; m_val = max_probability;
m_quality = MIN (MIN (m_quality, other.m_quality), m_quality = MIN (MIN (m_quality, other.m_quality),
profile_guessed); GUESSED);
return *this; return *this;
} }
else if (!m_val) else if (!m_val)
...@@ -432,7 +432,7 @@ public: ...@@ -432,7 +432,7 @@ public:
other.m_val), other.m_val),
max_probability); max_probability);
} }
m_quality = MIN (MIN (m_quality, other.m_quality), profile_adjusted); m_quality = MIN (MIN (m_quality, other.m_quality), ADJUSTED);
} }
return *this; return *this;
} }
...@@ -482,7 +482,7 @@ public: ...@@ -482,7 +482,7 @@ public:
profile_probability guessed () const profile_probability guessed () const
{ {
profile_probability ret = *this; profile_probability ret = *this;
ret.m_quality = profile_guessed; ret.m_quality = GUESSED;
return ret; return ret;
} }
...@@ -490,7 +490,7 @@ public: ...@@ -490,7 +490,7 @@ public:
profile_probability afdo () const profile_probability afdo () const
{ {
profile_probability ret = *this; profile_probability ret = *this;
ret.m_quality = profile_afdo; ret.m_quality = AFDO;
return ret; return ret;
} }
...@@ -505,7 +505,7 @@ public: ...@@ -505,7 +505,7 @@ public:
uint64_t tmp; uint64_t tmp;
safe_scale_64bit (m_val, num, den, &tmp); safe_scale_64bit (m_val, num, den, &tmp);
ret.m_val = MIN (tmp, max_probability); ret.m_val = MIN (tmp, max_probability);
ret.m_quality = MIN (m_quality, profile_adjusted); ret.m_quality = MIN (m_quality, ADJUSTED);
return ret; return ret;
} }
...@@ -528,7 +528,7 @@ public: ...@@ -528,7 +528,7 @@ public:
bool probably_reliable_p () const bool probably_reliable_p () const
{ {
if (m_quality >= profile_adjusted) if (m_quality >= ADJUSTED)
return true; return true;
if (!initialized_p ()) if (!initialized_p ())
return false; return false;
...@@ -539,10 +539,10 @@ public: ...@@ -539,10 +539,10 @@ public:
/* Return false if profile_probability is bogus. */ /* Return false if profile_probability is bogus. */
bool verify () const bool verify () const
{ {
gcc_checking_assert (m_quality != profile_uninitialized); gcc_checking_assert (m_quality != UNINITIALIZED_PROFILE);
if (m_val == uninitialized_probability) if (m_val == uninitialized_probability)
return m_quality == profile_guessed; return m_quality == GUESSED;
else if (m_quality < profile_guessed) else if (m_quality < GUESSED)
return false; return false;
return m_val <= max_probability; return m_val <= max_probability;
} }
...@@ -699,14 +699,14 @@ public: ...@@ -699,14 +699,14 @@ public:
{ {
profile_count c; profile_count c;
c.m_val = 0; c.m_val = 0;
c.m_quality = profile_adjusted; c.m_quality = ADJUSTED;
return c; return c;
} }
static profile_count guessed_zero () static profile_count guessed_zero ()
{ {
profile_count c; profile_count c;
c.m_val = 0; c.m_val = 0;
c.m_quality = profile_guessed; c.m_quality = GUESSED;
return c; return c;
} }
static profile_count one () static profile_count one ()
...@@ -719,7 +719,7 @@ public: ...@@ -719,7 +719,7 @@ public:
{ {
profile_count c; profile_count c;
c.m_val = uninitialized_count; c.m_val = uninitialized_count;
c.m_quality = profile_guessed_local; c.m_quality = GUESSED_LOCAL;
return c; return c;
} }
...@@ -738,17 +738,17 @@ public: ...@@ -738,17 +738,17 @@ public:
/* Return true if value can be trusted. */ /* Return true if value can be trusted. */
bool reliable_p () const bool reliable_p () const
{ {
return m_quality >= profile_adjusted; return m_quality >= ADJUSTED;
} }
/* Return true if vlaue can be operated inter-procedurally. */ /* Return true if vlaue can be operated inter-procedurally. */
bool ipa_p () const bool ipa_p () const
{ {
return !initialized_p () || m_quality >= profile_guessed_global0; return !initialized_p () || m_quality >= GUESSED_GLOBAL0;
} }
/* Return true if quality of profile is precise. */ /* Return true if quality of profile is precise. */
bool precise_p () const bool precise_p () const
{ {
return m_quality == profile_precise; return m_quality == PRECISE;
} }
/* Get the value of the count. */ /* Get the value of the count. */
...@@ -763,8 +763,8 @@ public: ...@@ -763,8 +763,8 @@ public:
that makes it terminate in a way not visible in CFG. */ that makes it terminate in a way not visible in CFG. */
bool ok_for_merging (profile_count other) const bool ok_for_merging (profile_count other) const
{ {
if (m_quality < profile_adjusted if (m_quality < ADJUSTED
|| other.m_quality < profile_adjusted) || other.m_quality < ADJUSTED)
return true; return true;
return !(other < *this); return !(other < *this);
} }
...@@ -851,8 +851,8 @@ public: ...@@ -851,8 +851,8 @@ public:
/* Return false if profile_count is bogus. */ /* Return false if profile_count is bogus. */
bool verify () const bool verify () const
{ {
gcc_checking_assert (m_quality != profile_uninitialized); gcc_checking_assert (m_quality != UNINITIALIZED_PROFILE);
return m_val != uninitialized_count || m_quality == profile_guessed_local; return m_val != uninitialized_count || m_quality == GUESSED_LOCAL;
} }
/* Comparsions are three-state and conservative. False is returned if /* Comparsions are three-state and conservative. False is returned if
...@@ -943,7 +943,7 @@ public: ...@@ -943,7 +943,7 @@ public:
if (ret.m_val == 0) if (ret.m_val == 0)
{ {
ret.m_val = 1; ret.m_val = 1;
ret.m_quality = MIN (m_quality, profile_adjusted); ret.m_quality = MIN (m_quality, ADJUSTED);
} }
return ret; return ret;
} }
...@@ -976,7 +976,7 @@ public: ...@@ -976,7 +976,7 @@ public:
return profile_count::uninitialized (); return profile_count::uninitialized ();
profile_count ret; profile_count ret;
ret.m_val = RDIV (m_val * prob, REG_BR_PROB_BASE); ret.m_val = RDIV (m_val * prob, REG_BR_PROB_BASE);
ret.m_quality = MIN (m_quality, profile_adjusted); ret.m_quality = MIN (m_quality, ADJUSTED);
return ret; return ret;
} }
...@@ -1010,7 +1010,7 @@ public: ...@@ -1010,7 +1010,7 @@ public:
gcc_checking_assert (num >= 0 && den > 0); gcc_checking_assert (num >= 0 && den > 0);
safe_scale_64bit (m_val, num, den, &tmp); safe_scale_64bit (m_val, num, den, &tmp);
ret.m_val = MIN (tmp, max_count); ret.m_val = MIN (tmp, max_count);
ret.m_quality = MIN (m_quality, profile_adjusted); ret.m_quality = MIN (m_quality, ADJUSTED);
return ret; return ret;
} }
profile_count apply_scale (profile_count num, profile_count den) const profile_count apply_scale (profile_count num, profile_count den) const
...@@ -1029,10 +1029,10 @@ public: ...@@ -1029,10 +1029,10 @@ public:
uint64_t val; uint64_t val;
safe_scale_64bit (m_val, num.m_val, den.m_val, &val); safe_scale_64bit (m_val, num.m_val, den.m_val, &val);
ret.m_val = MIN (val, max_count); ret.m_val = MIN (val, max_count);
ret.m_quality = MIN (MIN (MIN (m_quality, profile_adjusted), ret.m_quality = MIN (MIN (MIN (m_quality, ADJUSTED),
num.m_quality), den.m_quality); num.m_quality), den.m_quality);
if (num.ipa_p () && !ret.ipa_p ()) if (num.ipa_p () && !ret.ipa_p ())
ret.m_quality = MIN (num.m_quality, profile_guessed); ret.m_quality = MIN (num.m_quality, GUESSED);
return ret; return ret;
} }
...@@ -1042,7 +1042,7 @@ public: ...@@ -1042,7 +1042,7 @@ public:
profile_count ret = *this; profile_count ret = *this;
if (!initialized_p ()) if (!initialized_p ())
return *this; return *this;
ret.m_quality = profile_guessed_local; ret.m_quality = GUESSED_LOCAL;
return ret; return ret;
} }
...@@ -1052,7 +1052,7 @@ public: ...@@ -1052,7 +1052,7 @@ public:
profile_count ret = *this; profile_count ret = *this;
if (!initialized_p ()) if (!initialized_p ())
return *this; return *this;
ret.m_quality = profile_guessed_global0; ret.m_quality = GUESSED_GLOBAL0;
return ret; return ret;
} }
...@@ -1063,7 +1063,7 @@ public: ...@@ -1063,7 +1063,7 @@ public:
profile_count ret = *this; profile_count ret = *this;
if (!initialized_p ()) if (!initialized_p ())
return *this; return *this;
ret.m_quality = profile_guessed_global0adjusted; ret.m_quality = GUESSED_GLOBAL0_ADJUSTED;
return ret; return ret;
} }
...@@ -1071,7 +1071,7 @@ public: ...@@ -1071,7 +1071,7 @@ public:
profile_count guessed () const profile_count guessed () const
{ {
profile_count ret = *this; profile_count ret = *this;
ret.m_quality = MIN (ret.m_quality, profile_guessed); ret.m_quality = MIN (ret.m_quality, GUESSED);
return ret; return ret;
} }
...@@ -1079,11 +1079,11 @@ public: ...@@ -1079,11 +1079,11 @@ public:
acorss functions. */ acorss functions. */
profile_count ipa () const profile_count ipa () const
{ {
if (m_quality > profile_guessed_global0adjusted) if (m_quality > GUESSED_GLOBAL0_ADJUSTED)
return *this; return *this;
if (m_quality == profile_guessed_global0) if (m_quality == GUESSED_GLOBAL0)
return profile_count::zero (); return profile_count::zero ();
if (m_quality == profile_guessed_global0adjusted) if (m_quality == GUESSED_GLOBAL0_ADJUSTED)
return profile_count::adjusted_zero (); return profile_count::adjusted_zero ();
return profile_count::uninitialized (); return profile_count::uninitialized ();
} }
...@@ -1092,7 +1092,7 @@ public: ...@@ -1092,7 +1092,7 @@ public:
profile_count afdo () const profile_count afdo () const
{ {
profile_count ret = *this; profile_count ret = *this;
ret.m_quality = profile_afdo; ret.m_quality = AFDO;
return ret; return ret;
} }
...@@ -1106,7 +1106,7 @@ public: ...@@ -1106,7 +1106,7 @@ public:
if (!initialized_p () || !overall.initialized_p () if (!initialized_p () || !overall.initialized_p ()
|| !overall.m_val) || !overall.m_val)
return profile_probability::uninitialized (); return profile_probability::uninitialized ();
if (*this == overall && m_quality == profile_precise) if (*this == overall && m_quality == PRECISE)
return profile_probability::always (); return profile_probability::always ();
profile_probability ret; profile_probability ret;
gcc_checking_assert (compatible_p (overall)); gcc_checking_assert (compatible_p (overall));
...@@ -1114,14 +1114,14 @@ public: ...@@ -1114,14 +1114,14 @@ public:
if (overall.m_val < m_val) if (overall.m_val < m_val)
{ {
ret.m_val = profile_probability::max_probability; ret.m_val = profile_probability::max_probability;
ret.m_quality = profile_guessed; ret.m_quality = GUESSED;
return ret; return ret;
} }
else else
ret.m_val = RDIV (m_val * profile_probability::max_probability, ret.m_val = RDIV (m_val * profile_probability::max_probability,
overall.m_val); overall.m_val);
ret.m_quality = MIN (MAX (MIN (m_quality, overall.m_quality), ret.m_quality = MIN (MAX (MIN (m_quality, overall.m_quality),
profile_guessed), profile_adjusted); GUESSED), ADJUSTED);
return ret; return ret;
} }
...@@ -1154,7 +1154,7 @@ public: ...@@ -1154,7 +1154,7 @@ public:
Conversions back and forth are used to read the coverage and get it Conversions back and forth are used to read the coverage and get it
into internal representation. */ into internal representation. */
static profile_count from_gcov_type (gcov_type v, static profile_count from_gcov_type (gcov_type v,
profile_quality quality = profile_precise); profile_quality quality = PRECISE);
/* LTO streaming support. */ /* LTO streaming support. */
static profile_count stream_in (struct lto_input_block *); static profile_count stream_in (struct lto_input_block *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment