Use be_put_ignore_regs() instead of duplicating its logic.
[libfirm] / ir / be / beabi.c
index 257fe73..26e1b0e 100644 (file)
@@ -1729,6 +1729,10 @@ static void modify_irg(be_abi_irg_t *env)
 
        DBG((dbg, LEVEL_1, "introducing abi on %+F\n", irg));
 
+       /* Must fetch memory here, otherwise the start Barrier gets the wrong
+        * memory, which leads to loops in the DAG. */
+       old_mem = get_irg_initial_mem(irg);
+
        /* set the links of all frame entities to NULL, we use it
           to detect if an entity is already linked in the value_param_list */
        tp = get_method_value_param_type(method_type);
@@ -1856,7 +1860,6 @@ static void modify_irg(be_abi_irg_t *env)
        obstack_free(&env->obst, rm);
 
        /* create a new initial memory proj */
-       old_mem = get_irg_initial_mem(irg);
        assert(is_Proj(old_mem));
        new_mem_proj = new_r_Proj(irg, get_nodes_block(old_mem),
                                  new_r_Unknown(irg, mode_T), mode_M,
@@ -2128,13 +2131,13 @@ static void fix_pic_symconsts(ir_node *node, void *data)
                mode     = get_irn_mode(pred);
                unknown  = new_r_Unknown(irg, mode);
                pic_base = arch_code_generator_get_pic_base(env->birg->cg);
-               add      = new_r_Add(irg, block, pic_base, pred, mode);
-
-               /* make sure the walker doesn't visit this add again */
-               mark_irn_visited(add);
 
                /* all ok now for locally constructed stuff */
                if (can_address_relative(entity)) {
+                       ir_node *add = new_r_Add(irg, block, pic_base, pred, mode);
+
+                       /* make sure the walker doesn't visit this add again */
+                       mark_irn_visited(add);
                        set_irn_n(node, i, add);
                        continue;
                }
@@ -2144,7 +2147,8 @@ static void fix_pic_symconsts(ir_node *node, void *data)
                pic_symbol   = get_pic_symbol(be, entity);
                pic_symconst = new_rd_SymConst_addr_ent(dbgi, irg, mode_P_code,
                                                        pic_symbol, NULL);
-               set_Add_right(add, pic_symconst);
+               add = new_r_Add(irg, block, pic_base, pic_symconst, mode);
+               mark_irn_visited(add);
 
                /* we need an extra indirection for global data outside our current
                   module. The loads are always safe and can therefore float