aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgrtl.c
diff options
context:
space:
mode:
authorZdenek Dvorak <dvorakz@suse.cz>2005-03-11 09:05:12 +0000
committerZdenek Dvorak <dvorakz@suse.cz>2005-03-11 09:05:12 +0000
commita56dc54e74ac32a7d7d58e8613d6af1de74a5e65 (patch)
treec92921efb68fbb5a7e8dd2d9a10b526b2c5a61bf /gcc/cfgrtl.c
parent43132022d3a01383cedc40bda3adbcac89bc1979 (diff)
* basic-block.h (single_succ_p, single_pred_p, single_succ_edge,
single_pred_edge, single_succ, single_pred): New inline functions. * bb-reorder.c (rotate_loop, find_traces_1_round, add_labels_and_missing_jumps, fix_up_fall_thru_edges, duplicate_computed_gotos): Use the single_succ/pred functions. * cfganal.c (forwarder_block_p): Ditto. * cfgbuild.c (compute_outgoing_frequencies): Ditto. * cfgcleanup.c (try_simplify_condjump, try_forward_edges, outgoing_edges_match, try_crossjump_to_edge, try_optimize_cfg, merge_seq_blocks): Ditto. * cfghooks.c (split_edge, tidy_fallthru_edges): Ditto. * cfglayout.c (fixup_reorder_chain): Ditto. * cfgloop.c (mark_single_exit_loops, update_latch_info, canonicalize_loop_headers, verify_loop_structure): Ditto. * cfgloopmanip.c (remove_path, unloop, loop_delete_branch_edge, mfb_update_loops, create_preheader, force_single_succ_latches, create_loop_notes): Ditto. * cfgrtl.c (rtl_can_merge_blocks, try_redirect_by_replacing_jump, force_nonfallthru_and_redirect, rtl_tidy_fallthru_edge, commit_one_edge_insertion, purge_dead_edges, cfg_layout_can_merge_blocks_p): Ditto. * except.c (sjlj_emit_function_enter): Ditto. * flow.c (init_propagate_block_info): Ditto. * function.c (thread_prologue_and_epilogue_insns): Ditto. * gcse.c (find_implicit_sets, bypass_conditional_jumps, insert_insn_end_bb): Ditto. * ifcvt.c (merge_if_block, find_if_block, find_if_case_1, find_if_case_2): Ditto. * lambda-code.c (perfect_nestify): Ditto. * lcm.c (optimize_mode_switching): Ditto. * loop-doloop.c (doloop_modify): Ditto. * loop-init.c (loop_optimizer_init): Ditto. * loop-iv.c (simplify_using_initial_values): Ditto. * loop-unroll.c (unroll_loop_runtime_iterations): Ditto. * loop-unswitch.c (unswitch_loop): Ditto. * modulo-sched.c (generate_prolog_epilog): Ditto. * predict.c (combine_predictions_for_insn, estimate_probability, tree_estimate_probability, last_basic_block_p, estimate_bb_frequencies): Ditto. * profile.c (branch_prob): Ditto. * regrename.c (copyprop_hardreg_forward): Ditto. * sched-rgn.c (is_cfg_nonregular, find_rgns, update_live): Ditto. * tracer.c (layout_superblocks): Ditto. * tree-cfg.c (tree_can_merge_blocks_p, tree_merge_blocks, cfg_remove_useless_stmts_bb, cleanup_control_flow, cleanup_control_expr_graph, disband_implicit_edges, tree_find_edge_insert_loc, bsi_commit_edge_inserts, tree_verify_flow_info, tree_make_forwarder_block, tree_forwarder_block_p, remove_forwarder_block, remove_forwarder_block_with_phi, merge_phi_nodes): Ditto. * tree-if-conv.c (tree_if_conversion): Ditto. * tree-mudflap.c (mf_build_check_statement_for): Ditto. * tree-ssa-dce.c (remove_dead_stmt): Ditto. * tree-ssa-dom.c (dom_opt_finalize_block): Ditto. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, copy_loop_headers): Ditto. * tree-ssa-loop-im.c (loop_commit_inserts): Ditto. * tree-ssa-loop-ivopts.c (compute_phi_arg_on_exit): Ditto. * tree-ssa-loop-manip.c (split_loop_exit_edge, ip_normal_pos, lv_adjust_loop_entry_edge, tree_ssa_loop_version): Ditto. * tree-ssa-loop-niter.c (simplify_using_initial_conditions): Ditto. * tree-ssa-loop-unswitch.c (simplify_using_entry_checks): Ditto. * tree-ssa-phiopt.c (tree_ssa_phiopt, value_replacement): Ditto. * tree-ssa-pre.c (compute_antic_aux, insert_aux, init_pre): Ditto. * tree-ssa-threadupdate.c (redirect_edges): Ditto. * tree-tailcall.c (independent_of_stmt_p, find_tail_calls, eliminate_tail_call, tree_optimize_tail_calls_1): Ditto. * tree-vect-analyze.c (vect_analyze_loop_form): Ditto. * tree-vect-transform.c (vect_update_ivs_after_vectorizer): Ditto. * tree-vectorizer.c (slpeel_update_phi_nodes_for_guard, slpeel_add_loop_guard): Ditto. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@96292 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgrtl.c')
-rw-r--r--gcc/cfgrtl.c54
1 files changed, 28 insertions, 26 deletions
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 8190d4fc21b..92399068dca 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -623,12 +623,12 @@ rtl_can_merge_blocks (basic_block a,basic_block b)
return false;
/* There must be exactly one edge in between the blocks. */
- return (EDGE_COUNT (a->succs) == 1
- && EDGE_SUCC (a, 0)->dest == b
- && EDGE_COUNT (b->preds) == 1
+ return (single_succ_p (a)
+ && single_succ (a) == b
+ && single_pred_p (b)
&& a != b
/* Must be simple edge. */
- && !(EDGE_SUCC (a, 0)->flags & EDGE_COMPLEX)
+ && !(single_succ_edge (a)->flags & EDGE_COMPLEX)
&& a->next_bb == b
&& a != ENTRY_BLOCK_PTR && b != EXIT_BLOCK_PTR
/* If the jump insn has side effects,
@@ -817,10 +817,11 @@ try_redirect_by_replacing_jump (edge e, basic_block target, bool in_cfglayout)
}
/* Keep only one edge out and set proper flags. */
- while (EDGE_COUNT (src->succs) > 1)
+ if (!single_succ_p (src))
remove_edge (e);
+ gcc_assert (single_succ_p (src));
- e = EDGE_SUCC (src, 0);
+ e = single_succ_edge (src);
if (fallthru)
e->flags = EDGE_FALLTHRU;
else
@@ -1124,7 +1125,7 @@ force_nonfallthru_and_redirect (edge e, basic_block target)
}
if (JUMP_P (BB_END (jump_block))
&& !any_condjump_p (BB_END (jump_block))
- && (EDGE_SUCC (jump_block, 0)->flags & EDGE_CROSSING))
+ && (single_succ_edge (jump_block)->flags & EDGE_CROSSING))
REG_NOTES (BB_END (jump_block)) = gen_rtx_EXPR_LIST
(REG_CROSSING_JUMP, NULL_RTX,
REG_NOTES (BB_END (jump_block)));
@@ -1226,7 +1227,7 @@ rtl_tidy_fallthru_edge (edge e)
if (JUMP_P (q)
&& onlyjump_p (q)
&& (any_uncondjump_p (q)
- || EDGE_COUNT (b->succs) == 1))
+ || single_succ_p (b)))
{
#ifdef HAVE_cc0
/* If this was a conditional jump, we need to also delete
@@ -1544,7 +1545,7 @@ commit_one_edge_insertion (edge e, int watch_calls)
/* Special case -- avoid inserting code between call and storing
its return value. */
if (watch_calls && (e->flags & EDGE_FALLTHRU)
- && EDGE_COUNT (e->dest->preds) == 1
+ && single_pred_p (e->dest)
&& e->src != ENTRY_BLOCK_PTR
&& CALL_P (BB_END (e->src)))
{
@@ -1564,7 +1565,7 @@ commit_one_edge_insertion (edge e, int watch_calls)
{
/* Figure out where to put these things. If the destination has
one predecessor, insert there. Except for the exit block. */
- if (EDGE_COUNT (e->dest->preds) == 1 && e->dest != EXIT_BLOCK_PTR)
+ if (single_pred_p (e->dest) && e->dest != EXIT_BLOCK_PTR)
{
bb = e->dest;
@@ -1590,7 +1591,7 @@ commit_one_edge_insertion (edge e, int watch_calls)
/* If the source has one successor and the edge is not abnormal,
insert there. Except for the entry block. */
else if ((e->flags & EDGE_ABNORMAL) == 0
- && EDGE_COUNT (e->src->succs) == 1
+ && single_succ_p (e->src)
&& e->src != ENTRY_BLOCK_PTR)
{
bb = e->src;
@@ -1645,7 +1646,7 @@ commit_one_edge_insertion (edge e, int watch_calls)
NOTE_BASIC_BLOCK (new_note) = bb;
if (JUMP_P (BB_END (bb))
&& !any_condjump_p (BB_END (bb))
- && (EDGE_SUCC (bb, 0)->flags & EDGE_CROSSING))
+ && (single_succ_edge (bb)->flags & EDGE_CROSSING))
REG_NOTES (BB_END (bb)) = gen_rtx_EXPR_LIST
(REG_CROSSING_JUMP, NULL_RTX, REG_NOTES (BB_END (bb)));
if (after == bb_note)
@@ -1671,9 +1672,9 @@ commit_one_edge_insertion (edge e, int watch_calls)
for the (single) epilogue, which already has a fallthru edge
to EXIT. */
- e = EDGE_SUCC (bb, 0);
+ e = single_succ_edge (bb);
gcc_assert (e->dest == EXIT_BLOCK_PTR
- && EDGE_COUNT (bb->succs) == 1 && (e->flags & EDGE_FALLTHRU));
+ && single_succ_p (bb) && (e->flags & EDGE_FALLTHRU));
e->flags &= ~EDGE_FALLTHRU;
emit_barrier_after (last);
@@ -2404,10 +2405,10 @@ purge_dead_edges (basic_block bb)
return purged;
/* Redistribute probabilities. */
- if (EDGE_COUNT (bb->succs) == 1)
+ if (single_succ_p (bb))
{
- EDGE_SUCC (bb, 0)->probability = REG_BR_PROB_BASE;
- EDGE_SUCC (bb, 0)->count = bb->count;
+ single_succ_edge (bb)->probability = REG_BR_PROB_BASE;
+ single_succ_edge (bb)->count = bb->count;
}
else
{
@@ -2431,8 +2432,9 @@ purge_dead_edges (basic_block bb)
from non-local gotos and the like. If there were, we shouldn't
have created the sibcall in the first place. Second, there
should of course never have been a fallthru edge. */
- gcc_assert (EDGE_COUNT (bb->succs) == 1);
- gcc_assert (EDGE_SUCC (bb, 0)->flags == (EDGE_SIBCALL | EDGE_ABNORMAL));
+ gcc_assert (single_succ_p (bb));
+ gcc_assert (single_succ_edge (bb)->flags
+ == (EDGE_SIBCALL | EDGE_ABNORMAL));
return 0;
}
@@ -2465,10 +2467,10 @@ purge_dead_edges (basic_block bb)
ei_next (&ei);
}
- gcc_assert (EDGE_COUNT (bb->succs) == 1);
+ gcc_assert (single_succ_p (bb));
- EDGE_SUCC (bb, 0)->probability = REG_BR_PROB_BASE;
- EDGE_SUCC (bb, 0)->count = bb->count;
+ single_succ_edge (bb)->probability = REG_BR_PROB_BASE;
+ single_succ_edge (bb)->count = bb->count;
if (dump_file)
fprintf (dump_file, "Purged non-fallthru edges from bb %i\n",
@@ -2722,12 +2724,12 @@ cfg_layout_can_merge_blocks_p (basic_block a, basic_block b)
return false;
/* There must be exactly one edge in between the blocks. */
- return (EDGE_COUNT (a->succs) == 1
- && EDGE_SUCC (a, 0)->dest == b
- && EDGE_COUNT (b->preds) == 1
+ return (single_succ_p (a)
+ && single_succ (a) == b
+ && single_pred_p (b) == 1
&& a != b
/* Must be simple edge. */
- && !(EDGE_SUCC (a, 0)->flags & EDGE_COMPLEX)
+ && !(single_succ_edge (a)->flags & EDGE_COMPLEX)
&& a != ENTRY_BLOCK_PTR && b != EXIT_BLOCK_PTR
/* If the jump insn has side effects,
we can't kill the edge. */