diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-11-22 17:14:00 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-11-22 17:14:00 +0000 |
commit | c6356c1796657da2e0b31ea892ed768375c96ef1 (patch) | |
tree | e3538ca20caef7bf1f7f387c46b84c91cda52be6 /gcc | |
parent | 3fc92937aad25385f5ae0e1e8525a8f05c5e0d1f (diff) | |
download | gcc-c6356c1796657da2e0b31ea892ed768375c96ef1.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@91019 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/cfg.c | 13 | ||||
-rw-r--r-- | gcc/cfgbuild.c | 11 | ||||
-rw-r--r-- | gcc/cfghooks.c | 7 | ||||
-rw-r--r-- | gcc/cfgloop.c | 9 | ||||
-rw-r--r-- | gcc/cfgloopmanip.c | 5 | ||||
-rw-r--r-- | gcc/cfgrtl.c | 19 | ||||
-rw-r--r-- | gcc/predict.c | 41 | ||||
-rw-r--r-- | gcc/tracer.c | 5 | ||||
-rw-r--r-- | gcc/tree-cfg.c | 33 |
10 files changed, 71 insertions, 86 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6c3ed41ed82..33a81cc01f9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/cfg.c b/gcc/cfg.c index 85f6fac4125..f7e5a79e0ae 100644 --- a/gcc/cfg.c +++ b/gcc/cfg.c @@ -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; } diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c index f5bf3e839cd..134a984fa76 100644 --- a/gcc/cfgbuild.c +++ b/gcc/cfgbuild.c @@ -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) diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c index 42d1183841a..841e468bfbb 100644 --- a/gcc/cfghooks.c +++ b/gcc/cfghooks.c @@ -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); } diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c index d985a2caa95..303c2187c50 100644 --- a/gcc/cfgloop.c +++ b/gcc/cfgloop.c @@ -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. */ diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c index a370e385d89..06fbf701e23 100644 --- a/gcc/cfgloopmanip.c +++ b/gcc/cfgloopmanip.c @@ -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); } diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index 8ac70879cc0..69970518de4 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -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 diff --git a/gcc/predict.c b/gcc/predict.c index 432e8373f38..daf98398f29 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -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) diff --git a/gcc/tracer.c b/gcc/tracer.c index 968d093b723..9b8876602ca 100644 --- a/gcc/tracer.c +++ b/gcc/tracer.c @@ -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); diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 337463c0e39..fea09d88bfe 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -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 |