OSDN Git Service

PR c++/10549
[pf3gnuchains/gcc-fork.git] / gcc / predict.c
index 29d7c46..80ad41e 100644 (file)
@@ -1,5 +1,5 @@
 /* Branch prediction routines for the GNU compiler.
-   Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -47,7 +47,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "recog.h"
 #include "expr.h"
 #include "predict.h"
-#include "profile.h"
+#include "coverage.h"
 #include "sreal.h"
 #include "params.h"
 #include "target.h"
@@ -120,11 +120,9 @@ bool
 maybe_hot_bb_p (bb)
      basic_block bb;
 {
-  if (profile_info.count_profiles_merged
-      && flag_branch_probabilities
+  if (profile_info && flag_branch_probabilities
       && (bb->count
-         < profile_info.max_counter_in_program
-         / PARAM_VALUE (HOT_BB_COUNT_FRACTION)))
+         < profile_info->sum_max / PARAM_VALUE (HOT_BB_COUNT_FRACTION)))
     return false;
   if (bb->frequency < BB_FREQ_MAX / PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION))
     return false;
@@ -137,11 +135,9 @@ bool
 probably_cold_bb_p (bb)
      basic_block bb;
 {
-  if (profile_info.count_profiles_merged
-      && flag_branch_probabilities
+  if (profile_info && flag_branch_probabilities
       && (bb->count
-         < profile_info.max_counter_in_program
-         / PARAM_VALUE (HOT_BB_COUNT_FRACTION)))
+         < profile_info->sum_max / PARAM_VALUE (HOT_BB_COUNT_FRACTION)))
     return true;
   if (bb->frequency < BB_FREQ_MAX / PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION))
     return true;
@@ -153,10 +149,8 @@ bool
 probably_never_executed_bb_p (bb)
        basic_block bb;
 {
-  if (profile_info.count_profiles_merged
-      && flag_branch_probabilities)
-    return ((bb->count + profile_info.count_profiles_merged / 2)
-           / profile_info.count_profiles_merged) == 0;
+  if (profile_info && flag_branch_probabilities)
+    return ((bb->count + profile_info->runs / 2) / profile_info->runs) == 0;
   return false;
 }
 
@@ -1177,6 +1171,7 @@ estimate_bb_frequencies (loops)
 
       if (!real_values_initialized)
         {
+         real_values_initialized = 1;
          sreal_init (&real_zero, 0, 0);
          sreal_init (&real_one, 1, 0);
          sreal_init (&real_br_prob_base, REG_BR_PROB_BASE, 0);
@@ -1265,8 +1260,7 @@ compute_function_frequency ()
 {
   basic_block bb;
 
-  if (!profile_info.count_profiles_merged
-      || !flag_branch_probabilities)
+  if (!profile_info || !flag_branch_probabilities)
     return;
   cfun->function_frequency = FUNCTION_FREQUENCY_UNLIKELY_EXECUTED;
   FOR_EACH_BB (bb)