From patchwork Wed May 9 17:54:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 135333 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp56484lji; Wed, 9 May 2018 11:04:05 -0700 (PDT) X-Google-Smtp-Source: AB8JxZplLuP9aHeXPEwvfEIBmRV1LmiaHL/onpxyDD+gzw0ZiIknbXK1AX18qPLZa7tZpTtVOOhp X-Received: by 10.55.33.160 with SMTP id f32mr39970241qki.153.1525889045746; Wed, 09 May 2018 11:04:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525889045; cv=none; d=google.com; s=arc-20160816; b=sRqxrh6NcBRbPUOcROEaRGIL9OYaKhffjE9ACbN8MsNGfMxLkUs4+8kgeOPR1VGpg4 xT9btsgR3YRZJZgsXSoPAlFdDK+7gVATssQCDb2+U5mqYjUWgTfJdPO3ZMmwUN3KcKO2 2kEy7qBY3sNDYmfoeC9B8zcq5J/d3Ng6QQlRsBl1XiXLyqE5ta4xOFD41cTHmFEfXr7l uCoqxvkYnpbjfFZAhQKcI8xjAFG8z0t8zPdoXSU3MS3Zuvo6Yxq+EsZhrzv/sb2eMyoS NctYZZ0Vflky+vidl23aYJt5qmVKWS/+VhUzoeDfks05C9MxTeFLVOUbm4802laHiga6 nqEw== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=bmNH3/Xt87KSPREfiGWU2svReCznKpFcDCnBU4R99pQ=; b=sdQlO345HCQA3y3JrW703NKDQpNVlHAaRsU3oEU3ggw9JTecIyR8zbUtGoZQUhCvOt 3N1pJQZGgS8YUfjtMFto/uFFrM5d2o7Ru8GpFuRJcOobWkwC1iA1M/iatxz7wIWTMMXL 9ZtKFEd8otQ1NhVGnH7mqAIeQAfomJ6t7cOBKPSKFWD7yjoithj6nTwKoMJMoKfq3Mcs zL8tO/JXfpQcK5fFFYYzQRAChso4n4uOs6j6UZ2fAHOTvUhv6ep5iDOHDdNiPsj6SvTa f6J6zJ6HPNbYqpZqzg1kfZQcm3LuaACjbgzy0uCVgqsNOgl1O+tpttKuOIAEV5jjCnKk Esfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=I9DmCdQU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id a102si12496206qka.110.2018.05.09.11.04.05 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 09 May 2018 11:04:05 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=I9DmCdQU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58154 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGTRd-0005h1-6M for patch@linaro.org; Wed, 09 May 2018 14:04:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48357) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGTJK-00058L-8h for qemu-devel@nongnu.org; Wed, 09 May 2018 13:55:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGTJF-0005js-P4 for qemu-devel@nongnu.org; Wed, 09 May 2018 13:55:30 -0400 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:33534) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGTJE-0005h7-VM for qemu-devel@nongnu.org; Wed, 09 May 2018 13:55:25 -0400 Received: by mail-pf0-x243.google.com with SMTP id f20so17212350pfn.0 for ; Wed, 09 May 2018 10:55:24 -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; bh=bmNH3/Xt87KSPREfiGWU2svReCznKpFcDCnBU4R99pQ=; b=I9DmCdQUbgG/tqDD28ySxVD0mM91yUW+3c2dLKyfF/8gO1jVVUOFEs0kFsbuqIsbOd X2rDIdxVKjZ/Obco9xh0MvSqLJYkU70Nfb8oMrWY0V2o7aPToIT7uMdgM9FTxmFHToIN EwgWFDt4stvmpg6pr90BnjhK3mVfvB8/dSTfs= 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; bh=bmNH3/Xt87KSPREfiGWU2svReCznKpFcDCnBU4R99pQ=; b=F983uXhhQ74FdM9MfmRfR2Pf8SO65gibd5a3vSmhH4xSbg0Ftef7rv6FFqYA6pu9D8 xW5WmE+ThGA8AhctKHOFv1QhqngFc64Eiql4hV4AaV0Iv0urOHOJiWeSkxvN1lqj76Ih L7I4DOXoquXgntYJns3fxDDWpRR/1Q+/Ux2YxAklkKDOyw7F7p+A4N5J63rGVy7stvad nBjHyzHlJzy9OfZEL4/tjPTXO1BOB8vBUTYcW06vxZ/2wmewkgadk9Rub6b5K9+U0N9V EWPVEQh5ruwlBH8fVlbGKln1l4dNeOMPkwEHTznIIHVNpxb/TyvnHiCCW+xXs1X62JTz tWGg== X-Gm-Message-State: ALQs6tBeR9YdUws6+jqkawd6kda4sVqWufxG3r6TputgkOzPgZ0MnkQ4 DCQGVX7aVSGUBcjaY1/SqEITzqvBaRo= X-Received: by 2002:a63:66c3:: with SMTP id a186-v6mr25525339pgc.408.1525888523523; Wed, 09 May 2018 10:55:23 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-2-170.tukw.qwest.net. [97.113.2.170]) by smtp.gmail.com with ESMTPSA id l90sm60332813pfb.149.2018.05.09.10.55.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 09 May 2018 10:55:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 10:54:43 -0700 Message-Id: <20180509175458.15642-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180509175458.15642-1-richard.henderson@linaro.org> References: <20180509175458.15642-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::243 Subject: [Qemu-devel] [PULL 13/28] target/sparc: convert to DisasJumpType X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Sagar Karandikar , David Hildenbrand , Palmer Dabbelt , Mark Cave-Ayland , Max Filippov , Michael Clark , "Edgar E. Iglesias" , Guan Xuetao , Yongbok Kim , Alexander Graf , "Emilio G. Cota" , Richard Henderson , Artyom Tarasenko , Eduardo Habkost , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, Stafford Horne , David Gibson , Peter Crosthwaite , Bastian Koppelmann , Cornelia Huck , Michael Walle , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Cc: Mark Cave-Ayland Cc: Artyom Tarasenko Signed-off-by: Emilio G. Cota Signed-off-by: Richard Henderson --- target/sparc/translate.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) -- 2.17.0 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 5aa367a182..03c6510717 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -30,6 +30,7 @@ #include "exec/helper-gen.h" #include "trace-tcg.h" +#include "exec/translator.h" #include "exec/log.h" #include "asi.h" @@ -69,7 +70,7 @@ typedef struct DisasContext { target_ulong pc; /* current Program Counter: integer or DYNAMIC_PC */ target_ulong npc; /* next PC: integer or DYNAMIC_PC or JUMP_PC */ target_ulong jump_pc[2]; /* used when JUMP_PC pc value is used */ - int is_br; + DisasJumpType is_jmp; int mem_idx; bool fpu_enabled; bool address_mask_32bit; @@ -995,7 +996,7 @@ static void gen_branch_a(DisasContext *dc, target_ulong pc1) gen_set_label(l1); gen_goto_tb(dc, 1, npc + 4, npc + 8); - dc->is_br = 1; + dc->is_jmp = DISAS_NORETURN; } static void gen_branch_n(DisasContext *dc, target_ulong pc1) @@ -1078,7 +1079,7 @@ static void gen_exception(DisasContext *dc, int which) t = tcg_const_i32(which); gen_helper_raise_exception(cpu_env, t); tcg_temp_free_i32(t); - dc->is_br = 1; + dc->is_jmp = DISAS_NORETURN; } static void gen_check_align(TCGv addr, int mask) @@ -3351,7 +3352,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) if (cond == 8) { /* An unconditional trap ends the TB. */ - dc->is_br = 1; + dc->is_jmp = DISAS_NORETURN; goto jmp_insn; } else { /* A conditional trap falls through to the next insn. */ @@ -4331,7 +4332,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) save_state(dc); gen_op_next_insn(); tcg_gen_exit_tb(0); - dc->is_br = 1; + dc->is_jmp = DISAS_NORETURN; break; case 0x6: /* V9 wrfprs */ tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2); @@ -4340,7 +4341,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) save_state(dc); gen_op_next_insn(); tcg_gen_exit_tb(0); - dc->is_br = 1; + dc->is_jmp = DISAS_NORETURN; break; case 0xf: /* V9 sir, nop if user */ #if !defined(CONFIG_USER_ONLY) @@ -4468,7 +4469,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) save_state(dc); gen_op_next_insn(); tcg_gen_exit_tb(0); - dc->is_br = 1; + dc->is_jmp = DISAS_NORETURN; #endif } break; @@ -4624,7 +4625,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) save_state(dc); gen_op_next_insn(); tcg_gen_exit_tb(0); - dc->is_br = 1; + dc->is_jmp = DISAS_NORETURN; break; case 1: // htstate // XXX gen_op_wrhtstate(); @@ -5690,7 +5691,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) } else if (dc->npc == JUMP_PC) { /* we can do a static jump */ gen_branch2(dc, dc->jump_pc[0], dc->jump_pc[1], cpu_cond); - dc->is_br = 1; + dc->is_jmp = DISAS_NORETURN; } else { dc->pc = dc->npc; dc->npc = dc->npc + 4; @@ -5752,6 +5753,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock * tb) pc_start = tb->pc; dc->pc = pc_start; last_pc = dc->pc; + dc->is_jmp = DISAS_NEXT; dc->npc = (target_ulong) tb->cs_base; dc->cc_op = CC_OP_DYNAMIC; dc->mem_idx = tb->flags & TB_FLAG_MMU_MASK; @@ -5796,7 +5798,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock * tb) } gen_helper_debug(cpu_env); tcg_gen_exit_tb(0); - dc->is_br = 1; + dc->is_jmp = DISAS_NORETURN; goto exit_gen_loop; } @@ -5808,8 +5810,9 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock * tb) disas_sparc_insn(dc, insn); - if (dc->is_br) + if (dc->is_jmp == DISAS_NORETURN) { break; + } /* if the next PC is different, we abort now */ if (dc->pc != (last_pc + 4)) break; @@ -5830,7 +5833,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock * tb) if (tb_cflags(tb) & CF_LAST_IO) { gen_io_end(); } - if (!dc->is_br) { + if (dc->is_jmp != DISAS_NORETURN) { if (dc->pc != DYNAMIC_PC && (dc->npc != DYNAMIC_PC && dc->npc != JUMP_PC)) { /* static PC and NPC: we can use direct chaining */