cfg.c (cached_make_edge): Use find_edge rather than an inlined variant.

* cfg.c (cached_make_edge): Use find_edge rather than an inlined
        variant.
        * cfgbuild.c (make_edges): Likewise.
        * cfghooks.c (can_duplicate_block_p): Likewise.
        * cfgloop.c (loop_latch_edge): Likewise.
        * cfgloopmanip.c (force_single_succ_latches): Likewise.
        * cfgrtl.c (rtl_flow_call_edges_add): Likewise.
        * predict.c (predict_loops, propagate_freq): Likewise.
        * tracer.c (tail_duplicate): Likewise.
        * tree-cfg.c (disband_implicit_edges): Likewise.
        (tree_forwarder_block_p, tree_flow_call_edges_add): Likewise.

From-SVN: r91019
This commit is contained in:
Jeff Law 2004-11-22 10:14:00 -07:00 committed by Jeff Law
parent 169c5767ef
commit 9ff3d2dea0
10 changed files with 71 additions and 86 deletions

View File

@ -1,3 +1,17 @@
2004-11-21 Jeff Law <law@redhat.com>
* cfg.c (cached_make_edge): Use find_edge rather than an inlined
variant.
* cfgbuild.c (make_edges): Likewise.
* cfghooks.c (can_duplicate_block_p): Likewise.
* cfgloop.c (loop_latch_edge): Likewise.
* cfgloopmanip.c (force_single_succ_latches): Likewise.
* cfgrtl.c (rtl_flow_call_edges_add): Likewise.
* predict.c (predict_loops, propagate_freq): Likewise.
* tracer.c (tail_duplicate): Likewise.
* tree-cfg.c (disband_implicit_edges): Likewise.
(tree_forwarder_block_p, tree_flow_call_edges_add): Likewise.
2004-11-22 Nick Clifton <nickc@redhat.com>
* sbitmap.c (sbitmap_union_of_preds): Remove redundant

View File

@ -288,7 +288,6 @@ cached_make_edge (sbitmap *edge_cache, basic_block src, basic_block dst, int fla
{
int use_edge_cache;
edge e;
edge_iterator ei;
/* Don't bother with edge cache for ENTRY or EXIT, if there aren't that
many edges to them, or we didn't allocate memory for it. */
@ -309,12 +308,12 @@ cached_make_edge (sbitmap *edge_cache, basic_block src, basic_block dst, int fla
/* Fall through. */
case 0:
FOR_EACH_EDGE (e, ei, src->succs)
if (e->dest == dst)
{
e->flags |= flags;
return NULL;
}
e = find_edge (src, dst);
if (e)
{
e->flags |= flags;
return NULL;
}
break;
}

View File

@ -271,7 +271,6 @@ make_edges (basic_block min, basic_block max, int update_p)
enum rtx_code code;
int force_fallthru = 0;
edge e;
edge_iterator ei;
if (LABEL_P (BB_HEAD (bb))
&& LABEL_ALT_ENTRY_P (BB_HEAD (bb)))
@ -390,12 +389,10 @@ make_edges (basic_block min, basic_block max, int update_p)
/* Find out if we can drop through to the next block. */
insn = NEXT_INSN (insn);
FOR_EACH_EDGE (e, ei, bb->succs)
if (e->dest == EXIT_BLOCK_PTR && e->flags & EDGE_FALLTHRU)
{
insn = 0;
break;
}
e = find_edge (bb, EXIT_BLOCK_PTR);
if (e && e->flags & EDGE_FALLTHRU)
insn = NULL;
while (insn
&& NOTE_P (insn)
&& NOTE_LINE_NUMBER (insn) != NOTE_INSN_BASIC_BLOCK)

View File

@ -675,7 +675,6 @@ bool
can_duplicate_block_p (basic_block bb)
{
edge e;
edge_iterator ei;
if (!cfg_hooks->can_duplicate_block_p)
internal_error ("%s does not support can_duplicate_block_p.",
@ -686,9 +685,9 @@ can_duplicate_block_p (basic_block bb)
/* Duplicating fallthru block to exit would require adding a jump
and splitting the real last BB. */
FOR_EACH_EDGE (e, ei, bb->succs)
if (e->dest == EXIT_BLOCK_PTR && e->flags & EDGE_FALLTHRU)
return false;
e = find_edge (bb, EXIT_BLOCK_PTR);
if (e && (e->flags & EDGE_FALLTHRU))
return false;
return cfg_hooks->can_duplicate_block_p (bb);
}

View File

@ -1499,14 +1499,7 @@ verify_loop_structure (struct loops *loops)
edge
loop_latch_edge (const struct loop *loop)
{
edge e;
edge_iterator ei;
FOR_EACH_EDGE (e, ei, loop->header->preds)
if (e->src == loop->latch)
break;
return e;
return find_edge (loop->latch, loop->header);
}
/* Returns preheader edge of LOOP. */

View File

@ -1221,14 +1221,11 @@ force_single_succ_latches (struct loops *loops)
for (i = 1; i < loops->num; i++)
{
edge_iterator ei;
loop = loops->parray[i];
if (loop->latch != loop->header && EDGE_COUNT (loop->latch->succs) == 1)
continue;
FOR_EACH_EDGE (e, ei, loop->header->preds)
if (e->src == loop->latch)
break;
e = find_edge (loop->latch, loop->header);
loop_split_edge_with (e, NULL_RTX);
}

View File

@ -2972,15 +2972,13 @@ rtl_flow_call_edges_add (sbitmap blocks)
if (need_fake_edge_p (insn))
{
edge e;
edge_iterator ei;
FOR_EACH_EDGE (e, ei, bb->succs)
if (e->dest == EXIT_BLOCK_PTR)
{
insert_insn_on_edge (gen_rtx_USE (VOIDmode, const0_rtx), e);
commit_edge_insertions ();
break;
}
e = find_edge (bb, EXIT_BLOCK_PTR);
if (e)
{
insert_insn_on_edge (gen_rtx_USE (VOIDmode, const0_rtx), e);
commit_edge_insertions ();
}
}
}
@ -3023,9 +3021,8 @@ rtl_flow_call_edges_add (sbitmap blocks)
#ifdef ENABLE_CHECKING
if (split_at_insn == BB_END (bb))
{
edge_iterator ei;
FOR_EACH_EDGE (e, ei, bb->succs)
gcc_assert (e->dest != EXIT_BLOCK_PTR);
e = find_edge (bb, EXIT_BLOCK_PTR);
gcc_assert (e == NULL);
}
#endif

View File

@ -669,13 +669,15 @@ predict_loops (struct loops *loops_info, bool rtlsimpleloops)
/* Loop branch heuristics - predict an edge back to a
loop's head as taken. */
FOR_EACH_EDGE (e, ei, bb->succs)
if (e->dest == loop->header
&& e->src == loop->latch)
{
header_found = 1;
predict_edge_def (e, PRED_LOOP_BRANCH, TAKEN);
}
if (bb == loop->latch)
{
e = find_edge (loop->latch, loop->header);
if (e)
{
header_found = 1;
predict_edge_def (e, PRED_LOOP_BRANCH, TAKEN);
}
}
/* Loop exit heuristics - predict an edge exiting the loop if the
conditional has no loop header successors as not taken. */
@ -1660,21 +1662,20 @@ propagate_freq (struct loop *loop, bitmap tovisit)
bitmap_clear_bit (tovisit, bb->index);
/* Compute back edge frequencies. */
FOR_EACH_EDGE (e, ei, bb->succs)
if (e->dest == head)
{
sreal tmp;
e = find_edge (bb, head);
if (e)
{
sreal tmp;
/* EDGE_INFO (e)->back_edge_prob
= ((e->probability * BLOCK_INFO (bb)->frequency)
/ REG_BR_PROB_BASE); */
/* EDGE_INFO (e)->back_edge_prob
= ((e->probability * BLOCK_INFO (bb)->frequency)
/ REG_BR_PROB_BASE); */
sreal_init (&tmp, e->probability, 0);
sreal_mul (&tmp, &tmp, &BLOCK_INFO (bb)->frequency);
sreal_mul (&EDGE_INFO (e)->back_edge_prob,
&tmp, &real_inv_br_prob_base);
}
sreal_init (&tmp, e->probability, 0);
sreal_mul (&tmp, &tmp, &BLOCK_INFO (bb)->frequency);
sreal_mul (&EDGE_INFO (e)->back_edge_prob,
&tmp, &real_inv_br_prob_base);
}
/* Propagate to successor blocks. */
FOR_EACH_EDGE (e, ei, bb->succs)

View File

@ -275,12 +275,9 @@ tail_duplicate (void)
&& can_duplicate_block_p (bb2))
{
edge e;
edge_iterator ei;
basic_block old = bb2;
FOR_EACH_EDGE (e, ei, bb2->preds)
if (e->src == bb)
break;
e = find_edge (bb, bb2);
nduplicated += counts [bb2->index];
bb2 = duplicate_block (bb2, e);

View File

@ -2649,11 +2649,9 @@ disband_implicit_edges (void)
from cfg_remove_useless_stmts here since it violates the
invariants for tree--cfg correspondence and thus fits better
here where we do it anyway. */
FOR_EACH_EDGE (e, ei, bb->succs)
e = find_edge (bb, bb->next_bb);
if (e)
{
if (e->dest != bb->next_bb)
continue;
if (e->flags & EDGE_TRUE_VALUE)
COND_EXPR_THEN (stmt) = build_empty_stmt ();
else if (e->flags & EDGE_FALSE_VALUE)
@ -3892,8 +3890,6 @@ static bool
tree_forwarder_block_p (basic_block bb)
{
block_stmt_iterator bsi;
edge e;
edge_iterator ei;
/* BB must have a single outgoing edge. */
if (EDGE_COUNT (bb->succs) != 1
@ -3911,10 +3907,8 @@ tree_forwarder_block_p (basic_block bb)
gcc_assert (bb != ENTRY_BLOCK_PTR);
#endif
/* Successors of the entry block are not forwarders. */
FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR->succs)
if (e->dest == bb)
return false;
if (find_edge (ENTRY_BLOCK_PTR, bb))
return false;
/* Now walk through the statements. We can ignore labels, anything else
means this is not a forwarder block. */
@ -5206,7 +5200,6 @@ tree_flow_call_edges_add (sbitmap blocks)
Handle this by adding a dummy instruction in a new last basic block. */
if (check_last_block)
{
edge_iterator ei;
basic_block bb = EXIT_BLOCK_PTR->prev_bb;
block_stmt_iterator bsi = bsi_last (bb);
tree t = NULL_TREE;
@ -5217,13 +5210,12 @@ tree_flow_call_edges_add (sbitmap blocks)
{
edge e;
FOR_EACH_EDGE (e, ei, bb->succs)
if (e->dest == EXIT_BLOCK_PTR)
{
bsi_insert_on_edge (e, build_empty_stmt ());
bsi_commit_edge_inserts ();
break;
}
e = find_edge (bb, EXIT_BLOCK_PTR);
if (e)
{
bsi_insert_on_edge (e, build_empty_stmt ());
bsi_commit_edge_inserts ();
}
}
}
@ -5260,9 +5252,8 @@ tree_flow_call_edges_add (sbitmap blocks)
#ifdef ENABLE_CHECKING
if (stmt == last_stmt)
{
edge_iterator ei;
FOR_EACH_EDGE (e, ei, bb->succs)
gcc_assert (e->dest != EXIT_BLOCK_PTR);
e = find_edge (bb, EXIT_BLOCK_PTR);
gcc_assert (e == NULL);
}
#endif