From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bru8J-0002jW-9a for qemu-devel@nongnu.org; Wed, 05 Oct 2016 17:53:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bru8E-0001nK-7T for qemu-devel@nongnu.org; Wed, 05 Oct 2016 17:53:46 -0400 Received: from mail-pa0-x234.google.com ([2607:f8b0:400e:c03::234]:33214) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bru8D-0001n5-Fu for qemu-devel@nongnu.org; Wed, 05 Oct 2016 17:53:42 -0400 Received: by mail-pa0-x234.google.com with SMTP id cd13so491160pac.0 for ; Wed, 05 Oct 2016 14:53:41 -0700 (PDT) References: <1474047287-145701-1-git-send-email-thomas.hanson@linaro.org> <1474047287-145701-3-git-send-email-thomas.hanson@linaro.org> From: Tom Hanson Message-ID: <57F57641.3090104@linaro.org> Date: Wed, 5 Oct 2016 15:53:05 -0600 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/3] target-arm: Code changes to implement overwrite of tag field on PC load List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers , grant.likely@hpe.com, Richard Henderson On 09/29/2016 07:24 PM, Peter Maydell wrote: > On 16 September 2016 at 10:34, Thomas Hanson wrote: ... >> diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c >> index f5e29d2..4d6f951 100644 ... >> @@ -176,6 +177,58 @@ void gen_a64_set_pc_im(uint64_t val) >> tcg_gen_movi_i64(cpu_pc, val); >> } >> >> +void gen_a64_set_pc_reg(DisasContext *s, unsigned int rn) > > I think it would be better to take a TCGv_i64 here rather than > unsigned int rn (ie have the caller do the cpu_reg(s, rn)). > (You probably don't need that prototype of cpu_reg() above if > you do this, though that's not why it's better.) > Why would this be better? To me, the caller has a register number and wants that register used to load the PC. So, it passes in the register number. The fact that gen_a64_set_pc_reg() needs to convert that into a TCGv_i64 is an implementation detail that should be encapsulated/hidden from the caller. If the desire is to eliminate the multiple cpu_reg() calls inside of gen_a64_set_pc_reg() then that mapping could be done at the top of the function before the outer if().