The memory output for asm nodes uses proj N, not N+1.
[cparser] / ast2firm.c
index 17620fd..00f7497 100644 (file)
@@ -2059,7 +2059,8 @@ static ir_node *call_expression_to_firm(const call_expression_t *const call)
                 * nodes into a new and unreachable block. */
                keep_alive(node);
                keep_alive(get_cur_block());
-               new_Block(0, NULL);
+               ir_node *block = new_Block(0, NULL);
+               set_cur_block(block);
        }
 
        return result;
@@ -2616,7 +2617,8 @@ static ir_node *produce_condition_result(const expression_t *expression,
        mature_immBlock(zero_block);
 
        ir_node *in_cf[2] = { jmp_one, jmp_zero };
-       new_Block(2, in_cf);
+       ir_node *block = new_Block(2, in_cf);
+       set_cur_block(block);
 
        ir_node *in[2] = { one, zero };
        ir_node *val   = new_d_Phi(dbgi, 2, in, mode);
@@ -3167,7 +3169,8 @@ static ir_node *conditional_to_firm(const conditional_expression_t *expression)
 
        /* create the common block */
        ir_node *in_cf[2] = { true_jmp, false_jmp };
-       new_Block(2, in_cf);
+       ir_node *block = new_Block(2, in_cf);
+       set_cur_block(block);
 
        /* TODO improve static semantics, so either both or no values are NULL */
        if (true_val == NULL || false_val == NULL)
@@ -5472,7 +5475,7 @@ static void asm_statement_to_firm(const asm_statement_t *statement)
 
        /* create output projs & connect them */
        if (needs_memory) {
-               ir_node *projm = new_Proj(node, mode_M, out_size+1);
+               ir_node *projm = new_Proj(node, mode_M, out_size);
                set_store(projm);
        }
 
@@ -5640,13 +5643,12 @@ static void initialize_function_parameters(entity_t *entity)
        assert(entity->kind == ENTITY_FUNCTION);
        ir_graph *irg             = current_ir_graph;
        ir_node  *args            = get_irg_args(irg);
-       ir_node  *start_block     = get_irg_start_block(irg);
        ir_type  *function_irtype = get_ir_type(entity->declaration.type);
        int      first_param_nr   = 0;
 
        if (entity->function.need_closure) {
                /* add an extra parameter for the static link */
-               entity->function.static_link = new_r_Proj(start_block, args, mode_P_data, 0);
+               entity->function.static_link = new_r_Proj(args, mode_P_data, 0);
                ++first_param_nr;
        }
 
@@ -5680,7 +5682,7 @@ static void initialize_function_parameters(entity_t *entity)
                ir_mode *param_mode   = get_type_mode(param_irtype);
 
                long     pn    = n + first_param_nr;
-               ir_node *value = new_r_Proj(start_block, args, param_mode, pn);
+               ir_node *value = new_r_Proj(args, param_mode, pn);
 
                ir_mode *mode = get_ir_mode_storage(type);
                value = create_conv(NULL, value, mode);