sparc: floatingpoint flags producing nodes have 1 cycle delay, add an ad-hoc fix...
[libfirm] / ir / be / bestate.c
index b7035da..7f831ea 100644 (file)
@@ -135,8 +135,7 @@ static spill_info_t *create_spill(minibelady_env_t *env, ir_node *state, int for
                do {
                        after = next;
                        next = sched_next(after);
-               } while (is_Proj(next) || is_Phi(next) || be_is_Keep(next)
-                       || (arch_irn_get_flags(next) & arch_irn_flags_prolog));
+               } while (is_Proj(next) || is_Phi(next) || be_is_Keep(next));
        } else {
                after = state;
        }
@@ -162,7 +161,7 @@ static void spill_phi(minibelady_env_t *env, ir_node *phi)
        ir_graph     *irg           = get_irn_irg(phi);
        ir_node      *block         = get_nodes_block(phi);
        int           arity         = get_irn_arity(phi);
-       ir_node     **in            = ALLOCAN(ir_node*, arity);
+       ir_node     **phi_in        = ALLOCAN(ir_node*, arity);
        ir_node      *dummy         = new_r_Dummy(irg, mode_M);
        ir_node      *spill_to_kill = NULL;
        spill_info_t *spill_info;
@@ -178,13 +177,13 @@ static void spill_phi(minibelady_env_t *env, ir_node *phi)
 
        /* create a new phi-M with bad preds */
        for (i = 0; i < arity; ++i) {
-               in[i] = dummy;
+               phi_in[i] = dummy;
        }
 
        DBG((dbg, LEVEL_2, "\tcreate Phi-M for %+F\n", phi));
 
        /* create a Phi-M */
-       spill_info->spill = be_new_Phi(block, arity, in, mode_M, NULL);
+       spill_info->spill = be_new_Phi(block, arity, phi_in, mode_M, NULL);
        sched_add_after(block, spill_info->spill);
 
        if (spill_to_kill != NULL) {
@@ -352,17 +351,6 @@ static block_info_t *compute_block_start_state(minibelady_env_t *env, ir_node *b
        return block_info;
 }
 
-static ir_node *get_reload_point(ir_node *before)
-{
-       while (true) {
-               ir_node *prev = sched_prev(before);
-               if (! (arch_irn_get_flags(prev) & arch_irn_flags_epilog))
-                       break;
-               before = prev;
-       }
-       return before;
-}
-
 /**
  * For the given block @p block, decide for each values
  * whether it is used from a register or is reloaded
@@ -419,8 +407,8 @@ static void belady(minibelady_env_t *env, ir_node *block)
                }
                /* create a reload to match state if necessary */
                if (need_val != NULL && need_val != current_state) {
+                       ir_node *before = node;
                        DBG((dbg, LEVEL_3, "\t... reloading %+F\n", need_val));
-                       ir_node *before = get_reload_point(node);
                        create_reload(env, need_val, before, current_state);
                        current_state = need_val;
                }
@@ -614,7 +602,7 @@ void be_assure_state(ir_graph *irg, const arch_register_t *reg, void *func_env,
        obstack_free(&env.obst, NULL);
 }
 
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_state);
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_state)
 void be_init_state(void)
 {
        FIRM_DBG_REGISTER(dbg, "firm.be.state");