From patchwork Mon Feb 27 05:24:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 656772 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp2178724wrb; Sun, 26 Feb 2023 21:29:34 -0800 (PST) X-Google-Smtp-Source: AK7set+rvHb9K1IiG1mT9N90SJpoCdrwWUz5HL7N3CxjCJAor8dIOLXRpw+oQV8AshGMuVSQHQ2z X-Received: by 2002:a05:6214:768:b0:56e:f4e0:a4ec with SMTP id f8-20020a056214076800b0056ef4e0a4ecmr37473418qvz.46.1677475774534; Sun, 26 Feb 2023 21:29:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677475774; cv=none; d=google.com; s=arc-20160816; b=xM9VtgVuPyk48DcUt1Jqn1y5Zzp52m2IlX3a6VtcBrxXiarxxgxghKPh3AeyLCj96v ZATw04jGxM/dn0wWsfsebNs0950duVPeVyzp9Ly2BySZBNrlQTZsY9hj1OFhjuys3eDj agIp+6aNumEvfTbvg0tC9GoBMdnVmw0o9MJcQHK85B8EtWB1MsxLJ/Hxhth133NlXhQx l222Jj8NUfCR0PP49Ss4X0gum3PyHEkY2YAM6Gmvqjup61WirwNVhcaeXa42DsngOmnW e+5rBFMXPbslrq/cxJ9OH41wdAXN+kZyjzFOI1KAEYJKUa/T/anAF+ZNa6n4nfbEPvPc zPGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=gqHQnIXQuU7WvdYNKGsRU9JQ3hqtUaL0pq9Pxj9E05Q=; b=PUOJ3Q4aqdxaKHutQT0Ur7XQZ0oJQQcQXclogod08baZK45/TWoHUH80ckYzycd+mD XpZ12orRLCDXP2GkzHVwEeYZ9tk+ggdyG0Qod3ALG+/X1sEFiwrj8c/lXh9Z9wU6tG0W NvK6pQO05SyV4eXmPZB1mhNrp+uXqBJDr86OPfTR1vlJysfW42O+PoWm/f4TF8mm5Fk1 m+XqoEjKAIUdzdFhrUrO7XTECCKFJ6tY298abjZu19nY/MXKH4uXxaTam8cnr9g4KcK6 KF0yrFMAyOs8e3FDqOpKaqyAaZDARp90OZuwLhQKQmHK1KtXEjiBIpn0zF5ABZM/TyJ2 VOgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xuKMdqLy; 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 fh12-20020a0562141a0c00b00572170aff3asi6135886qvb.117.2023.02.26.21.29.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 26 Feb 2023 21:29:34 -0800 (PST) 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=xuKMdqLy; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWW2R-0000kb-T2; Mon, 27 Feb 2023 00:27:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pWW21-0008Sz-Tq for qemu-devel@nongnu.org; Mon, 27 Feb 2023 00:26:37 -0500 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pWW20-0007he-1f for qemu-devel@nongnu.org; Mon, 27 Feb 2023 00:26:37 -0500 Received: by mail-pj1-x102d.google.com with SMTP id me6-20020a17090b17c600b0023816b0c7ceso913347pjb.2 for ; Sun, 26 Feb 2023 21:26:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gqHQnIXQuU7WvdYNKGsRU9JQ3hqtUaL0pq9Pxj9E05Q=; b=xuKMdqLyePGrT8T8X4T1rSMKzLfAJ8hjh2mMUUhGyFD/asKHRywZaxly+A0z+0UPht q7HhrqwACefN/KSfANTn87bNecKxkTUvFsy6nF+xQfOZnpbcIEuimU5DkgBgfqzFPdA9 eEBpm/8KGThZuHJrnFfZbyKe7hJMh/4IwwEhKOkl1dSsIadRUAT9PonjQcAgiGePrREP k4blLPIybMqAdUhwiwQ3EBg44VFOXtOb/gaRGTqxowL6VRKR8aWSFW0tICuowSWq2Gj4 +Qj/PLtONYs5i+sC4gKhfZSZbEykckOQ/b4LCrjRRGbwxivCiV98qMBxxBDepgRQpVlL iwZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gqHQnIXQuU7WvdYNKGsRU9JQ3hqtUaL0pq9Pxj9E05Q=; b=mEGhG1cwfh/AloAANeQ8ZFioG6sBjfF/n508hTEzEpQ6Me/9SAitz4UAnSaZ9ALkvQ iPj6XJ9INMyyUJ1mB/mGfkS0eelVY8W4wYf8QoQ3y4c3eH5njIyI5a54gKzJv0QgPuaI euyqSA/SpZqm9EfOBFJI2B98n1SUsydG3U9/e9+5Ac+dBH1reqfSsZM6gUKv2jiY/SVc CK50UyWks2DqiP7q6im4ug+jXAGvbj4RW7ssFpKZAZxXqUcogeKUcHiUTHr59zwx6xxk QLvMfNMrupJKmO2ImcAFId8s/x/FXLG0YjPyY17SYAniXIcAPYG1TLrZf9OBGev2Jk3v 2zCg== X-Gm-Message-State: AO0yUKXRVmNy3dIrMzofLzL3+C17EXilnSfJIz9Jva4ktH+g0wB2iVTh WMhnhpI2/Nmsqq2VT4sQpJq0fja0CTFqzgtgafg= X-Received: by 2002:a17:903:80c:b0:19c:dbce:dceb with SMTP id kr12-20020a170903080c00b0019cdbcedcebmr8450701plb.44.1677475595233; Sun, 26 Feb 2023 21:26:35 -0800 (PST) Received: from stoup.. (rrcs-173-198-77-218.west.biz.rr.com. [173.198.77.218]) by smtp.gmail.com with ESMTPSA id a14-20020a170902ecce00b0019a837be977sm3513341plh.271.2023.02.26.21.26.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 21:26:34 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com, kbastian@mail.uni-paderborn.de, ysato@users.sourceforge.jp, gaosong@loongson.cn, jiaxun.yang@flygoat.com, tsimpson@quicinc.com, ale@rev.ng, mrolnik@gmail.com, edgar.iglesias@gmail.com Subject: [PATCH v2 31/76] target/loongarch: Drop temp_new Date: Sun, 26 Feb 2023 19:24:20 -1000 Message-Id: <20230227052505.352889-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230227052505.352889-1-richard.henderson@linaro.org> References: <20230227052505.352889-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Translators are no longer required to free tcg temporaries, therefore there's no need to record temps for later freeing. Replace the few uses with tcg_temp_new. Reviewed-by: Song Gao Signed-off-by: Richard Henderson --- target/loongarch/translate.h | 3 --- target/loongarch/translate.c | 21 +++---------------- .../insn_trans/trans_privileged.c.inc | 2 +- 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/target/loongarch/translate.h b/target/loongarch/translate.h index 6d2e382e8b..67bc74c05b 100644 --- a/target/loongarch/translate.h +++ b/target/loongarch/translate.h @@ -32,9 +32,6 @@ typedef struct DisasContext { uint16_t mem_idx; uint16_t plv; TCGv zero; - /* Space for 3 operands plus 1 extra for address computation. */ - TCGv temp[4]; - uint8_t ntemp; } DisasContext; void generate_exception(DisasContext *ctx, int excp); diff --git a/target/loongarch/translate.c b/target/loongarch/translate.c index 2a43ab0201..f443b5822f 100644 --- a/target/loongarch/translate.c +++ b/target/loongarch/translate.c @@ -85,9 +85,6 @@ static void loongarch_tr_init_disas_context(DisasContextBase *dcbase, bound = -(ctx->base.pc_first | TARGET_PAGE_MASK) / 4; ctx->base.max_insns = MIN(ctx->base.max_insns, bound); - ctx->ntemp = 0; - memset(ctx->temp, 0, sizeof(ctx->temp)); - ctx->zero = tcg_constant_tl(0); } @@ -110,12 +107,6 @@ static void loongarch_tr_insn_start(DisasContextBase *dcbase, CPUState *cs) * * Further, we may provide an extension for word operations. */ -static TCGv temp_new(DisasContext *ctx) -{ - assert(ctx->ntemp < ARRAY_SIZE(ctx->temp)); - return ctx->temp[ctx->ntemp++] = tcg_temp_new(); -} - static TCGv gpr_src(DisasContext *ctx, int reg_num, DisasExtend src_ext) { TCGv t; @@ -128,11 +119,11 @@ static TCGv gpr_src(DisasContext *ctx, int reg_num, DisasExtend src_ext) case EXT_NONE: return cpu_gpr[reg_num]; case EXT_SIGN: - t = temp_new(ctx); + t = tcg_temp_new(); tcg_gen_ext32s_tl(t, cpu_gpr[reg_num]); return t; case EXT_ZERO: - t = temp_new(ctx); + t = tcg_temp_new(); tcg_gen_ext32u_tl(t, cpu_gpr[reg_num]); return t; } @@ -142,7 +133,7 @@ static TCGv gpr_src(DisasContext *ctx, int reg_num, DisasExtend src_ext) static TCGv gpr_dst(DisasContext *ctx, int reg_num, DisasExtend dst_ext) { if (reg_num == 0 || dst_ext) { - return temp_new(ctx); + return tcg_temp_new(); } return cpu_gpr[reg_num]; } @@ -195,12 +186,6 @@ static void loongarch_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) generate_exception(ctx, EXCCODE_INE); } - for (int i = ctx->ntemp - 1; i >= 0; --i) { - tcg_temp_free(ctx->temp[i]); - ctx->temp[i] = NULL; - } - ctx->ntemp = 0; - ctx->base.pc_next += 4; } diff --git a/target/loongarch/insn_trans/trans_privileged.c.inc b/target/loongarch/insn_trans/trans_privileged.c.inc index 40f82becb0..56f4c45e09 100644 --- a/target/loongarch/insn_trans/trans_privileged.c.inc +++ b/target/loongarch/insn_trans/trans_privileged.c.inc @@ -243,7 +243,7 @@ static bool trans_csrwr(DisasContext *ctx, arg_csrwr *a) dest = gpr_dst(ctx, a->rd, EXT_NONE); csr->writefn(dest, cpu_env, src1); } else { - dest = temp_new(ctx); + dest = tcg_temp_new(); tcg_gen_ld_tl(dest, cpu_env, csr->offset); tcg_gen_st_tl(src1, cpu_env, csr->offset); }