#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)))
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
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++;
fputc ('\n', rtl_dump_file);
}
- free (bb_infos);
+ free_aux_for_blocks ();
}
/* Instrument and/or analyze program behavior based on program flow graph.
{
int i;
int num_edges, ignored_edges;
- struct edge_info *edge_infos;
struct edge_list *el;
/* Start of a function. */
|| 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
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);
}
}
}
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))
/* 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);
if (rtl_dump_file)
dump_flow_info (rtl_dump_file);
- free (edge_infos);
+ free_aux_for_edges ();
free_edge_list (el);
}
\f
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)))
{
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. */