From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:39304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULFRD-0003Ug-Fz for qemu-devel@nongnu.org; Thu, 28 Mar 2013 12:12:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ULFRA-0000Ng-KD for qemu-devel@nongnu.org; Thu, 28 Mar 2013 12:12:27 -0400 Received: from mail-ob0-x233.google.com ([2607:f8b0:4003:c01::233]:39225) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULFRA-0000NZ-FJ for qemu-devel@nongnu.org; Thu, 28 Mar 2013 12:12:24 -0400 Received: by mail-ob0-f179.google.com with SMTP id un3so9357035obb.38 for ; Thu, 28 Mar 2013 09:12:24 -0700 (PDT) Sender: Richard Henderson Message-ID: <51546BE3.2060509@twiddle.net> Date: Thu, 28 Mar 2013 09:12:19 -0700 From: Richard Henderson MIME-Version: 1.0 References: <1364484781-15561-1-git-send-email-rth@twiddle.net> <1364484781-15561-8-git-send-email-rth@twiddle.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 07/20] tcg-arm: Fold epilogue into INDEX_op_exit_tb List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel@nongnu.org, Aurelien Jarno On 03/28/2013 09:05 AM, Peter Maydell wrote: > On 28 March 2013 15:32, Richard Henderson wrote: >> The epilogue on ARM is one pop instruction, that pops the return >> address into PC. Avoid the jump to jump for this case. Use the >> standard movi32 routine for loading the return value if it's easy. > >> @@ -2025,8 +2023,7 @@ static void tcg_target_qemu_prologue(TCGContext *s) >> tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]); >> >> tcg_out_bx(s, COND_AL, tcg_target_call_iarg_regs[1]); >> - tb_ret_addr = s->code_ptr; >> >> /* ldmia sp!, { r4 - r12, pc } */ >> - tcg_out32(s, (COND_AL << 28) | 0x08bd9ff0); >> + tb_pop_ret = (COND_AL << 28) | 0x08bd9ff0; >> } > > Why are we using a variable when it's always constant? I just wanted the comments for the stmia and ldmia to be the same, and near one another. Would it be better if tcg_target_qemu_prologue was moved up in the file, and tb_ret_addr made a static const (which the compiler should fold)? E.g. /* ldmia sp!, { r4 - r12, pc } @ See the stmia definition below. */ static const uint32_t tb_pop_ret = ...; static void tcg_target_qemu_prologue(TCGContext *s) { /* comment */ /* stmia sp!, {r4-r12, lr} */ tcg_out32(...); ... } > Also, please add a comment to the bottom of the qemu_prologue() > saying something like > > /* We never return here; we always return directly from generated > * code to our caller. > */ Sure. r~