X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbespill.c;h=016a2d776de04a402bdb83afe03d0bfea7d3c99a;hb=3767f52182607e5de9f0ed7e48d88132317c12d8;hp=55c50769a723e148cda9d2188962eb53efa817f0;hpb=ea64ddabccc512b21b425e4d89fda5e4ffe124a6;p=libfirm diff --git a/ir/be/bespill.c b/ir/be/bespill.c index 55c50769a..016a2d776 100644 --- a/ir/be/bespill.c +++ b/ir/be/bespill.c @@ -56,7 +56,7 @@ struct _spill_env_t { struct obstack obst; set *spill_ctxs; set *spills; /**< all spill_info_t's, which must be placed */ - pset *mem_phis; /**< set of all special spilled phis. allocated and freed seperately */ + pset *mem_phis; /**< set of all special spilled phis. allocated and freed separately */ decide_irn_t is_mem_phi; /**< callback func to decide if a phi needs special spilling */ void *data; /**< data passed to all callbacks */ DEBUG_ONLY(firm_dbg_module_t *dbg;) @@ -74,6 +74,12 @@ static int cmp_spillinfo(const void *x, const void *y, size_t size) { return ! (xx->spilled_node == yy->spilled_node); } +DEBUG_ONLY( +void be_set_spill_env_dbg_module(spill_env_t *env, firm_dbg_module_t *dbg) { + env->dbg = dbg; +} +); + spill_env_t *be_new_spill_env(const be_chordal_env_t *chordal_env, decide_irn_t is_mem_phi, void *data) { spill_env_t *env = xmalloc(sizeof(env[0])); env->spill_ctxs = new_set(cmp_spillctx, 1024); @@ -389,7 +395,9 @@ typedef struct _ss_env_t { DEBUG_ONLY(firm_dbg_module_t *dbg;) } ss_env_t; - +/** + * Walker: compute the spill slots + */ static void compute_spill_slots_walker(ir_node *spill, void *env) { ss_env_t *ssenv = env; ir_node *ctx; @@ -404,12 +412,18 @@ static void compute_spill_slots_walker(ir_node *spill, void *env) { entry = pmap_find(ssenv->slots, ctx); if (!entry) { + struct _arch_env_t *arch_env = ssenv->cenv->birg->main_env->arch_env; + ir_node *spilled = get_irn_n(spill, be_pos_Spill_val); + const arch_register_t *reg = arch_get_irn_register(arch_env, spilled); + const arch_register_class_t *cls = arch_register_get_class(reg); + ir_mode *largest_mode = arch_register_class_mode(cls); + /* this is a new spill context */ ss = obstack_alloc(&ssenv->ob, sizeof(*ss)); - ss->members = pset_new_ptr(8); - ss->largest_mode = get_irn_mode(get_irn_n(spill, be_pos_Spill_val)); - ss->size = get_mode_size_bytes(ss->largest_mode); - ss->align = ss->size; /* TODO Assumed for now */ + ss->members = pset_new_ptr(8); + ss->largest_mode = largest_mode; + ss->size = get_mode_size_bytes(ss->largest_mode); + ss->align = arch_isa_get_reg_class_alignment(arch_env->isa, cls); pmap_insert(ssenv->slots, ctx, ss); } else { ir_node *irn;