aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop-iv.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2005-04-01 14:17:36 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2005-04-01 14:17:36 +0000
commitb5e624c6dc2cfbc1bc41fc4f4b70a320f0f0cadb (patch)
tree2faae66acc9a81f1dddcb31724e669a2eb325a04 /gcc/loop-iv.c
parent71df4441367b6ed747ccc97431f1a63fc68ee00b (diff)
downloadgcc-b5e624c6dc2cfbc1bc41fc4f4b70a320f0f0cadb.zip
gcc-b5e624c6dc2cfbc1bc41fc4f4b70a320f0f0cadb.tar.gz
gcc-b5e624c6dc2cfbc1bc41fc4f4b70a320f0f0cadb.tar.bz2
local-alloc.c (update_equiv_regs): Use gcc_assert, gcc_unreachable.
* local-alloc.c (update_equiv_regs): Use gcc_assert, gcc_unreachable. (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, eliminate_implied_condition, eliminate_implied_condition, simplify_using_initial_values, shorten_into_mode, canonicalize_iv_subregs, iv_number_of_iterations): Likewise. * loop-unroll.c (expand_var_during_unrolling): Likewise. * loop-unswitch.c (compare_and_jump_seq, unswitch_single_loop, unswitch_loop): Likewise. * loop.c (INSN_LUID, loop_optimize, rtx_equal_for_loop_p, move_movables, replace_call_address, find_and_verify_loops, rtx_equal_for_prefetch_p, fold_rtx_mult_add, loop_iterations, record_giv, final_giv_value, general_induction_var, simplify_giv_expr, extension_within_bounds_p, try_copy_prop, loop_giv_dump): Likewise. From-SVN: r97394
Diffstat (limited to 'gcc/loop-iv.c')
-rw-r--r--gcc/loop-iv.c81
1 files changed, 35 insertions, 46 deletions
diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c
index 55faf4a..09ed73c 100644
--- a/gcc/loop-iv.c
+++ b/gcc/loop-iv.c
@@ -793,16 +793,15 @@ get_biv_step_1 (rtx insn, rtx reg,
case SIGN_EXTEND:
case ZERO_EXTEND:
- if (GET_MODE (op0) != *inner_mode
- || *extend != UNKNOWN
- || *outer_step != const0_rtx)
- abort ();
+ gcc_assert (GET_MODE (op0) == *inner_mode
+ && *extend == UNKNOWN
+ && *outer_step == const0_rtx);
*extend = code;
break;
default:
- abort ();
+ gcc_unreachable ();
}
return true;
@@ -826,17 +825,8 @@ get_biv_step (rtx reg, rtx *inner_step, enum machine_mode *inner_mode,
outer_step))
return false;
- if (*inner_mode != *outer_mode
- && *extend == UNKNOWN)
- abort ();
-
- if (*inner_mode == *outer_mode
- && *extend != UNKNOWN)
- abort ();
-
- if (*inner_mode == *outer_mode
- && *outer_step != const0_rtx)
- abort ();
+ gcc_assert ((*inner_mode == *outer_mode) != (*extend != UNKNOWN));
+ gcc_assert (*inner_mode != *outer_mode || *outer_step == const0_rtx);
return true;
}
@@ -1085,8 +1075,7 @@ iv_analyze (rtx insn, rtx def, struct rtx_iv *iv)
mby = XEXP (rhs, 1);
if (!CONSTANT_P (mby))
{
- if (!CONSTANT_P (op0))
- abort ();
+ gcc_assert (CONSTANT_P (op0));
tmp = op0;
op0 = mby;
mby = tmp;
@@ -1094,14 +1083,13 @@ iv_analyze (rtx insn, rtx def, struct rtx_iv *iv)
break;
case ASHIFT:
- if (CONSTANT_P (XEXP (rhs, 0)))
- abort ();
+ gcc_assert (!CONSTANT_P (XEXP (rhs, 0)));
op0 = XEXP (rhs, 0);
mby = XEXP (rhs, 1);
break;
default:
- abort ();
+ gcc_unreachable ();
}
amode = GET_MODE (rhs);
@@ -1210,8 +1198,7 @@ get_iv_value (struct rtx_iv *iv, rtx iteration)
/* We would need to generate some if_then_else patterns, and so far
it is not needed anywhere. */
- if (iv->first_special)
- abort ();
+ gcc_assert (!iv->first_special);
if (iv->step != const0_rtx && iteration != const0_rtx)
val = simplify_gen_binary (PLUS, iv->extend_mode, iv->base,
@@ -1547,8 +1534,7 @@ canon_condition (rtx cond)
mode = GET_MODE (op0);
if (mode == VOIDmode)
mode = GET_MODE (op1);
- if (mode == VOIDmode)
- abort ();
+ gcc_assert (mode != VOIDmode);
if (GET_CODE (op1) == CONST_INT
&& GET_MODE_CLASS (mode) != MODE_CC
@@ -1677,20 +1663,23 @@ simplify_using_condition (rtx cond, rtx *expr, regset altered)
static void
eliminate_implied_condition (enum rtx_code op, rtx a, rtx *b)
{
- if (op == AND)
+ switch (op)
{
+ case AND:
/* If A implies *B, we may replace *B by true. */
if (implies_p (a, *b))
*b = const_true_rtx;
- }
- else if (op == IOR)
- {
+ break;
+
+ case IOR:
/* If *B implies A, we may replace *B by false. */
if (implies_p (*b, a))
*b = const0_rtx;
+ break;
+
+ default:
+ gcc_unreachable ();
}
- else
- abort ();
}
/* Eliminates the conditions in TAIL that are implied by HEAD. OP is the
@@ -1731,19 +1720,22 @@ simplify_using_initial_values (struct loop *loop, enum rtx_code op, rtx *expr)
eliminate_implied_conditions (op, &head, tail);
- if (op == AND)
+ switch (op)
{
+ case AND:
neutral = const_true_rtx;
aggr = const0_rtx;
- }
- else if (op == IOR)
- {
+ break;
+
+ case IOR:
neutral = const0_rtx;
aggr = const_true_rtx;
- }
- else
- abort ();
+ break;
+ default:
+ gcc_unreachable ();
+ }
+
simplify_using_initial_values (loop, UNKNOWN, &head);
if (head == aggr)
{
@@ -1770,8 +1762,7 @@ simplify_using_initial_values (struct loop *loop, enum rtx_code op, rtx *expr)
return;
}
- if (op != UNKNOWN)
- abort ();
+ gcc_assert (op == UNKNOWN);
e = loop_preheader_edge (loop);
if (e->src == ENTRY_BLOCK_PTR)
@@ -1873,7 +1864,7 @@ shorten_into_mode (struct rtx_iv *iv, enum machine_mode mode,
break;
default:
- abort ();
+ gcc_unreachable ();
}
iv->mode = mode;
@@ -1931,7 +1922,7 @@ canonicalize_iv_subregs (struct rtx_iv *iv0, struct rtx_iv *iv1,
break;
default:
- abort ();
+ gcc_unreachable ();
}
/* Values of both variables should be computed in the same mode. These
@@ -2031,15 +2022,13 @@ iv_number_of_iterations (struct loop *loop, rtx insn, rtx condition,
desc->niter_max = 0;
cond = GET_CODE (condition);
- if (!COMPARISON_P (condition))
- abort ();
+ gcc_assert (COMPARISON_P (condition));
mode = GET_MODE (XEXP (condition, 0));
if (mode == VOIDmode)
mode = GET_MODE (XEXP (condition, 1));
/* The constant comparisons should be folded. */
- if (mode == VOIDmode)
- abort ();
+ gcc_assert (mode != VOIDmode);
/* We only handle integers or pointers. */
if (GET_MODE_CLASS (mode) != MODE_INT