Remove the attribute const arch_env_t *arch_env from struct ia32_code_gen_t. We...
[libfirm] / ir / be / bespillbelady2.c
index 43f72e5..74a6e6c 100644 (file)
@@ -32,9 +32,7 @@
  *   capacity of the blocks to let global variables live through
  *   them.
  */
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <math.h>
 #include <limits.h>
@@ -54,7 +52,6 @@
 #include "irprintf.h"
 #include "execfreq.h"
 #include "dfs_t.h"
-#include "xmalloc.h"
 
 #include "beutil.h"
 #include "bearch_t.h"
@@ -205,7 +202,7 @@ static INLINE void workset_bulk_fill(workset_t *workset, int count, const loc_t
 static INLINE void workset_insert(belady_env_t *env, workset_t *ws, ir_node *val) {
        int i;
        /* check for current regclass */
-       if (!arch_irn_consider_in_reg_alloc(env->arch, env->cls, val)) {
+       if (!arch_irn_consider_in_reg_alloc(env->cls, val)) {
                // DBG((dbg, DBG_WORKSET, "Skipped %+F\n", val));
                return;
        }
@@ -307,7 +304,7 @@ static INLINE void *new_block_info(belady_env_t *bel, int id)
        res->bl  = bl;
        res->id  = id;
        res->exec_freq    = get_block_execfreq(bel->ef, bl);
-       res->reload_cost  = bel->arch->isa->reload_cost * res->exec_freq;
+       res->reload_cost  = bel->arch->reload_cost * res->exec_freq;
        res->free_at_jump = bel->n_regs;
        INIT_LIST_HEAD(&res->br_head);
        set_irn_link(bl, res);
@@ -504,7 +501,7 @@ static INLINE unsigned get_curr_distance(block_info_t *bi, const ir_node *irn, i
        belady_env_t *env          = bi->bel;
        sched_timestep_t curr_step = sched_get_time_step(env->instr);
        next_use_t *use            = get_current_use(bi, irn);
-       int flags                  = arch_irn_get_flags(env->arch, irn);
+       int flags                  = arch_irn_get_flags(irn);
 
        assert(!(flags & arch_irn_flags_ignore));
 
@@ -738,7 +735,7 @@ static void belady(belady_env_t *env, int id) {
                if (is_op_forking(get_irn_op(env->instr))) {
                        for (i = get_irn_arity(env->instr) - 1; i >= 0; --i) {
                                ir_node *op = get_irn_n(env->instr, i);
-                               block_info->free_at_jump -= arch_irn_consider_in_reg_alloc(env->arch, env->cls, op);
+                               block_info->free_at_jump -= arch_irn_consider_in_reg_alloc(env->cls, op);
                        }
                }
 
@@ -1080,7 +1077,7 @@ static double can_bring_in(global_end_state_t *ges, ir_node *bl, ir_node *irn, d
                         * there might by unknwons as operands of phis in that case
                         * we set the costs to zero, since they won't get spilled.
                         */
-                       if (arch_irn_consider_in_reg_alloc(env->arch, env->cls, op))
+                       if (arch_irn_consider_in_reg_alloc(env->cls, op))
                                c = can_make_available_at_end(ges, pr, op, limit - glob_costs, level + 1);
                        else
                                c = 0.0;
@@ -1328,7 +1325,7 @@ static void optimize_variable(global_end_state_t *ges, bring_in_t *br)
                                DBG((dbg, DBG_GLOBAL, "\t-> use blocked. local reload: %+F, try spill at: %+F\n",
                                                        br->first_use, better_spill_loc));
                                be_add_reload(env->senv, irn, br->first_use, env->cls, 1);
-                               be_add_spill(env->senv, irn, sched_next(better_spill_loc));
+                               be_add_spill(env->senv, irn, better_spill_loc);
                                ir_nodeset_insert(env->extra_spilled, irn);
                        }
 
@@ -1447,7 +1444,7 @@ static void global_assign(belady_env_t *env)
                        if (!is_Phi(irn))
                                break;
 
-                       if (arch_irn_consider_in_reg_alloc(env->arch, env->cls, irn)
+                       if (arch_irn_consider_in_reg_alloc(env->cls, irn)
                                        && !bitset_contains_irn(ges.succ_phis, irn))
                                be_spill_phi(env->senv, irn);
                }