Commit e16acfcd by Nathan Sidwell Committed by Nathan Sidwell

params.c (set_param_value): Use gcc_assert & gcc_unreachable.

	* 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
parent f73d5666
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.
......
......@@ -61,8 +61,7 @@ set_param_value (const char *name, int value)
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)
......
......@@ -120,8 +120,7 @@ open_dump_file (enum tree_dump_index index, tree decl)
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);
......@@ -285,11 +284,9 @@ rest_of_handle_final (void)
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);
......
......@@ -309,9 +309,8 @@ expr_equiv_p (const void *exp1p, const void *exp2p)
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;
}
......@@ -489,11 +488,8 @@ oprs_unchanged_p (rtx x, rtx insn, bool after_insn)
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. */
......@@ -741,11 +737,8 @@ hash_scan_set (rtx 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))
{
......@@ -856,11 +849,8 @@ reg_set_between_after_reload_p (rtx reg, rtx from_insn, rtx to_insn)
{
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;
......@@ -893,11 +883,8 @@ reg_used_between_after_reload_p (rtx reg, rtx from_insn, rtx to_insn)
{
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;
......@@ -947,11 +934,15 @@ reg_set_or_used_since_bb_start (rtx reg, basic_block bb, rtx up_to_insn)
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". */
......@@ -1044,8 +1035,9 @@ eliminate_partially_redundant_load (basic_block bb, rtx insn,
{
/* 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),
......@@ -1116,8 +1108,7 @@ eliminate_partially_redundant_load (basic_block bb, rtx insn,
/* 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)),
......
......@@ -293,7 +293,7 @@ reload_cse_simplify_set (rtx set, rtx insn)
if (this_val == trunc_int_for_mode (this_val, GET_MODE (src)))
break;
default:
abort ();
gcc_unreachable ();
}
this_rtx = GEN_INT (this_val);
}
......@@ -1068,8 +1068,7 @@ reload_combine_note_use (rtx *xp, rtx insn)
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;
......@@ -1089,8 +1088,7 @@ reload_combine_note_use (rtx *xp, rtx insn)
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)];
......
......@@ -181,8 +181,7 @@ tree_predicted_by_p (basic_block bb, enum br_predictor predictor)
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;
......@@ -1440,8 +1439,7 @@ expected_value_to_br_prob (void)
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);
}
......@@ -1610,9 +1608,8 @@ propagate_freq (struct loop *loop, bitmap tovisit)
{
#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)
......@@ -1756,8 +1753,7 @@ expensive_function_p (int threshold)
/* 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
......
......@@ -607,7 +607,7 @@ print_rtx (rtx in_rtx)
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;
......
......@@ -150,8 +150,7 @@ instrument_edges (struct edge_list *el)
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,
......@@ -197,7 +196,7 @@ instrument_values (histogram_values values)
break;
default:
abort ();
gcc_unreachable ();
}
if (!coverage_counter_alloc (t, hist->n_counters))
continue;
......@@ -221,7 +220,7 @@ instrument_values (histogram_values values)
break;
default:
abort ();
gcc_unreachable ();
}
}
VEC_free (histogram_value, values);
......@@ -430,8 +429,7 @@ compute_branch_probabilities (void)
/* 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--;
......@@ -458,8 +456,7 @@ compute_branch_probabilities (void)
/* 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--;
......@@ -481,8 +478,7 @@ compute_branch_probabilities (void)
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
......@@ -1116,8 +1112,7 @@ branch_prob (void)
n_instrumented = instrument_edges (el);
if (n_instrumented != num_instrumented)
abort ();
gcc_assert (n_instrumented == num_instrumented);
if (flag_profile_values)
instrument_values (values);
......@@ -1177,8 +1172,7 @@ union_groups (basic_block bb1, basic_block bb2)
/* ??? 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;
}
......@@ -1322,9 +1316,8 @@ end_branch_prob (void)
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. */
......@@ -1332,7 +1325,6 @@ tree_register_profile_hooks (void)
void
rtl_register_profile_hooks (void)
{
gcc_assert (!ir_type ());
profile_hooks = &rtl_profile_hooks;
if (ir_type ())
abort ();
}
......@@ -34,7 +34,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#undef abort
#include "version.h"
/* Include getopt.h for the sake of getopt_long. */
......@@ -641,8 +640,7 @@ in_system_include_dir (const char *path)
{
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))
......@@ -679,10 +677,8 @@ file_could_be_converted (const char *path)
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))
......@@ -723,10 +719,8 @@ file_normally_convertible (const char *path)
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))
......@@ -1930,7 +1924,7 @@ gen_aux_info_file (const char *base_filename)
}
return 1;
}
abort ();
gcc_unreachable ();
}
}
......@@ -2742,8 +2736,7 @@ check_source (int cond, const char *clean_p)
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)
{
......@@ -3670,8 +3663,8 @@ do_cleaning (char *new_clean_text_base, const char *new_clean_text_limit)
{
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 = ' ';
......@@ -3685,8 +3678,8 @@ do_cleaning (char *new_clean_text_base, const char *new_clean_text_limit)
{
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;
......@@ -3700,8 +3693,8 @@ do_cleaning (char *new_clean_text_base, const char *new_clean_text_limit)
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;
......@@ -3715,8 +3708,8 @@ do_cleaning (char *new_clean_text_base, const char *new_clean_text_limit)
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 = ' ';
......
......@@ -2065,8 +2065,7 @@ collect_points_to_info_r (tree var, tree stmt, void *data)
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 */
......
......@@ -2204,8 +2204,12 @@ execute_fold_all_builtins (void)
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)
......
......@@ -2348,8 +2348,8 @@ static rtx
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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment