From patchwork Thu Apr 21 15:17:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 564400 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp589173map; Thu, 21 Apr 2022 09:29:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwp5nI7hK3gR+eQdDcZePOmNZiOoTOKM9MrXrWjfPjgPCMbb1bd7ciIhUc/2LNDKDtwwS+R X-Received: by 2002:a0d:e981:0:b0:2ec:9bf:fb71 with SMTP id s123-20020a0de981000000b002ec09bffb71mr462993ywe.409.1650558545149; Thu, 21 Apr 2022 09:29:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650558545; cv=none; d=google.com; s=arc-20160816; b=bgDK0ggDMxPKTT6ldZeN0BFPGsSaBQVuC4XhAFMU2gbL6YDtJkiqxqTknDqrRKt2+4 DjNFEVaZtFoe4lAnHxiRbkBWn+xc21EwNn1liLvKy85xpSUgUT1zGuT29zmOa+z2DMG4 PaVJCtF5CZk69BzdXdPCjTHeNjlFmFjaRJN6C/IJhseVOG2ZUvpEDO38LmyGjOptR2cM HY32s4HkCEGbQMaQmfH+M4ASr/b88VnSxjyx5wZwNtWf5MCK5r/Ur+3qfTLTmojU9P9a zIAw2wcjQHkRIm2Pi8TROxzdwUMDSxIbN4IzaMQ2FgBMomz8bF+Sf2EJqfugz23WPKLN IZtQ== 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=9FhYqgUBmxsHbCT6l/0igDDpPwMQ5ePyATfk3NegcvI=; b=X75fEbiPnZDSuymkzb+F3Gy62wWAC7/LEWb1vDFLJf8Nxxmx1amJykGin9WDtsWlR1 DXx0lZz0AOLIGrdQYYE1AEunPxh/QiwDNwXejhLYA+JZwnIr17kZktCNo4Vv/USJNYfu +qQaJ9XZ73aGDDmhKR+ymywTa7cmb9hxaRYzHzbnRdoFImmWLEKPli+4JCJUbmcMnOZF 8VvufB0ZOk2lXiifv79mpafg9K9iOXPym877mASNagoMgeUdm63MOvZcyFH5ax4DRCLi bWvqo5EmU7Iv247stG+aEQoaUwOuqFg1vB+HA+okeUr/ahIwT2vtpThweaOKd5ATqkOf qPcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JU8umLF8; 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 j8-20020a25d208000000b006415a628131si2899635ybg.146.2022.04.21.09.29.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 09:29:05 -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=JU8umLF8; 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]:52684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhZg0-0005Yj-Kn for patch@linaro.org; Thu, 21 Apr 2022 12:29:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44764) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhYcu-0005Ge-8P for qemu-devel@nongnu.org; Thu, 21 Apr 2022 11:21:48 -0400 Received: from mail-io1-xd2a.google.com ([2607:f8b0:4864:20::d2a]:46880) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhYcr-00075C-2U for qemu-devel@nongnu.org; Thu, 21 Apr 2022 11:21:47 -0400 Received: by mail-io1-xd2a.google.com with SMTP id g21so5609535iom.13 for ; Thu, 21 Apr 2022 08:21:44 -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=9FhYqgUBmxsHbCT6l/0igDDpPwMQ5ePyATfk3NegcvI=; b=JU8umLF8coRVc6poxFZswPbXj4dHMO87pIBOmoncfjeisvOSu7p/aPgDY5QhXHzYHn jqk3YI+rLB77Y1Co5m4FZIYHWjSxQZo7XyG3r+Xf5VafrabaZBDzlsMe9NUWIs2FYdyI OXaBuW08Ay3/wVmBEKcOU9N489vYP0IqNi6o7qhH6c2wpnFugDWMdNO83tJANvBYA+8h t8/ywI/5z3gsEbIcnXkDsH16uugYUIuzkwVe5R05OT+YKujc66Qiq1kvUi/p21C8ALTE TBpz3GRC/bTzxF3HnRTe3+BSNi0iolHl1re72LvjHh2IPIGuAv747U6aXabny9KV+SAw 099Q== 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=9FhYqgUBmxsHbCT6l/0igDDpPwMQ5ePyATfk3NegcvI=; b=vaWN7OKhBUT1E+xKM0FOkFbGqz4A1uIhYI/cSbK4lzs2NAX6yJdsRj8wUYGFHWvQxW w47lJF8WcwGrzzLw1K/h8BTi9BXw8/Og48vRqet8XWw5ao5OncSfkf7XdaIT6wPMoHcn qNYr0Lte4BENM5QQrSHcfAnCCcXjWyTj1PCXj1bOH1YTHsaPMVfTQOfD9zXInqdJC+za LBcVpKM3DN60yxvBtKdKvkrrF5e1+I5+L0OVYRXwdQM/D65ZFjgCowKYhLewrqyLF11I +dRZSfYYm+3SpQ4wNIK6eXQNy8YC2HBhY22/d6YnmuW/P8xb3JAQZBzRZo5oRcGUdmYG BQqw== X-Gm-Message-State: AOAM533l5YPf/I4ORlfRQlkrJm7DG7o9buMwMBYU/YSwc4FzKA+N6S4O PANrV0kd5JPipKFV7fHwAcx2c+iKmcXP7A== X-Received: by 2002:a05:6638:b3b:b0:328:738a:3996 with SMTP id c27-20020a0566380b3b00b00328738a3996mr73549jab.86.1650554504085; Thu, 21 Apr 2022 08:21:44 -0700 (PDT) Received: from stoup.. ([2607:fb90:80c8:6cf3:a91a:4957:ba18:ac18]) by smtp.gmail.com with ESMTPSA id j1-20020a926e01000000b002cc52449a19sm3985402ilc.35.2022.04.21.08.21.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 08:21:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v7 42/64] target/nios2: Use tcg_constant_tl Date: Thu, 21 Apr 2022 08:17:13 -0700 Message-Id: <20220421151735.31996-43-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::d2a; envelope-from=richard.henderson@linaro.org; helo=mail-io1-xd2a.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" Replace current uses of tcg_const_tl, and remove the frees. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/translate.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/target/nios2/translate.c b/target/nios2/translate.c index b27269bf08..f33015f942 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -99,7 +99,6 @@ typedef struct DisasContext { DisasContextBase base; - TCGv_i32 zero; target_ulong pc; int mem_idx; const ControlRegState *cr_state; @@ -125,31 +124,20 @@ static uint8_t get_opxcode(uint32_t code) return instr.opx; } -static TCGv load_zero(DisasContext *dc) +static TCGv load_gpr(DisasContext *dc, unsigned reg) { - if (!dc->zero) { - dc->zero = tcg_const_i32(0); - } - return dc->zero; -} - -static TCGv load_gpr(DisasContext *dc, uint8_t reg) -{ - if (likely(reg != R_ZERO)) { - return cpu_R[reg]; - } else { - return load_zero(dc); + assert(reg < NUM_GP_REGS); + if (unlikely(reg == R_ZERO)) { + return tcg_constant_tl(0); } + return cpu_R[reg]; } static void t_gen_helper_raise_exception(DisasContext *dc, uint32_t index) { - TCGv_i32 tmp = tcg_const_i32(index); - tcg_gen_movi_tl(cpu_pc, dc->pc); - gen_helper_raise_exception(cpu_env, tmp); - tcg_temp_free_i32(tmp); + gen_helper_raise_exception(cpu_env, tcg_constant_i32(index)); dc->base.is_jmp = DISAS_NORETURN; } @@ -876,14 +864,8 @@ static void nios2_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) return; } - dc->zero = NULL; - instr = &i_type_instructions[op]; instr->handler(dc, code, instr->flags); - - if (dc->zero) { - tcg_temp_free(dc->zero); - } } static void nios2_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)