summaryrefslogtreecommitdiff
path: root/gcc/ipa-inline.c
diff options
context:
space:
mode:
authortbsaunde <tbsaunde@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-11 02:31:00 +0000
committertbsaunde <tbsaunde@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-11 02:31:00 +0000
commit23a92fc764dc04a0248a570bba74db0a7f7d843d (patch)
tree45432b15918ada70945d621144d6decabaa36832 /gcc/ipa-inline.c
parent1deb811aba6bf50dc79d09b48c087106ce81ca81 (diff)
downloadgcc-23a92fc764dc04a0248a570bba74db0a7f7d843d.tar.gz
c++ify sreal
gcc/ChangeLog: 2014-11-10 Trevor Saunders <tsaunders@mozilla.com> * ipa-inline.c (edge_badness): Adjust. (inline_small_functions): Likewise. * predict.c (propagate_freq): Likewise. (estimate_bb_frequencies): Likewise. * sreal.c (sreal::dump): Rename from dump_sreal. (debug): Adjust. (copy): Remove function. (sreal::shift_right): Rename from sreal_sift_right. (sreal::normalize): Rename from normalize. (sreal_init): Remove function. (sreal::to_int): Rename from sreal_to_int. (sreal_compare): Remove function. (sreal::operator+): Rename from sreal_add. (sreal::operator-): Rename from sreal_sub. (sreal::operator*): Rename from sreal_mul. (sreal::operator/): Rename from sreal_div. * sreal.h (class sreal): Adjust. (inline sreal &operator+=): New operator. (inline sreal &operator-=): Likewise. (inline sreal &operator/=): Likewise. (inline sreal &operator*=): Likewise. (inline bool operator!=): Likewise. (inline bool operator>): Likewise. (inline bool operator<=): Likewise. (inline bool operator>=): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217332 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-inline.c')
-rw-r--r--gcc/ipa-inline.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 534b3303193..5c9781584e1 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -962,29 +962,28 @@ edge_badness (struct cgraph_edge *edge, bool dump)
else if (max_count)
{
- sreal tmp, relbenefit_real, growth_real;
int relbenefit = relative_time_benefit (callee_info, edge, edge_time);
/* Capping edge->count to max_count. edge->count can be larger than
max_count if an inline adds new edges which increase max_count
after max_count is computed. */
gcov_type edge_count = edge->count > max_count ? max_count : edge->count;
- sreal_init (&relbenefit_real, relbenefit, 0);
- sreal_init (&growth_real, growth, 0);
+ sreal relbenefit_real (relbenefit, 0);
+ sreal growth_real (growth, 0);
/* relative_edge_count. */
- sreal_init (&tmp, edge_count, 0);
- sreal_div (&tmp, &tmp, &max_count_real);
+ sreal tmp (edge_count, 0);
+ tmp /= max_count_real;
/* relative_time_benefit. */
- sreal_mul (&tmp, &tmp, &relbenefit_real);
- sreal_div (&tmp, &tmp, &max_relbenefit_real);
+ tmp *= relbenefit_real;
+ tmp /= max_relbenefit_real;
/* growth_f_caller. */
- sreal_mul (&tmp, &tmp, &half_int_min_real);
- sreal_div (&tmp, &tmp, &growth_real);
+ tmp *= half_int_min_real;
+ tmp /= growth_real;
- badness = -1 * sreal_to_int (&tmp);
+ badness = -1 * tmp.to_int ();
if (dump)
{
@@ -1627,9 +1626,9 @@ inline_small_functions (void)
if (max_count < edge->count)
max_count = edge->count;
}
- sreal_init (&max_count_real, max_count, 0);
- sreal_init (&max_relbenefit_real, RELATIVE_TIME_BENEFIT_RANGE, 0);
- sreal_init (&half_int_min_real, INT_MAX / 2, 0);
+ max_count_real = sreal (max_count, 0);
+ max_relbenefit_real = sreal (RELATIVE_TIME_BENEFIT_RANGE, 0);
+ half_int_min_real = sreal (INT_MAX / 2, 0);
ipa_free_postorder_info ();
initialize_growth_caches ();