Commit c28fcf22 authored by Michael Beck's avatar Michael Beck
Browse files

- replace a lot of assert(0) by panic()

[r22225]
parent 62ae09d2
......@@ -41,6 +41,7 @@
#include "iropt_dbg.h"
#include "archop.h"
#include "irop.h"
#include "error.h"
/* when we need verifying */
#ifdef NDEBUG
......@@ -69,8 +70,7 @@ new_rd_Min(dbg_info *db, ir_graph *irg, ir_node *block,
ir_node *res;
if (! op_Min) {
assert(0);
return NULL;
panic("cannot create Min node, not allowed");
}
in[0] = op1;
......@@ -92,8 +92,7 @@ new_rd_Max(dbg_info *db, ir_graph *irg, ir_node *block,
ir_node *res;
if (! op_Max) {
assert(0);
return NULL;
panic("cannot create Max node, not allowed");
}
in[0] = op1;
......
......@@ -1323,8 +1323,7 @@ static ir_node *gen_Proj_Load(ir_node *node) {
default:
break;
}
assert(0);
return new_rd_Unknown(irg, get_irn_mode(node));
panic("Unsupported Proj from Load");
}
/**
......@@ -1348,8 +1347,7 @@ static ir_node *gen_Proj_CopyB(ir_node *node) {
default:
break;
}
assert(0);
return new_rd_Unknown(irg, mode);
panic("Unsupported Proj from CopyB");
}
/**
......@@ -1390,8 +1388,7 @@ static ir_node *gen_Proj_Quot(ir_node *node) {
default:
break;
}
assert(0);
return new_rd_Unknown(irg, mode);
panic("Unsupported Proj from Quot");
}
/**
......@@ -1416,9 +1413,7 @@ static ir_node *gen_Proj_be_AddSP(ir_node *node) {
} else if (proj == pn_be_AddSP_M) {
return new_rd_Proj(dbgi, irg, block, new_pred, mode_M, pn_arm_SubSPandCopy_M);
}
assert(0);
return new_rd_Unknown(irg, get_irn_mode(node));
panic("Unsupported Proj from AddSP");
}
/**
......@@ -1440,9 +1435,7 @@ static ir_node *gen_Proj_be_SubSP(ir_node *node) {
} else if (proj == pn_be_SubSP_M) {
return new_rd_Proj(dbgi, irg, block, new_pred, mode_M, pn_arm_AddSP_M);
}
assert(0);
return new_rd_Unknown(irg, get_irn_mode(node));
panic("Unsupported Proj from SubSP");
}
/**
......@@ -1478,8 +1471,7 @@ static ir_node *gen_Proj(ir_node *node) {
if (proj == pn_Store_M) {
return be_transform_node(pred);
} else {
assert(0);
return new_r_Bad(irg);
panic("Unsupported Proj from Store");
}
} else if (is_Load(pred)) {
return gen_Proj_Load(node);
......
......@@ -385,7 +385,7 @@ static ir_node *convert_dbl_to_int(ir_node *bl, ir_node *arg, ir_node *mem,
*resL = new_Const_long(mode_Is, v);
} else if (is_Load(skip_Proj(arg))) {
/* FIXME: handling of low/high depends on LE/BE here */
assert(0);
panic("Unimplemented convert_dbl_to_int() case");
}
else {
ir_graph *irg = current_ir_graph;
......@@ -427,8 +427,7 @@ static ir_node *convert_sng_to_int(ir_node *bl, ir_node *arg)
load = skip_Proj(arg);
}
assert(0);
return NULL;
panic("Unimplemented convert_sng_to_int() case");
}
/**
......@@ -1142,15 +1141,13 @@ static const be_execution_unit_t ***arm_get_allowed_execution_units(const void *
(void) self;
(void) irn;
/* TODO */
assert(0);
return NULL;
panic("Unimplemented arm_get_allowed_execution_units()");
}
static const be_machine_t *arm_get_machine(const void *self) {
(void) self;
/* TODO */
assert(0);
return NULL;
panic("Unimplemented arm_get_machine()");
}
/**
......
......@@ -1261,7 +1261,7 @@ static void dump_global(be_gas_decl_env_t *env, ir_entity *ent)
dump_compound_init(env, ent);
break;
default:
assert(0);
panic("Unimplemented type kind in dump_global()");
}
}
}
......
......@@ -42,6 +42,7 @@
#include "offset.h"
#include "bitfiddle.h"
#include "raw_bitset.h"
#include "error.h"
#include "irop_t.h"
#include "irmode_t.h"
......@@ -1421,14 +1422,14 @@ static void phi_set_frame_entity(ir_node *irn, ir_entity *ent)
{
(void) irn;
(void) ent;
assert(0);
panic("phi_set_frame_entity() should not be called");
}
static void phi_set_frame_offset(ir_node *irn, int bias)
{
(void) irn;
(void) bias;
assert(0);
panic("phi_set_frame_offset() should not be called");
}
static int phi_get_sp_bias(const ir_node *irn)
......
......@@ -460,8 +460,7 @@ static void dump_to_file(be_raext_env_t *raenv, char *filename) {
if (!(f = fopen(filename, "wt"))) {
fprintf(stderr, "Could not open file %s for writing\n", filename);
assert(0);
exit(0xdeadbeef);
abort();
}
raenv->f = f;
......@@ -630,8 +629,7 @@ static int read_and_apply_results(be_raext_env_t *raenv, char *filename) {
if (!(f = fopen(filename, "rt"))) {
fprintf(stderr, "Could not open file %s for reading\n", filename);
assert(0);
exit(0xdeadbeef);
abort();
}
raenv->f = f;
......
......@@ -951,16 +951,14 @@ static const be_execution_unit_t ***mips_get_allowed_execution_units(
(void) self;
(void) irn;
/* TODO */
assert(0);
return NULL;
panic("Unimplemented mips_get_allowed_execution_units()");
}
static const be_machine_t *mips_get_machine(const void *self)
{
(void) self;
/* TODO */
assert(0);
return NULL;
panic("Unimplemented mips_get_machine()");
}
/**
......
......@@ -160,7 +160,7 @@ static const char *get_symconst_str(ir_node *node)
id = get_entity_ident(get_SymConst_entity(node));
return get_id_str(id);
default:
assert(0);
panic("Unsupported SymConst kind");
}
return NULL;
......
......@@ -1035,7 +1035,7 @@ static void mips_fix_CopyB_Proj(mips_transform_env_t* env) {
long n = get_Proj_proj(node);
if(n == pn_CopyB_M_except) {
assert(0);
panic("Unsupported Proj from CopyB");
} else if(n == pn_CopyB_M_regular) {
set_Proj_proj(node, pn_Store_M);
} else if(n == pn_CopyB_M_except) {
......
......@@ -890,14 +890,14 @@ static const be_execution_unit_t ***ppc32_get_allowed_execution_units(const void
(void) self;
(void) irn;
/* TODO */
assert(0);
panic("Unimplemented ppc32_get_allowed_execution_units()");
return NULL;
}
static const be_machine_t *ppc32_get_machine(const void *self) {
(void) self;
/* TODO */
assert(0);
panic("Unimplemented ppc32_get_machine()");
return NULL;
}
......
......@@ -38,6 +38,7 @@
#include "iropt_t.h"
#include "irprintf.h"
#include "debug.h"
#include "error.h"
#include "../benode_t.h"
#include "bearch_ppc32_t.h"
......@@ -186,9 +187,7 @@ int is_16bit_signed_const(ir_node *node)
return 0;
}
default:
fprintf(stderr, "is_16bit_signed_const(): Mode not supported: %s\n", get_mode_name(get_irn_mode(node)));
assert(0);
return 0;
panic("is_16bit_signed_const(): Mode not supported: %F", get_irn_mode(node));
}
}
......@@ -221,9 +220,7 @@ int is_16bit_unsigned_const(ir_node *node)
return 1;
}
default:
fprintf(stderr, "is_16bit_unsigned_const(): Mode not supported: %s\n", get_mode_name(get_irn_mode(node)));
assert(0);
return 0;
panic("is_16bit_unsigned_const(): Mode not supported: %F", get_irn_mode(node));
}
}
......@@ -278,9 +275,7 @@ static ir_node *gen_Add(ppc32_transform_env_t *env) {
return new_rd_ppc32_Add(env->dbg, env->irg, env->block, op1, op2, env->mode);
default:
fprintf(stderr, "Mode for Add not supported: %s\n", get_mode_name(env->mode));
assert(0);
return NULL;
panic("Mode for Add not supported: %F", env->mode);
}
}
......@@ -309,9 +304,7 @@ static ir_node *gen_Mul(ppc32_transform_env_t *env) {
case irm_P:
default:
fprintf(stderr, "Mode for Mul not supported: %s\n", get_mode_name(env->mode));
assert(0);
return NULL;
panic("Mode for Mul not supported: %F", env->mode);
}
}
......@@ -340,9 +333,7 @@ static ir_node *gen_Mulh(ppc32_transform_env_t *env) {
case irm_F:
case irm_P:
default:
fprintf(stderr, "Mode for Mulh not supported: %s\n", get_mode_name(env->mode));
assert(0);
return NULL;
panic("Mode for Mulh not supported: %F", env->mode);
}
}
......@@ -410,9 +401,7 @@ static ir_node *gen_Sub(ppc32_transform_env_t *env) {
return new_rd_ppc32_Sub(env->dbg, env->irg, env->block, op1, op2, env->mode);
default:
fprintf(stderr, "Mode for Sub not supported: %s\n", get_mode_name(env->mode));
assert(0);
return NULL;
panic("Mode for Sub not supported: %F", env->mode);
}
}
......@@ -433,9 +422,7 @@ static ir_node *gen_Quot(ppc32_transform_env_t *env) {
return new_rd_ppc32_fDivs(env->dbg, env->irg, env->block, op1, op2, env->mode);
default:
fprintf(stderr, "Mode for Quot not supported: %s\n", get_mode_name(env->mode));
assert(0);
return NULL;
panic("Mode for Quot not supported: %F", env->mode);
}
}
......@@ -461,9 +448,7 @@ static ir_node *gen_Div(ppc32_transform_env_t *env) {
return new_rd_ppc32_Divwu(env->dbg, env->irg, env->block, op1, op2, mode_T);
default:
fprintf(stderr, "Mode for Div not supported: %s\n", get_mode_name(get_irn_mode(op1)));
assert(0);
return NULL;
panic("Mode for Div not supported: %F", get_irn_mode(op1));
}
}
......@@ -517,10 +502,7 @@ static ir_node *gen_DivMod(ppc32_transform_env_t *env) {
break;
default:
fprintf(stderr, "Mode for DivMod not supported: %s\n", get_mode_name(res_mode));
assert(0);
return 0;
panic("Mode for DivMod not supported: %F", res_mode);
}
if (proj_div == NULL)
......@@ -755,9 +737,7 @@ static ir_node *gen_Minus(ppc32_transform_env_t *env) {
return new_rd_ppc32_Neg(env->dbg, env->irg, env->block, op, env->mode);
default:
fprintf(stderr, "Mode for Neg not supported: %s\n", get_mode_name(env->mode));
assert(0);
return NULL;
panic("Mode for Neg not supported: %F", env->mode);
}
}
......@@ -884,11 +864,7 @@ static ir_node *gen_Conv(ppc32_transform_env_t *env) {
break;
}
fprintf(stderr, "Mode for Conv not supported: %s -> %s\n",
get_mode_name(get_irn_mode(get_irn_n(env->irn,0))),get_mode_name(env->mode));
assert(0);
return NULL;
panic("Mode for Conv not supported: %F -> %F", get_irn_mode(op), env->mode);
#undef SKIP
}
......@@ -921,8 +897,7 @@ static ir_node *gen_Abs(ppc32_transform_env_t *env) {
default:
break;
}
fprintf(stderr, "Mode for Abs not supported: %s\n", get_mode_name(env->mode));
assert(0);
panic("Mode for Abs not supported: %F", env->mode);
return NULL;
}
......@@ -967,11 +942,7 @@ static ir_node *gen_Unknown(ppc32_transform_env_t *env) {
else if (mode_is_int(env->mode))
return new_rd_ppc32_Unknown(env->dbg, env->irg, env->block, env->mode);
else
{
fprintf(stderr, "Mode %s for unknown value not supported.\n", get_mode_name(env->mode));
assert(0);
return 0;
}
panic("Mode %F for unknown value not supported.", env->mode);
}
static ir_node *ldst_insert_const(ir_node *ptr, tarval **ptv, ident **pid, ppc32_transform_env_t *env) {
......@@ -1048,9 +1019,7 @@ static ir_node *gen_Load(ppc32_transform_env_t *env) {
break;
default:
fprintf(stderr, "Mode for Load not supported: %s\n", get_mode_name(env->mode));
assert(0);
return 0;
panic("Mode for Load not supported: %F", env->mode);
}
if(tv_const)
......@@ -1109,9 +1078,7 @@ static ir_node *gen_Store(ppc32_transform_env_t *env) {
break;
default:
fprintf(stderr, "Mode for Store not supported: %s\n", get_mode_name(env->mode));
assert(0);
return 0;
panic("Mode for Store not supported: %F", env->mode);
}
if(tv_const)
{
......@@ -1274,9 +1241,7 @@ static ir_node *gen_be_FrameAddr(ppc32_transform_env_t *env) {
* the BAD transformer.
*/
static ir_node *bad_transform(ppc32_transform_env_t *env) {
ir_fprintf(stderr, "Not implemented: %+F\n", env->irn);
assert(0);
return NULL;
panic("Transformation not implemented: %+F\n", env->irn);
}
/**
......@@ -1548,9 +1513,7 @@ static ir_node *gen_ppc32_Const(ppc32_transform_env_t *env) {
}
default:
fprintf(stderr, "Mode for Const not supported: %s\n", get_mode_name(env->mode));
assert(0);
return 0;
panic("Mode for Const not supported: %F", env->mode);
}
set_ppc32_constant_tarval(node, tv_const);
return node;
......@@ -1603,11 +1566,8 @@ static ir_node *gen_ppc32_fConst(ppc32_transform_env_t *env) {
}
default:
fprintf(stderr, "Mode for fConst not supported: %s\n", get_mode_name(env->mode));
assert(0);
return 0;
panic("Mode for fConst not supported: %F", env->mode);
}
assert(0 && "Dead end!");
}
......@@ -1663,9 +1623,7 @@ static ir_node *gen_ppc32_SymConst(ppc32_transform_env_t *env) {
}
default:
fprintf(stderr, "Mode for SymConst not supported: %s\n", get_mode_name(env->mode));
assert(0);
return 0;
panic("Mode for SymConst not supported: %F", env->mode);
}
return node;
}
......
......@@ -37,6 +37,7 @@
#include "ircons.h"
#include "iropt_t.h"
#include "debug.h"
#include "error.h"
#include "../benode_t.h"
#include "bearch_ppc32_t.h"
......@@ -173,11 +174,7 @@ static ir_node *gen_Conv(ppc32_transform_env_t *env, ir_node *op) {
default:
break;
}
fprintf(stderr, "Mode for Conv not supported: %s -> %s\n", get_mode_name(from_mode), get_mode_name(to_mode));
assert(0);
return 0;
// return op;
panic("Mode for Conv not supported: %F -> %F", from_mode, to_mode);
}
int search_from_node_in_block(ir_node *from, ir_node *to)
......
......@@ -63,6 +63,7 @@
#include "irdump.h"
#include "iredges_t.h"
#include "debug.h"
#include "error.h"
#ifdef _WIN32
/* Break into the debugger. The Win32 way. */
......@@ -435,8 +436,8 @@ static const char *reason_str(bp_reasons_t reason)
case BP_ON_REMIRG: return "removing IRG";
case BP_ON_NEW_ENT: return "entity creation";
case BP_ON_NEW_TYPE: return "type creation";
default: assert(0);
}
panic("unsupported reason");
return "unknown";
} /* reason_str */
......
......@@ -52,6 +52,7 @@
#include "ircons.h"
#include "irarch.h"
#include "irflag.h"
#include "error.h"
#undef DEB
......@@ -467,7 +468,7 @@ static ir_node *build_graph(mul_env *env, instruction *inst) {
case ZERO:
return inst->irn = new_r_Const(current_ir_graph, env->blk, env->mode, get_mode_null(env->mode));
default:
assert(0);
panic("Unsupported instruction kind");
return NULL;
}
}
......@@ -507,10 +508,8 @@ static int evaluate_insn(mul_env *env, instruction *inst) {
case ZERO:
inst->costs = costs = env->evaluate(inst->kind, NULL);
return costs;
default:
assert(0);
return 0;
}
panic("Unsupported instruction kind");
}
/**
......
......@@ -95,7 +95,7 @@ static FILE *text_open(const char *basename, const char * suffix1, const char *s
F = fopen(fname, "w"); /* open file for writing */
if (!F) {
perror(fname);
assert(0);
abort();
}
free(fname);
......
......@@ -42,6 +42,7 @@
#include "array.h"
#include "pmap.h"
#include "xmalloc.h"
#include "error.h"
/** A type map for def_find_pointer_type. */
static pmap *type_map;
......@@ -124,7 +125,7 @@ static ir_type *create_modified_mtd_type(const lower_params_t *lp, ir_type *mtp)
if (n_regs > 0) {
/* this compound will be returned solely in registers */
assert(0);
panic("Returning compounds in registers not yet implemented");
}
else {
/* this compound will be allocated on callers stack and its
......
......@@ -53,6 +53,7 @@
#include "array.h"
#include "firmstat.h"
#include "xmalloc.h"
#include "error.h"
/** The debug handle. */
DEBUG_ONLY(static firm_dbg_module_t *dbg;)
......@@ -305,7 +306,7 @@ static ir_node *do_apply(ir_opcode code, dbg_info *db, ir_node *op1, ir_node *op
result = new_rd_Sub(db, irg, block, op1, op2, mode);
break;
default:
assert(0);
panic("Unsupported opcode");
result = NULL;
}
return result;
......@@ -1117,7 +1118,7 @@ static ir_node *applyOneEdge(ir_node *iv, ir_node *rc, LFTR_edge *e, iv_env *env
DB((dbg, LEVEL_4, " - %+F", tv_r));
break;
default:
assert(0);
panic("Unsupported opcode");
tv = tarval_bad;
}
......
......@@ -45,8 +45,8 @@
#include "tv_t.h"
#include "irdump.h"
#include "irgraph_t.h"
#include "callgraph.h"
#include "error.h"
/**
* An interval initializer.
......@@ -109,8 +109,8 @@ static INLINE void insert_entity_in_owner(ir_entity *ent) {
case tpo_array:
set_array_element_entity(owner, ent);
break;
default: assert(0);
}
panic("Unsupported type kind");
} /* insert_entity_in_owner */
/**
......
......@@ -41,6 +41,7 @@
#include "strcalc.h"
#include "xmalloc.h"
#include "error.h"
/*
* local definitions and macros
......@@ -1455,9 +1456,7 @@ const char *sc_print(const void *value, unsigned bits, enum base_t base, int sig
break;
default:
printf("%i\n", base);
assert(0);
return NULL;
panic("Unsupported base %d", base);
}
return pos;
}
......
......@@ -127,10 +127,9 @@ static void _fail_verify(tarval *tv, const char* file, int line)
{
/* print a memory image of the tarval and throw an assertion */
if (tv)
printf("%s:%d: Invalid tarval:\n mode: %s\n value: [%p]\n", file, line, get_mode_name(tv->mode), tv->value);
panic("%s:%d: Invalid tarval: mode: %F\n value: [%p]", file, line, tv->mode, tv->value);
else
printf("%s:%d: Invalid tarval (null)", file, line);
assert(0);
panic("%s:%d: Invalid tarval (null)", file, line);
}
#ifdef __GNUC__
INLINE static void tarval_verify(tarval *tv) __attribute__ ((unused));
......@@ -335,8 +334,7 @@ tarval *new_tarval_from_str(const char *str, size_t len, ir_mode *mode)
case irms_control_flow:
case irms_memory:
case irms_auxiliary:
assert(0);
break;
panic("Unsupported tarval creation with mode %F", mode);