From patchwork Thu Apr 21 15:16:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 564382 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp565717map; Thu, 21 Apr 2022 09:02:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwa3VHDDxmMTThwIqsbS+a9+OJdaq9Gh6VY3lc9wdNqpSNAbi8nDNoUyPeWZJlY0n0We5Py X-Received: by 2002:a5b:982:0:b0:63e:7d7e:e2f2 with SMTP id c2-20020a5b0982000000b0063e7d7ee2f2mr305152ybq.549.1650556937043; Thu, 21 Apr 2022 09:02:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650556937; cv=none; d=google.com; s=arc-20160816; b=NrX3yCopfHnRQrnqb/Cfe/u8KKMe/vgPRkdOfBU1f5PmvHLXNRmFWZkifgygbUyUt/ Wsjv4MwkC3Tg+ELbPLsBbgvGYnkYDqg2M+PIpZqUqe/p5ZfiHj4KunnQcU3eZM7cQhwi QJJcPFnlZZUNzWOyTMkpTyUQJREEIwNH6eiEHLvCQ2sbIB03KK3NCb7qKW8YcXHE8gvv BQTbCq5mCw4epAnmi89/q123enWfBIquDEIZoSxkn8wAiz7L+NxTkZPPir782EswLMYW zU8SOXwLNriqp1k7FUVt4hPhXXPS65e1gr5rzIvoQFRpDz18P6UCh27qYVmf219RvxH9 7VBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=TWYIA+ZPja/ASXfObfSVoW3kDH0rTYrrqx2UWkBH5EA=; b=MxLG5o+LD5rLHVcY0IeFUZkut9Ea4cEPnDP2gpP0PLReeWdQlP7csc4IZsjm7jZWIK nsBJ+4pDNpaA37ZcRJnWYhotRclUE6fJAbOp9rxCUouQKI38JyxKahIeVAvKO1BjlJto ZYDl+7x0F7o55JV7nVElBhNjJNl51fYbwL3I7E033ZIy1rieC1wyEiLSkn/zbr0UOBTa 6TZ6FLD29hBNBrwXPMn2zoPOeCRPtlHmt6X9s1/sqHkEK1C0QbbYFvuDtmmiCL0LcLmu 2WBSP3AsmZjTWpZyyTztHaxf+ZrL3kdjHaW0KBBLuWBuUWjb1glT5mE1+4fLWgwX3yCC B4vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QutF7KyZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j126-20020a25d284000000b00644acd8f6dbsi2837522ybg.437.2022.04.21.09.02.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 09:02:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QutF7KyZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhZG4-0004xD-H7 for patch@linaro.org; Thu, 21 Apr 2022 12:02:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhYZQ-0007MG-6C for qemu-devel@nongnu.org; Thu, 21 Apr 2022 11:18:12 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:54006) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhYZM-0006I8-Nz for qemu-devel@nongnu.org; Thu, 21 Apr 2022 11:18:10 -0400 Received: by mail-pj1-x102c.google.com with SMTP id bx5so5230025pjb.3 for ; Thu, 21 Apr 2022 08:18:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TWYIA+ZPja/ASXfObfSVoW3kDH0rTYrrqx2UWkBH5EA=; b=QutF7KyZLwox158/IHVvTdcjQHvHOv78xJzevawmgCYd/EuKFL8vb27L5pndsO6kAX hP3g9XE++b1VQTcYDBzJj0TP+PHlstVqdJipOnV3/PDUWmd6QZf1B1WaDjVmkBJ4nYtT 6UWCm+/zECQFZMAaWBuCptpmyT5mq1Ikak/IeKQC6IFP5n/P7CQB1byOsHaAEqLE8nJW RM+XhGtxdhe+E4uJaTNH+ONAWtoB4JV+HgcLtLDVkB7yWUOz0dLMmqmWx76n2csN/uJo g/5XekUOyZU7vIxofAFXpozycZvP5E8E3FvCSBVekW1n2smTVEoGcQwwrbi8tFUBSeeb mDsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TWYIA+ZPja/ASXfObfSVoW3kDH0rTYrrqx2UWkBH5EA=; b=qoDqpyIW9WZ7xZTfiwLbSgVA+NHqdMY6T9FbRrFKeir7bdoGSTPIAPWEpLb/fNcun3 2QfQU8EXeoZkip0D73TNBoCHZ9THduKDAkDabHTbToV/gARgKsGMakFLbefJzwKcIU0q 4xmyhkqgHyZpH9781lo5cyBXnks+P8aHt1DLjdNMbGzzFvoLMRWVAAIg6Zxw5RsYOHUe FoBluVbZcxzfmqf7hN3dygvstRzq9TmsX5WhkrCy9qrm7PipITNuLJR3No5IPkN3wvXD GvGkp+Qx2nIkqFUp+L0Ts6dBHNfNkNyVB6zFQP8wea2xyOHbOGu+OdbOl0kghCpYXBYl SUsQ== X-Gm-Message-State: AOAM533Sti/EO6eIh5tIi1o9PpXmJ2qzOv/OG4RIjJls+u+JrqV7rznO wTFxBGgNPtSyNx5nwY6uPp9rK9JTHRZTzw== X-Received: by 2002:a17:902:d2c5:b0:158:f839:4d8a with SMTP id n5-20020a170902d2c500b00158f8394d8amr40761plc.108.1650554287444; Thu, 21 Apr 2022 08:18:07 -0700 (PDT) Received: from stoup.. ([2607:fb90:80c8:6cf3:a91a:4957:ba18:ac18]) by smtp.gmail.com with ESMTPSA id z16-20020a056a00241000b004f3a647ae89sm24616248pfh.174.2022.04.21.08.18.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 08:18:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v7 19/64] target/nios2: Do not create TCGv for control registers Date: Thu, 21 Apr 2022 08:16:50 -0700 Message-Id: <20220421151735.31996-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220421151735.31996-1-richard.henderson@linaro.org> References: <20220421151735.31996-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We don't need to reference them often, and when we do it is just as easy to load/store from cpu_env directly. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/translate.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/target/nios2/translate.c b/target/nios2/translate.c index 3694f2503b..6c739bfa5e 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -103,7 +103,7 @@ typedef struct DisasContext { int mem_idx; } DisasContext; -static TCGv cpu_R[NUM_CORE_REGS]; +static TCGv cpu_R[NUM_GP_REGS]; static TCGv cpu_pc; typedef struct Nios2Instruction { @@ -394,7 +394,11 @@ static void eret(DisasContext *dc, uint32_t code, uint32_t flags) #ifdef CONFIG_USER_ONLY g_assert_not_reached(); #else - gen_helper_eret(cpu_env, cpu_R[CR_ESTATUS], cpu_R[R_EA]); + TCGv tmp = tcg_temp_new(); + tcg_gen_ld_tl(tmp, cpu_env, offsetof(CPUNios2State, regs[CR_ESTATUS])); + gen_helper_eret(cpu_env, tmp, cpu_R[R_EA]); + tcg_temp_free(tmp); + dc->base.is_jmp = DISAS_NORETURN; #endif } @@ -420,7 +424,11 @@ static void bret(DisasContext *dc, uint32_t code, uint32_t flags) #ifdef CONFIG_USER_ONLY g_assert_not_reached(); #else - gen_helper_eret(cpu_env, cpu_R[CR_BSTATUS], cpu_R[R_BA]); + TCGv tmp = tcg_temp_new(); + tcg_gen_ld_tl(tmp, cpu_env, offsetof(CPUNios2State, regs[CR_BSTATUS])); + gen_helper_eret(cpu_env, tmp, cpu_R[R_BA]); + tcg_temp_free(tmp); + dc->base.is_jmp = DISAS_NORETURN; #endif } @@ -463,6 +471,7 @@ static void callr(DisasContext *dc, uint32_t code, uint32_t flags) static void rdctl(DisasContext *dc, uint32_t code, uint32_t flags) { R_TYPE(instr, code); + TCGv t1, t2; if (!gen_check_supervisor(dc)) { return; @@ -482,10 +491,19 @@ static void rdctl(DisasContext *dc, uint32_t code, uint32_t flags) * must perform the AND here, and anywhere else we need the * guest value of ipending. */ - tcg_gen_and_tl(cpu_R[instr.c], cpu_R[CR_IPENDING], cpu_R[CR_IENABLE]); + t1 = tcg_temp_new(); + t2 = tcg_temp_new(); + tcg_gen_ld_tl(t1, cpu_env, + offsetof(CPUNios2State, regs[CR_IPENDING])); + tcg_gen_ld_tl(t2, cpu_env, + offsetof(CPUNios2State, regs[CR_IENABLE])); + tcg_gen_and_tl(cpu_R[instr.c], t1, t2); + tcg_temp_free(t1); + tcg_temp_free(t2); break; default: - tcg_gen_mov_tl(cpu_R[instr.c], cpu_R[instr.imm5 + CR_BASE]); + tcg_gen_ld_tl(cpu_R[instr.c], cpu_env, + offsetof(CPUNios2State, regs[instr.imm5 + CR_BASE])); break; } } @@ -522,7 +540,8 @@ static void wrctl(DisasContext *dc, uint32_t code, uint32_t flags) dc->base.is_jmp = DISAS_UPDATE; /* fall through */ default: - tcg_gen_mov_tl(cpu_R[instr.imm5 + CR_BASE], v); + tcg_gen_st_tl(v, cpu_env, + offsetof(CPUNios2State, regs[instr.imm5 + CR_BASE])); break; } #endif @@ -910,7 +929,7 @@ void nios2_tcg_init(void) { int i; - for (i = 0; i < NUM_CORE_REGS; i++) { + for (i = 0; i < NUM_GP_REGS; i++) { cpu_R[i] = tcg_global_mem_new(cpu_env, offsetof(CPUNios2State, regs[i]), regnames[i]);