From patchwork Tue Jun 29 18:54:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468335 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5252922jao; Tue, 29 Jun 2021 12:29:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEtlN8V1201ye08rjoN55oi4QDWoywDWqklXAzXdWoleZUTX23EqmNO+rkwrRuDCoD9duq X-Received: by 2002:a25:ea53:: with SMTP id o19mr40886481ybe.2.1624994966031; Tue, 29 Jun 2021 12:29:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624994966; cv=none; d=google.com; s=arc-20160816; b=IqNPiWJL74T4Q3Wt6rea5sSyJk89TrCktyRmSR2MADCVLEAueONRLWw0QTpofw6o9z 1EgbPkJZ6dAgAS07VSzGkx+k8r+5LpaXaqrL3IIbeAwTnVxBdlYUr0EzKhVDW/L9B4Gx z69l98YtdYnZcUkM8Kh7nZVuetpFr5nlFoDXXSxMwFFGmEsm5TGmKiU3Ho3ZX2MbFJcW hrz1Egkbfpq1Y89GjKC9TaY4QA4Z6f9P6nJIiXdz6Vxa/5EH6YLMq0cM6iFeJwWtvn/8 48baqm1GBpcBymBH/C3llDTtQ9Qrn58Fz9NWDl+aTBQtEWDU3f1HNl54gsyofcDLpkDw zTkQ== 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=B/3UYnAw/Iw5+lYVvwYrCl8yQAl4h8zPvaGurMEMOTY=; b=d9Yggy+D/i2ECrD3pP68MpiJqs2NNXqBhEtRNY5CUgZKTQZYbLe/9PrIceuR6MdgNy qdNTKQgx9EcQwHcqbFvcP/JYiTdkys/6HoEg2B2FGXowPHcPQimPCdYP7/FTeFsoR/l/ p871w2wXJDzDnIoj/5VVWc/wN6wgS63JXCyj1YPtyzhp0iJQHmpCWJVEyNNajuKJLj5d SJmMBzAqWaA/obwbeP6VimArNzBHtN02BOHKdwr03CE4b+pvaQU4whUpM6na0CgIvc7b 4kgyjm1nhwsTFahLNtlbErXimpJmmwxaPsmHgMNekBJgeesl2NbsyEc5eN3Tl38l+YzW fhNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RsKPgkt8; 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 a3si16859721ybn.493.2021.06.29.12.29.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:29:26 -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=RsKPgkt8; 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]:49982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJQD-0000az-Gw for patch@linaro.org; Tue, 29 Jun 2021 15:29:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38432) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItB-00081O-1L for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:17 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:44895) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIsw-0000s4-Uy for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:16 -0400 Received: by mail-pj1-x102b.google.com with SMTP id p4-20020a17090a9304b029016f3020d867so3079694pjo.3 for ; Tue, 29 Jun 2021 11:55:01 -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=B/3UYnAw/Iw5+lYVvwYrCl8yQAl4h8zPvaGurMEMOTY=; b=RsKPgkt8YNh2p9EUfdlzEM0Vx/9va1HVXT+wqNjovQO6F72giuv8HRhPKpbuag8/+3 jeG9s8E2Tp9+mAnw+Hcyt3r9HRkcgHqXZQKE02en8MPdawwKGqyXWurjVWBxD6AH+lng gomB3h9wKCoiY5jCnHmDLBOITNM0GgYhgJtwNW3L3iadSjiLEt8ZWYauhh7w2/f/4Tuv mMDfuPSICIhmKq79xmhCBH7aFrnqPWkU9G6hAyD54g1K3+PW4mlgLx6+dEi59NpiPqte nkOTqqHD9VlGd5EeKuydQRvt+ZVM9ZcZqaV4MYZyET5tvhmzF1omFbkl5qCLcRQS9OCS G1Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=B/3UYnAw/Iw5+lYVvwYrCl8yQAl4h8zPvaGurMEMOTY=; b=TGmoze4zLJ6pQDMn9Q13e630E+c9A0ZxTmV+2nsi2l4w0A1DsFXe1BhxwKCOGDDOeq /M8CIO/8s4cicBxF15rHQOX0NiDvzz3yJmWQPUBabr3nsuzPDLeswzGA4p2cl3y4FTdG h5z/JM2NV6TSfZ+MM/e/qZjvUBYLzc7YgDT1lQQ45IKIkzP76joZ8/1gSkyiaqdTWuCg SW0ecUOueJS2dS/T/rNTx2KKoSzJpQx9ie/lMDBdT2L2ogHXjcTJOYo3DGA+DSLrDjSd RggJFJeYf1HE8YXvS0UtkEIsRAAWu6IvHOPbsEONHSQTys7LYDd2ZY+kEWZizuYW3YF6 Odog== X-Gm-Message-State: AOAM533e7D6hkF3B7TXWpNApcb1LZ1ksBIErh2Xh6qW/xertskRptOs+ 4Rugo+kAmX2OalMLEkTWLs0TbSOmwhgm3A== X-Received: by 2002:a17:90a:6548:: with SMTP id f8mr36310253pjs.106.1624992900729; Tue, 29 Jun 2021 11:55:00 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 08/63] target/nios2: Inline handle_instruction Date: Tue, 29 Jun 2021 11:54:00 -0700 Message-Id: <20210629185455.3131172-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.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=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" Move handle_instruction into nios2_tr_translate_insn as the only caller. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/translate.c | 66 +++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 35 deletions(-) -- 2.25.1 diff --git a/target/nios2/translate.c b/target/nios2/translate.c index 9e71267b42..abc7e5f96a 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -735,38 +735,6 @@ illegal_op: t_gen_helper_raise_exception(dc, EXCP_ILLEGAL); } -static void handle_instruction(DisasContext *dc, CPUNios2State *env) -{ - uint32_t code; - uint8_t op; - const Nios2Instruction *instr; - -#if defined(CONFIG_USER_ONLY) - /* FIXME: Is this needed ? */ - if (dc->pc >= 0x1000 && dc->pc < 0x2000) { - t_gen_helper_raise_exception(dc, 0xaa); - return; - } -#endif - - code = cpu_ldl_code(env, dc->pc); - op = get_opcode(code); - - if (unlikely(op >= ARRAY_SIZE(i_type_instructions))) { - t_gen_helper_raise_exception(dc, EXCP_ILLEGAL); - return; - } - - dc->zero = NULL; - - instr = &i_type_instructions[op]; - instr->handler(dc, code, instr->flags); - - if (dc->zero) { - tcg_temp_free(dc->zero); - } -} - static const char * const regnames[] = { "zero", "at", "r2", "r3", "r4", "r5", "r6", "r7", @@ -842,12 +810,40 @@ static void nios2_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) { DisasContext *dc = container_of(dcbase, DisasContext, base); CPUNios2State *env = cs->env_ptr; + const Nios2Instruction *instr; + uint32_t code, pc; + uint8_t op; - dc->pc = dc->base.pc_next; - dc->base.pc_next += 4; + pc = dc->base.pc_next; + dc->pc = pc; + dc->base.pc_next = pc + 4; /* Decode an instruction */ - handle_instruction(dc, env); + +#if defined(CONFIG_USER_ONLY) + /* FIXME: Is this needed ? */ + if (pc >= 0x1000 && pc < 0x2000) { + t_gen_helper_raise_exception(dc, 0xaa); + return; + } +#endif + + code = cpu_ldl_code(env, pc); + op = get_opcode(code); + + if (unlikely(op >= ARRAY_SIZE(i_type_instructions))) { + t_gen_helper_raise_exception(dc, EXCP_ILLEGAL); + 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)