aboutsummaryrefslogtreecommitdiff
path: root/gcc/ifcvt.c
diff options
context:
space:
mode:
authorZdenek Dvorak <dvorakz@suse.cz>2005-03-11 10:05:12 +0100
committerZdenek Dvorak <rakdver@gcc.gnu.org>2005-03-11 09:05:12 +0000
commitc5cbcccf9019f6ed28209f903245cce9cfc73e40 (patch)
treec92921efb68fbb5a7e8dd2d9a10b526b2c5a61bf /gcc/ifcvt.c
parent0b2df4a7037bf50942bb43ae799f88a7d6c4c261 (diff)
downloadgcc-c5cbcccf9019f6ed28209f903245cce9cfc73e40.zip
gcc-c5cbcccf9019f6ed28209f903245cce9cfc73e40.tar.gz
gcc-c5cbcccf9019f6ed28209f903245cce9cfc73e40.tar.bz2
basic-block.h (single_succ_p, [...]): New inline functions.
* 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. From-SVN: r96292
Diffstat (limited to 'gcc/ifcvt.c')
-rw-r--r--gcc/ifcvt.c49
1 files changed, 24 insertions, 25 deletions
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index a507c54..b0df6da 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -2278,13 +2278,12 @@ merge_if_block (struct ce_if_block * ce_info)
/* The outgoing edge for the current COMBO block should already
be correct. Verify this. */
- if (EDGE_COUNT (combo_bb->succs) > 1
- || EDGE_SUCC (combo_bb, 0)->dest != join_bb)
- abort ();
+ gcc_assert (single_succ_p (combo_bb)
+ && single_succ (combo_bb) == join_bb);
/* Remove the jump and cruft from the end of the COMBO block. */
if (join_bb != EXIT_BLOCK_PTR)
- tidy_fallthru_edge (EDGE_SUCC (combo_bb, 0));
+ tidy_fallthru_edge (single_succ_edge (combo_bb));
}
num_updated_if_blocks++;
@@ -2456,10 +2455,10 @@ find_if_block (struct ce_if_block * ce_info)
were && tests (which jump to the else block) or || tests (which jump to
the then block). */
if (HAVE_conditional_execution && reload_completed
- && EDGE_COUNT (test_bb->preds) == 1
- && EDGE_PRED (test_bb, 0)->flags == EDGE_FALLTHRU)
+ && single_pred_p (test_bb)
+ && single_pred_edge (test_bb)->flags == EDGE_FALLTHRU)
{
- basic_block bb = EDGE_PRED (test_bb, 0)->src;
+ basic_block bb = single_pred (test_bb);
basic_block target_bb;
int max_insns = MAX_CONDITIONAL_EXECUTE;
int n_insns;
@@ -2492,10 +2491,10 @@ find_if_block (struct ce_if_block * ce_info)
total_insns += n_insns;
blocks++;
- if (EDGE_COUNT (bb->preds) != 1)
+ if (!single_pred_p (bb))
break;
- bb = EDGE_PRED (bb, 0)->src;
+ bb = single_pred (bb);
n_insns = block_jumps_and_fallthru_p (bb, target_bb);
}
while (n_insns >= 0 && (total_insns + n_insns) <= max_insns);
@@ -2530,8 +2529,8 @@ find_if_block (struct ce_if_block * ce_info)
/* The THEN block of an IF-THEN combo must have zero or one successors. */
if (EDGE_COUNT (then_bb->succs) > 0
- && (EDGE_COUNT (then_bb->succs) > 1
- || (EDGE_SUCC (then_bb, 0)->flags & EDGE_COMPLEX)
+ && (!single_succ_p (then_bb)
+ || (single_succ_edge (then_bb)->flags & EDGE_COMPLEX)
|| (flow2_completed && tablejump_p (BB_END (then_bb), NULL, NULL))))
return FALSE;
@@ -2543,7 +2542,7 @@ find_if_block (struct ce_if_block * ce_info)
code processing. ??? we should fix this in the future. */
if (EDGE_COUNT (then_bb->succs) == 0)
{
- if (EDGE_COUNT (else_bb->preds) == 1)
+ if (single_pred_p (else_bb))
{
rtx last_insn = BB_END (then_bb);
@@ -2566,7 +2565,7 @@ find_if_block (struct ce_if_block * ce_info)
/* If the THEN block's successor is the other edge out of the TEST block,
then we have an IF-THEN combo without an ELSE. */
- else if (EDGE_SUCC (then_bb, 0)->dest == else_bb)
+ else if (single_succ (then_bb) == else_bb)
{
join_bb = else_bb;
else_bb = NULL_BLOCK;
@@ -2575,12 +2574,12 @@ find_if_block (struct ce_if_block * ce_info)
/* If the THEN and ELSE block meet in a subsequent block, and the ELSE
has exactly one predecessor and one successor, and the outgoing edge
is not complex, then we have an IF-THEN-ELSE combo. */
- else if (EDGE_COUNT (else_bb->succs) == 1
- && EDGE_SUCC (then_bb, 0)->dest == EDGE_SUCC (else_bb, 0)->dest
- && EDGE_COUNT (else_bb->preds) == 1
- && ! (EDGE_SUCC (else_bb, 0)->flags & EDGE_COMPLEX)
+ else if (single_succ_p (else_bb)
+ && single_succ (then_bb) == single_succ (else_bb)
+ && single_pred_p (else_bb)
+ && ! (single_succ_edge (else_bb)->flags & EDGE_COMPLEX)
&& ! (flow2_completed && tablejump_p (BB_END (else_bb), NULL, NULL)))
- join_bb = EDGE_SUCC (else_bb, 0)->dest;
+ join_bb = single_succ (else_bb);
/* Otherwise it is not an IF-THEN or IF-THEN-ELSE combination. */
else
@@ -2875,15 +2874,15 @@ find_if_case_1 (basic_block test_bb, edge then_edge, edge else_edge)
return FALSE;
/* THEN has one successor. */
- if (EDGE_COUNT (then_bb->succs) != 1)
+ if (!single_succ_p (then_bb))
return FALSE;
/* THEN does not fall through, but is not strange either. */
- if (EDGE_SUCC (then_bb, 0)->flags & (EDGE_COMPLEX | EDGE_FALLTHRU))
+ if (single_succ_edge (then_bb)->flags & (EDGE_COMPLEX | EDGE_FALLTHRU))
return FALSE;
/* THEN has one predecessor. */
- if (EDGE_COUNT (then_bb->preds) != 1)
+ if (!single_pred_p (then_bb))
return FALSE;
/* THEN must do something. */
@@ -2902,7 +2901,7 @@ find_if_case_1 (basic_block test_bb, edge then_edge, edge else_edge)
/* Registers set are dead, or are predicable. */
if (! dead_or_predicable (test_bb, then_bb, else_bb,
- EDGE_SUCC (then_bb, 0)->dest, 1))
+ single_succ (then_bb), 1))
return FALSE;
/* Conversion went ok, including moving the insns and fixing up the
@@ -2980,17 +2979,17 @@ find_if_case_2 (basic_block test_bb, edge then_edge, edge else_edge)
return FALSE;
/* ELSE has one successor. */
- if (EDGE_COUNT (else_bb->succs) != 1)
+ if (!single_succ_p (else_bb))
return FALSE;
else
- else_succ = EDGE_SUCC (else_bb, 0);
+ else_succ = single_succ_edge (else_bb);
/* ELSE outgoing edge is not complex. */
if (else_succ->flags & EDGE_COMPLEX)
return FALSE;
/* ELSE has one predecessor. */
- if (EDGE_COUNT (else_bb->preds) != 1)
+ if (!single_pred_p (else_bb))
return FALSE;
/* THEN is not EXIT. */