From patchwork Thu Sep 7 22:40:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 111975 Delivered-To: patch@linaro.org Received: by 10.140.94.239 with SMTP id g102csp722429qge; Thu, 7 Sep 2017 15:44:14 -0700 (PDT) X-Received: by 10.237.60.22 with SMTP id t22mr1340008qte.249.1504824254268; Thu, 07 Sep 2017 15:44:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504824254; cv=none; d=google.com; s=arc-20160816; b=qIhN5yHlYw+6qeED5Q+OR9V7NgMz+pU+A5L5gu3tghcplmqxWETzKtJXufdSvgWwTS o0A24rdX6OY7QWSvvyBhkeHGAiWYZjK24u4wmFp+wo5V66GJWCHETQBPOF3KP5f2y/DA oQ2e9d457D+6n/fofsf+JXeX6Y8/7dcUpVFTY8kclaptMa6ULC2VOhSVl0xYuEuKzN0X 9RIMnWk1mUdG0h2CrOq9chgeCKleA+0Fo97Bd+idJWxHPY8nPS6g9pasroKP0bye2hMg WieVOrl4Z9u6pDZ59dAUcvnjHDQRG3XGMZyvJsD5CQpMCdUfibbg9SiMq7gISr8BKPpp lVCw== 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=S2df7Us213tGoZSMo2fbN848O/tBS8d6oJFU35pfhgE=; b=FCLIi7yc8Paio4Sh/Tvdl3gSV2/ruFr681mrO3Ds8AW4OYsr/b+hmhVBPwCXiPWatq 9yOVXDZX7wtsYitDGyxFFvONaAQm7pmmfyawhjN5kBAqiO1iSoLdp35dY/U09yiUHUeN zmLX5601Yvq7CQmGqvAdhnatn887Or54g0QXJy4M0ff+ia/xYWrJdT7SYTEUUS0PReVN 1fMPzzGSW99d+wKSHT1IJy9V0syWGxiSuBLFBTWCSrWpmflZEv9nVGS+eB6MKN/iXpVM Fd/3Hnt8hvNysACpEV2cq4AHhyAJB3yE+Q+J1a50lmpjS8+avTtGiNHlmaGXyl4yXq93 GXtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=SGTs+iwD; 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 t2si475434qkd.16.2017.09.07.15.44.13 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 07 Sep 2017 15:44:14 -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=SGTs+iwD; 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]:42523 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq5Wt-0005PZ-Sy for patch@linaro.org; Thu, 07 Sep 2017 18:44:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51942) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq5Ts-0002xQ-Eo for qemu-devel@nongnu.org; Thu, 07 Sep 2017 18:41:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq5Tm-00080a-OT for qemu-devel@nongnu.org; Thu, 07 Sep 2017 18:41:04 -0400 Received: from mail-pf0-x231.google.com ([2607:f8b0:400e:c00::231]:36486) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dq5Tm-000808-GA for qemu-devel@nongnu.org; Thu, 07 Sep 2017 18:40:58 -0400 Received: by mail-pf0-x231.google.com with SMTP id e199so1621667pfh.3 for ; Thu, 07 Sep 2017 15:40:58 -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=S2df7Us213tGoZSMo2fbN848O/tBS8d6oJFU35pfhgE=; b=SGTs+iwDlmQLCEYn+/CnomKa6Hhv52TDnhUX9A2DC7nww0HcNe/RlzKxLWzW/hu6vo I868QkGnLB52iJ9zimqqOSvpp7d8a8HjxD4oVikMnq3irZyibQPLPFfTffSYjJA9UzPE 10gbG9KmhDHX1JQxUk7TZE0JMFds8nAtBLAgo= 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=S2df7Us213tGoZSMo2fbN848O/tBS8d6oJFU35pfhgE=; b=U/S6og9XqMczZD94ru72HBYD0Xu39AaOsW5zCB892O6d9V1gkd/lhvsoIH7STPoa+g o8rMiqQv+QqKsTL/vIX8ylyn7i3uELv3zU4UwpevQ31aV8GRQSoiAj/KWouAFOgxuFeY 370rCtEQkJXBso/LDSrK5SMb1KFtW2tNdWT50XOm48xZm7wrcnI3UmuVB60Pai4fu8l3 yVz/sZGeDeWvZw3qxjxGjAHpmb/Bp01DNHa32wZ2scnBtcWgT6IT+AzlZEJZCThWoo1A XoQAxioVeaWdDRjtZuAOT45+9hofMFxj6Yt/NZPivKCl17sqnbtpbsLEaO+qKHQc5W5r TjCA== X-Gm-Message-State: AHPjjUjuxkHi4oYSCLrBnFZj4xte7g/UNCM61k6znToEqwz/NZcDx48B 7Y7LrYml/9gicPH9CRZLLg== X-Google-Smtp-Source: ADKCNb6qBpk6oaMiqTghNtPZr+ktqqzkNR4kpdWOLaUKulxV/FtYfqMDeH6sHdcDDI3mKvxmAgxVXg== X-Received: by 10.98.31.217 with SMTP id l86mr970172pfj.136.1504824057037; Thu, 07 Sep 2017 15:40:57 -0700 (PDT) Received: from bigtime.twiddle.net (97-126-108-236.tukw.qwest.net. [97.126.108.236]) by smtp.gmail.com with ESMTPSA id h19sm770678pfh.142.2017.09.07.15.40.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Sep 2017 15:40:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 15:40:30 -0700 Message-Id: <20170907224051.21518-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170907224051.21518-1-richard.henderson@linaro.org> References: <20170907224051.21518-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::231 Subject: [Qemu-devel] [PULL 02/23] tcg: Rearrange ldst label tracking 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, Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Dispense with TCGBackendData, as it has never been used for more than holding a single pointer. Use a define in the cpu/tcg-target.h to signal requirement for TCGLabelQemuLdst, so that we can drop the no-op tcg-be-null.h stubs. Rename tcg-be-ldst.h to tcg-ldst.inc.c. Reviewed-by: Paolo Bonzini Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.h | 4 ++++ tcg/arm/tcg-target.h | 4 ++++ tcg/i386/tcg-target.h | 4 ++++ tcg/mips/tcg-target.h | 4 ++++ tcg/ppc/tcg-target.h | 4 ++++ tcg/s390/tcg-target.h | 4 ++++ tcg/tcg-be-null.h | 44 ----------------------------------- tcg/tcg.h | 6 +++-- tcg/tci/tcg-target.h | 4 ++++ tcg/aarch64/tcg-target.inc.c | 3 ++- tcg/arm/tcg-target.inc.c | 3 ++- tcg/i386/tcg-target.inc.c | 4 ++-- tcg/mips/tcg-target.inc.c | 4 ++-- tcg/ppc/tcg-target.inc.c | 4 ++-- tcg/s390/tcg-target.inc.c | 4 ++-- tcg/sparc/tcg-target.inc.c | 2 -- tcg/{tcg-be-ldst.h => tcg-ldst.inc.c} | 27 ++++----------------- tcg/tcg.c | 17 +++++++------- tcg/tci/tcg-target.inc.c | 2 -- 19 files changed, 57 insertions(+), 91 deletions(-) delete mode 100644 tcg/tcg-be-null.h rename tcg/{tcg-be-ldst.h => tcg-ldst.inc.c} (85%) -- 2.13.5 diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h index 719861fe3e..1bdbd7058b 100644 --- a/tcg/aarch64/tcg-target.h +++ b/tcg/aarch64/tcg-target.h @@ -122,4 +122,8 @@ static inline void flush_icache_range(uintptr_t start, uintptr_t stop) void tb_target_set_jmp_target(uintptr_t, uintptr_t, uintptr_t); +#ifdef CONFIG_SOFTMMU +#define TCG_TARGET_NEED_LDST_LABELS +#endif + #endif /* AARCH64_TCG_TARGET_H */ diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h index 7117ebf4fc..2e92cb3283 100644 --- a/tcg/arm/tcg-target.h +++ b/tcg/arm/tcg-target.h @@ -140,4 +140,8 @@ static inline void flush_icache_range(uintptr_t start, uintptr_t stop) /* not defined -- call should be eliminated at compile time */ void tb_target_set_jmp_target(uintptr_t, uintptr_t, uintptr_t); +#ifdef CONFIG_SOFTMMU +#define TCG_TARGET_NEED_LDST_LABELS +#endif + #endif diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h index 2fd28fa6a5..11ee7fadd1 100644 --- a/tcg/i386/tcg-target.h +++ b/tcg/i386/tcg-target.h @@ -186,4 +186,8 @@ static inline void tb_target_set_jmp_target(uintptr_t tc_ptr, #define TCG_TARGET_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD) +#ifdef CONFIG_SOFTMMU +#define TCG_TARGET_NEED_LDST_LABELS +#endif + #endif diff --git a/tcg/mips/tcg-target.h b/tcg/mips/tcg-target.h index 928a762bd7..a8222476f0 100644 --- a/tcg/mips/tcg-target.h +++ b/tcg/mips/tcg-target.h @@ -211,4 +211,8 @@ static inline void flush_icache_range(uintptr_t start, uintptr_t stop) void tb_target_set_jmp_target(uintptr_t, uintptr_t, uintptr_t); +#ifdef CONFIG_SOFTMMU +#define TCG_TARGET_NEED_LDST_LABELS +#endif + #endif diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h index aa44e715d8..3772cc6648 100644 --- a/tcg/ppc/tcg-target.h +++ b/tcg/ppc/tcg-target.h @@ -129,4 +129,8 @@ void tb_target_set_jmp_target(uintptr_t, uintptr_t, uintptr_t); #define TCG_TARGET_DEFAULT_MO (0) +#ifdef CONFIG_SOFTMMU +#define TCG_TARGET_NEED_LDST_LABELS +#endif + #endif diff --git a/tcg/s390/tcg-target.h b/tcg/s390/tcg-target.h index 31a9eb4ac7..52010c30cb 100644 --- a/tcg/s390/tcg-target.h +++ b/tcg/s390/tcg-target.h @@ -155,4 +155,8 @@ static inline void tb_target_set_jmp_target(uintptr_t tc_ptr, /* no need to flush icache explicitly */ } +#ifdef CONFIG_SOFTMMU +#define TCG_TARGET_NEED_LDST_LABELS +#endif + #endif diff --git a/tcg/tcg-be-null.h b/tcg/tcg-be-null.h deleted file mode 100644 index 5222fe29e2..0000000000 --- a/tcg/tcg-be-null.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * TCG Backend Data: No backend data - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -typedef struct TCGBackendData { - /* Empty */ - char dummy; -} TCGBackendData; - - -/* - * Initialize TB backend data at the beginning of the TB. - */ - -static inline void tcg_out_tb_init(TCGContext *s) -{ -} - -/* - * Generate TB finalization at the end of block - */ - -static inline bool tcg_out_tb_finalize(TCGContext *s) -{ - return true; -} diff --git a/tcg/tcg.h b/tcg/tcg.h index 46957d9bd7..b0e00e744e 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -712,8 +712,10 @@ struct TCGContext { CPUState *cpu; /* *_trans */ TCGv_env tcg_env; /* *_exec */ - /* The TCGBackendData structure is private to tcg-target.inc.c. */ - struct TCGBackendData *be; + /* These structures are private to tcg-target.inc.c. */ +#ifdef TCG_TARGET_NEED_LDST_LABELS + struct TCGLabelQemuLdst *ldst_labels; +#endif TCGTempSet free_temps[TCG_TYPE_COUNT * 2]; TCGTemp temps[TCG_MAX_TEMPS]; /* globals first, temps after */ diff --git a/tcg/tci/tcg-target.h b/tcg/tci/tcg-target.h index 26140d78cb..5d692e1f4b 100644 --- a/tcg/tci/tcg-target.h +++ b/tcg/tci/tcg-target.h @@ -206,4 +206,8 @@ static inline void tb_target_set_jmp_target(uintptr_t tc_ptr, /* no need to flush icache explicitly */ } +#ifdef CONFIG_SOFTMMU +#define TCG_TARGET_NEED_LDST_LABELS +#endif + #endif /* TCG_TARGET_H */ diff --git a/tcg/aarch64/tcg-target.inc.c b/tcg/aarch64/tcg-target.inc.c index a1e5dd2f03..c7c751bafc 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -10,7 +10,6 @@ * See the COPYING file in the top-level directory for details. */ -#include "tcg-be-ldst.h" #include "qemu/bitops.h" /* We're going to re-use TCGType in setting of the SF bit, which controls @@ -1070,6 +1069,8 @@ static void tcg_out_cltz(TCGContext *s, TCGType ext, TCGReg d, } #ifdef CONFIG_SOFTMMU +#include "tcg-ldst.inc.c" + /* helper signature: helper_ret_ld_mmu(CPUState *env, target_ulong addr, * TCGMemOpIdx oi, uintptr_t ra) */ diff --git a/tcg/arm/tcg-target.inc.c b/tcg/arm/tcg-target.inc.c index 37efcf06af..81ea900852 100644 --- a/tcg/arm/tcg-target.inc.c +++ b/tcg/arm/tcg-target.inc.c @@ -23,7 +23,6 @@ */ #include "elf.h" -#include "tcg-be-ldst.h" int arm_arch = __ARM_ARCH; @@ -1060,6 +1059,8 @@ static inline void tcg_out_mb(TCGContext *s, TCGArg a0) } #ifdef CONFIG_SOFTMMU +#include "tcg-ldst.inc.c" + /* helper signature: helper_ret_ld_mmu(CPUState *env, target_ulong addr, * int mmu_idx, uintptr_t ra) */ diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index e4b120a40c..1a1ad96906 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -22,8 +22,6 @@ * THE SOFTWARE. */ -#include "tcg-be-ldst.h" - #ifdef CONFIG_DEBUG_TCG static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { #if TCG_TARGET_REG_BITS == 64 @@ -1214,6 +1212,8 @@ static void tcg_out_nopn(TCGContext *s, int n) } #if defined(CONFIG_SOFTMMU) +#include "tcg-ldst.inc.c" + /* helper signature: helper_ret_ld_mmu(CPUState *env, target_ulong addr, * int mmu_idx, uintptr_t ra) */ diff --git a/tcg/mips/tcg-target.inc.c b/tcg/mips/tcg-target.inc.c index 04f8c839fe..750baadf37 100644 --- a/tcg/mips/tcg-target.inc.c +++ b/tcg/mips/tcg-target.inc.c @@ -24,8 +24,6 @@ * THE SOFTWARE. */ -#include "tcg-be-ldst.h" - #ifdef HOST_WORDS_BIGENDIAN # define MIPS_BE 1 #else @@ -1112,6 +1110,8 @@ static void tcg_out_call(TCGContext *s, tcg_insn_unit *arg) } #if defined(CONFIG_SOFTMMU) +#include "tcg-ldst.inc.c" + static void * const qemu_ld_helpers[16] = { [MO_UB] = helper_ret_ldub_mmu, [MO_SB] = helper_ret_ldsb_mmu, diff --git a/tcg/ppc/tcg-target.inc.c b/tcg/ppc/tcg-target.inc.c index 018c240f6d..d772faf7be 100644 --- a/tcg/ppc/tcg-target.inc.c +++ b/tcg/ppc/tcg-target.inc.c @@ -22,8 +22,6 @@ * THE SOFTWARE. */ -#include "tcg-be-ldst.h" - #if defined _CALL_DARWIN || defined __APPLE__ #define TCG_TARGET_CALL_DARWIN #endif @@ -1418,6 +1416,8 @@ static const uint32_t qemu_exts_opc[4] = { }; #if defined (CONFIG_SOFTMMU) +#include "tcg-ldst.inc.c" + /* helper signature: helper_ld_mmu(CPUState *env, target_ulong addr, * int mmu_idx, uintptr_t ra) */ diff --git a/tcg/s390/tcg-target.inc.c b/tcg/s390/tcg-target.inc.c index 38b9e791ee..ee0dff995a 100644 --- a/tcg/s390/tcg-target.inc.c +++ b/tcg/s390/tcg-target.inc.c @@ -24,8 +24,6 @@ * THE SOFTWARE. */ -#include "tcg-be-ldst.h" - /* We only support generating code for 64-bit mode. */ #if TCG_TARGET_REG_BITS != 64 #error "unsupported code generation mode" @@ -1458,6 +1456,8 @@ static void tcg_out_qemu_st_direct(TCGContext *s, TCGMemOp opc, TCGReg data, } #if defined(CONFIG_SOFTMMU) +#include "tcg-ldst.inc.c" + /* We're expecting to use a 20-bit signed offset on the tlb memory ops. Using the offset of the second entry in the last tlb table ensures that we can index all of the elements of the first entry. */ diff --git a/tcg/sparc/tcg-target.inc.c b/tcg/sparc/tcg-target.inc.c index 06cabbedf5..bb7f7e8906 100644 --- a/tcg/sparc/tcg-target.inc.c +++ b/tcg/sparc/tcg-target.inc.c @@ -22,8 +22,6 @@ * THE SOFTWARE. */ -#include "tcg-be-null.h" - #ifdef CONFIG_DEBUG_TCG static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { "%g0", diff --git a/tcg/tcg-be-ldst.h b/tcg/tcg-ldst.inc.c similarity index 85% rename from tcg/tcg-be-ldst.h rename to tcg/tcg-ldst.inc.c index 17777aec5a..0e14cf4357 100644 --- a/tcg/tcg-be-ldst.h +++ b/tcg/tcg-ldst.inc.c @@ -20,8 +20,6 @@ * THE SOFTWARE. */ -#ifdef CONFIG_SOFTMMU - typedef struct TCGLabelQemuLdst { bool is_ld; /* qemu_ld: true, qemu_st: false */ TCGMemOpIdx oi; @@ -35,19 +33,6 @@ typedef struct TCGLabelQemuLdst { struct TCGLabelQemuLdst *next; } TCGLabelQemuLdst; -typedef struct TCGBackendData { - TCGLabelQemuLdst *labels; -} TCGBackendData; - - -/* - * Initialize TB backend data at the beginning of the TB. - */ - -static inline void tcg_out_tb_init(TCGContext *s) -{ - s->be->labels = NULL; -} /* * Generate TB finalization at the end of block @@ -56,12 +41,12 @@ static inline void tcg_out_tb_init(TCGContext *s) static void tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l); static void tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l); -static bool tcg_out_tb_finalize(TCGContext *s) +static bool tcg_out_ldst_finalize(TCGContext *s) { TCGLabelQemuLdst *lb; /* qemu_ld/st slow paths */ - for (lb = s->be->labels; lb != NULL; lb = lb->next) { + for (lb = s->ldst_labels; lb != NULL; lb = lb->next) { if (lb->is_ld) { tcg_out_qemu_ld_slow_path(s, lb); } else { @@ -85,13 +70,9 @@ static bool tcg_out_tb_finalize(TCGContext *s) static inline TCGLabelQemuLdst *new_ldst_label(TCGContext *s) { - TCGBackendData *be = s->be; TCGLabelQemuLdst *l = tcg_malloc(sizeof(*l)); - l->next = be->labels; - be->labels = l; + l->next = s->ldst_labels; + s->ldst_labels = l; return l; } -#else -#include "tcg-be-null.h" -#endif /* CONFIG_SOFTMMU */ diff --git a/tcg/tcg.c b/tcg/tcg.c index 35598296c5..dd74eabb0a 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -112,10 +112,9 @@ static bool tcg_out_sti(TCGContext *s, TCGType type, TCGArg val, static void tcg_out_call(TCGContext *s, tcg_insn_unit *target); static int tcg_target_const_match(tcg_target_long val, TCGType type, const TCGArgConstraint *arg_ct); -static void tcg_out_tb_init(TCGContext *s); -static bool tcg_out_tb_finalize(TCGContext *s); - - +#ifdef TCG_TARGET_NEED_LDST_LABELS +static bool tcg_out_ldst_finalize(TCGContext *s); +#endif static TCGRegSet tcg_target_available_regs[2]; static TCGRegSet tcg_target_call_clobber_regs; @@ -470,8 +469,6 @@ void tcg_func_start(TCGContext *s) s->gen_op_buf[0].prev = 0; s->gen_next_op_idx = 1; s->gen_next_parm_idx = 0; - - s->be = tcg_malloc(sizeof(TCGBackendData)); } static inline int temp_idx(TCGContext *s, TCGTemp *ts) @@ -2619,7 +2616,9 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb) s->code_buf = tb->tc_ptr; s->code_ptr = tb->tc_ptr; - tcg_out_tb_init(s); +#ifdef TCG_TARGET_NEED_LDST_LABELS + s->ldst_labels = NULL; +#endif num_insns = -1; for (oi = s->gen_op_buf[0].next; oi != 0; oi = oi_next) { @@ -2694,9 +2693,11 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb) s->gen_insn_end_off[num_insns] = tcg_current_code_size(s); /* Generate TB finalization at the end of block */ - if (!tcg_out_tb_finalize(s)) { +#ifdef TCG_TARGET_NEED_LDST_LABELS + if (!tcg_out_ldst_finalize(s)) { return -1; } +#endif /* flush instruction cache */ flush_icache_range((uintptr_t)s->code_buf, (uintptr_t)s->code_ptr); diff --git a/tcg/tci/tcg-target.inc.c b/tcg/tci/tcg-target.inc.c index b6a15569f8..94461b2baf 100644 --- a/tcg/tci/tcg-target.inc.c +++ b/tcg/tci/tcg-target.inc.c @@ -22,8 +22,6 @@ * THE SOFTWARE. */ -#include "tcg-be-null.h" - /* TODO list: * - See TODO comments in code. */