Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D98EDC07E9D for ; Tue, 27 Sep 2022 18:06:33 +0000 (UTC) Received: from localhost ([::1]:53320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odEyW-0001Ci-Qu for qemu-devel@archiver.kernel.org; Tue, 27 Sep 2022 14:06:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odEwP-0007J6-Jk for qemu-devel@nongnu.org; Tue, 27 Sep 2022 14:04:23 -0400 Received: from rev.ng ([5.9.113.41]:51843) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odEwO-0007FB-5v for qemu-devel@nongnu.org; Tue, 27 Sep 2022 14:04:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=rev.ng; s=dkim; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From:References: Cc:To:Subject:Reply-To:MIME-Version:Date:Message-ID:Sender:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=jJmPSiUMhMWCiInkVVWYnQvn6JZVuc7wtF0E3Vcg7jE=; b=ZXt8vtEHNv0cGaWldAuH2lHtDb vjWdHNqUHCSeMQcvgIDmpDFMa21WEa5TGD18atovXZYn+3/aOnj/prGGAtQI8ntzwfPgWmTzvFCUR OyeWSFug2mGMEnvhaMGpjd6t/S0wRs6u4w1M00u8WkX4SNQbk3RkUHlL6NqcJli2FUNQ=; Message-ID: <164011e3-8721-81d2-65b2-e88f9959c478@rev.ng> Date: Tue, 27 Sep 2022 20:04:04 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: Re: [PATCH v11 06/15] target/hexagon: expose next PC in DisasContext Content-Language: en-US To: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , qemu-devel@nongnu.org Cc: ale@rev.ng, babush@rev.ng, nizzo@rev.ng, tsimpson@quicinc.com, bcain@quicinc.com, mlambert@quicinc.com, richard.henderson@linaro.org, alex.bennee@linaro.org References: <20220804115548.13024-1-anjo@rev.ng> <20220804115548.13024-7-anjo@rev.ng> Organization: rev.ng In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=5.9.113.41; envelope-from=anjo@rev.ng; helo=rev.ng X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-2.319, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: anjo@rev.ng X-ACL-Warn: , Anton Johansson From: Anton Johansson via > Missing the rationale. "The idef-parser will use it with IMM_NPC". > > But I feel I'm missing something, what is the diff between > IMM_PC/IMM_NPC? > I'll try to clarify. Firstly, why do we need this patch? Hexagon intructions need access to both the current pc and the next pc, for the generated helper functions this is done through env->gpr[HEX_REG_PC] and `env->next_PC`. However for the TCG code generated by idef-parser we much prefer reading pc and npc from `DisasContext` as these are constant during translation time, we can then "constant fold" by emitting C code for operations on pc and npc instead of TCG code. Secondly, what's IMM_NPC and IMM_PC? This is internal to the parser, but refers to types of immediate values `HexImm`, an immediate with type IMM_NPC can then easily be emitted as `ctx->npc`, similarly IMM_PC gets emitted as `ctx->base.pc_next`. > And why not use target_ulong? Good idea, I'll change it to `target_ulong` -- Anton Johansson, rev.ng Labs Srl.