summaryrefslogtreecommitdiff
path: root/gcc/cselib.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2004-09-07 15:46:53 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2004-09-07 15:46:53 +0000
commit341c100fc52d5e5175ac3e3aa3caf096c8ac1378 (patch)
treece9be778c6fd5bbc5eb633ed0344673882ecdabe /gcc/cselib.c
parent6b094f38d7561422c087a31d26a8d36b58d7a549 (diff)
downloadgcc-341c100fc52d5e5175ac3e3aa3caf096c8ac1378.tar.gz
cfganal.c (flow_depth_first_order_compute, [...]): Use gcc_assert or gcc_unreachable.
* 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. From-SVN: r87145
Diffstat (limited to 'gcc/cselib.c')
-rw-r--r--gcc/cselib.c103
1 files changed, 54 insertions, 49 deletions
diff --git a/gcc/cselib.c b/gcc/cselib.c
index bf50dcaf991..aa9224892d9 100644
--- a/gcc/cselib.c
+++ b/gcc/cselib.c
@@ -235,9 +235,9 @@ entry_and_rtx_equal_p (const void *entry, const void *x_arg)
rtx x = (rtx) x_arg;
enum machine_mode mode = GET_MODE (x);
- if (GET_CODE (x) == CONST_INT
- || (mode == VOIDmode && GET_CODE (x) == CONST_DOUBLE))
- abort ();
+ gcc_assert (GET_CODE (x) != CONST_INT
+ && (mode != VOIDmode || GET_CODE (x) != CONST_DOUBLE));
+
if (mode != GET_MODE (v->u.val_rtx))
return 0;
@@ -370,8 +370,7 @@ remove_useless_values (void)
htab_traverse (hash_table, discard_useless_values, 0);
- if (n_useless_values != 0)
- abort ();
+ gcc_assert (!n_useless_values);
}
/* Return the mode in which a register was last set. If X is not a
@@ -524,7 +523,7 @@ rtx_equal_for_cselib_p (rtx x, rtx y)
contain anything but integers and other rtx's,
except for within LABEL_REFs and SYMBOL_REFs. */
default:
- abort ();
+ gcc_unreachable ();
}
}
return 1;
@@ -539,8 +538,7 @@ wrap_constant (enum machine_mode mode, rtx x)
if (GET_CODE (x) != CONST_INT
&& (GET_CODE (x) != CONST_DOUBLE || GET_MODE (x) != VOIDmode))
return x;
- if (mode == VOIDmode)
- abort ();
+ gcc_assert (mode != VOIDmode);
return gen_rtx_CONST (mode, x);
}
@@ -643,40 +641,54 @@ cselib_hash_rtx (rtx x, enum machine_mode mode, int create)
fmt = GET_RTX_FORMAT (code);
for (; i >= 0; i--)
{
- if (fmt[i] == 'e')
+ switch (fmt[i])
{
- rtx tem = XEXP (x, i);
- unsigned int tem_hash = cselib_hash_rtx (tem, 0, create);
-
- if (tem_hash == 0)
- return 0;
-
- hash += tem_hash;
- }
- else if (fmt[i] == 'E')
- for (j = 0; j < XVECLEN (x, i); j++)
+ case 'e':
{
- unsigned int tem_hash = cselib_hash_rtx (XVECEXP (x, i, j), 0, create);
-
+ rtx tem = XEXP (x, i);
+ unsigned int tem_hash = cselib_hash_rtx (tem, 0, create);
+
if (tem_hash == 0)
return 0;
-
+
hash += tem_hash;
}
- else if (fmt[i] == 's')
- {
- const unsigned char *p = (const unsigned char *) XSTR (x, i);
+ break;
+ case 'E':
+ for (j = 0; j < XVECLEN (x, i); j++)
+ {
+ unsigned int tem_hash
+ = cselib_hash_rtx (XVECEXP (x, i, j), 0, create);
+
+ if (tem_hash == 0)
+ return 0;
+
+ hash += tem_hash;
+ }
+ break;
+
+ case 's':
+ {
+ const unsigned char *p = (const unsigned char *) XSTR (x, i);
+
+ if (p)
+ while (*p)
+ hash += *p++;
+ break;
+ }
+
+ case 'i':
+ hash += XINT (x, i);
+ break;
- if (p)
- while (*p)
- hash += *p++;
+ case '0':
+ case 't':
+ /* unused */
+ break;
+
+ default:
+ gcc_unreachable ();
}
- else if (fmt[i] == 'i')
- hash += XINT (x, i);
- else if (fmt[i] == '0' || fmt[i] == 't')
- /* unused */;
- else
- abort ();
}
return hash ? hash : 1 + (unsigned int) GET_CODE (x);
@@ -690,10 +702,7 @@ new_cselib_val (unsigned int value, enum machine_mode mode)
{
cselib_val *e = pool_alloc (cselib_val_pool);
-#ifdef ENABLE_CHECKING
- if (value == 0)
- abort ();
-#endif
+ gcc_assert (value);
e->value = value;
/* We use custom method to allocate this RTL construct because it accounts
@@ -799,7 +808,7 @@ cselib_subst_to_values (rtx x)
if (GET_MODE (l->elt->u.val_rtx) == GET_MODE (x))
return l->elt->u.val_rtx;
- abort ();
+ gcc_unreachable ();
case MEM:
e = cselib_lookup_mem (x, 0);
@@ -963,9 +972,8 @@ cselib_invalidate_regno (unsigned int regno, enum machine_mode mode)
unsigned int i;
/* If we see pseudos after reload, something is _wrong_. */
- if (reload_completed && regno >= FIRST_PSEUDO_REGISTER
- && reg_renumber[regno] >= 0)
- abort ();
+ gcc_assert (!reload_completed || regno < FIRST_PSEUDO_REGISTER
+ || reg_renumber[regno] < 0);
/* Determine the range of registers that must be invalidated. For
pseudos, only REGNO is affected. For hard regs, we must take MODE
@@ -973,8 +981,7 @@ cselib_invalidate_regno (unsigned int regno, enum machine_mode mode)
if they contain values that overlap REGNO. */
if (regno < FIRST_PSEUDO_REGISTER)
{
- if (mode == VOIDmode)
- abort ();
+ gcc_assert (mode != VOIDmode);
if (regno < max_value_regs)
i = 0;
@@ -1188,11 +1195,9 @@ cselib_record_set (rtx dest, cselib_val *src_elt, cselib_val *dest_addr_elt)
}
else
{
- if (REG_VALUES (dreg)->elt == 0)
- REG_VALUES (dreg)->elt = src_elt;
- else
- /* The register should have been invalidated. */
- abort ();
+ /* The register should have been invalidated. */
+ gcc_assert (REG_VALUES (dreg)->elt == 0);
+ REG_VALUES (dreg)->elt = src_elt;
}
if (src_elt->locs == 0)