From 48ef3f1151bfb17ad3df3f05aedb794927605890 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Wed, 6 Jun 2007 12:35:40 +0000 Subject: [PATCH] BugFix: when register parameter are used the mode must be the mode of the parameters! Add conv's for that purpose. [r14367] --- ir/be/beabi.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ir/be/beabi.c b/ir/be/beabi.c index 599ea7ffa..7f4d1f813 100644 --- a/ir/be/beabi.c +++ b/ir/be/beabi.c @@ -1913,13 +1913,14 @@ static void modify_irg(be_abi_irg_t *env) if(arg_proj != NULL) { be_abi_call_arg_t *arg; ir_type *param_type; - int nr = get_Proj_proj(arg_proj); + int nr = get_Proj_proj(arg_proj); + ir_mode *mode; nr = MIN(nr, n_params); arg = get_call_arg(call, 0, nr); param_type = get_method_param_type(method_type, nr); - if(arg->in_reg) { + if (arg->in_reg) { repl = pmap_get(env->regs, (void *) arg->reg); } @@ -1932,14 +1933,21 @@ static void modify_irg(be_abi_irg_t *env) } /* The stack parameter is not primitive (it is a struct or array), - we thus will create a node representing the parameter's address - on the stack. */ + we thus will create a node representing the parameter's address + on the stack. */ else { repl = be_new_FrameAddr(sp->reg_class, irg, reg_params_bl, frame_pointer, arg->stack_ent); } } assert(repl != NULL); + + /* Beware: the mode of the register parameters is always the mode of the register class + which may be wrong. Add Conv's then. */ + mode = get_irn_mode(args[i]); + if (mode != get_irn_mode(repl)) { + repl = new_r_Conv(irg, get_irn_n(repl, -1), repl, mode); + } exchange(args[i], repl); } } -- 2.20.1