Unbox RBLK memory for parameter passing in machinize_call.
@@ -372,7 +372,14 @@ static void machinize_call (gen_ctx_t gen_ctx, MIR_insn_t call_insn) {
} else if (type != MIR_T_F && type != MIR_T_D && n_iregs < 5) {
if (ext_insn != NULL) gen_add_insn_before (gen_ctx, call_insn, ext_insn);
arg_reg_op = _MIR_new_hard_reg_op (ctx, R2_HARD_REG + n_iregs);
+ if (type != MIR_T_RBLK) {
gen_mov (gen_ctx, call_insn, MIR_MOV, arg_reg_op, arg_op);
+ } else {
+ assert (arg_op.mode == MIR_OP_MEM);
+ gen_mov (gen_ctx, call_insn, MIR_MOV, arg_reg_op, MIR_new_reg_op (ctx, arg_op.u.mem.base));
+ arg_reg_op = _MIR_new_hard_reg_mem_op (ctx, MIR_T_RBLK, arg_op.u.mem.disp,
+ R2_HARD_REG + n_iregs, MIR_NON_HARD_REG, 1);
+ }
if (i >= start) call_insn->ops[i] = arg_reg_op; /* don't change LD return yet */
n_iregs++;
} else { /* put arguments on the stack: */
@@ -380,7 +387,13 @@ static void machinize_call (gen_ctx_t gen_ctx, MIR_insn_t call_insn) {
new_insn_code = (type == MIR_T_F ? MIR_FMOV : type == MIR_T_D ? MIR_DMOV : MIR_MOV);
mem_op = _MIR_new_hard_reg_mem_op (ctx, mem_type, param_mem_size + S390X_STACK_HEADER_SIZE,
SP_HARD_REG, MIR_NON_HARD_REG, 1);
+ if (type != MIR_T_RBLK) {
gen_mov (gen_ctx, call_insn, new_insn_code, mem_op, arg_op);
+ } else {
+ assert (arg_op.mode == MIR_OP_MEM);
+ gen_mov (gen_ctx, call_insn, new_insn_code, mem_op,
+ MIR_new_reg_op (ctx, arg_op.u.mem.base));
+ }
if (i >= start) call_insn->ops[i] = mem_op;
param_mem_size += 8;
}
