X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbespillutil.c;h=96ec7b38edd51b7754cbf92ac2b2304235166d45;hb=2589efb23f5c24a341529d4f75d6f5f7eddaba00;hp=a8109542e8e792c22288ef3d859d62af896fd386;hpb=1a26f4853c07d1ecd68a097409dd602edfe29eff;p=libfirm diff --git a/ir/be/bespillutil.c b/ir/be/bespillutil.c index a8109542e..96ec7b38e 100644 --- a/ir/be/bespillutil.c +++ b/ir/be/bespillutil.c @@ -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,19 +147,18 @@ 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; + 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 = be_get_birg_irg(birg); - env->birg = birg; + env->irg = irg; env->arch_env = arch_env; ir_nodeset_init(&env->mem_phis); env->spill_cost = arch_env->spill_cost; env->reload_cost = arch_env->reload_cost; - env->exec_freq = be_get_birg_exec_freq(birg); + env->exec_freq = be_get_irg_exec_freq(irg); obstack_init(&env->obst); #ifdef FIRM_STATISTICS @@ -372,7 +370,6 @@ void be_add_reload_on_edge(spill_env_t *env, ir_node *to_spill, ir_node *block, void be_spill_phi(spill_env_t *env, ir_node *node) { ir_node *block; - spill_info_t* spill; int i, arity; assert(is_Phi(node)); @@ -381,11 +378,9 @@ void be_spill_phi(spill_env_t *env, ir_node *node) /* create spills for the phi arguments */ block = get_nodes_block(node); - spill = get_spillinfo(env, node); for (i = 0, arity = get_irn_arity(node); i < arity; ++i) { ir_node *arg = get_irn_n(node, i); ir_node *insert; - //get_spillinfo(env, arg); /* some backends have virtual noreg/unknown nodes that are not scheduled * and simply always available. */ @@ -567,6 +562,9 @@ static int is_value_available(spill_env_t *env, const ir_node *arg, (void)reloader; + if (get_irn_mode(arg) == mode_T) + return 0; + /* * Ignore registers are always available */ @@ -677,9 +675,8 @@ static ir_node *do_remat(spill_env_t *env, ir_node *spilled, ir_node *reloader) res = new_ir_node(get_irn_dbg_info(spilled), env->irg, bl, get_irn_op(spilled), get_irn_mode(spilled), get_irn_arity(spilled), ins); - copy_node_attr(spilled, res); + copy_node_attr(env->irg, spilled, res); arch_env_mark_remat(env->arch_env, res); - new_backedge_info(res); DBG((dbg, LEVEL_1, "Insert remat %+F of %+F before reloader %+F\n", res, spilled, reloader)); @@ -992,9 +989,9 @@ void be_insert_spills_reloads(spill_env_t *env) * SSA form for the spilled value */ if (ARR_LEN(copies) > 0) { be_ssa_construction_env_t senv; - /* be_lv_t *lv = be_get_birg_liveness(env->birg); */ + /* 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 +1015,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,16 +1043,15 @@ 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); } +BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spill); void be_init_spill(void) { FIRM_DBG_REGISTER(dbg, "firm.be.spill"); } - -BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spill);