Fixed some obviously wrong conditions.
[libfirm] / ir / ir / irio.c
index c94065e..9b4c336 100644 (file)
@@ -190,7 +190,7 @@ static void symtbl_init(void)
        INSERTENUM(tt_builtin, ir_bk_trap);
        INSERTENUM(tt_builtin, ir_bk_debugbreak);
        INSERTENUM(tt_builtin, ir_bk_return_address);
-       INSERTENUM(tt_builtin, ir_bk_frame_addess);
+       INSERTENUM(tt_builtin, ir_bk_frame_address);
        INSERTENUM(tt_builtin, ir_bk_prefetch);
        INSERTENUM(tt_builtin, ir_bk_ffs);
        INSERTENUM(tt_builtin, ir_bk_clz);
@@ -583,6 +583,9 @@ static void export_type_or_ent_post(type_or_ent tore, void *ctx)
        }
 }
 
+/**
+ * Walker: exports every node.
+ */
 static void export_node(ir_node *irn, void *ctx)
 {
        io_env_t *env = (io_env_t *) ctx;
@@ -592,10 +595,9 @@ static void export_node(ir_node *irn, void *ctx)
        if (env->ignoreblocks && opcode == iro_Block)
                return;
 
-       n = get_irn_arity(irn);
-
        fprintf(env->file, "\t%s %ld [ ", get_irn_opname(irn), get_irn_node_nr(irn));
 
+       n = get_irn_arity(irn);
        for (i = -1; i < n; i++) {
                ir_node *pred = get_irn_n(irn, i);
                if (pred == NULL) {
@@ -609,8 +611,7 @@ static void export_node(ir_node *irn, void *ctx)
 
        fprintf(env->file, "] { ");
 
-       switch (opcode)
-       {
+       switch (opcode) {
                #include "gen_irio_export.inl"
        }
        fputs("}\n", env->file);
@@ -650,7 +651,7 @@ static void export_modes(io_env_t *env)
        fputs("}\n\n", env->file);
 }
 
-/** Exports the whole irp to the given file in a textual form. */
+/* Exports the whole irp to the given file in a textual form. */
 void ir_export(const char *filename)
 {
        io_env_t env;
@@ -691,7 +692,7 @@ void ir_export(const char *filename)
        fclose(env.file);
 }
 
-/** Exports the given irg to the given file. */
+/* Exports the given irg to the given file. */
 void ir_export_irg(ir_graph *irg, const char *filename)
 {
        io_env_t env;
@@ -1481,11 +1482,14 @@ static int parse_modes(io_env_t *env)
                                ir_mode_arithmetic arith = read_mode_arithmetic(env);
                                unsigned modulo_shift = read_long(env);
                                int vector_elems = read_long(env);
+                               ir_mode *mode;
 
-                               ir_mode *mode = new_ir_mode(name, sort, size, sign, arith, modulo_shift);
+                               if (vector_elems != 1) {
+                                       panic("no support for import of vector modes yes");
+                               }
 
-                               if (mode_is_reference(mode))
-                               {
+                               mode = new_ir_mode(name, sort, size, sign, arith, modulo_shift);
+                               if (mode_is_reference(mode)) {
                                        set_reference_mode_signed_eq(mode, read_mode(env));
                                        set_reference_mode_unsigned_eq(mode, read_mode(env));
                                }