OSDN Git Service

* g++.dg/other/debug1.C: Fix typos.
[pf3gnuchains/gcc-fork.git] / gcc / profile.c
index d011021..bda2dc5 100644 (file)
@@ -68,7 +68,7 @@ struct bb_info
 #define BB_INFO(b)  ((struct bb_info *) (b)->aux)
 
 /* Keep all basic block indexes nonnegative in the gcov output.  Index 0
-   is used for entry block, last block exit block.   */
+   is used for entry block, last block exit block.  */
 #define GCOV_INDEX_TO_BB(i)  ((i) == 0 ? ENTRY_BLOCK_PTR               \
                              : (((i) == n_basic_blocks + 1)            \
                                 ? EXIT_BLOCK_PTR : BASIC_BLOCK ((i)-1)))
@@ -152,7 +152,7 @@ instrument_edges (el)
              if (rtl_dump_file)
                fprintf (rtl_dump_file, "Edge %d to %d instrumented%s\n",
                         e->src->index, e->dest->index,
-                        e->flags & EDGE_CRITICAL ? " (and split)" : "");
+                        EDGE_CRITICAL_P (e) ? " (and split)" : "");
              need_func_profiler = 1;
              insert_insn_on_edge (
                         gen_edge_profiler (total_num_edges_instrumented
@@ -217,18 +217,15 @@ compute_branch_probabilities ()
   int hist_br_prob[20];
   int num_never_executed;
   int num_branches;
-  struct bb_info *bb_infos;
 
   /* Attach extra info block to each bb.  */
 
-  bb_infos = (struct bb_info *)
-    xcalloc (n_basic_blocks + 2, sizeof (struct bb_info));
+  alloc_aux_for_blocks (sizeof (struct bb_info));
   for (i = 0; i < n_basic_blocks + 2; i++)
     {
       basic_block bb = GCOV_INDEX_TO_BB (i);
       edge e;
 
-      bb->aux = &bb_infos[i];
       for (e = bb->succ; e; e = e->succ_next)
        if (!EDGE_INFO (e)->ignore)
          BB_INFO (bb)->succ_count++;
@@ -496,7 +493,7 @@ compute_branch_probabilities ()
       fputc ('\n', rtl_dump_file);
     }
 
-  free (bb_infos);
+  free_aux_for_blocks ();
 }
 
 /* Instrument and/or analyze program behavior based on program flow graph.
@@ -520,7 +517,6 @@ branch_prob ()
 {
   int i;
   int num_edges, ignored_edges;
-  struct edge_info *edge_infos;
   struct edge_list *el;
 
   /* Start of a function.  */
@@ -563,7 +559,7 @@ branch_prob ()
                  || insn != NEXT_INSN (bb->head))
                {
                  e = split_block (bb, PREV_INSN (insn));
-                 make_edge (NULL, ENTRY_BLOCK_PTR, e->dest, EDGE_FAKE);
+                 make_edge (ENTRY_BLOCK_PTR, e->dest, EDGE_FAKE);
                  break;
                }
              else
@@ -572,7 +568,7 @@ branch_prob ()
                     be the very first instruction of function.  */
                  if (!i)
                    abort ();
-                 make_edge (NULL, ENTRY_BLOCK_PTR, bb, EDGE_FAKE);
+                 make_edge (ENTRY_BLOCK_PTR, bb, EDGE_FAKE);
                }
            }
        }
@@ -599,28 +595,26 @@ branch_prob ()
          if (rtl_dump_file)
            fprintf (rtl_dump_file, "Adding fake exit edge to bb %i\n",
                     bb->index);
-          make_edge (NULL, bb, EXIT_BLOCK_PTR, EDGE_FAKE);
+          make_edge (bb, EXIT_BLOCK_PTR, EDGE_FAKE);
        }
       if (need_entry_edge && !have_entry_edge)
        {
          if (rtl_dump_file)
            fprintf (rtl_dump_file, "Adding fake entry edge to bb %i\n",
                     bb->index);
-          make_edge (NULL, ENTRY_BLOCK_PTR, bb, EDGE_FAKE);
+          make_edge (ENTRY_BLOCK_PTR, bb, EDGE_FAKE);
        }
     }
 
   el = create_edge_list ();
   num_edges = NUM_EDGES (el);
-  edge_infos = (struct edge_info *)
-    xcalloc (num_edges, sizeof (struct edge_info));
+  alloc_aux_for_edges (sizeof (struct edge_info));
 
   ignored_edges = 0;
   for (i = 0 ; i < num_edges ; i++)
     {
       edge e = INDEX_EDGE (el, i);
       e->count = 0;
-      e->aux = &edge_infos[i];
 
       /* Mark edges we've replaced by fake edges above as ignored.  */
       if ((e->flags & (EDGE_ABNORMAL | EDGE_ABNORMAL_CALL))
@@ -703,7 +697,7 @@ branch_prob ()
 
   /* Create spanning tree from basic block graph, mark each edge that is
      on the spanning tree.  We insert as many abnormal and critical edges
-     as possible to minimize number of edge splits necesary.  */
+     as possible to minimize number of edge splits necessary.  */
 
   find_spanning_tree (el);
 
@@ -803,7 +797,7 @@ branch_prob ()
   if (rtl_dump_file)
     dump_flow_info (rtl_dump_file);
 
-  free (edge_infos);
+  free_aux_for_edges ();
   free_edge_list (el);
 }
 \f
@@ -884,7 +878,7 @@ find_spanning_tree (el)
   for (i = 0; i < num_edges; i++)
     {
       edge e = INDEX_EDGE (el, i);
-      if ((e->flags & EDGE_CRITICAL)
+      if ((EDGE_CRITICAL_P (e))
          && !EDGE_INFO (e)->ignore
          && (find_group (e->src) != find_group (e->dest)))
        {
@@ -904,6 +898,11 @@ find_spanning_tree (el)
          union_groups (e->src, e->dest);
        }
     }
+
+  EXIT_BLOCK_PTR->aux = NULL;
+  ENTRY_BLOCK_PTR->aux = NULL;
+  for (i = 0; i < n_basic_blocks; i++)
+    BASIC_BLOCK (i)->aux = NULL;
 }
 \f
 /* Perform file-level initialization for branch-prob processing.  */