From: Matthias Braun Date: Thu, 26 Jan 2012 17:13:44 +0000 (+0100) Subject: be: fix phi constraints double width values X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=f81eb3aa65ff7a6d9cfe1988d1b43882e477d0ed;p=libfirm be: fix phi constraints double width values --- diff --git a/ir/be/benode.c b/ir/be/benode.c index 103522396..e93b64845 100644 --- a/ir/be/benode.c +++ b/ir/be/benode.c @@ -1075,9 +1075,8 @@ static const arch_irn_ops_t dummy_be_irn_ops = { ir_node *be_new_Phi(ir_node *block, int n_ins, ir_node **ins, ir_mode *mode, - const arch_register_class_t *cls) + const arch_register_req_t *req) { - const arch_register_req_t *req; ir_graph *irg = get_irn_irg(block); struct obstack *obst = be_get_be_obst(irg); backend_info_t *info; @@ -1089,11 +1088,6 @@ ir_node *be_new_Phi(ir_node *block, int n_ins, ir_node **ins, ir_mode *mode, memset(info->out_infos, 0, 1 * sizeof(info->out_infos[0])); info->in_reqs = OALLOCN(obst, const arch_register_req_t*, n_ins); - if (cls == NULL) { - req = arch_no_register_req; - } else { - req = cls->class_req; - } info->out_infos[0].req = req; for (i = 0; i < n_ins; ++i) { info->in_reqs[i] = req; diff --git a/ir/be/benode.h b/ir/be/benode.h index 003cad1ff..65ff3357f 100644 --- a/ir/be/benode.h +++ b/ir/be/benode.h @@ -450,7 +450,7 @@ void be_dump_phi_reg_reqs(FILE *out, const ir_node *node, dump_reason_t reason); * Creates a new phi with associated backend informations */ ir_node *be_new_Phi(ir_node *block, int n_ins, ir_node **ins, ir_mode *mode, - const arch_register_class_t *cls); + const arch_register_req_t *req); /** * Search for output of start node with a specific register diff --git a/ir/be/beprefalloc.c b/ir/be/beprefalloc.c index 338b7a438..ffc442c04 100644 --- a/ir/be/beprefalloc.c +++ b/ir/be/beprefalloc.c @@ -1769,7 +1769,8 @@ static void allocate_coalesce_block(ir_node *block, void *data) if (need_phi) { ir_mode *mode = get_irn_mode(node); - ir_node *phi = be_new_Phi(block, n_preds, phi_ins, mode, cls); + ir_node *phi = be_new_Phi(block, n_preds, phi_ins, mode, + cls->class_req); DB((dbg, LEVEL_3, "Create Phi %+F (for %+F) -", phi, node)); #ifdef DEBUG_libfirm diff --git a/ir/be/bespillutil.c b/ir/be/bespillutil.c index a390ca266..fa103f1d0 100644 --- a/ir/be/bespillutil.c +++ b/ir/be/bespillutil.c @@ -462,7 +462,7 @@ static void spill_phi(spill_env_t *env, spill_info_t *spillinfo) /* override or replace spills list... */ spill = OALLOC(&env->obst, spill_t); spill->after = determine_spill_point(phi); - spill->spill = be_new_Phi(block, arity, ins, mode_M, NULL); + spill->spill = be_new_Phi(block, arity, ins, mode_M, arch_no_register_req); spill->next = NULL; sched_add_after(block, spill->spill); diff --git a/ir/be/bessaconstr.c b/ir/be/bessaconstr.c index 0cb6df97b..59d03b9c5 100644 --- a/ir/be/bessaconstr.c +++ b/ir/be/bessaconstr.c @@ -245,7 +245,7 @@ static ir_node *insert_dummy_phi(be_ssa_construction_env_t *env, ir_node *block) for (i = 0; i < n_preds; ++i) { ins[i] = dummy; } - phi = be_new_Phi(block, n_preds, ins, env->mode, env->phi_cls); + phi = be_new_Phi(block, n_preds, ins, env->mode, env->phi_req); sched_add_after(block, phi); ARR_APP1(ir_node*, env->new_phis, phi); @@ -458,6 +458,24 @@ void be_ssa_construction_destroy(be_ssa_construction_env_t *env) stat_ev_ctx_pop("bessaconstr"); } +static void determine_phi_req(be_ssa_construction_env_t *env, ir_node *value) +{ + const arch_register_req_t *req = arch_get_irn_register_req(value); + env->mode = get_irn_mode(value); + if (req->width == 1) { + env->phi_req = req->cls->class_req; + } else { + /* construct a new register req... */ + ir_graph *irg = get_irn_irg(value); + struct obstack *obst = be_get_be_obst(irg); + arch_register_req_t *new_req = OALLOCZ(obst, arch_register_req_t); + new_req->cls = req->cls; + new_req->type = req->type & arch_register_req_type_aligned; + new_req->width = req->width; + env->phi_req = new_req; + } +} + void be_ssa_construction_add_copy(be_ssa_construction_env_t *env, ir_node *copy) { @@ -466,8 +484,7 @@ void be_ssa_construction_add_copy(be_ssa_construction_env_t *env, assert(env->iterated_domfront_calculated == 0); if (env->mode == NULL) { - env->mode = get_irn_mode(copy); - env->phi_cls = arch_get_irn_reg_class(copy); + determine_phi_req(env, copy); } else { assert(env->mode == get_irn_mode(copy)); } @@ -488,8 +505,7 @@ void be_ssa_construction_add_copies(be_ssa_construction_env_t *env, assert(env->iterated_domfront_calculated == 0); if (env->mode == NULL) { - env->mode = get_irn_mode(copies[0]); - env->phi_cls = arch_get_irn_reg_class(copies[0]); + determine_phi_req(env, copies[0]); } for (i = 0; i < copies_len; ++i) { diff --git a/ir/be/bessaconstr.h b/ir/be/bessaconstr.h index 832d21fa8..c44ee65f6 100644 --- a/ir/be/bessaconstr.h +++ b/ir/be/bessaconstr.h @@ -62,7 +62,7 @@ typedef struct be_ssa_construction_env_t { ir_graph *irg; const be_dom_front_info_t *domfronts; ir_mode *mode; - const arch_register_class_t *phi_cls; + const arch_register_req_t *phi_req; waitq *worklist; const ir_nodeset_t *ignore_uses; ir_node **new_phis; diff --git a/ir/be/bestate.c b/ir/be/bestate.c index 1e3bf3eff..3c57ae3b6 100644 --- a/ir/be/bestate.c +++ b/ir/be/bestate.c @@ -182,7 +182,8 @@ static void spill_phi(minibelady_env_t *env, ir_node *phi) DBG((dbg, LEVEL_2, "\tcreate Phi-M for %+F\n", phi)); /* create a Phi-M */ - spill_info->spill = be_new_Phi(block, arity, phi_in, mode_M, NULL); + spill_info->spill = be_new_Phi(block, arity, phi_in, mode_M, + arch_no_register_req); sched_add_after(block, spill_info->spill); if (spill_to_kill != NULL) {