sparc: fix bitopcc bugs
[libfirm] / ir / be / bespillutil.c
index 86eef3e..1aeb1a1 100644 (file)
@@ -98,7 +98,6 @@ struct spill_env_t {
        const arch_env_t *arch_env;
        ir_graph         *irg;
        struct obstack    obst;
-       be_irg_t         *birg;
        int               spill_cost;     /**< the cost of a single spill node */
        int               reload_cost;    /**< the cost of a reload node */
        set              *spills;         /**< all spill_info_t's, which must be
@@ -148,15 +147,13 @@ static spill_info_t *get_spillinfo(const spill_env_t *env, ir_node *value)
        return res;
 }
 
-spill_env_t *be_new_spill_env(be_irg_t *birg)
+spill_env_t *be_new_spill_env(ir_graph *irg)
 {
-       const arch_env_t *arch_env = birg->main_env->arch_env;
-       ir_graph         *irg      = be_get_birg_irg(birg);
+       const arch_env_t *arch_env = be_get_irg_arch_env(irg);
 
        spill_env_t *env = XMALLOC(spill_env_t);
        env->spills                     = new_set(cmp_spillinfo, 1024);
        env->irg            = irg;
-       env->birg           = birg;
        env->arch_env       = arch_env;
        ir_nodeset_init(&env->mem_phis);
        env->spill_cost     = arch_env->spill_cost;
@@ -194,12 +191,11 @@ void be_delete_spill_env(spill_env_t *env)
 void be_add_spill(spill_env_t *env, ir_node *to_spill, ir_node *after)
 {
        spill_info_t  *spill_info = get_spillinfo(env, to_spill);
-       const ir_node *insn       = skip_Proj_const(to_spill);
        spill_t       *spill;
        spill_t       *s;
        spill_t       *last;
 
-       assert(!arch_irn_is(insn, dont_spill));
+       assert(!arch_irn_is(skip_Proj_const(to_spill), dont_spill));
        DB((dbg, LEVEL_1, "Add spill of %+F after %+F\n", to_spill, after));
 
        /* Just for safety make sure that we do not insert the spill in front of a phi */
@@ -264,9 +260,8 @@ void be_add_reload2(spill_env_t *env, ir_node *to_spill, ir_node *before,
 {
        spill_info_t  *info;
        reloader_t    *rel;
-       const ir_node *insn = skip_Proj_const(to_spill);
 
-       assert(!arch_irn_is(insn, dont_spill));
+       assert(!arch_irn_is(skip_Proj_const(to_spill), dont_spill));
 
        info = get_spillinfo(env, to_spill);
 
@@ -994,7 +989,7 @@ void be_insert_spills_reloads(spill_env_t *env)
                        be_ssa_construction_env_t senv;
                        /* be_lv_t *lv = be_get_irg_liveness(env->irg); */
 
-                       be_ssa_construction_init(&senv, env->birg);
+                       be_ssa_construction_init(&senv, env->irg);
                        be_ssa_construction_add_copy(&senv, to_spill);
                        be_ssa_construction_add_copies(&senv, copies, ARR_LEN(copies));
                        be_ssa_construction_fix_users(&senv, to_spill);
@@ -1018,7 +1013,7 @@ void be_insert_spills_reloads(spill_env_t *env)
 
                        be_ssa_construction_env_t senv;
 
-                       be_ssa_construction_init(&senv, env->birg);
+                       be_ssa_construction_init(&senv, env->irg);
                        spill = si->spills;
                        for ( ; spill != NULL; spill = spill->next) {
                                /* maybe we rematerialized the value and need no spill */
@@ -1046,9 +1041,9 @@ void be_insert_spills_reloads(spill_env_t *env)
 
        /* Matze: In theory be_ssa_construction should take care of the liveness...
         * try to disable this again in the future */
-       be_liveness_invalidate(env->birg->lv);
+       be_liveness_invalidate(be_get_irg_liveness(env->irg));
 
-       be_remove_dead_nodes_from_schedule(env->birg);
+       be_remove_dead_nodes_from_schedule(env->irg);
 
        be_timer_pop(T_RA_SPILL_APPLY);
 }