X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbelower.c;h=1fc5176a467bcddb504e912810f1cba66f8ff722;hb=d7e24151b66cbd565f0feaea15627811cb3db664;hp=10d0f6ba158435719327222a60a3969a3d05568e;hpb=5e7aa7339cb288b72541082ad50bb838d4467e9a;p=libfirm diff --git a/ir/be/belower.c b/ir/be/belower.c index 10d0f6ba1..1fc5176a4 100644 --- a/ir/be/belower.c +++ b/ir/be/belower.c @@ -214,10 +214,10 @@ static int get_pairidx_for_out_regidx(reg_pair_t *pairs, int n, unsigned reg_idx * @param start Index to start * @return The cycle or chain */ -static perm_cycle_t *get_perm_cycle(perm_cycle_t *const cycle, - reg_pair_t *const pairs, - int const n, - int start) +static void get_perm_cycle(perm_cycle_t *const cycle, + reg_pair_t *const pairs, + int const n, + int start) { int head = pairs[start].in_reg->index; int cur_idx = pairs[start].out_reg->index; @@ -280,8 +280,6 @@ static perm_cycle_t *get_perm_cycle(perm_cycle_t *const cycle, if (cur_pair_idx >= 0) pairs[cur_pair_idx].checked = 1; } - - return cycle; } /** @@ -499,15 +497,6 @@ static int has_irn_users(const ir_node *irn) { return get_irn_out_edge_first_kind(irn, EDGE_KIND_NORMAL) != 0; } -/** - * Skip all Proj nodes. - */ -static INLINE ir_node *belower_skip_proj(ir_node *irn) { - while(is_Proj(irn)) - irn = get_Proj_pred(irn); - return irn; -} - static ir_node *find_copy(ir_node *irn, ir_node *op) { ir_node *cur_node; @@ -522,12 +511,11 @@ static ir_node *find_copy(ir_node *irn, ir_node *op) } static void gen_assure_different_pattern(ir_node *irn, ir_node *other_different, constraint_env_t *env) { - be_irg_t *birg = env->birg; - ir_graph *irg = be_get_birg_irg(birg); - ir_nodemap_t *op_set = &env->op_set; - ir_node *block = get_nodes_block(irn); - const arch_register_class_t *cls = arch_get_irn_reg_class(other_different, -1); - ir_node *in[2], *keep, *cpy; + ir_graph *irg; + ir_nodemap_t *op_set; + ir_node *block; + const arch_register_class_t *cls; + ir_node *keep, *cpy; op_copy_assoc_t *entry; if (arch_irn_is(other_different, ignore) || @@ -536,32 +524,36 @@ static void gen_assure_different_pattern(ir_node *irn, ir_node *other_different, return; } + irg = be_get_birg_irg(env->birg); + op_set = &env->op_set; + block = get_nodes_block(irn); + cls = arch_get_irn_reg_class(other_different, -1); + /* Make a not spillable copy of the different node */ /* this is needed because the different irn could be */ /* in block far far away */ /* The copy is optimized later if not needed */ /* check if already exists such a copy in the schedule immediately before */ - cpy = find_copy(belower_skip_proj(irn), other_different); + cpy = find_copy(skip_Proj(irn), other_different); if (! cpy) { cpy = be_new_Copy(cls, irg, block, other_different); be_node_set_flags(cpy, BE_OUT_POS(0), arch_irn_flags_dont_spill); DBG((dbg_constr, LEVEL_1, "created non-spillable %+F for value %+F\n", cpy, other_different)); - } - else { + } else { DBG((dbg_constr, LEVEL_1, "using already existing %+F for value %+F\n", cpy, other_different)); } - in[0] = irn; - in[1] = cpy; - /* Add the Keep resp. CopyKeep and reroute the users */ /* of the other_different irn in case of CopyKeep. */ if (has_irn_users(other_different)) { keep = be_new_CopyKeep_single(cls, irg, block, cpy, irn, get_irn_mode(other_different)); be_node_set_reg_class(keep, 1, cls); - } - else { + } else { + ir_node *in[2]; + + in[0] = irn; + in[1] = cpy; keep = be_new_Keep(cls, irg, block, 2, in); } @@ -570,7 +562,7 @@ static void gen_assure_different_pattern(ir_node *irn, ir_node *other_different, /* insert copy and keep into schedule */ assert(sched_is_scheduled(irn) && "need schedule to assure constraints"); if (! sched_is_scheduled(cpy)) - sched_add_before(belower_skip_proj(irn), cpy); + sched_add_before(skip_Proj(irn), cpy); sched_add_after(irn, keep); /* insert the other different and it's copies into the map */ @@ -587,9 +579,8 @@ static void gen_assure_different_pattern(ir_node *irn, ir_node *other_different, ir_nodeset_insert(&entry->copies, cpy); /* insert keep in case of CopyKeep */ - if (be_is_CopyKeep(keep)) { + if (be_is_CopyKeep(keep)) ir_nodeset_insert(&entry->copies, keep); - } } /**