re PR target/65697 (__atomic memory barriers not strong enough for __sync builtins)
[gcc.git] / gcc / profile.c
index 6be8a030fc6e0ade3632f1e18cbddf9e2fac5e2f..754326b3a362eec8b2d0ee1b57a39aa8994b3b77 100644 (file)
@@ -1,5 +1,5 @@
 /* Calculate branch probabilities, and basic block execution counts.
-   Copyright (C) 1990-2014 Free Software Foundation, Inc.
+   Copyright (C) 1990-2015 Free Software Foundation, Inc.
    Contributed by James E. Wilson, UC Berkeley/Cygnus Support;
    based on some ideas from Dain Samples of UC Berkeley.
    Further mangling by Bob Manson, Cygnus Support.
@@ -54,17 +54,32 @@ along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "flags.h"
 #include "regs.h"
-#include "expr.h"
+#include "symtab.h"
+#include "hard-reg-set.h"
 #include "function.h"
+#include "alias.h"
+#include "tree.h"
+#include "insn-config.h"
+#include "expmed.h"
+#include "dojump.h"
+#include "explow.h"
+#include "calls.h"
+#include "emit-rtl.h"
+#include "varasm.h"
+#include "stmt.h"
+#include "expr.h"
+#include "predict.h"
+#include "dominance.h"
+#include "cfg.h"
+#include "cfganal.h"
 #include "basic-block.h"
 #include "diagnostic-core.h"
 #include "coverage.h"
 #include "value-prof.h"
-#include "tree.h"
+#include "fold-const.h"
 #include "tree-ssa-alias.h"
 #include "internal-fn.h"
 #include "gimple-expr.h"
-#include "is-a.h"
 #include "gimple.h"
 #include "gimple-iterator.h"
 #include "tree-cfg.h"
@@ -106,6 +121,14 @@ static int total_num_times_called;
 static int total_hist_br_prob[20];
 static int total_num_branches;
 
+/* Helper function to update gcov_working_sets.  */
+
+void add_working_set (gcov_working_set_t *set) {
+  int i = 0;
+  for (; i < NUM_GCOV_WORKING_SETS; i++)
+    gcov_working_sets[i] = set[i];
+}
+
 /* Forward declarations.  */
 static void find_spanning_tree (struct edge_list *);
 
@@ -238,7 +261,7 @@ get_working_sets (void)
           ws_info = &gcov_working_sets[ws_ix];
           /* Print out the percentage using int arithmatic to avoid float.  */
           fprintf (dump_file, "\t\t%u.%02u%%: num counts=%u, min counter="
-                   "%"PRId64 "\n",
+                   "%" PRId64 "\n",
                    pct / 100, pct - (pct / 100 * 100),
                    ws_info->num_counters,
                    (int64_t)ws_info->min_counter);
@@ -319,7 +342,7 @@ is_edge_inconsistent (vec<edge, va_gc> *edges)
              if (dump_file)
                {
                  fprintf (dump_file,
-                          "Edge %i->%i is inconsistent, count%"PRId64,
+                          "Edge %i->%i is inconsistent, count%" PRId64,
                           e->src->index, e->dest->index, e->count);
                  dump_bb (dump_file, e->src, 0, TDF_DETAILS);
                  dump_bb (dump_file, e->dest, 0, TDF_DETAILS);
@@ -368,7 +391,7 @@ is_inconsistent (void)
          if (dump_file)
            {
              fprintf (dump_file, "BB %i count is negative "
-                      "%"PRId64,
+                      "%" PRId64,
                       bb->index,
                       bb->count);
              dump_bb (dump_file, bb, 0, TDF_DETAILS);
@@ -380,7 +403,7 @@ is_inconsistent (void)
          if (dump_file)
            {
              fprintf (dump_file, "BB %i count does not match sum of incoming edges "
-                      "%"PRId64" should be %"PRId64,
+                      "%" PRId64" should be %" PRId64,
                       bb->index,
                       bb->count,
                       sum_edge_counts (bb->preds));
@@ -395,7 +418,7 @@ is_inconsistent (void)
          if (dump_file)
            {
              fprintf (dump_file, "BB %i count does not match sum of outgoing edges "
-                      "%"PRId64" should be %"PRId64,
+                      "%" PRId64" should be %" PRId64,
                       bb->index,
                       bb->count,
                       sum_edge_counts (bb->succs));
@@ -472,7 +495,7 @@ read_profile_edge_counts (gcov_type *exec_counts)
              {
                fprintf (dump_file, "\nRead edge from %i to %i, count:",
                         bb->index, e->dest->index);
-               fprintf (dump_file, "%"PRId64,
+               fprintf (dump_file, "%" PRId64,
                         (int64_t) e->count);
              }
          }