Commit 9ff3d2de by Jeff Law Committed by Jeff Law

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
parent 169c5767
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> 2004-11-22 Nick Clifton <nickc@redhat.com>
* sbitmap.c (sbitmap_union_of_preds): Remove redundant * sbitmap.c (sbitmap_union_of_preds): Remove redundant
......
...@@ -288,7 +288,6 @@ cached_make_edge (sbitmap *edge_cache, basic_block src, basic_block dst, int fla ...@@ -288,7 +288,6 @@ cached_make_edge (sbitmap *edge_cache, basic_block src, basic_block dst, int fla
{ {
int use_edge_cache; int use_edge_cache;
edge e; edge e;
edge_iterator ei;
/* Don't bother with edge cache for ENTRY or EXIT, if there aren't that /* 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. */ 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 ...@@ -309,12 +308,12 @@ cached_make_edge (sbitmap *edge_cache, basic_block src, basic_block dst, int fla
/* Fall through. */ /* Fall through. */
case 0: case 0:
FOR_EACH_EDGE (e, ei, src->succs) e = find_edge (src, dst);
if (e->dest == dst) if (e)
{ {
e->flags |= flags; e->flags |= flags;
return NULL; return NULL;
} }
break; break;
} }
......
...@@ -271,7 +271,6 @@ make_edges (basic_block min, basic_block max, int update_p) ...@@ -271,7 +271,6 @@ make_edges (basic_block min, basic_block max, int update_p)
enum rtx_code code; enum rtx_code code;
int force_fallthru = 0; int force_fallthru = 0;
edge e; edge e;
edge_iterator ei;
if (LABEL_P (BB_HEAD (bb)) if (LABEL_P (BB_HEAD (bb))
&& LABEL_ALT_ENTRY_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) ...@@ -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. */ /* Find out if we can drop through to the next block. */
insn = NEXT_INSN (insn); insn = NEXT_INSN (insn);
FOR_EACH_EDGE (e, ei, bb->succs) e = find_edge (bb, EXIT_BLOCK_PTR);
if (e->dest == EXIT_BLOCK_PTR && e->flags & EDGE_FALLTHRU) if (e && e->flags & EDGE_FALLTHRU)
{ insn = NULL;
insn = 0;
break;
}
while (insn while (insn
&& NOTE_P (insn) && NOTE_P (insn)
&& NOTE_LINE_NUMBER (insn) != NOTE_INSN_BASIC_BLOCK) && NOTE_LINE_NUMBER (insn) != NOTE_INSN_BASIC_BLOCK)
......
...@@ -675,7 +675,6 @@ bool ...@@ -675,7 +675,6 @@ bool
can_duplicate_block_p (basic_block bb) can_duplicate_block_p (basic_block bb)
{ {
edge e; edge e;
edge_iterator ei;
if (!cfg_hooks->can_duplicate_block_p) if (!cfg_hooks->can_duplicate_block_p)
internal_error ("%s does not support 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) ...@@ -686,9 +685,9 @@ can_duplicate_block_p (basic_block bb)
/* Duplicating fallthru block to exit would require adding a jump /* Duplicating fallthru block to exit would require adding a jump
and splitting the real last BB. */ and splitting the real last BB. */
FOR_EACH_EDGE (e, ei, bb->succs) e = find_edge (bb, EXIT_BLOCK_PTR);
if (e->dest == EXIT_BLOCK_PTR && e->flags & EDGE_FALLTHRU) if (e && (e->flags & EDGE_FALLTHRU))
return false; return false;
return cfg_hooks->can_duplicate_block_p (bb); return cfg_hooks->can_duplicate_block_p (bb);
} }
......
...@@ -1499,14 +1499,7 @@ verify_loop_structure (struct loops *loops) ...@@ -1499,14 +1499,7 @@ verify_loop_structure (struct loops *loops)
edge edge
loop_latch_edge (const struct loop *loop) loop_latch_edge (const struct loop *loop)
{ {
edge e; return find_edge (loop->latch, loop->header);
edge_iterator ei;
FOR_EACH_EDGE (e, ei, loop->header->preds)
if (e->src == loop->latch)
break;
return e;
} }
/* Returns preheader edge of LOOP. */ /* Returns preheader edge of LOOP. */
......
...@@ -1221,14 +1221,11 @@ force_single_succ_latches (struct loops *loops) ...@@ -1221,14 +1221,11 @@ force_single_succ_latches (struct loops *loops)
for (i = 1; i < loops->num; i++) for (i = 1; i < loops->num; i++)
{ {
edge_iterator ei;
loop = loops->parray[i]; loop = loops->parray[i];
if (loop->latch != loop->header && EDGE_COUNT (loop->latch->succs) == 1) if (loop->latch != loop->header && EDGE_COUNT (loop->latch->succs) == 1)
continue; continue;
FOR_EACH_EDGE (e, ei, loop->header->preds) e = find_edge (loop->latch, loop->header);
if (e->src == loop->latch)
break;
loop_split_edge_with (e, NULL_RTX); loop_split_edge_with (e, NULL_RTX);
} }
......
...@@ -2972,15 +2972,13 @@ rtl_flow_call_edges_add (sbitmap blocks) ...@@ -2972,15 +2972,13 @@ rtl_flow_call_edges_add (sbitmap blocks)
if (need_fake_edge_p (insn)) if (need_fake_edge_p (insn))
{ {
edge e; edge e;
edge_iterator ei;
FOR_EACH_EDGE (e, ei, bb->succs) e = find_edge (bb, EXIT_BLOCK_PTR);
if (e->dest == EXIT_BLOCK_PTR) if (e)
{ {
insert_insn_on_edge (gen_rtx_USE (VOIDmode, const0_rtx), e); insert_insn_on_edge (gen_rtx_USE (VOIDmode, const0_rtx), e);
commit_edge_insertions (); commit_edge_insertions ();
break; }
}
} }
} }
...@@ -3023,9 +3021,8 @@ rtl_flow_call_edges_add (sbitmap blocks) ...@@ -3023,9 +3021,8 @@ rtl_flow_call_edges_add (sbitmap blocks)
#ifdef ENABLE_CHECKING #ifdef ENABLE_CHECKING
if (split_at_insn == BB_END (bb)) if (split_at_insn == BB_END (bb))
{ {
edge_iterator ei; e = find_edge (bb, EXIT_BLOCK_PTR);
FOR_EACH_EDGE (e, ei, bb->succs) gcc_assert (e == NULL);
gcc_assert (e->dest != EXIT_BLOCK_PTR);
} }
#endif #endif
......
...@@ -669,13 +669,15 @@ predict_loops (struct loops *loops_info, bool rtlsimpleloops) ...@@ -669,13 +669,15 @@ predict_loops (struct loops *loops_info, bool rtlsimpleloops)
/* Loop branch heuristics - predict an edge back to a /* Loop branch heuristics - predict an edge back to a
loop's head as taken. */ loop's head as taken. */
FOR_EACH_EDGE (e, ei, bb->succs) if (bb == loop->latch)
if (e->dest == loop->header {
&& e->src == loop->latch) e = find_edge (loop->latch, loop->header);
{ if (e)
header_found = 1; {
predict_edge_def (e, PRED_LOOP_BRANCH, TAKEN); header_found = 1;
} predict_edge_def (e, PRED_LOOP_BRANCH, TAKEN);
}
}
/* Loop exit heuristics - predict an edge exiting the loop if the /* Loop exit heuristics - predict an edge exiting the loop if the
conditional has no loop header successors as not taken. */ conditional has no loop header successors as not taken. */
...@@ -1660,21 +1662,20 @@ propagate_freq (struct loop *loop, bitmap tovisit) ...@@ -1660,21 +1662,20 @@ propagate_freq (struct loop *loop, bitmap tovisit)
bitmap_clear_bit (tovisit, bb->index); bitmap_clear_bit (tovisit, bb->index);
/* Compute back edge frequencies. */ e = find_edge (bb, head);
FOR_EACH_EDGE (e, ei, bb->succs) if (e)
if (e->dest == head) {
{ sreal tmp;
sreal tmp;
/* EDGE_INFO (e)->back_edge_prob /* EDGE_INFO (e)->back_edge_prob
= ((e->probability * BLOCK_INFO (bb)->frequency) = ((e->probability * BLOCK_INFO (bb)->frequency)
/ REG_BR_PROB_BASE); */ / REG_BR_PROB_BASE); */
sreal_init (&tmp, e->probability, 0); sreal_init (&tmp, e->probability, 0);
sreal_mul (&tmp, &tmp, &BLOCK_INFO (bb)->frequency); sreal_mul (&tmp, &tmp, &BLOCK_INFO (bb)->frequency);
sreal_mul (&EDGE_INFO (e)->back_edge_prob, sreal_mul (&EDGE_INFO (e)->back_edge_prob,
&tmp, &real_inv_br_prob_base); &tmp, &real_inv_br_prob_base);
} }
/* Propagate to successor blocks. */ /* Propagate to successor blocks. */
FOR_EACH_EDGE (e, ei, bb->succs) FOR_EACH_EDGE (e, ei, bb->succs)
......
...@@ -275,12 +275,9 @@ tail_duplicate (void) ...@@ -275,12 +275,9 @@ tail_duplicate (void)
&& can_duplicate_block_p (bb2)) && can_duplicate_block_p (bb2))
{ {
edge e; edge e;
edge_iterator ei;
basic_block old = bb2; basic_block old = bb2;
FOR_EACH_EDGE (e, ei, bb2->preds) e = find_edge (bb, bb2);
if (e->src == bb)
break;
nduplicated += counts [bb2->index]; nduplicated += counts [bb2->index];
bb2 = duplicate_block (bb2, e); bb2 = duplicate_block (bb2, e);
......
...@@ -2649,11 +2649,9 @@ disband_implicit_edges (void) ...@@ -2649,11 +2649,9 @@ disband_implicit_edges (void)
from cfg_remove_useless_stmts here since it violates the from cfg_remove_useless_stmts here since it violates the
invariants for tree--cfg correspondence and thus fits better invariants for tree--cfg correspondence and thus fits better
here where we do it anyway. */ 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) if (e->flags & EDGE_TRUE_VALUE)
COND_EXPR_THEN (stmt) = build_empty_stmt (); COND_EXPR_THEN (stmt) = build_empty_stmt ();
else if (e->flags & EDGE_FALSE_VALUE) else if (e->flags & EDGE_FALSE_VALUE)
...@@ -3892,8 +3890,6 @@ static bool ...@@ -3892,8 +3890,6 @@ static bool
tree_forwarder_block_p (basic_block bb) tree_forwarder_block_p (basic_block bb)
{ {
block_stmt_iterator bsi; block_stmt_iterator bsi;
edge e;
edge_iterator ei;
/* BB must have a single outgoing edge. */ /* BB must have a single outgoing edge. */
if (EDGE_COUNT (bb->succs) != 1 if (EDGE_COUNT (bb->succs) != 1
...@@ -3911,10 +3907,8 @@ tree_forwarder_block_p (basic_block bb) ...@@ -3911,10 +3907,8 @@ tree_forwarder_block_p (basic_block bb)
gcc_assert (bb != ENTRY_BLOCK_PTR); gcc_assert (bb != ENTRY_BLOCK_PTR);
#endif #endif
/* Successors of the entry block are not forwarders. */ if (find_edge (ENTRY_BLOCK_PTR, bb))
FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR->succs) return false;
if (e->dest == bb)
return false;
/* Now walk through the statements. We can ignore labels, anything else /* Now walk through the statements. We can ignore labels, anything else
means this is not a forwarder block. */ means this is not a forwarder block. */
...@@ -5206,7 +5200,6 @@ tree_flow_call_edges_add (sbitmap blocks) ...@@ -5206,7 +5200,6 @@ tree_flow_call_edges_add (sbitmap blocks)
Handle this by adding a dummy instruction in a new last basic block. */ Handle this by adding a dummy instruction in a new last basic block. */
if (check_last_block) if (check_last_block)
{ {
edge_iterator ei;
basic_block bb = EXIT_BLOCK_PTR->prev_bb; basic_block bb = EXIT_BLOCK_PTR->prev_bb;
block_stmt_iterator bsi = bsi_last (bb); block_stmt_iterator bsi = bsi_last (bb);
tree t = NULL_TREE; tree t = NULL_TREE;
...@@ -5217,13 +5210,12 @@ tree_flow_call_edges_add (sbitmap blocks) ...@@ -5217,13 +5210,12 @@ tree_flow_call_edges_add (sbitmap blocks)
{ {
edge e; edge e;
FOR_EACH_EDGE (e, ei, bb->succs) e = find_edge (bb, EXIT_BLOCK_PTR);
if (e->dest == EXIT_BLOCK_PTR) if (e)
{ {
bsi_insert_on_edge (e, build_empty_stmt ()); bsi_insert_on_edge (e, build_empty_stmt ());
bsi_commit_edge_inserts (); bsi_commit_edge_inserts ();
break; }
}
} }
} }
...@@ -5260,9 +5252,8 @@ tree_flow_call_edges_add (sbitmap blocks) ...@@ -5260,9 +5252,8 @@ tree_flow_call_edges_add (sbitmap blocks)
#ifdef ENABLE_CHECKING #ifdef ENABLE_CHECKING
if (stmt == last_stmt) if (stmt == last_stmt)
{ {
edge_iterator ei; e = find_edge (bb, EXIT_BLOCK_PTR);
FOR_EACH_EDGE (e, ei, bb->succs) gcc_assert (e == NULL);
gcc_assert (e->dest != EXIT_BLOCK_PTR);
} }
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment