/* The tracer pass for the GNU compiler.
Contributed by Jan Hubicka, SuSE Labs.
- Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GCC.
{
edge e;
edge best = NULL;
+ edge_iterator ei;
- for (e = bb->succ; e; e = e->succ_next)
+ FOR_EACH_EDGE (e, ei, bb->succs)
if (!best || better_p (e, best))
best = e;
if (!best || ignore_bb_p (best->dest))
{
edge e;
edge best = NULL;
+ edge_iterator ei;
- for (e = bb->pred; e; e = e->pred_next)
+ FOR_EACH_EDGE (e, ei, bb->preds)
if (!best || better_p (e, best))
best = e;
if (!best || ignore_bb_p (best->src))
if (ignore_bb_p (bb))
continue;
- if (seen (bb))
- abort ();
+ gcc_assert (!seen (bb));
n = find_trace (bb, trace);
blocks[bb2->index] = NULL;
}
traced_insns += bb2->frequency * counts [bb2->index];
- if (bb2->pred && bb2->pred->pred_next
- && cfg_layout_can_duplicate_bb_p (bb2))
+ if (EDGE_COUNT (bb2->preds) > 1
+ && can_duplicate_block_p (bb2))
{
- edge e = bb2->pred;
+ edge e;
basic_block old = bb2;
- while (e->src != bb)
- e = e->pred_next;
+ e = find_edge (bb, bb2);
+
nduplicated += counts [bb2->index];
- bb2 = cfg_layout_duplicate_bb (bb2, e);
+ bb2 = duplicate_block (bb2, e);
/* Reconsider the original copy of block we've duplicated.
Removing the most common predecessor may make it to be
static void
layout_superblocks (void)
{
- basic_block end = ENTRY_BLOCK_PTR->succ->dest;
- basic_block bb = ENTRY_BLOCK_PTR->succ->dest->next_bb;
+ basic_block end = single_succ (ENTRY_BLOCK_PTR);
+ basic_block bb = end->next_bb;
while (bb != EXIT_BLOCK_PTR)
{
+ edge_iterator ei;
edge e, best = NULL;
while (end->rbi->next)
end = end->rbi->next;
- for (e = end->succ; e; e = e->succ_next)
+ FOR_EACH_EDGE (e, ei, end->succs)
if (e->dest != EXIT_BLOCK_PTR
- && e->dest != ENTRY_BLOCK_PTR->succ->dest
+ && e->dest != single_succ (ENTRY_BLOCK_PTR)
&& !e->dest->rbi->visited
&& (!best || EDGE_FREQUENCY (e) > EDGE_FREQUENCY (best)))
best = e;
}
}
-/* Main entry point to this file. */
+/* Main entry point to this file. FLAGS is the set of flags to pass
+ to cfg_layout_initialize(). */
void
-tracer (void)
+tracer (unsigned int flags)
{
if (n_basic_blocks <= 1)
return;
timevar_push (TV_TRACER);
- cfg_layout_initialize ();
+ cfg_layout_initialize (flags);
mark_dfs_back_edges ();
if (dump_file)
dump_flow_info (dump_file);