From: Christian Würdig Date: Mon, 26 Feb 2007 17:37:59 +0000 (+0000) Subject: set mode of result Proj to result mode of function X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=818bd104e29a7f389d86969aa1472cabe1f99172;p=libfirm set mode of result Proj to result mode of function --- diff --git a/ir/be/beabi.c b/ir/be/beabi.c index d515e3bb0..d26ea3a32 100644 --- a/ir/be/beabi.c +++ b/ir/be/beabi.c @@ -660,19 +660,22 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp, i /* Set the register constraints of the results. */ for (i = 0; res_projs[i]; ++i) { - ir_node *irn = res_projs[i]; - int proj = get_Proj_proj(irn); + int pn = get_Proj_proj(res_projs[i]); /* Correct Proj number since it has been adjusted! (see above) */ - const be_abi_call_arg_t *arg = get_call_arg(call, 1, proj - pn_Call_max); + const be_abi_call_arg_t *arg = get_call_arg(call, 1, pn - pn_Call_max); /* correct mode */ + ir_type *method_tp = get_Call_type(irn); + ir_type *res_tp = get_method_res_type(method_tp, i); + ir_mode *res_mode = get_type_mode(res_tp); const arch_register_class_t *cls = arch_register_get_class(arg->reg); - ir_mode *mode = arch_register_class_mode(cls); - set_irn_mode(irn, mode); + ir_mode *mode = res_mode ? res_mode : arch_register_class_mode(cls); + + set_irn_mode(res_projs[i], mode); assert(arg->in_reg); - be_set_constr_single_reg(low_call, BE_OUT_POS(proj), arg->reg); + be_set_constr_single_reg(low_call, BE_OUT_POS(pn), arg->reg); } obstack_free(obst, in); exchange(irn, low_call);