From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48889) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aKCYE-0006q3-HC for qemu-devel@nongnu.org; Fri, 15 Jan 2016 17:08:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aKCYA-0008Df-H1 for qemu-devel@nongnu.org; Fri, 15 Jan 2016 17:08:58 -0500 Received: from mail-qk0-x241.google.com ([2607:f8b0:400d:c09::241]:35758) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aKCYA-0008Db-Bx for qemu-devel@nongnu.org; Fri, 15 Jan 2016 17:08:54 -0500 Received: by mail-qk0-x241.google.com with SMTP id s5so998384qkd.2 for ; Fri, 15 Jan 2016 14:08:54 -0800 (PST) Sender: Richard Henderson References: <1450382320-5383-1-git-send-email-rth@twiddle.net> <1450382427-5973-1-git-send-email-rth@twiddle.net> <20151231113341.GE360@aurel32.net> From: Richard Henderson Message-ID: <56996DF2.4080803@twiddle.net> Date: Fri, 15 Jan 2016 14:08:50 -0800 MIME-Version: 1.0 In-Reply-To: <20151231113341.GE360@aurel32.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 10/14] tcg: Introduce temp_load List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Aurelien Jarno Cc: mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org On 12/31/2015 03:33 AM, Aurelien Jarno wrote: >> - if (ts->val_type == TEMP_VAL_REG) { >> - tcg_out_st(s, ts->type, ts->reg, TCG_REG_CALL_STACK, stack_offset); >> - } else if (ts->val_type == TEMP_VAL_MEM) { >> - reg = tcg_reg_alloc(s, tcg_target_available_regs[ts->type], >> - s->reserved_regs); >> - /* XXX: not correct if reading values from the stack */ > > Shouldn't we keep this comment by moving it to temp_load? No, because I believe the comment to be inaccurate. > >> - tcg_out_ld(s, ts->type, reg, ts->mem_base->reg, ts->mem_offset); >> - tcg_out_st(s, ts->type, reg, TCG_REG_CALL_STACK, stack_offset); >> - } else if (ts->val_type == TEMP_VAL_CONST) { >> - reg = tcg_reg_alloc(s, tcg_target_available_regs[ts->type], >> - s->reserved_regs); >> - /* XXX: sign extend may be needed on some targets */ > > Same here. > >> - tcg_out_movi(s, ts->type, reg, ts->val); Likewise. If the target needs sign-extend, it will do it here in movi given the type. >> - tcg_out_st(s, ts->type, reg, TCG_REG_CALL_STACK, stack_offset); >> - } else { >> - tcg_abort(); >> - } >> + temp_load(s, ts, tcg_target_available_regs[ts->type], >> + s->reserved_regs); >> + tcg_out_st(s, ts->type, ts->reg, TCG_REG_CALL_STACK, stack_offset); >> } >> #ifndef TCG_TARGET_STACK_GROWSUP >> stack_offset += sizeof(tcg_target_long); >> @@ -2193,18 +2180,19 @@ static void tcg_reg_alloc_call(TCGContext *s, int nb_oargs, int nb_iargs, >> ts = &s->temps[arg]; >> reg = tcg_target_call_iarg_regs[i]; >> tcg_reg_free(s, reg); >> + >> if (ts->val_type == TEMP_VAL_REG) { >> if (ts->reg != reg) { >> tcg_out_mov(s, ts->type, reg, ts->reg); >> } >> - } else if (ts->val_type == TEMP_VAL_MEM) { >> - tcg_out_ld(s, ts->type, reg, ts->mem_base->reg, ts->mem_offset); >> - } else if (ts->val_type == TEMP_VAL_CONST) { >> - /* XXX: sign extend ? */ > > And here. > >> - tcg_out_movi(s, ts->type, reg, ts->val); Likewise. r~