X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbestate.c;h=28e336e1ad8d1be817664ec775b8ecb85bfa6964;hb=e32731e8c4dbbfd7b7f21f0b3baa1a2c0fa8b37e;hp=52efa3a61aa9af4e50ed3a03cd29ad161545b486;hpb=e30e5834fd8c1c3a7d28fc66e99b91a84993bde8;p=libfirm diff --git a/ir/be/bestate.c b/ir/be/bestate.c index 52efa3a61..28e336e1a 100644 --- a/ir/be/bestate.c +++ b/ir/be/bestate.c @@ -25,9 +25,7 @@ * @date 26.03.2007 * @version $Id$ */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include "bestate.h" @@ -62,7 +60,6 @@ typedef struct spill_info_t { typedef struct minibelady_env_t { struct obstack obst; - const arch_env_t *arch_env; const arch_register_t *reg; const be_lv_t *lv; void *func_env; @@ -79,7 +76,7 @@ typedef struct block_info_t { ir_node *end_state; } block_info_t; -static INLINE +static inline block_info_t *new_block_info(struct obstack *obst, ir_node *block) { block_info_t *res = obstack_alloc(obst, sizeof(*res)); @@ -92,14 +89,14 @@ block_info_t *new_block_info(struct obstack *obst, ir_node *block) return res; } -static INLINE +static inline block_info_t *get_block_info(ir_node *block) { assert(irn_visited(block)); return (block_info_t*) get_irn_link(block); } -static INLINE +static inline spill_info_t *create_spill_info(minibelady_env_t *env, ir_node *state) { spill_info_t *spill_info = obstack_alloc(&env->obst, sizeof(spill_info[0])); @@ -116,7 +113,7 @@ spill_info_t *create_spill_info(minibelady_env_t *env, ir_node *state) return spill_info; } -static INLINE +static inline spill_info_t *get_spill_info(minibelady_env_t *env, const ir_node *node) { spill_info_t *spill_info @@ -169,12 +166,13 @@ void create_reload(minibelady_env_t *env, ir_node *state, ir_node *before, 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 i, arity = get_irn_arity(phi); - ir_node **in = alloca(arity * sizeof(in[0])); - ir_node *spill_to_kill = NULL; + 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 *spill_to_kill = NULL; spill_info_t *spill_info; + int i; /* does a spill exist for the phis value? */ spill_info = get_spill_info(env, phi); @@ -268,7 +266,7 @@ block_info_t *compute_block_start_state(minibelady_env_t *env, ir_node *block) sched_foreach(block, node) { if (!is_Phi(node)) break; - if (arch_get_irn_register(env->arch_env, node) != env->reg) + if (arch_get_irn_register(node) != env->reg) continue; DBG((dbg, LEVEL_2, "\t...checking %+F\n", node)); @@ -318,7 +316,7 @@ block_info_t *compute_block_start_state(minibelady_env_t *env, ir_node *block) if(!mode_is_data(get_irn_mode(node))) continue; - if (arch_get_irn_register(env->arch_env, node) != env->reg) + if (arch_get_irn_register(node) != env->reg) continue; DBG((dbg, LEVEL_2, "\t...checking %+F\n", node)); @@ -409,7 +407,7 @@ void belady(minibelady_env_t *env, ir_node *block) if(!mode_is_data(get_irn_mode(in))) continue; - reg = arch_get_irn_register(env->arch_env, in); + reg = arch_get_irn_register(in); if(reg == env->reg) { assert(need_val == NULL); need_val = in; @@ -436,7 +434,7 @@ void belady(minibelady_env_t *env, ir_node *block) if(!mode_is_data(get_irn_mode(proj))) continue; - reg = arch_get_irn_register(env->arch_env, proj); + reg = arch_get_irn_register(proj); if(reg == env->reg) { current_state = proj; DBG((dbg, LEVEL_3, "\t... current_state <- %+F\n", current_state)); @@ -444,8 +442,7 @@ void belady(minibelady_env_t *env, ir_node *block) } } else { if(mode_is_data(get_irn_mode(node))) { - const arch_register_t *reg = - arch_get_irn_register(env->arch_env, node); + const arch_register_t *reg = arch_get_irn_register(node); if(reg == env->reg) { current_state = node; DBG((dbg, LEVEL_3, "\t... current_state <- %+F\n", current_state)); @@ -542,14 +539,12 @@ void be_assure_state(be_irg_t *birg, const arch_register_t *reg, void *func_env, be_lv_t *lv = be_assure_liveness(birg); be_liveness_assure_sets(lv); - be_assure_dom_front(birg); /* construct control flow loop tree */ if(! (get_irg_loopinfo_state(irg) & loopinfo_cf_consistent)) { construct_cf_backedges(irg); } obstack_init(&env.obst); - env.arch_env = be_get_birg_arch_env(birg); env.reg = reg; env.func_env = func_env; env.create_spill = create_spill; @@ -602,8 +597,7 @@ void be_assure_state(be_irg_t *birg, const arch_register_t *reg, void *func_env, len = ARR_LEN(phis); for(i = 0; i < len; ++i) { ir_node *phi = phis[i]; - be_set_phi_flags(env.arch_env, phi, arch_irn_flags_ignore); - arch_set_irn_register(env.arch_env, phi, env.reg); + arch_set_irn_register(phi, env.reg); } be_ssa_construction_destroy(&senv);