+2004-09-08 Nathan Sidwell <nathan@codesourcery.com>
+
+ * final.c (shorten_branches, final, get_insn_template,
+ output_alternate_entry_point, final_scan_insn, alter_subreg,
+ alter_cond, output_operand, asm_fprintf, final_forward_branch_p,
+ leaf_renumber_regs_insn): Use gcc_assert and gcc_unreachable.
+ * fix-header.c (lookup_std_proto): Likewise.
+ * flow.c (first_insn_after_basic_block_note, verify_wide_reg,
+ verify_local_live_at_start, update_life_info, mark_reg,
+ calculate_global_regs_live, allocate_reg_life_data,
+ init_propagate_block_info, mark_set_regs, flush_reg_cond_reg_1,
+ ior_reg_cond, not_reg_cond, and_reg_cond, elim_reg_cond,
+ attempt_auto_inc, mark_used_reg, mark_used_regs): Likewise.
+ * fold-const.c (force_fit_type, div_and_round_double,
+ may_negate_without_overflow_p, int_const_binop, const_binop,
+ size_binop, size_diffop, fold_convert_const, fold_convert,
+ invert_tree_comparison, swap_tree_comparison,
+ comparison_to_compcode, compcode_to_comparison, invert_truthvalue,
+ range_binop, make_range, fold_cond_expr_with_comparison,
+ fold_div_compare, fold, fold_checksum_tree, fold_negate_const,
+ fold_abs_const, fold_not_const, fold_relational_const, round_up,
+ round_down): Likewise.
+ * function.c (find_function_data, assign_stack_temp_for_type,
+ instantiate_virtual_regs_lossage, aggregate_value_p,
+ assign_parm_find_entry_rtl, assign_parm_setup_block,
+ expand_function_start, expand_function_end, keep_stack_depressed,
+ handle_epilogue_set, thread_prologue_and_epilogue_insns): Likewise.
+
2004-09-08 Daniel Berlin <dberlin@dberlin.org>
* Makefile.in (tree-loop-linear.o): Added.
/* Range of labels grows monotonically in the function. Abort here
means that the initialization of array got lost. */
- if (n_old_labels > n_labels)
- abort ();
+ gcc_assert (n_old_labels <= n_labels);
memset (label_align + n_old_labels, 0,
(n_labels - n_old_labels) * sizeof (struct label_alignment));
continue;
pat = PATTERN (insn);
len = XVECLEN (pat, 1);
- if (len <= 0)
- abort ();
+ gcc_assert (len > 0);
min_align = MAX_CODE_ALIGN;
for (min = max_shuid, max = min_shuid, i = len - 1; i >= 0; i--)
{
{
/* This can be triggered by bugs elsewhere in the compiler if
new insns are created after init_insn_lengths is called. */
- if (NOTE_P (insn))
- insn_current_address = -1;
- else
- abort ();
+ gcc_assert (NOTE_P (insn));
+ insn_current_address = -1;
}
else
insn_current_address = INSN_ADDRESSES (INSN_UID (insn));
case INSN_OUTPUT_FORMAT_MULTI:
return insn_data[code].output.multi[which_alternative];
case INSN_OUTPUT_FORMAT_FUNCTION:
- if (insn == NULL)
- abort ();
+ gcc_assert (insn);
return (*insn_data[code].output.function) (recog_data.operand, insn);
default:
- abort ();
+ gcc_unreachable ();
}
}
case LABEL_NORMAL:
default:
- abort ();
+ gcc_unreachable ();
}
}
/* End of a symbol-block. */
--block_depth;
- if (block_depth < 0)
- abort ();
+ gcc_assert (block_depth >= 0);
(*debug_hooks->end_block) (high_block_linenum, n);
}
break;
default:
- if (NOTE_LINE_NUMBER (insn) <= 0)
- abort ();
+ gcc_assert (NOTE_LINE_NUMBER (insn) > 0);
break;
}
break;
#ifdef ASM_OUTPUT_ADDR_VEC
ASM_OUTPUT_ADDR_VEC (PREV_INSN (insn), body);
#else
- abort ();
+ gcc_unreachable ();
#endif
}
else
#ifdef ASM_OUTPUT_ADDR_DIFF_VEC
ASM_OUTPUT_ADDR_DIFF_VEC (PREV_INSN (insn), body);
#else
- abort ();
+ gcc_unreachable ();
#endif
}
#else
ASM_OUTPUT_ADDR_VEC_ELT
(file, CODE_LABEL_NUMBER (XEXP (XVECEXP (body, 0, idx), 0)));
#else
- abort ();
+ gcc_unreachable ();
#endif
}
else
CODE_LABEL_NUMBER (XEXP (XVECEXP (body, 1, idx), 0)),
CODE_LABEL_NUMBER (XEXP (XEXP (body, 0), 0)));
#else
- abort ();
+ gcc_unreachable ();
#endif
}
}
{
rtx prev;
- if (prev_nonnote_insn (insn) != last_ignored_compare)
- abort ();
+ gcc_assert (prev_nonnote_insn (insn) == last_ignored_compare);
/* We have already processed the notes between the setter and
the user. Make sure we don't process them again, this is
/* This instruction should have been split in shorten_branches,
to ensure that we would have valid length info for the
splitees. */
- abort ();
+ gcc_unreachable ();
#endif
return new;
if (new != 0)
*xp = new;
- /* Simplify_subreg can't handle some REG cases, but we have to. */
- else if (REG_P (y))
+ else
{
+ /* Simplify_subreg can't handle some REG cases, but we have to. */
unsigned int regno = subreg_hard_regno (x, 1);
+
+ gcc_assert (REG_P (y));
*xp = gen_rtx_REG_offset (y, GET_MODE (x), regno, SUBREG_BYTE (x));
}
- else
- abort ();
}
return *xp;
switch (GET_CODE (cond))
{
default:
- abort ();
+ gcc_unreachable ();
case NE:
PUT_CODE (cond, cc_status.flags & CC_Z_IN_N ? GE : LT);
/* If X is a pseudo-register, abort now rather than writing trash to the
assembler file. */
-
- if (x && REG_P (x) && REGNO (x) >= FIRST_PSEUDO_REGISTER)
- abort ();
+ gcc_assert (!x || !REG_P (x) || REGNO (x) < FIRST_PSEUDO_REGISTER);
PRINT_OPERAND (asm_out_file, x, code);
}
ASM_FPRINTF_EXTENSIONS (file, argptr, p)
#endif
default:
- abort ();
+ gcc_unreachable ();
}
break;
final_forward_branch_p (rtx insn)
{
int insn_id, label_id;
- if (!uid_shuid)
- abort ();
+
+ gcc_assert (uid_shuid);
insn_id = INSN_SHUID (insn);
label_id = INSN_SHUID (JUMP_LABEL (insn));
/* We've hit some insns that does not have id information available. */
- if (!insn_id || !label_id)
- abort ();
+ gcc_assert (insn_id && label_id);
return insn_id < label_id;
}
return;
}
newreg = LEAF_REG_REMAP (newreg);
- if (newreg < 0)
- abort ();
+ gcc_assert (newreg >= 0);
regs_ever_live[REGNO (in_rtx)] = 0;
regs_ever_live[newreg] = 1;
REGNO (in_rtx) = newreg;
break;
default:
- abort ();
+ gcc_unreachable ();
}
}
#endif
&& strncmp (fn->fname, name, name_length) == 0)
return fn;
i = (i+1) % HASH_SIZE;
- if (i == i0)
- abort ();
+ gcc_assert (i != i0);
}
}
return NULL_RTX;
if (LABEL_P (insn))
insn = NEXT_INSN (insn);
- if (!NOTE_INSN_BASIC_BLOCK_P (insn))
- abort ();
+ gcc_assert (NOTE_INSN_BASIC_BLOCK_P (insn));
return NEXT_INSN (insn);
}
break;
head = NEXT_INSN (head);
}
-
if (dump_file)
{
fprintf (dump_file, "Register %d died unexpectedly.\n", regno);
dump_bb (bb, dump_file, 0);
}
- abort ();
+ fatal_error ("internal consistency failure");
}
/* A subroutine of update_life_info. Verify that there are no untoward
fputs ("Old:\n", dump_file);
dump_bb (bb, dump_file, 0);
}
- abort ();
+ fatal_error ("internal consistency failure");
}
}
else
"Register %d died unexpectedly.\n", i);
dump_bb (bb, dump_file, 0);
}
- abort ();
+ fatal_error ("internal consistency failure");
}
-
/* Verify that the now-live register is wider than word_mode. */
verify_wide_reg (i, bb);
});
/* Changes to the CFG are only allowed when
doing a global update for the entire CFG. */
- if ((prop_flags & PROP_ALLOW_CFG_CHANGES)
- && (extent == UPDATE_LIFE_LOCAL || blocks))
- abort ();
+ gcc_assert (!(prop_flags & PROP_ALLOW_CFG_CHANGES)
+ || (extent != UPDATE_LIFE_LOCAL && !blocks));
/* For a global update, we go through the relaxation process again. */
if (extent != UPDATE_LIFE_LOCAL)
regset set = (regset) xset;
int regno = REGNO (reg);
- if (GET_MODE (reg) == BLKmode)
- abort ();
+ gcc_assert (GET_MODE (reg) != BLKmode);
SET_REGNO_REG_SET (set, regno);
if (regno < FIRST_PSEUDO_REGISTER)
sick behavior here. */
#ifdef ENABLE_CHECKING
FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
- if (bb->aux)
- abort ();
+ gcc_assert (!bb->aux);
#endif
tmp = INITIALIZE_REG_SET (tmp_head);
int i;
max_regno = max_reg_num ();
- if (reg_deaths)
- abort ();
+ gcc_assert (!reg_deaths);
reg_deaths = xcalloc (sizeof (*reg_deaths), max_regno);
/* Recalculate the register space, in case it has grown. Old style
bb_false = bb_true;
bb_true = t;
}
- else if (! (bb->succ->succ_next->flags & EDGE_FALLTHRU))
- abort ();
+ else
+ gcc_assert (bb->succ->succ_next->flags & EDGE_FALLTHRU);
}
else
{
/* This can happen with a conditional jump to the next insn. */
- if (JUMP_LABEL (BB_END (bb)) != BB_HEAD (bb_true))
- abort ();
+ gcc_assert (JUMP_LABEL (BB_END (bb)) == BB_HEAD (bb_true));
/* Simplest way to do nothing. */
bb_false = bb_true;
switch (code = GET_CODE (sub))
{
case COND_EXEC:
- if (cond != NULL_RTX)
- abort ();
+ gcc_assert (!cond);
cond = COND_EXEC_TEST (sub);
sub = COND_EXEC_CODE (sub);
xdata[1] = node->key;
return -1;
}
- else if (rcli->condition == const1_rtx)
- abort ();
+ else
+ gcc_assert (rcli->condition != const1_rtx);
return 0;
}
return gen_rtx_IOR (0, old, x);
default:
- abort ();
+ gcc_unreachable ();
}
}
if (COMPARISON_P (x)
&& REG_P (XEXP (x, 0)))
{
- if (XEXP (x, 1) != const0_rtx)
- abort ();
+ gcc_assert (XEXP (x, 1) == const0_rtx);
return gen_rtx_fmt_ee (reversed_comparison_code (x, NULL),
VOIDmode, XEXP (x, 0), const0_rtx);
return gen_rtx_AND (0, old, x);
default:
- abort ();
+ gcc_unreachable ();
}
}
return x;
default:
- abort ();
+ gcc_unreachable ();
}
}
#endif /* HAVE_conditional_execution */
rtx q = SET_DEST (set);
rtx y = SET_SRC (set);
int opnum = XEXP (y, 0) == incr_reg ? 0 : 1;
+ int changed;
/* Make sure this reg appears only once in this insn. */
if (count_occurrences (PATTERN (insn), incr_reg, 1) != 1)
/* Modify the old increment-insn to simply copy
the already-incremented value of our register. */
- if (! validate_change (incr, &SET_SRC (set), incr_reg, 0))
- abort ();
+ changed = validate_change (incr, &SET_SRC (set), incr_reg, 0);
+ gcc_assert (changed);
/* If that makes it a no-op (copying the register into itself) delete
it so it won't appear to be a "use" and a "set" of this
for (i = regno_first; i <= regno_last; ++i)
if (! REGNO_REG_SET_P (pbi->reg_live, i))
{
-#ifdef ENABLE_CHECKING
- if (reg_deaths[i])
- abort ();
-#endif
+ gcc_assert (!reg_deaths[i]);
reg_deaths[i] = pbi->insn_num;
}
}
}
case COND_EXEC:
- if (cond != NULL_RTX)
- abort ();
+ gcc_assert (!cond);
mark_used_regs (pbi, COND_EXEC_TEST (x), NULL_RTX, insn);
unsigned int prec;
int sign_extended_type;
- if (TREE_CODE (t) != INTEGER_CST)
- abort ();
+ gcc_assert (TREE_CODE (t) == INTEGER_CST);
low = TREE_INT_CST_LOW (t);
high = TREE_INT_CST_HIGH (t);
break;
default:
- abort ();
+ gcc_unreachable ();
}
/* Compute true remainder: rem = num - (quo * den) */
unsigned int prec;
tree type;
- if (TREE_CODE (t) != INTEGER_CST)
- abort ();
+ gcc_assert (TREE_CODE (t) == INTEGER_CST);
type = TREE_TYPE (t);
if (TYPE_UNSIGNED (type))
break;
default:
- abort ();
+ gcc_unreachable ();
}
t = build_int_cst_wide (TREE_TYPE (arg1), low, hi);
break;
default:
- abort ();
+ gcc_unreachable ();
}
return t;
}
{
tree type = TREE_TYPE (arg0);
- if (TREE_CODE (type) != INTEGER_TYPE || ! TYPE_IS_SIZETYPE (type)
- || type != TREE_TYPE (arg1))
- abort ();
+ gcc_assert (TREE_CODE (type) == INTEGER_TYPE && TYPE_IS_SIZETYPE (type)
+ && type == TREE_TYPE (arg1));
/* Handle the special case of two integer constants faster. */
if (TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == INTEGER_CST)
tree type = TREE_TYPE (arg0);
tree ctype;
- if (TREE_CODE (type) != INTEGER_TYPE || ! TYPE_IS_SIZETYPE (type)
- || type != TREE_TYPE (arg1))
- abort ();
+ gcc_assert (TREE_CODE (type) == INTEGER_TYPE && TYPE_IS_SIZETYPE (type)
+ && type == TREE_TYPE (arg1));
/* If the type is already signed, just do the simple thing. */
if (!TYPE_UNSIGNED (type))
break;
default:
- abort ();
+ gcc_unreachable ();
}
/* If R is NaN, return zero and show we have an overflow. */
TYPE_MAIN_VARIANT (orig)))
return fold (build1 (NOP_EXPR, type, arg));
- if (INTEGRAL_TYPE_P (type) || POINTER_TYPE_P (type)
- || TREE_CODE (type) == OFFSET_TYPE)
+ switch (TREE_CODE (type))
{
+ case INTEGER_TYPE: case CHAR_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE:
+ case POINTER_TYPE: case REFERENCE_TYPE:
+ case OFFSET_TYPE:
if (TREE_CODE (arg) == INTEGER_CST)
{
tem = fold_convert_const (NOP_EXPR, type, arg);
tem = fold (build1 (REALPART_EXPR, TREE_TYPE (orig), arg));
return fold_convert (type, tem);
}
- if (TREE_CODE (orig) == VECTOR_TYPE
- && tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (orig)))
- return fold (build1 (NOP_EXPR, type, arg));
- }
- else if (TREE_CODE (type) == REAL_TYPE)
- {
+ gcc_assert (TREE_CODE (orig) == VECTOR_TYPE
+ && tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (orig)));
+ return fold (build1 (NOP_EXPR, type, arg));
+
+ case REAL_TYPE:
if (TREE_CODE (arg) == INTEGER_CST)
{
tem = fold_convert_const (FLOAT_EXPR, type, arg);
return tem;
}
- if (INTEGRAL_TYPE_P (orig) || POINTER_TYPE_P (orig))
- return fold (build1 (FLOAT_EXPR, type, arg));
- if (TREE_CODE (orig) == REAL_TYPE)
- return fold (build1 (flag_float_store ? CONVERT_EXPR : NOP_EXPR,
- type, arg));
- if (TREE_CODE (orig) == COMPLEX_TYPE)
+ switch (TREE_CODE (orig))
{
+ case INTEGER_TYPE: case CHAR_TYPE:
+ case BOOLEAN_TYPE: case ENUMERAL_TYPE:
+ case POINTER_TYPE: case REFERENCE_TYPE:
+ return fold (build1 (FLOAT_EXPR, type, arg));
+
+ case REAL_TYPE:
+ return fold (build1 (flag_float_store ? CONVERT_EXPR : NOP_EXPR,
+ type, arg));
+
+ case COMPLEX_TYPE:
tem = fold (build1 (REALPART_EXPR, TREE_TYPE (orig), arg));
return fold_convert (type, tem);
+
+ default:
+ gcc_unreachable ();
}
- }
- else if (TREE_CODE (type) == COMPLEX_TYPE)
- {
- if (INTEGRAL_TYPE_P (orig)
- || POINTER_TYPE_P (orig)
- || TREE_CODE (orig) == REAL_TYPE)
- return build2 (COMPLEX_EXPR, type,
- fold_convert (TREE_TYPE (type), arg),
- fold_convert (TREE_TYPE (type), integer_zero_node));
- if (TREE_CODE (orig) == COMPLEX_TYPE)
- {
- tree rpart, ipart;
+
+ case COMPLEX_TYPE:
+ switch (TREE_CODE (orig))
+ {
+ case INTEGER_TYPE: case CHAR_TYPE:
+ case BOOLEAN_TYPE: case ENUMERAL_TYPE:
+ case POINTER_TYPE: case REFERENCE_TYPE:
+ case REAL_TYPE:
+ return build2 (COMPLEX_EXPR, type,
+ fold_convert (TREE_TYPE (type), arg),
+ fold_convert (TREE_TYPE (type), integer_zero_node));
+ case COMPLEX_TYPE:
+ {
+ tree rpart, ipart;
+
+ if (TREE_CODE (arg) == COMPLEX_EXPR)
+ {
+ rpart = fold_convert (TREE_TYPE (type), TREE_OPERAND (arg, 0));
+ ipart = fold_convert (TREE_TYPE (type), TREE_OPERAND (arg, 1));
+ return fold (build2 (COMPLEX_EXPR, type, rpart, ipart));
+ }
+
+ arg = save_expr (arg);
+ rpart = fold (build1 (REALPART_EXPR, TREE_TYPE (orig), arg));
+ ipart = fold (build1 (IMAGPART_EXPR, TREE_TYPE (orig), arg));
+ rpart = fold_convert (TREE_TYPE (type), rpart);
+ ipart = fold_convert (TREE_TYPE (type), ipart);
+ return fold (build2 (COMPLEX_EXPR, type, rpart, ipart));
+ }
+
+ default:
+ gcc_unreachable ();
+ }
+
+ case VECTOR_TYPE:
+ gcc_assert (tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (orig)));
+ gcc_assert (INTEGRAL_TYPE_P (orig) || POINTER_TYPE_P (orig)
+ || TREE_CODE (orig) == VECTOR_TYPE);
+ return fold (build1 (NOP_EXPR, type, arg));
- if (TREE_CODE (arg) == COMPLEX_EXPR)
- {
- rpart = fold_convert (TREE_TYPE (type), TREE_OPERAND (arg, 0));
- ipart = fold_convert (TREE_TYPE (type), TREE_OPERAND (arg, 1));
- return fold (build2 (COMPLEX_EXPR, type, rpart, ipart));
- }
+ case VOID_TYPE:
+ return fold (build1 (CONVERT_EXPR, type, fold_ignored_result (arg)));
- arg = save_expr (arg);
- rpart = fold (build1 (REALPART_EXPR, TREE_TYPE (orig), arg));
- ipart = fold (build1 (IMAGPART_EXPR, TREE_TYPE (orig), arg));
- rpart = fold_convert (TREE_TYPE (type), rpart);
- ipart = fold_convert (TREE_TYPE (type), ipart);
- return fold (build2 (COMPLEX_EXPR, type, rpart, ipart));
- }
- }
- else if (TREE_CODE (type) == VECTOR_TYPE)
- {
- if ((INTEGRAL_TYPE_P (orig) || POINTER_TYPE_P (orig))
- && tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (orig)))
- return fold (build1 (NOP_EXPR, type, arg));
- if (TREE_CODE (orig) == VECTOR_TYPE
- && tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (orig)))
- return fold (build1 (NOP_EXPR, type, arg));
+ default:
+ gcc_unreachable ();
}
- else if (VOID_TYPE_P (type))
- return fold (build1 (CONVERT_EXPR, type, fold_ignored_result (arg)));
- abort ();
}
\f
/* Return an expr equal to X but certainly not valid as an lvalue. */
case UNORDERED_EXPR:
return ORDERED_EXPR;
default:
- abort ();
+ gcc_unreachable ();
}
}
case LE_EXPR:
return GE_EXPR;
default:
- abort ();
+ gcc_unreachable ();
}
}
case UNGE_EXPR:
return COMPCODE_UNGE;
default:
- abort ();
+ gcc_unreachable ();
}
}
case COMPCODE_UNGE:
return UNGE_EXPR;
default:
- abort ();
+ gcc_unreachable ();
}
}
default:
break;
}
- if (TREE_CODE (TREE_TYPE (arg)) != BOOLEAN_TYPE)
- abort ();
+ gcc_assert (TREE_CODE (TREE_TYPE (arg)) == BOOLEAN_TYPE);
return build1 (TRUTH_NOT_EXPR, type, arg);
}
result = sgn0 >= sgn1;
break;
default:
- abort ();
+ gcc_unreachable ();
}
return constant_boolean_node (result, type);
in_p = ! in_p, low = 0, high = arg1;
break;
default:
- abort ();
+ gcc_unreachable ();
}
/* If this is an unsigned comparison, we also know that EXP is
tem = fold (build1 (ABS_EXPR, TREE_TYPE (arg1), arg1));
return negate_expr (fold_convert (type, tem));
default:
- abort ();
+ gcc_unreachable ();
}
/* A != 0 ? A : 0 is simply A, unless A is -0. Likewise
}
break;
default:
- abort ();
+ gcc_unreachable ();
}
}
case NE_EXPR:
break;
default:
- abort ();
+ gcc_unreachable ();
}
return NULL_TREE;
break;
default:
- abort ();
+ gcc_unreachable ();
}
}
else
break;
default:
- abort ();
+ gcc_unreachable ();
}
}
case LT_EXPR:
return constant_boolean_node (0, type);
default:
- abort ();
+ gcc_unreachable ();
}
}
char buf[sizeof (struct tree_decl)];
int i, len;
- if (sizeof (struct tree_exp) + 5 * sizeof (tree)
- > sizeof (struct tree_decl)
- || sizeof (struct tree_type) > sizeof (struct tree_decl))
- abort ();
+ gcc_assert ((sizeof (struct tree_exp) + 5 * sizeof (tree)
+ <= sizeof (struct tree_decl))
+ && sizeof (struct tree_type) <= sizeof (struct tree_decl));
if (expr == NULL)
return;
slot = htab_find_slot (ht, expr, INSERT);
{
tree t = NULL_TREE;
- if (TREE_CODE (arg0) == INTEGER_CST)
+ switch (TREE_CODE (arg0))
{
- unsigned HOST_WIDE_INT low;
- HOST_WIDE_INT high;
- int overflow = neg_double (TREE_INT_CST_LOW (arg0),
- TREE_INT_CST_HIGH (arg0),
- &low, &high);
- t = build_int_cst_wide (type, low, high);
- t = force_fit_type (t, 1,
- (overflow | TREE_OVERFLOW (arg0))
- && !TYPE_UNSIGNED (type),
- TREE_CONSTANT_OVERFLOW (arg0));
- }
- else if (TREE_CODE (arg0) == REAL_CST)
- t = build_real (type, REAL_VALUE_NEGATE (TREE_REAL_CST (arg0)));
-#ifdef ENABLE_CHECKING
- else
- abort ();
-#endif
+ case INTEGER_CST:
+ {
+ unsigned HOST_WIDE_INT low;
+ HOST_WIDE_INT high;
+ int overflow = neg_double (TREE_INT_CST_LOW (arg0),
+ TREE_INT_CST_HIGH (arg0),
+ &low, &high);
+ t = build_int_cst_wide (type, low, high);
+ t = force_fit_type (t, 1,
+ (overflow | TREE_OVERFLOW (arg0))
+ && !TYPE_UNSIGNED (type),
+ TREE_CONSTANT_OVERFLOW (arg0));
+ break;
+ }
+
+ case REAL_CST:
+ t = build_real (type, REAL_VALUE_NEGATE (TREE_REAL_CST (arg0)));
+ break;
+ default:
+ gcc_unreachable ();
+ }
+
return t;
}
{
tree t = NULL_TREE;
- if (TREE_CODE (arg0) == INTEGER_CST)
+ switch (TREE_CODE (arg0))
{
+ case INTEGER_CST:
/* If the value is unsigned, then the absolute value is
the same as the ordinary value. */
if (TYPE_UNSIGNED (type))
- return arg0;
+ t = arg0;
/* Similarly, if the value is non-negative. */
else if (INT_CST_LT (integer_minus_one_node, arg0))
- return arg0;
+ t = arg0;
/* If the value is negative, then the absolute value is
its negation. */
else
t = build_int_cst_wide (type, low, high);
t = force_fit_type (t, -1, overflow | TREE_OVERFLOW (arg0),
TREE_CONSTANT_OVERFLOW (arg0));
- return t;
}
- }
- else if (TREE_CODE (arg0) == REAL_CST)
- {
+ break;
+
+ case REAL_CST:
if (REAL_VALUE_NEGATIVE (TREE_REAL_CST (arg0)))
- return build_real (type, REAL_VALUE_NEGATE (TREE_REAL_CST (arg0)));
+ t = build_real (type, REAL_VALUE_NEGATE (TREE_REAL_CST (arg0)));
else
- return arg0;
+ t = arg0;
+ break;
+
+ default:
+ gcc_unreachable ();
}
-#ifdef ENABLE_CHECKING
- else
- abort ();
-#endif
-
+
return t;
}
{
tree t = NULL_TREE;
- if (TREE_CODE (arg0) == INTEGER_CST)
- {
- t = build_int_cst_wide (type,
- ~ TREE_INT_CST_LOW (arg0),
- ~ TREE_INT_CST_HIGH (arg0));
- t = force_fit_type (t, 0, TREE_OVERFLOW (arg0),
- TREE_CONSTANT_OVERFLOW (arg0));
- }
-#ifdef ENABLE_CHECKING
- else
- abort ();
-#endif
-
+ gcc_assert (TREE_CODE (arg0) == INTEGER_CST);
+
+ t = build_int_cst_wide (type,
+ ~ TREE_INT_CST_LOW (arg0),
+ ~ TREE_INT_CST_HIGH (arg0));
+ t = force_fit_type (t, 0, TREE_OVERFLOW (arg0),
+ TREE_CONSTANT_OVERFLOW (arg0));
+
return t;
}
break;
default:
- abort ();
+ gcc_unreachable ();
}
return constant_boolean_node (result, type);
{
tree div = NULL_TREE;
- if (divisor <= 0)
- abort ();
+ gcc_assert (divisor > 0);
if (divisor == 1)
return value;
{
tree div = NULL_TREE;
- if (divisor <= 0)
- abort ();
+ gcc_assert (divisor > 0);
if (divisor == 1)
return value;
if (p->decl == decl)
return p;
- abort ();
+ gcc_unreachable ();
}
/* Save the current context for compilation of a nested function.
/* If SIZE is -1 it means that somebody tried to allocate a temporary
of a variable size. */
- if (size == -1)
- abort ();
+ gcc_assert (size != -1);
/* These are now unused. */
- if (keep > 1)
- abort ();
+ gcc_assert (keep <= 1);
if (mode == BLKmode)
align = BIGGEST_ALIGNMENT;
So for requests which depended on the rounding of SIZE, we go ahead
and round it now. We also make sure ALIGNMENT is at least
BIGGEST_ALIGNMENT. */
- if (mode == BLKmode && align < BIGGEST_ALIGNMENT)
- abort ();
+ gcc_assert (mode != BLKmode || align == BIGGEST_ALIGNMENT);
p->slot = assign_stack_local (mode,
(mode == BLKmode
? CEIL_ROUND (size, (int) align / BITS_PER_UNIT)
static void
instantiate_virtual_regs_lossage (rtx insn)
{
- if (asm_noperands (PATTERN (insn)) >= 0)
- {
- error_for_asm (insn, "impossible constraint in `asm'");
- delete_insn (insn);
- }
- else
- abort ();
+ gcc_assert (asm_noperands (PATTERN (insn)) >= 0);
+ error_for_asm (insn, "impossible constraint in `asm'");
+ delete_insn (insn);
}
/* Given a pointer to a piece of rtx and an optional pointer to the
containing object, instantiate any virtual registers present in it.
break;
default:
/* We don't expect other rtl types here. */
- abort();
+ gcc_unreachable ();
}
if (TREE_CODE (type) == VOID_TYPE)
/* We assume at most one partial arg, and it must be the first
argument on the stack. */
- if (all->extra_pretend_bytes || all->pretend_args_size)
- abort ();
+ gcc_assert (!all->extra_pretend_bytes && !all->pretend_args_size);
pretend_bytes = partial * UNITS_PER_WORD;
all->pretend_args_size = CEIL_ROUND (pretend_bytes, STACK_BYTES);
}
else if (GET_CODE (entry_parm) == PARALLEL)
;
- else if (size != 0 && PARM_BOUNDARY % BITS_PER_WORD != 0)
- abort ();
+ else
+ gcc_assert (!size || !(PARM_BOUNDARY % BITS_PER_WORD));
mem = validize_mem (stack_parm);
so we may see a PARALLEL or a REG. */
if (REG_P (hard_reg))
SET_DECL_RTL (DECL_RESULT (subr), gen_reg_rtx (GET_MODE (hard_reg)));
- else if (GET_CODE (hard_reg) == PARALLEL)
- SET_DECL_RTL (DECL_RESULT (subr), gen_group_rtx (hard_reg));
else
- abort ();
+ {
+ gcc_assert (GET_CODE (hard_reg) == PARALLEL);
+ SET_DECL_RTL (DECL_RESULT (subr), gen_group_rtx (hard_reg));
+ }
/* Set DECL_REGISTER flag so that expand_function_end will copy the
result to the real return register(s). */
rtx real_decl_rtl = current_function_return_rtx;
/* This should be set in assign_parms. */
- if (! REG_FUNCTION_VALUE_P (real_decl_rtl))
- abort ();
+ gcc_assert (REG_FUNCTION_VALUE_P (real_decl_rtl));
/* If this is a BLKmode structure being returned in registers,
then use the mode computed in expand_return. Note that if
insn = next;
continue;
}
- else if (MEM_P (retaddr)
- && REG_P (XEXP (retaddr, 0)))
- base = gen_rtx_REG (Pmode, REGNO (XEXP (retaddr, 0))), offset = 0;
- else if (MEM_P (retaddr)
- && GET_CODE (XEXP (retaddr, 0)) == PLUS
- && REG_P (XEXP (XEXP (retaddr, 0), 0))
- && GET_CODE (XEXP (XEXP (retaddr, 0), 1)) == CONST_INT)
+ else
{
- base = gen_rtx_REG (Pmode, REGNO (XEXP (XEXP (retaddr, 0), 0)));
- offset = INTVAL (XEXP (XEXP (retaddr, 0), 1));
+ rtx ret_ptr;
+ gcc_assert (MEM_P (retaddr));
+
+ ret_ptr = XEXP (retaddr, 0);
+
+ if (REG_P (ret_ptr))
+ {
+ base = gen_rtx_REG (Pmode, REGNO (ret_ptr));
+ offset = 0;
+ }
+ else
+ {
+ gcc_assert (GET_CODE (ret_ptr) == PLUS
+ && REG_P (XEXP (ret_ptr, 0))
+ && GET_CODE (XEXP (ret_ptr, 1)) == CONST_INT);
+ base = gen_rtx_REG (Pmode, REGNO (XEXP (ret_ptr, 0)));
+ offset = INTVAL (XEXP (ret_ptr, 1));
+ }
}
- else
- abort ();
/* If the base of the location containing the return pointer
is SP, we must update it with the replacement address. Otherwise,
&& info.const_equiv[regno] == 0)
break;
- if (regno == FIRST_PSEUDO_REGISTER)
- abort ();
+ gcc_assert (regno < FIRST_PSEUDO_REGISTER);
reg = gen_rtx_REG (Pmode, regno);
emit_move_insn (reg, retaddr);
/* Show the SET in the above insn is a RETURN. */
jump_set = single_set (jump_insn);
- if (jump_set == 0)
- abort ();
- else
- SET_IS_RETURN_P (jump_set) = 1;
+ gcc_assert (jump_set);
+ SET_IS_RETURN_P (jump_set) = 1;
}
/* If SP is not mentioned in the pattern and its equivalent register, if
&& (info.sp_equiv_reg == stack_pointer_rtx
|| !reg_set_p (info.sp_equiv_reg, insn)))
{
- if (! validate_replace_rtx (stack_pointer_rtx,
- plus_constant (info.sp_equiv_reg,
- info.sp_offset),
- insn))
- abort ();
+ int changed;
+
+ changed = validate_replace_rtx (stack_pointer_rtx,
+ plus_constant (info.sp_equiv_reg,
+ info.sp_offset),
+ insn);
+ gcc_assert (changed);
add_insn (insn);
}
set from. If unknown, abort. */
if (reg_set_p (stack_pointer_rtx, set))
{
- if (SET_DEST (set) != stack_pointer_rtx)
- abort ();
+ gcc_assert (SET_DEST (set) == stack_pointer_rtx);
if (GET_CODE (SET_SRC (set)) == PLUS)
{
p->new_sp_equiv_reg = XEXP (SET_SRC (set), 0);
if (GET_CODE (XEXP (SET_SRC (set), 1)) == CONST_INT)
p->new_sp_offset = INTVAL (XEXP (SET_SRC (set), 1));
- else if (REG_P (XEXP (SET_SRC (set), 1))
- && REGNO (XEXP (SET_SRC (set), 1)) < FIRST_PSEUDO_REGISTER
- && p->const_equiv[REGNO (XEXP (SET_SRC (set), 1))] != 0)
- p->new_sp_offset
- = INTVAL (p->const_equiv[REGNO (XEXP (SET_SRC (set), 1))]);
else
- abort ();
+ {
+ gcc_assert (REG_P (XEXP (SET_SRC (set), 1))
+ && (REGNO (XEXP (SET_SRC (set), 1))
+ < FIRST_PSEUDO_REGISTER)
+ && p->const_equiv[REGNO (XEXP (SET_SRC (set), 1))]);
+ p->new_sp_offset
+ = INTVAL (p->const_equiv[REGNO (XEXP (SET_SRC (set), 1))]);
+ }
}
else
p->new_sp_equiv_reg = SET_SRC (set), p->new_sp_offset = 0;
p->new_sp_offset += p->sp_offset;
}
- if (p->new_sp_equiv_reg == 0 || !REG_P (p->new_sp_equiv_reg))
- abort ();
+ gcc_assert (p->new_sp_equiv_reg && REG_P (p->new_sp_equiv_reg));
return;
}
Pmode). */
else if (p->new_sp_equiv_reg != 0 && reg_set_p (p->new_sp_equiv_reg, set))
{
- if (p->equiv_reg_src != 0
- || !REG_P (p->new_sp_equiv_reg)
- || !REG_P (SET_DEST (set))
- || GET_MODE_BITSIZE (GET_MODE (SET_DEST (set))) > BITS_PER_WORD
- || REGNO (p->new_sp_equiv_reg) != REGNO (SET_DEST (set)))
- abort ();
- else
- p->equiv_reg_src
- = simplify_replace_rtx (SET_SRC (set), stack_pointer_rtx,
- plus_constant (p->sp_equiv_reg,
- p->sp_offset));
+ gcc_assert (!p->equiv_reg_src
+ && REG_P (p->new_sp_equiv_reg)
+ && REG_P (SET_DEST (set))
+ && (GET_MODE_BITSIZE (GET_MODE (SET_DEST (set)))
+ <= BITS_PER_WORD)
+ && REGNO (p->new_sp_equiv_reg) == REGNO (SET_DEST (set)));
+ p->equiv_reg_src
+ = simplify_replace_rtx (SET_SRC (set), stack_pointer_rtx,
+ plus_constant (p->sp_equiv_reg,
+ p->sp_offset));
}
/* Otherwise, replace any references to SP in the insn to its new value
/* Can't deal with multiple successors of the entry block
at the moment. Function should always have at least one
entry point. */
- if (!ENTRY_BLOCK_PTR->succ || ENTRY_BLOCK_PTR->succ->succ_next)
- abort ();
+ gcc_assert (ENTRY_BLOCK_PTR->succ && !ENTRY_BLOCK_PTR->succ->succ_next);
insert_insn_on_edge (seq, ENTRY_BLOCK_PTR->succ);
inserted = 1;