- replace a lot of assert(0) by panic()
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Tue, 23 Sep 2008 23:30:44 +0000 (23:30 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Tue, 23 Sep 2008 23:30:44 +0000 (23:30 +0000)
[r22225]

20 files changed:
ir/arch/archop.c
ir/be/arm/arm_transform.c
ir/be/arm/bearch_arm.c
ir/be/begnuas.c
ir/be/benode.c
ir/be/beraextern.c
ir/be/mips/bearch_mips.c
ir/be/mips/mips_emitter.c
ir/be/mips/mips_transform.c
ir/be/ppc32/bearch_ppc32.c
ir/be/ppc32/ppc32_transform.c
ir/be/ppc32/ppc32_transform_conv.c
ir/debug/debugger.c
ir/ir/irarch.c
ir/ir/irdumptxt.c
ir/lower/lower_calls.c
ir/opt/opt_osr.c
ir/tr/entity.c
ir/tv/strcalc.c
ir/tv/tv.c

index f255688..a23c467 100644 (file)
@@ -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;
index ee4588b..9dfe5fc 100644 (file)
@@ -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);
index b711065..ec6cbd5 100644 (file)
@@ -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()");
 }
 
 /**
index 8360ec2..8cc6ec5 100644 (file)
@@ -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()");
                        }
                }
        }
index dc215ac..5c19be7 100644 (file)
@@ -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)
index 74a2b54..d4fdb35 100644 (file)
@@ -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;
 
index 58aa6a6..62b9193 100644 (file)
@@ -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()");
 }
 
 /**
index 018db91..e7fcae0 100644 (file)
@@ -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;
index ed9fb37..e54e8e4 100644 (file)
@@ -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) {
index 3765d26..4330862 100644 (file)
@@ -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;
 }
 
index 66e21bf..8740964 100644 (file)
@@ -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;
 }
index 5efe5aa..58263a8 100644 (file)
@@ -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)
index a6f883f..ff43b2c 100644 (file)
@@ -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 */
 
index 549b747..41e154c 100644 (file)
@@ -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");
 }
 
 /**
index 4ff9d6b..5105942 100644 (file)
@@ -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);
 
index 8c9fc67..72a93ab 100644 (file)
@@ -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
index 4bf9050..3253615 100644 (file)
@@ -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;
                }
 
index ba7bd97..03086ae 100644 (file)
@@ -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 */
 
 /**
index 43b3ed3..1a078eb 100644 (file)
@@ -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;
 }
index 69133cb..a26ed24 100644 (file)
@@ -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);
 
        case irms_internal_boolean:
                /* match [tT][rR][uU][eE]|[fF][aA][lL][sS][eE] */
@@ -359,9 +357,7 @@ tarval *new_tarval_from_str(const char *str, size_t len, ir_mode *mode)
                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);
 }
 
 /*
@@ -492,8 +488,7 @@ tarval *get_tarval_max(ir_mode *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;
@@ -524,8 +519,7 @@ tarval *get_tarval_min(ir_mode *mode) {
        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;
@@ -558,8 +552,7 @@ tarval *get_tarval_null(ir_mode *mode) {
        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);
@@ -577,18 +570,14 @@ tarval *get_tarval_null(ir_mode *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;
@@ -606,18 +595,14 @@ tarval *get_tarval_one(ir_mode *mode) {
 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:
@@ -642,18 +627,15 @@ int tarval_is_constant(tarval *tv) {
 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;
@@ -671,58 +653,46 @@ tarval *get_tarval_nan(ir_mode *mode) {
        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 ========================================
  */
 
 /*
@@ -731,11 +701,8 @@ tarval *get_tarval_minus_inf(ir_mode *mode) {
 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:
@@ -747,8 +714,7 @@ int tarval_is_negative(tarval *a) {
                return fc_is_negative(a->value);
 
        default:
-               assert(0 && "not implemented");
-               return 0;
+               panic("mode %F does not support negation value", a->mode);
        }
 }
 
@@ -793,7 +759,7 @@ pn_Cmp tarval_cmp(tarval *a, tarval *b) {
        assert(b);
 
        if (a == tarval_bad || b == tarval_bad) {
-               assert(0 && "Comparison with tarval_bad");
+               panic("Comparison with tarval_bad");
                return pn_Cmp_False;
        }