#include "iropt_dbg.h"
#include "archop.h"
#include "irop.h"
+#include "error.h"
/* when we need verifying */
#ifdef NDEBUG
ir_node *res;
if (! op_Min) {
- assert(0);
- return NULL;
+ panic("cannot create Min node, not allowed");
}
in[0] = op1;
ir_node *res;
if (! op_Max) {
- assert(0);
- return NULL;
+ panic("cannot create Max node, not allowed");
}
in[0] = op1;
default:
break;
}
- assert(0);
- return new_rd_Unknown(irg, get_irn_mode(node));
+ panic("Unsupported Proj from Load");
}
/**
default:
break;
}
- assert(0);
- return new_rd_Unknown(irg, mode);
+ panic("Unsupported Proj from CopyB");
}
/**
default:
break;
}
- assert(0);
- return new_rd_Unknown(irg, mode);
+ panic("Unsupported Proj from Quot");
}
/**
} 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");
}
/**
} 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");
}
/**
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);
*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;
load = skip_Proj(arg);
}
- assert(0);
- return NULL;
+ panic("Unimplemented convert_sng_to_int() case");
}
/**
(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()");
}
/**
dump_compound_init(env, ent);
break;
default:
- assert(0);
+ panic("Unimplemented type kind in dump_global()");
}
}
}
#include "offset.h"
#include "bitfiddle.h"
#include "raw_bitset.h"
+#include "error.h"
#include "irop_t.h"
#include "irmode_t.h"
{
(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)
if (!(f = fopen(filename, "wt"))) {
fprintf(stderr, "Could not open file %s for writing\n", filename);
- assert(0);
- exit(0xdeadbeef);
+ abort();
}
raenv->f = f;
if (!(f = fopen(filename, "rt"))) {
fprintf(stderr, "Could not open file %s for reading\n", filename);
- assert(0);
- exit(0xdeadbeef);
+ abort();
}
raenv->f = f;
(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()");
}
/**
id = get_entity_ident(get_SymConst_entity(node));
return get_id_str(id);
default:
- assert(0);
+ panic("Unsupported SymConst kind");
}
return NULL;
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) {
(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;
}
#include "iropt_t.h"
#include "irprintf.h"
#include "debug.h"
+#include "error.h"
#include "../benode_t.h"
#include "bearch_ppc32_t.h"
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));
}
}
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));
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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));
}
}
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)
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);
}
}
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
}
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;
}
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) {
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)
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)
{
* 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);
}
/**
}
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;
}
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!");
}
}
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;
}
#include "ircons.h"
#include "iropt_t.h"
#include "debug.h"
+#include "error.h"
#include "../benode_t.h"
#include "bearch_ppc32_t.h"
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)
#include "irdump.h"
#include "iredges_t.h"
#include "debug.h"
+#include "error.h"
#ifdef _WIN32
/* Break into the debugger. The Win32 way. */
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 */
#include "ircons.h"
#include "irarch.h"
#include "irflag.h"
+#include "error.h"
#undef DEB
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;
}
}
case ZERO:
inst->costs = costs = env->evaluate(inst->kind, NULL);
return costs;
- default:
- assert(0);
- return 0;
}
+ panic("Unsupported instruction kind");
}
/**
F = fopen(fname, "w"); /* open file for writing */
if (!F) {
perror(fname);
- assert(0);
+ abort();
}
free(fname);
#include "array.h"
#include "pmap.h"
#include "xmalloc.h"
+#include "error.h"
/** A type map for def_find_pointer_type. */
static pmap *type_map;
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
#include "array.h"
#include "firmstat.h"
#include "xmalloc.h"
+#include "error.h"
/** The debug handle. */
DEBUG_ONLY(static firm_dbg_module_t *dbg;)
result = new_rd_Sub(db, irg, block, op1, op2, mode);
break;
default:
- assert(0);
+ panic("Unsupported opcode");
result = NULL;
}
return result;
DB((dbg, LEVEL_4, " - %+F", tv_r));
break;
default:
- assert(0);
+ panic("Unsupported opcode");
tv = tarval_bad;
}
#include "tv_t.h"
#include "irdump.h"
#include "irgraph_t.h"
-
#include "callgraph.h"
+#include "error.h"
/**
* An interval initializer.
case tpo_array:
set_array_element_entity(owner, ent);
break;
- default: assert(0);
}
+ panic("Unsupported type kind");
} /* insert_entity_in_owner */
/**
#include "strcalc.h"
#include "xmalloc.h"
+#include "error.h"
/*
* local definitions and macros
break;
default:
- printf("%i\n", base);
- assert(0);
- return NULL;
+ panic("Unsupported base %d", base);
}
return pos;
}
{
/* 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));
case irms_control_flow:
case irms_memory:
case irms_auxiliary:
- assert(0);
- break;
+ panic("Unsupported tarval creation with mode %F", mode);
case irms_internal_boolean:
/* match [tT][rR][uU][eE]|[fF][aA][lL][sS][eE] */
sc_val_from_str(str, len, NULL, mode);
return get_tarval(sc_get_buffer(), sc_get_buffer_length(), mode);
}
-
- assert(0); /* can't be reached, can it? */
- return NULL;
+ panic("Unsupported tarval creation with mode %F", mode);
}
/*
case irms_control_flow:
case irms_memory:
case irms_auxiliary:
- assert(0);
- break;
+ panic("mode %F does not support maximum value", mode);
case irms_internal_boolean:
return tarval_b_true;
case irms_control_flow:
case irms_memory:
case irms_auxiliary:
- assert(0);
- break;
+ panic("mode %F does not support minimum value", mode);
case irms_internal_boolean:
return tarval_b_false;
case irms_control_flow:
case irms_memory:
case irms_auxiliary:
- assert(0);
- break;
+ panic("mode %F does not support null value", mode);
case irms_float_number:
return new_tarval_from_double(0.0, mode);
tarval *get_tarval_one(ir_mode *mode) {
assert(mode);
- if (get_mode_n_vector_elems(mode) > 1) {
- /* vector arithmetic not implemented yet */
- assert(0);
- return tarval_bad;
- }
+ if (get_mode_n_vector_elems(mode) > 1)
+ panic("vector arithmetic not implemented yet");
switch (get_mode_sort(mode)) {
case irms_control_flow:
case irms_memory:
case irms_auxiliary:
- assert(0);
- break;
+ panic("mode %F does not support one value", mode);
case irms_internal_boolean:
return tarval_b_true;
tarval *get_tarval_all_one(ir_mode *mode) {
assert(mode);
- if (get_mode_n_vector_elems(mode) > 1) {
- /* vector arithmetic not implemented yet */
- assert(0);
- return tarval_bad;
- }
+ if (get_mode_n_vector_elems(mode) > 1)
+ panic("vector arithmetic not implemented yet");
switch (get_mode_sort(mode)) {
case irms_control_flow:
case irms_memory:
case irms_auxiliary:
- assert(0);
- return tarval_bad;
+ panic("mode %F does not support all-one value", mode);
case irms_int_number:
case irms_internal_boolean:
tarval *get_tarval_minus_one(ir_mode *mode) {
assert(mode);
- if (get_mode_n_vector_elems(mode) > 1) {
- /* vector arithmetic not implemented yet */
- return tarval_bad;
- }
+ if (get_mode_n_vector_elems(mode) > 1)
+ panic("vector arithmetic not implemented yet");
switch (get_mode_sort(mode)) {
case irms_control_flow:
case irms_memory:
case irms_auxiliary:
case irms_internal_boolean:
- assert(0);
- break;
+ panic("mode %F does not support minus one value", mode);
case irms_reference:
return tarval_bad;
const ieee_descriptor_t *desc;
assert(mode);
- if (get_mode_n_vector_elems(mode) > 1) {
- /* vector arithmetic not implemented yet */
- return tarval_bad;
- }
+ if (get_mode_n_vector_elems(mode) > 1)
+ panic("vector arithmetic not implemented yet");
if (get_mode_sort(mode) == irms_float_number) {
desc = get_descriptor(mode);
fc_get_qnan(desc, NULL);
return get_tarval(fc_get_buffer(), fc_get_buffer_length(), mode);
- } else {
- assert(0 && "tarval is not floating point");
- return tarval_bad;
- }
+ } else
+ panic("mode %F does not support NaN value", mode);
}
tarval *get_tarval_plus_inf(ir_mode *mode) {
assert(mode);
- if (get_mode_n_vector_elems(mode) > 1) {
- /* vector arithmetic not implemented yet */
- return tarval_bad;
- }
+ if (get_mode_n_vector_elems(mode) > 1)
+ panic("vector arithmetic not implemented yet");
if (get_mode_sort(mode) == irms_float_number) {
const ieee_descriptor_t *desc = get_descriptor(mode);
fc_get_plusinf(desc, NULL);
return get_tarval(fc_get_buffer(), fc_get_buffer_length(), mode);
- } else {
- assert(0 && "tarval is not floating point");
- return tarval_bad;
- }
+ } else
+ panic("mode %F does not support +inf value", mode);
}
tarval *get_tarval_minus_inf(ir_mode *mode) {
assert(mode);
- if (get_mode_n_vector_elems(mode) > 1) {
- /* vector arithmetic not implemented yet */
- return tarval_bad;
- }
+ if (get_mode_n_vector_elems(mode) > 1)
+ panic("vector arithmetic not implemented yet");
if (get_mode_sort(mode) == irms_float_number) {
const ieee_descriptor_t *desc = get_descriptor(mode);
fc_get_minusinf(desc, NULL);
return get_tarval(fc_get_buffer(), fc_get_buffer_length(), mode);
- } else {
- assert(0 && "tarval is not floating point");
- return tarval_bad;
- }
+ } else
+ panic("mode %F does not support -inf value", mode);
}
/*
- * Arithmethic operations on tarvals ========================================
+ * Arithmetic operations on tarvals ========================================
*/
/*
int tarval_is_negative(tarval *a) {
assert(a);
- if (get_mode_n_vector_elems(a->mode) > 1) {
- /* vector arithmetic not implemented yet */
- assert(0 && "tarval_is_negative is not allowed for vector modes");
- return 0;
- }
+ if (get_mode_n_vector_elems(a->mode) > 1)
+ panic("vector arithmetic not implemented yet");
switch (get_mode_sort(a->mode)) {
case irms_int_number:
return fc_is_negative(a->value);
default:
- assert(0 && "not implemented");
- return 0;
+ panic("mode %F does not support negation value", a->mode);
}
}
assert(b);
if (a == tarval_bad || b == tarval_bad) {
- assert(0 && "Comparison with tarval_bad");
+ panic("Comparison with tarval_bad");
return pn_Cmp_False;
}