summaryrefslogtreecommitdiff
path: root/gcc/cfglayout.c
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-07 15:46:53 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-07 15:46:53 +0000
commitcc636d560f756da291b909e5c1790ffba37c4e8c (patch)
treece9be778c6fd5bbc5eb633ed0344673882ecdabe /gcc/cfglayout.c
parent71bd4883d964169b14dfd5f83896fbc07cf2b55c (diff)
downloadgcc-cc636d560f756da291b909e5c1790ffba37c4e8c.tar.gz
* cfganal.c (flow_depth_first_order_compute, dfs_enumerate_from,
cfgbuild.c, inside_basic_block_p, control_flow_insn_p, make_label_edge, make_edges, find_basic_blocks_1): Use gcc_assert or gcc_unreachable. * cfg.c (clear_edges, initialize_bb_rbi, compact_blocks, remove_edge, alloc_aux_for_blocks, free_aux_for_blocks, alloc_aux_for_edges, free_aux_for_edges): Likewise. * cfgcleanup.c (try_forward_edges, merge_blocks_move_predecessor_nojumps, merge_blocks_move_successor_nojumps): Likewise. * cfgexpand.c (expand_gimple_cond_expr, expand_gimple_tailcall): Likewise. * cfghooks.c (duplicate_block): Likewise. * cfglayout.c (record_effective_endpoints, insn_locators_initialize, change_scope, fixup_reorder_chain, verify_insn_chain, fixup_fallthru_exit_predecessor, duplicate_insn_chain, cfg_layout_finalize): Likewise. * cfgloopanal.c (check_irred): Likewise. * cfgloop.c (superloop_at_depth, flow_loops_free, flow_loop_entry_edges_find, flow_loops_find, flow_loop_outside_edge_p, get_loop_body, get_loop_body_in_dom_order, get_loop_body_in_bfs_order, get_loop_exit_edges, num_loop_branches, cancel_loop, verify_loop_structure): Likewise. cfgloopmanip.c (find_path, remove_path, loop_delete_branch_edge, duplicate_loop_to_header_edge, create_preheader, create_loop_notes): Likewise. * cfgrtl.c (delete_insn, try_redirect_by_replacing_jump, edirect_branch_edge, force_nonfallthru_and_redirect, rtl_split_edge, insert_insn_on_edge, commit_one_edge_insertion, commit_edge_insertions, commit_edge_insertions_watch_calls, purge_dead_edges, cfg_layout_redirect_edge_and_branch, cfg_layout_redirect_edge_and_branch_force, cfg_layout_merge_blocks, rtl_flow_call_edges_add): Likewise. * cgraph.c (cgraph_node, cgraph_create_edge, cgraph_remove_edge, cgraph_redirect_edge_callee, cgraph_global_info, cgraph_rtl_info, cgraph_varpool_node): Likewise. * cgraphunit.c (cgraph_finalize_function, cgraph_finalize_compilation_unit, cgraph_mark_functions_to_output, cgraph_expand_function, cgraph_remove_unreachable_nodes, cgraph_clone_inlined_nodes, cgraph_mark_inline_edge, cgraph_mark_inline, cgraph_expand_all_functions, cgraph_build_static_cdtor): Likewise. * combine.c (do_SUBST, try_combine, subst, combine_simplify_rtx, simplify_logical, distribute_notes, insn_cuid): Likewise. * conflict.c (conflict_graph_add, print_conflict): Likewise. * coverage.c (rtl_coverage_counter_ref, tree_coverage_counter_ref, coverage_checksum_string): Likewise. * cse.c (make_new_qty, make_regs_eqv, insert, invalidate, hash_rtx, exp_equiv_p, cse_basic_block, count_reg_usage, cse_cc_succs, cse_condition_code_reg): Likewise. * cselib.c (entry_and_rtx_equal_p, remove_useless_values, rtx_equal_for_cselib_p, wrap_constant, cselib_hash_rtx, new_cselib_val, cselib_subst_to_values, cselib_invalidate_regno, cselib_record_set): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87145 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfglayout.c')
-rw-r--r--gcc/cfglayout.c104
1 files changed, 43 insertions, 61 deletions
diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c
index 994ab45c491..bc7cec93f0a 100644
--- a/gcc/cfglayout.c
+++ b/gcc/cfglayout.c
@@ -199,8 +199,9 @@ record_effective_endpoints (void)
&& NOTE_LINE_NUMBER (insn) != NOTE_INSN_BASIC_BLOCK;
insn = NEXT_INSN (insn))
continue;
- if (!insn)
- abort (); /* No basic blocks at all? */
+ /* No basic blocks at all? */
+ gcc_assert (insn);
+
if (PREV_INSN (insn))
cfg_layout_function_header =
unlink_insn_chain (get_insns (), PREV_INSN (insn));
@@ -273,21 +274,14 @@ insn_locators_initialize (void)
if (NOTE_P (insn))
{
- switch (NOTE_LINE_NUMBER (insn))
+ gcc_assert (NOTE_LINE_NUMBER (insn) != NOTE_INSN_BLOCK_BEG
+ && NOTE_LINE_NUMBER (insn) != NOTE_INSN_BLOCK_END);
+ if (NOTE_LINE_NUMBER (insn) > 0)
{
- case NOTE_INSN_BLOCK_BEG:
- case NOTE_INSN_BLOCK_END:
- abort ();
-
- default:
- if (NOTE_LINE_NUMBER (insn) > 0)
- {
- expanded_location xloc;
- NOTE_EXPANDED_LOCATION (xloc, insn);
- line_number = xloc.line;
- file_name = xloc.file;
- }
- break;
+ expanded_location xloc;
+ NOTE_EXPANDED_LOCATION (xloc, insn);
+ line_number = xloc.line;
+ file_name = xloc.file;
}
}
else
@@ -377,8 +371,7 @@ change_scope (rtx orig_insn, tree s1, tree s2)
while (ts1 != ts2)
{
- if (ts1 == NULL || ts2 == NULL)
- abort ();
+ gcc_assert (ts1 && ts2);
if (BLOCK_NUMBER (ts1) > BLOCK_NUMBER (ts2))
ts1 = BLOCK_SUPERCONTEXT (ts1);
else if (BLOCK_NUMBER (ts1) < BLOCK_NUMBER (ts2))
@@ -615,8 +608,7 @@ fixup_reorder_chain (void)
}
}
- if (index != n_basic_blocks)
- abort ();
+ gcc_assert (index == n_basic_blocks);
NEXT_INSN (insn) = cfg_layout_function_footer;
if (cfg_layout_function_footer)
@@ -675,11 +667,14 @@ fixup_reorder_chain (void)
{
rtx note;
edge e_fake;
+ bool redirected;
e_fake = unchecked_make_edge (bb, e_fall->dest, 0);
- if (!redirect_jump (BB_END (bb), block_label (bb), 0))
- abort ();
+ redirected = redirect_jump (BB_END (bb),
+ block_label (bb), 0);
+ gcc_assert (redirected);
+
note = find_reg_note (BB_END (bb), REG_BR_PROB, NULL_RTX);
if (note)
{
@@ -712,8 +707,8 @@ fixup_reorder_chain (void)
{
e_fall->flags &= ~EDGE_FALLTHRU;
#ifdef ENABLE_CHECKING
- if (!could_fall_through (e_taken->src, e_taken->dest))
- abort ();
+ gcc_assert (could_fall_through
+ (e_taken->src, e_taken->dest));
#endif
e_taken->flags |= EDGE_FALLTHRU;
update_br_prob_note (bb);
@@ -736,31 +731,30 @@ fixup_reorder_chain (void)
{
e_fall->flags &= ~EDGE_FALLTHRU;
#ifdef ENABLE_CHECKING
- if (!could_fall_through (e_taken->src, e_taken->dest))
- abort ();
+ gcc_assert (could_fall_through
+ (e_taken->src, e_taken->dest));
#endif
e_taken->flags |= EDGE_FALLTHRU;
update_br_prob_note (bb);
continue;
}
}
- else if (returnjump_p (bb_end_insn))
- continue;
else
{
- /* Otherwise we have some switch or computed jump. In the
- 99% case, there should not have been a fallthru edge. */
- if (! e_fall)
+#ifndef CASE_DROPS_THROUGH
+ /* Otherwise we have some return, switch or computed
+ jump. In the 99% case, there should not have been a
+ fallthru edge. */
+ gcc_assert (returnjump_p (bb_end_insn) || !e_fall);
+ continue;
+#else
+ if (returnjump_p (bb_end_insn) || !e_fall)
continue;
-
-#ifdef CASE_DROPS_THROUGH
/* Except for VAX. Since we didn't have predication for the
tablejump, the fallthru block should not have moved. */
if (bb->rbi->next == e_fall->dest)
continue;
bb_end_insn = skip_insns_after_block (bb);
-#else
- abort ();
#endif
}
}
@@ -903,20 +897,16 @@ verify_insn_chain (void)
for (prevx = NULL, insn_cnt1 = 1, x = get_insns ();
x != 0;
prevx = x, insn_cnt1++, x = NEXT_INSN (x))
- if (PREV_INSN (x) != prevx)
- abort ();
+ gcc_assert (PREV_INSN (x) == prevx);
- if (prevx != get_last_insn ())
- abort ();
+ gcc_assert (prevx == get_last_insn ());
for (nextx = NULL, insn_cnt2 = 1, x = get_last_insn ();
x != 0;
nextx = x, insn_cnt2++, x = PREV_INSN (x))
- if (NEXT_INSN (x) != nextx)
- abort ();
+ gcc_assert (NEXT_INSN (x) == nextx);
- if (insn_cnt1 != insn_cnt2)
- abort ();
+ gcc_assert (insn_cnt1 == insn_cnt2);
}
/* If we have assembler epilogues, the block falling through to exit must
@@ -928,10 +918,10 @@ fixup_fallthru_exit_predecessor (void)
edge e;
basic_block bb = NULL;
- /* This transformation is not valid before reload, because we might separate
- a call from the instruction that copies the return value. */
- if (! reload_completed)
- abort ();
+ /* This transformation is not valid before reload, because we might
+ separate a call from the instruction that copies the return
+ value. */
+ gcc_assert (reload_completed);
for (e = EXIT_BLOCK_PTR->pred; e; e = e->pred_next)
if (e->flags & EDGE_FALLTHRU)
@@ -1058,31 +1048,23 @@ duplicate_insn_chain (rtx from, rtx to)
case NOTE_INSN_BASIC_BLOCK:
break;
- /* There is no purpose to duplicate prologue. */
- case NOTE_INSN_BLOCK_BEG:
- case NOTE_INSN_BLOCK_END:
- /* The BLOCK_BEG/BLOCK_END notes should be eliminated when BB
- reordering is in the progress. */
- case NOTE_INSN_EH_REGION_BEG:
- case NOTE_INSN_EH_REGION_END:
- /* Should never exist at BB duplication time. */
- abort ();
- break;
case NOTE_INSN_REPEATED_LINE_NUMBER:
case NOTE_INSN_UNLIKELY_EXECUTED_CODE:
emit_note_copy (insn);
break;
default:
- if (NOTE_LINE_NUMBER (insn) < 0)
- abort ();
+ /* All other notes should have already been eliminated.
+ */
+ gcc_assert (NOTE_LINE_NUMBER (insn) >= 0);
+
/* It is possible that no_line_number is set and the note
won't be emitted. */
emit_note_copy (insn);
}
break;
default:
- abort ();
+ gcc_unreachable ();
}
}
insn = NEXT_INSN (last);
@@ -1217,7 +1199,7 @@ cfg_layout_finalize (void)
#ifdef ENABLE_CHECKING
verify_insn_chain ();
#endif
-
+
free_rbi_pool ();
FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
bb->rbi = NULL;