summaryrefslogtreecommitdiff
path: root/gcc/optabs.c
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-10 09:22:28 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-10 09:22:28 +0000
commitb690c0a33b1f18112b01f6213f82678d7aa9fe42 (patch)
tree53321caf2b610be1206b5d38f653d831c8fd72e4 /gcc/optabs.c
parent856b332650b9d74b647e8bb4084c24e99e28462c (diff)
downloadgcc-b690c0a33b1f18112b01f6213f82678d7aa9fe42.tar.gz
* lambda-mat.c (lambda_matrix_inverse_hard): Use gcc_assert
and gcc_unreachable instead of abort. * lambda.h (lambda_vector_min_nz): Likewise. * langhooks.c lhd_set_decl_assembler_name, lhd_can_use_bit_fields_p, lhd_incomplete_type_error, lhd_expand_expr, lhd_types_compatible_p, lhd_gimplify_expr): Likewise. * lcm.c (optimize_mode_switching): Likewise. * local-alloc.c (update_equiv_regs, block_alloc, find_free_reg): Likewise. * loop-doloop.c (doloop_modify): Likewise. * loop-invariant.c (record_use): Likewise. * loop-iv.c (get_biv_step_1, get_biv_step, iv_analyze, get_iv_value, canon_condition, simplify_using_condition, simplify_using_initial_values, shorten_into_mode, canonicalize_iv_subregs, iv_number_of_iterations): Likewise. * loop-unroll.c (unroll_and_peel_loops, peel_loop_completely, unroll_loop_constant_iterations, unroll_loop_runtime_iterations, peel_loop_simple, unroll_loop_stupid): Likewise. * loop-unswitch.c (compare_and_jump_seq, unswitch_single_loop, unswitch_loop): Likewise. * loop.c (gen_prefetch, loop_optimize, rtx_equal_for_loop_p, move_movables, replace_call_address, find_and_verify_loops, rtx_equal_for_prefetch_p, record_giv, general_induction_var, simplify_giv_expr, check_ext_dependent_givs, try_copy_prop, loop_giv_dump): Likewise. * loop.h (INSN_LUID): Likewise. * modulo-sched.c (normalize_sched_times, generate_prolog_epilog, sms_schedule, check_nodes_order): Likewise. * optabs.c (gen_conditional, add_equal_note, expand_simple_binop, expand_twoval_unop, expand_twoval_binop, expand_twoval_binop_libfunc, expand_simple_unop, emit_no_conflict_block, prepare_cmp_insn, emit_cmp_and_jump_insn_1, emit_cmp_and_jump_insns, prepare_float_lib_cmp, gen_add2_insn, have_add2_insn, gen_sub2_insn, have_sub2_insn, expand_float, expand_fix, debug_optab_libfuncs): Likewise. * opts.c (common_handle_option): Likewise. * params.c (set_param_value): Likewise. * passes.c (open_dump_file, rest_of_handle_final): Likewise. * postreload-gcse.c (expr_equiv_p, oprs_unchanged_p,hash_scan_set, reg_set_between_after_reload_p, reg_used_between_after_reload_p, get_avail_load_store_reg, eliminate_partially_redundant_load): Likewise. * postreload.c (reload_cse_simplify_set, reload_combine_note_use): Likewise. * predict.c (tree_predicted_by_p, expected_value_to_br_prob, propagate_freq, expensive_function_p): Likewise. * pretty-print.c (pp_base_format_text) * profile.c (instrument_edges, instrument_values, compute_branch_probabilities, branch_prob, union_groups, end_branch_prob, tree_register_profile_hooks): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87285 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r--gcc/optabs.c114
1 files changed, 44 insertions, 70 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c
index cc48ab53949..864e813099d 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -119,7 +119,7 @@ static rtx expand_parity (enum machine_mode, rtx, rtx);
#ifndef HAVE_conditional_trap
#define HAVE_conditional_trap 0
-#define gen_conditional_trap(a,b) (abort (), NULL_RTX)
+#define gen_conditional_trap(a,b) (gcc_unreachable (), NULL_RTX)
#endif
/* Add a REG_EQUAL note to the last insn in INSNS. TARGET is being set to
@@ -138,10 +138,9 @@ add_equal_note (rtx insns, rtx target, enum rtx_code code, rtx op0, rtx op1)
rtx last_insn, insn, set;
rtx note;
- if (! insns
- || ! INSN_P (insns)
- || NEXT_INSN (insns) == NULL_RTX)
- abort ();
+ gcc_assert (insns);
+ gcc_assert (INSN_P (insns));
+ gcc_assert (NEXT_INSN (insns) != NULL_RTX);
if (GET_RTX_CLASS (code) != RTX_COMM_ARITH
&& GET_RTX_CLASS (code) != RTX_BIN_ARITH
@@ -672,8 +671,7 @@ expand_simple_binop (enum machine_mode mode, enum rtx_code code, rtx op0,
enum optab_methods methods)
{
optab binop = code_to_optab[(int) code];
- if (binop == 0)
- abort ();
+ gcc_assert (binop != 0);
return expand_binop (mode, binop, op0, op1, target, unsignedp, methods);
}
@@ -1712,9 +1710,8 @@ expand_twoval_unop (optab unoptab, rtx op0, rtx targ0, rtx targ1,
/* We could handle this, but we should always be called with a pseudo
for our targets and all insns should take them as outputs. */
- if (! (*insn_data[icode].operand[0].predicate) (targ0, mode)
- || ! (*insn_data[icode].operand[1].predicate) (targ1, mode))
- abort ();
+ gcc_assert ((*insn_data[icode].operand[0].predicate) (targ0, mode));
+ gcc_assert ((*insn_data[icode].operand[1].predicate) (targ1, mode));
pat = GEN_FCN (icode) (targ0, targ1, xop0);
if (pat)
@@ -1841,9 +1838,8 @@ expand_twoval_binop (optab binoptab, rtx op0, rtx op1, rtx targ0, rtx targ1,
/* We could handle this, but we should always be called with a pseudo
for our targets and all insns should take them as outputs. */
- if (! (*insn_data[icode].operand[0].predicate) (targ0, mode)
- || ! (*insn_data[icode].operand[3].predicate) (targ1, mode))
- abort ();
+ gcc_assert ((*insn_data[icode].operand[0].predicate) (targ0, mode));
+ gcc_assert ((*insn_data[icode].operand[3].predicate) (targ1, mode));
pat = GEN_FCN (icode) (targ0, xop0, xop1, targ1);
if (pat)
@@ -1906,8 +1902,7 @@ expand_twoval_binop_libfunc (optab binoptab, rtx op0, rtx op1,
rtx insns;
/* Exactly one of TARG0 or TARG1 should be non-NULL. */
- if (!((targ0 != NULL_RTX) ^ (targ1 != NULL_RTX)))
- abort ();
+ gcc_assert ((targ0 != NULL_RTX) ^ (targ1 != NULL_RTX));
mode = GET_MODE (op0);
if (!binoptab->handlers[(int) mode].libfunc)
@@ -1944,8 +1939,7 @@ expand_simple_unop (enum machine_mode mode, enum rtx_code code, rtx op0,
rtx target, int unsignedp)
{
optab unop = code_to_optab[(int) code];
- if (unop == 0)
- abort ();
+ gcc_assert (unop != 0);
return expand_unop (mode, unop, op0, target, unsignedp);
}
@@ -2620,8 +2614,7 @@ emit_no_conflict_block (rtx insns, rtx target, rtx op0, rtx op1, rtx equiv)
}
}
- if (set == 0)
- abort ();
+ gcc_assert (set != 0);
if (! reg_overlap_mentioned_p (target, SET_DEST (set)))
{
@@ -2932,7 +2925,7 @@ prepare_cmp_insn (rtx *px, rtx *py, enum rtx_code *pcomparison, rtx size,
/* They could both be VOIDmode if both args are immediate constants,
but we should fold that at an earlier stage.
- With no special code here, this will call abort,
+ With no special code here, this will assert out,
reminding the programmer to implement such folding. */
if (mode != BLKmode && flag_force_mem)
@@ -2961,11 +2954,10 @@ prepare_cmp_insn (rtx *px, rtx *py, enum rtx_code *pcomparison, rtx size,
y = force_reg (mode, y);
#ifdef HAVE_cc0
- /* Abort if we have a non-canonical comparison. The RTL documentation
+ /* Assert out if we have a non-canonical comparison. The RTL documentation
states that canonical comparisons are required only for targets which
have cc0. */
- if (CONSTANT_P (x) && ! CONSTANT_P (y))
- abort ();
+ gcc_assert (!CONSTANT_P (x) || CONSTANT_P (y));
#endif
/* Don't let both operands fail to indicate the mode. */
@@ -2984,8 +2976,7 @@ prepare_cmp_insn (rtx *px, rtx *py, enum rtx_code *pcomparison, rtx size,
rtx opalign
= GEN_INT (MIN (MEM_ALIGN (x), MEM_ALIGN (y)) / BITS_PER_UNIT);
- if (size == 0)
- abort ();
+ gcc_assert (size != 0);
/* Try to use a memory block compare insn - either cmpstr
or cmpmem will do. */
@@ -3082,11 +3073,8 @@ prepare_cmp_insn (rtx *px, rtx *py, enum rtx_code *pcomparison, rtx size,
return;
}
- if (class == MODE_FLOAT)
- prepare_float_lib_cmp (px, py, pcomparison, pmode, punsignedp);
-
- else
- abort ();
+ gcc_assert (class == MODE_FLOAT);
+ prepare_float_lib_cmp (px, py, pcomparison, pmode, punsignedp);
}
/* Before emitting an insn with code ICODE, make sure that X, which is going
@@ -3126,7 +3114,7 @@ emit_cmp_and_jump_insn_1 (rtx x, rtx y, enum machine_mode mode,
enum machine_mode wider_mode = mode;
/* Try combined insns first. */
- do
+ for (;;)
{
enum insn_code icode;
PUT_MODE (test, wider_mode);
@@ -3169,15 +3157,12 @@ emit_cmp_and_jump_insn_1 (rtx x, rtx y, enum machine_mode mode,
return;
}
- if (class != MODE_INT && class != MODE_FLOAT
- && class != MODE_COMPLEX_FLOAT)
- break;
+ gcc_assert (class == MODE_INT || class == MODE_FLOAT
+ || class == MODE_COMPLEX_FLOAT);
wider_mode = GET_MODE_WIDER_MODE (wider_mode);
+ gcc_assert (wider_mode != VOIDmode);
}
- while (wider_mode != VOIDmode);
-
- abort ();
}
/* Generate code to compare X with Y so that the condition codes are
@@ -3208,8 +3193,7 @@ emit_cmp_and_jump_insns (rtx x, rtx y, enum rtx_code comparison, rtx size,
{
/* If we're not emitting a branch, this means some caller
is out of sync. */
- if (! label)
- abort ();
+ gcc_assert (label);
op0 = y, op1 = x;
comparison = swap_condition (comparison);
@@ -3280,8 +3264,7 @@ prepare_float_lib_cmp (rtx *px, rtx *py, enum rtx_code *pcomparison,
}
}
- if (mode == VOIDmode)
- abort ();
+ gcc_assert (mode != VOIDmode);
if (mode != orig_mode)
{
@@ -3339,7 +3322,7 @@ prepare_float_lib_cmp (rtx *px, rtx *py, enum rtx_code *pcomparison,
break;
default:
- abort ();
+ gcc_unreachable ();
}
equiv = simplify_gen_ternary (IF_THEN_ELSE, word_mode, word_mode,
equiv, true_rtx, false_rtx);
@@ -3641,13 +3624,12 @@ gen_add2_insn (rtx x, rtx y)
{
int icode = (int) add_optab->handlers[(int) GET_MODE (x)].insn_code;
- if (! ((*insn_data[icode].operand[0].predicate)
- (x, insn_data[icode].operand[0].mode))
- || ! ((*insn_data[icode].operand[1].predicate)
- (x, insn_data[icode].operand[1].mode))
- || ! ((*insn_data[icode].operand[2].predicate)
- (y, insn_data[icode].operand[2].mode)))
- abort ();
+ gcc_assert ((*insn_data[icode].operand[0].predicate)
+ (x, insn_data[icode].operand[0].mode));
+ gcc_assert ((*insn_data[icode].operand[1].predicate)
+ (x, insn_data[icode].operand[1].mode));
+ gcc_assert ((*insn_data[icode].operand[2].predicate)
+ (y, insn_data[icode].operand[2].mode));
return (GEN_FCN (icode) (x, x, y));
}
@@ -3676,8 +3658,7 @@ have_add2_insn (rtx x, rtx y)
{
int icode;
- if (GET_MODE (x) == VOIDmode)
- abort ();
+ gcc_assert (GET_MODE (x) != VOIDmode);
icode = (int) add_optab->handlers[(int) GET_MODE (x)].insn_code;
@@ -3702,13 +3683,12 @@ gen_sub2_insn (rtx x, rtx y)
{
int icode = (int) sub_optab->handlers[(int) GET_MODE (x)].insn_code;
- if (! ((*insn_data[icode].operand[0].predicate)
- (x, insn_data[icode].operand[0].mode))
- || ! ((*insn_data[icode].operand[1].predicate)
- (x, insn_data[icode].operand[1].mode))
- || ! ((*insn_data[icode].operand[2].predicate)
- (y, insn_data[icode].operand[2].mode)))
- abort ();
+ gcc_assert ((*insn_data[icode].operand[0].predicate)
+ (x, insn_data[icode].operand[0].mode));
+ gcc_assert ((*insn_data[icode].operand[1].predicate)
+ (x, insn_data[icode].operand[1].mode));
+ gcc_assert ((*insn_data[icode].operand[2].predicate)
+ (y, insn_data[icode].operand[2].mode));
return (GEN_FCN (icode) (x, x, y));
}
@@ -3737,8 +3717,7 @@ have_sub2_insn (rtx x, rtx y)
{
int icode;
- if (GET_MODE (x) == VOIDmode)
- abort ();
+ gcc_assert (GET_MODE (x) != VOIDmode);
icode = (int) sub_optab->handlers[(int) GET_MODE (x)].insn_code;
@@ -3864,8 +3843,7 @@ expand_float (rtx to, rtx from, int unsignedp)
enum machine_mode fmode, imode;
/* Crash now, because we won't be able to decide which mode to use. */
- if (GET_MODE (from) == VOIDmode)
- abort ();
+ gcc_assert (GET_MODE (from) != VOIDmode);
/* Look for an insn to do the conversion. Do it in the specified
modes if possible; otherwise convert either input, output or both to
@@ -4026,8 +4004,7 @@ expand_float (rtx to, rtx from, int unsignedp)
from = force_not_mem (from);
libfunc = tab->handlers[GET_MODE (to)][GET_MODE (from)].libfunc;
- if (!libfunc)
- abort ();
+ gcc_assert (libfunc);
start_sequence ();
@@ -4210,8 +4187,7 @@ expand_fix (rtx to, rtx from, int unsignedp)
convert_optab tab = unsignedp ? ufix_optab : sfix_optab;
libfunc = tab->handlers[GET_MODE (to)][GET_MODE (from)].libfunc;
- if (!libfunc)
- abort ();
+ gcc_assert (libfunc);
if (flag_force_mem)
from = force_not_mem (from);
@@ -4824,8 +4800,7 @@ debug_optab_libfuncs (void)
h = &o->handlers[j];
if (h->libfunc)
{
- if (GET_CODE (h->libfunc) != SYMBOL_REF)
- abort ();
+ gcc_assert (GET_CODE (h->libfunc) == SYMBOL_REF);
fprintf (stderr, "%s\t%s:\t%s\n",
GET_RTX_NAME (o->code),
GET_MODE_NAME (j),
@@ -4845,8 +4820,7 @@ debug_optab_libfuncs (void)
h = &o->handlers[j][k];
if (h->libfunc)
{
- if (GET_CODE (h->libfunc) != SYMBOL_REF)
- abort ();
+ gcc_assert (GET_CODE (h->libfunc) == SYMBOL_REF);
fprintf (stderr, "%s\t%s\t%s:\t%s\n",
GET_RTX_NAME (o->code),
GET_MODE_NAME (j),