* params.c (set_param_value): Use gcc_assert & gcc_unreachable.
* 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 (predict_insn, expected_value_to_br_prob,
propagate_freq, expensive_function_p): Likewise.
* print-rtl.c (print_rtx): Likewise.
* profile.c (instrument_edges, instrument_values,
compute_branch_probabilities, branch_prob, union_groups,
tree_register_profile_hooks, rtl_register_profile_hooks): Likewise.
* protoize.c (in_system_include_dir, file_could_be_converted,
file_normally_convertible, gen_aux_info_file, seek_to_line,
do_cleaning): Likewise.
* tree-ssa-alias.c (collect_points_to_info_r): Likewise.
* tree-ssa-ccp.c (execute_fold_all_builtins): Likewise.
* tree-ssa-loop-ivopts.c (produce_memory_decl_rtl): Likewise.
From-SVN: r97485
+2005-04-03 Nathan Sidwell <nathan@codesourcery.com>
+
+ * params.c (set_param_value): Use gcc_assert & gcc_unreachable.
+ * 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 (predict_insn, expected_value_to_br_prob,
+ propagate_freq, expensive_function_p): Likewise.
+ * print-rtl.c (print_rtx): Likewise.
+ * profile.c (instrument_edges, instrument_values,
+ compute_branch_probabilities, branch_prob, union_groups,
+ tree_register_profile_hooks, rtl_register_profile_hooks): Likewise.
+ * protoize.c (in_system_include_dir, file_could_be_converted,
+ file_normally_convertible, gen_aux_info_file, seek_to_line,
+ do_cleaning): Likewise.
+ * tree-ssa-alias.c (collect_points_to_info_r): Likewise.
+ * tree-ssa-ccp.c (execute_fold_all_builtins): Likewise.
+ * tree-ssa-loop-ivopts.c (produce_memory_decl_rtl): Likewise.
+
2005-04-03 Mostafa Hagog <mustafa@il.ibm.com>
* cfg.c (clear_bb_flags): Don't clear BB_DISABLE_SCHEDULE.
size_t i;
/* Make sure nobody tries to set a parameter to an invalid value. */
- if (value == INVALID_PARAM_VAL)
- abort ();
+ gcc_assert (value != INVALID_PARAM_VAL);
/* Scan the parameter table to find a matching entry. */
for (i = 0; i < num_compiler_params; ++i)
timevar_push (TV_DUMP);
- if (dump_file != NULL || dump_file_name != NULL)
- abort ();
+ gcc_assert (!dump_file && !dump_file_name);
dump_file_name = get_dump_file_name (index);
initializing_dump = !dump_initialized_p (index);
different from the DECL_NAME name used in the source file. */
x = DECL_RTL (current_function_decl);
- if (!MEM_P (x))
- abort ();
+ gcc_assert (MEM_P (x));
x = XEXP (x, 0);
- if (GET_CODE (x) != SYMBOL_REF)
- abort ();
+ gcc_assert (GET_CODE (x) == SYMBOL_REF);
fnname = XSTR (x, 0);
assemble_start_function (current_function_decl, fnname);
struct expr *exp1 = (struct expr *) exp1p;
struct expr *exp2 = (struct expr *) exp2p;
int equiv_p = exp_equiv_p (exp1->expr, exp2->expr, 0, true);
- if (equiv_p
- && exp1->hash != exp2->hash)
- abort ();
+
+ gcc_assert (!equiv_p || exp1->hash == exp2->hash);
return equiv_p;
}
\f
switch (code)
{
case REG:
-#ifdef ENABLE_CHECKING
/* We are called after register allocation. */
- if (REGNO (x) >= FIRST_PSEUDO_REGISTER)
- abort ();
-#endif
+ gcc_assert (REGNO (x) < FIRST_PSEUDO_REGISTER);
if (after_insn)
/* If the last CUID setting the insn is less than the CUID of
INSN, then reg X is not changed in or after INSN. */
if (JUMP_P (insn) || set_noop_p (pat))
return;
-#ifdef ENABLE_CHEKCING
/* We shouldn't have any EH_REGION notes post reload. */
- if (find_reg_note (insn, REG_EH_REGION, NULL_RTX))
- abort ();
-#endif
+ gcc_assert (!find_reg_note (insn, REG_EH_REGION, NULL_RTX));
if (REG_P (dest))
{
{
rtx insn;
-#ifdef ENABLE_CHECKING
/* We are called after register allocation. */
- if (!REG_P (reg) || REGNO (reg) >= FIRST_PSEUDO_REGISTER)
- abort ();
-#endif
+ gcc_assert (REG_P (reg) && REGNO (reg) < FIRST_PSEUDO_REGISTER);
if (from_insn == to_insn)
return NULL_RTX;
{
rtx insn;
-#ifdef ENABLE_CHECKING
/* We are called after register allocation. */
- if (!REG_P (reg) || REGNO (reg) >= FIRST_PSEUDO_REGISTER)
- abort ();
-#endif
+ gcc_assert (REG_P (reg) && REGNO (reg) < FIRST_PSEUDO_REGISTER);
if (from_insn == to_insn)
return NULL_RTX;
static rtx
get_avail_load_store_reg (rtx insn)
{
- if (REG_P (SET_DEST (PATTERN (insn)))) /* A load. */
+ if (REG_P (SET_DEST (PATTERN (insn))))
+ /* A load. */
return SET_DEST(PATTERN(insn));
- if (REG_P (SET_SRC (PATTERN (insn)))) /* A store. */
- return SET_SRC (PATTERN (insn));
- abort ();
+ else
+ {
+ /* A store. */
+ gcc_assert (REG_P (SET_SRC (PATTERN (insn))));
+ return SET_SRC (PATTERN (insn));
+ }
}
/* Return nonzero if the predecessors of BB are "well behaved". */
{
/* Check if the loaded register is not used. */
avail_insn = a_occr->insn;
- if (! (avail_reg = get_avail_load_store_reg (avail_insn)))
- abort ();
+ avail_reg = get_avail_load_store_reg (avail_insn);
+ gcc_assert (avail_reg);
+
/* Make sure we can generate a move from register avail_reg to
dest. */
extract_insn (gen_move_insn (copy_rtx (dest),
/* Set avail_reg to be the register having the value of the
memory. */
avail_reg = get_avail_load_store_reg (avail_insn);
- if (! avail_reg)
- abort ();
+ gcc_assert (avail_reg);
insert_insn_on_edge (gen_move_insn (copy_rtx (dest),
copy_rtx (avail_reg)),
if (this_val == trunc_int_for_mode (this_val, GET_MODE (src)))
break;
default:
- abort ();
+ gcc_unreachable ();
}
this_rtx = GEN_INT (this_val);
}
if (REG_P (SET_DEST (x)))
{
/* No spurious CLOBBERs of pseudo registers may remain. */
- if (REGNO (SET_DEST (x)) >= FIRST_PSEUDO_REGISTER)
- abort ();
+ gcc_assert (REGNO (SET_DEST (x)) < FIRST_PSEUDO_REGISTER);
return;
}
break;
int nregs;
/* No spurious USEs of pseudo registers may remain. */
- if (regno >= FIRST_PSEUDO_REGISTER)
- abort ();
+ gcc_assert (regno < FIRST_PSEUDO_REGISTER);
nregs = hard_regno_nregs[regno][GET_MODE (x)];
static void
predict_insn (rtx insn, enum br_predictor predictor, int probability)
{
- if (!any_condjump_p (insn))
- abort ();
+ gcc_assert (any_condjump_p (insn));
if (!flag_guess_branch_prob)
return;
cond = simplify_rtx (cond);
/* Turn the condition into a scaled branch probability. */
- if (cond != const_true_rtx && cond != const0_rtx)
- abort ();
+ gcc_assert (cond == const_true_rtx || cond == const0_rtx);
predict_insn_def (insn, PRED_BUILTIN_EXPECT,
cond == const_true_rtx ? TAKEN : NOT_TAKEN);
}
{
#ifdef ENABLE_CHECKING
FOR_EACH_EDGE (e, ei, bb->preds)
- if (bitmap_bit_p (tovisit, e->src->index)
- && !(e->flags & EDGE_DFS_BACK))
- abort ();
+ gcc_assert (!bitmap_bit_p (tovisit, e->src->index)
+ || (e->flags & EDGE_DFS_BACK));
#endif
FOR_EACH_EDGE (e, ei, bb->preds)
/* We can not compute accurately for large thresholds due to scaled
frequencies. */
- if (threshold > BB_FREQ_MAX)
- abort ();
+ gcc_assert (threshold <= BB_FREQ_MAX);
/* Frequencies are out of range. This either means that function contains
internal loop executing more than BB_FREQ_MAX times or profile feedback
case LABEL_STATIC_ENTRY: fputs (" [entry]", outfile); break;
case LABEL_GLOBAL_ENTRY: fputs (" [global entry]", outfile); break;
case LABEL_WEAK_ENTRY: fputs (" [weak entry]", outfile); break;
- default: abort();
+ default: gcc_unreachable ();
}
break;
if (!inf->ignore && !inf->on_tree)
{
- if (e->flags & EDGE_ABNORMAL)
- abort ();
+ gcc_assert (!(e->flags & EDGE_ABNORMAL));
if (dump_file)
fprintf (dump_file, "Edge %d to %d instrumented%s\n",
e->src->index, e->dest->index,
break;
default:
- abort ();
+ gcc_unreachable ();
}
if (!coverage_counter_alloc (t, hist->n_counters))
continue;
break;
default:
- abort ();
+ gcc_unreachable ();
}
}
VEC_free (histogram_value, values);
/* Calculate count for remaining edge by conservation. */
total = bb->count - total;
- if (! e)
- abort ();
+ gcc_assert (e);
EDGE_INFO (e)->count_valid = 1;
e->count = total;
bi->succ_count--;
/* Calculate count for remaining edge by conservation. */
total = bb->count - total + e->count;
- if (! e)
- abort ();
+ gcc_assert (e);
EDGE_INFO (e)->count_valid = 1;
e->count = total;
bi->pred_count--;
succ and pred count of zero. */
FOR_EACH_BB (bb)
{
- if (BB_INFO (bb)->succ_count || BB_INFO (bb)->pred_count)
- abort ();
+ gcc_assert (!BB_INFO (bb)->succ_count && !BB_INFO (bb)->pred_count);
}
/* For every edge, calculate its branch probability and add a reg_note
n_instrumented = instrument_edges (el);
- if (n_instrumented != num_instrumented)
- abort ();
+ gcc_assert (n_instrumented == num_instrumented);
if (flag_profile_values)
instrument_values (values);
/* ??? I don't have a place for the rank field. OK. Lets go w/o it,
this code is unlikely going to be performance problem anyway. */
- if (bb1g == bb2g)
- abort ();
+ gcc_assert (bb1g != bb2g);
bb1g->aux = bb2g;
}
void
tree_register_profile_hooks (void)
{
+ gcc_assert (ir_type ());
profile_hooks = &tree_profile_hooks;
- if (!ir_type ())
- abort ();
}
/* Set up hooks to enable RTL-based profiling. */
void
rtl_register_profile_hooks (void)
{
+ gcc_assert (!ir_type ());
profile_hooks = &rtl_profile_hooks;
- if (ir_type ())
- abort ();
}
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#undef abort
#include "version.h"
/* Include getopt.h for the sake of getopt_long. */
{
const struct default_include *p;
- if (! IS_ABSOLUTE_PATH (path))
- abort (); /* Must be an absolutized filename. */
+ gcc_assert (IS_ABSOLUTE_PATH (path));
for (p = cpp_include_defaults; p->fname; p++)
if (!strncmp (path, p->fname, strlen (p->fname))
dir_last_slash = slash;
}
#endif
- if (dir_last_slash)
- *dir_last_slash = '\0';
- else
- abort (); /* Should have been an absolutized filename. */
+ gcc_assert (dir_last_slash);
+ *dir_last_slash = '\0';
}
if (access (path, W_OK))
dir_last_slash = slash;
}
#endif
- if (dir_last_slash)
- *dir_last_slash = '\0';
- else
- abort (); /* Should have been an absolutized filename. */
+ gcc_assert (dir_last_slash);
+ *dir_last_slash = '\0';
}
if (access (path, R_OK))
}
return 1;
}
- abort ();
+ gcc_unreachable ();
}
}
\f
static const char *
seek_to_line (int n)
{
- if (n < last_known_line_number)
- abort ();
+ gcc_assert (n >= last_known_line_number);
while (n > last_known_line_number)
{
{
if (!ISSPACE ((const unsigned char)*scan_p))
*scan_p = ' ';
- if (++scan_p >= new_clean_text_limit)
- abort ();
+ ++scan_p;
+ gcc_assert (scan_p < new_clean_text_limit);
}
*scan_p++ = ' ';
*scan_p = ' ';
{
if (!ISSPACE ((const unsigned char)*scan_p))
*scan_p = ' ';
- if (++scan_p >= new_clean_text_limit)
- abort ();
+ ++scan_p;
+ gcc_assert (scan_p < new_clean_text_limit);
}
*scan_p++ = ' ';
break;
scan_p[1] = ' ';
if (!ISSPACE ((const unsigned char)*scan_p))
*scan_p = ' ';
- if (++scan_p >= new_clean_text_limit)
- abort ();
+ ++scan_p;
+ gcc_assert (scan_p < new_clean_text_limit);
}
*scan_p++ = ' ';
break;
scan_p[1] = ' ';
if (!ISSPACE ((const unsigned char)*scan_p))
*scan_p = ' ';
- if (++scan_p >= new_clean_text_limit)
- abort ();
+ ++scan_p;
+ gcc_assert (scan_p < new_clean_text_limit);
}
if (!ISSPACE ((const unsigned char)*scan_p))
*scan_p = ' ';
switch (TREE_CODE (stmt))
{
case RETURN_EXPR:
- if (TREE_CODE (TREE_OPERAND (stmt, 0)) != MODIFY_EXPR)
- abort ();
+ gcc_assert (TREE_CODE (TREE_OPERAND (stmt, 0)) == MODIFY_EXPR);
stmt = TREE_OPERAND (stmt, 0);
/* FALLTHRU */
if (!set_rhs (stmtp, result))
{
result = convert_to_gimple_builtin (&i, result);
- if (result && !set_rhs (stmtp, result))
- abort ();
+ if (result)
+ {
+ bool ok = set_rhs (stmtp, result);
+
+ gcc_assert (ok);
+ }
}
modify_stmt (*stmtp);
if (maybe_clean_eh_stmt (*stmtp)
produce_memory_decl_rtl (tree obj, int *regno)
{
rtx x;
- if (!obj)
- abort ();
+
+ gcc_assert (obj);
if (TREE_STATIC (obj) || DECL_EXTERNAL (obj))
{
const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (obj));