From f96514a99cb6c9ca82c9910015c2735a4ebe1ab4 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sun, 4 Mar 2018 22:03:22 -0500 Subject: [PATCH] tcg: Rearrange ldst label tracking 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. Backports commit 659ef5cbb893872d25e9d95191cc23b16546c8a1 from qemu --- .../aarch64-softmmu/aarch64-softmmu.vcxproj | 3 +- .../aarch64-softmmu.vcxproj.filters | 6 --- .../aarch64eb-softmmu.vcxproj | 3 +- .../aarch64eb-softmmu.vcxproj.filters | 6 --- msvc/unicorn/arm-softmmu/arm-softmmu.vcxproj | 3 +- .../arm-softmmu/arm-softmmu.vcxproj.filters | 6 --- .../armeb-softmmu/armeb-softmmu.vcxproj | 3 +- .../armeb-softmmu.vcxproj.filters | 6 --- .../unicorn/m68k-softmmu/m68k-softmmu.vcxproj | 3 +- .../m68k-softmmu/m68k-softmmu.vcxproj.filters | 6 --- .../unicorn/mips-softmmu/mips-softmmu.vcxproj | 3 +- .../mips-softmmu/mips-softmmu.vcxproj.filters | 6 --- .../mips64-softmmu/mips64-softmmu.vcxproj | 3 +- .../mips64-softmmu.vcxproj.filters | 6 --- .../mips64el-softmmu/mips64el-softmmu.vcxproj | 3 +- .../mips64el-softmmu.vcxproj.filters | 6 --- .../mipsel-softmmu/mipsel-softmmu.vcxproj | 3 +- .../mipsel-softmmu.vcxproj.filters | 6 --- .../sparc-softmmu/sparc-softmmu.vcxproj | 3 +- .../sparc-softmmu.vcxproj.filters | 6 --- .../sparc64-softmmu/sparc64-softmmu.vcxproj | 3 +- .../sparc64-softmmu.vcxproj.filters | 6 --- .../x86_64-softmmu/x86_64-softmmu.vcxproj | 3 +- .../x86_64-softmmu.vcxproj.filters | 6 --- qemu/tcg/aarch64/tcg-target.h | 4 ++ qemu/tcg/aarch64/tcg-target.inc.c | 3 +- qemu/tcg/arm/tcg-target.h | 4 ++ qemu/tcg/arm/tcg-target.inc.c | 3 +- qemu/tcg/i386/tcg-target.h | 4 ++ qemu/tcg/i386/tcg-target.inc.c | 4 +- qemu/tcg/mips/tcg-target.h | 4 ++ qemu/tcg/mips/tcg-target.inc.c | 4 +- qemu/tcg/ppc/tcg-target.h | 4 ++ qemu/tcg/ppc/tcg-target.inc.c | 4 +- qemu/tcg/s390/tcg-target.h | 4 ++ qemu/tcg/s390/tcg-target.inc.c | 4 +- qemu/tcg/sparc/tcg-target.inc.c | 2 - qemu/tcg/tcg-be-null.h | 46 ------------------- qemu/tcg/{tcg-be-ldst.h => tcg-ldst.inc.c} | 28 ++--------- qemu/tcg/tcg.c | 16 ++++--- qemu/tcg/tcg.h | 6 ++- 41 files changed, 66 insertions(+), 186 deletions(-) delete mode 100644 qemu/tcg/tcg-be-null.h rename qemu/tcg/{tcg-be-ldst.h => tcg-ldst.inc.c} (85%) diff --git a/msvc/unicorn/aarch64-softmmu/aarch64-softmmu.vcxproj b/msvc/unicorn/aarch64-softmmu/aarch64-softmmu.vcxproj index 9af8a22e..8ef2d80e 100644 --- a/msvc/unicorn/aarch64-softmmu/aarch64-softmmu.vcxproj +++ b/msvc/unicorn/aarch64-softmmu/aarch64-softmmu.vcxproj @@ -33,8 +33,6 @@ - - @@ -45,6 +43,7 @@ + diff --git a/msvc/unicorn/aarch64-softmmu/aarch64-softmmu.vcxproj.filters b/msvc/unicorn/aarch64-softmmu/aarch64-softmmu.vcxproj.filters index 7b5e8aaa..f6080626 100644 --- a/msvc/unicorn/aarch64-softmmu/aarch64-softmmu.vcxproj.filters +++ b/msvc/unicorn/aarch64-softmmu/aarch64-softmmu.vcxproj.filters @@ -60,12 +60,6 @@ target\arm - - tcg - - - tcg - tcg diff --git a/msvc/unicorn/aarch64eb-softmmu/aarch64eb-softmmu.vcxproj b/msvc/unicorn/aarch64eb-softmmu/aarch64eb-softmmu.vcxproj index db765fa9..343407ba 100644 --- a/msvc/unicorn/aarch64eb-softmmu/aarch64eb-softmmu.vcxproj +++ b/msvc/unicorn/aarch64eb-softmmu/aarch64eb-softmmu.vcxproj @@ -33,8 +33,6 @@ - - @@ -45,6 +43,7 @@ + diff --git a/msvc/unicorn/aarch64eb-softmmu/aarch64eb-softmmu.vcxproj.filters b/msvc/unicorn/aarch64eb-softmmu/aarch64eb-softmmu.vcxproj.filters index f35a6431..f3e040ba 100644 --- a/msvc/unicorn/aarch64eb-softmmu/aarch64eb-softmmu.vcxproj.filters +++ b/msvc/unicorn/aarch64eb-softmmu/aarch64eb-softmmu.vcxproj.filters @@ -60,12 +60,6 @@ target\arm - - tcg - - - tcg - tcg diff --git a/msvc/unicorn/arm-softmmu/arm-softmmu.vcxproj b/msvc/unicorn/arm-softmmu/arm-softmmu.vcxproj index 412a99db..45a716fd 100644 --- a/msvc/unicorn/arm-softmmu/arm-softmmu.vcxproj +++ b/msvc/unicorn/arm-softmmu/arm-softmmu.vcxproj @@ -32,8 +32,6 @@ - - @@ -44,6 +42,7 @@ + diff --git a/msvc/unicorn/arm-softmmu/arm-softmmu.vcxproj.filters b/msvc/unicorn/arm-softmmu/arm-softmmu.vcxproj.filters index 67d787b2..ec5694b1 100644 --- a/msvc/unicorn/arm-softmmu/arm-softmmu.vcxproj.filters +++ b/msvc/unicorn/arm-softmmu/arm-softmmu.vcxproj.filters @@ -27,12 +27,6 @@ fpu - - tcg - - - tcg - tcg diff --git a/msvc/unicorn/armeb-softmmu/armeb-softmmu.vcxproj b/msvc/unicorn/armeb-softmmu/armeb-softmmu.vcxproj index 0a5c5af7..2d0e50df 100644 --- a/msvc/unicorn/armeb-softmmu/armeb-softmmu.vcxproj +++ b/msvc/unicorn/armeb-softmmu/armeb-softmmu.vcxproj @@ -32,8 +32,6 @@ - - @@ -44,6 +42,7 @@ + diff --git a/msvc/unicorn/armeb-softmmu/armeb-softmmu.vcxproj.filters b/msvc/unicorn/armeb-softmmu/armeb-softmmu.vcxproj.filters index b4da2633..3bf1361b 100644 --- a/msvc/unicorn/armeb-softmmu/armeb-softmmu.vcxproj.filters +++ b/msvc/unicorn/armeb-softmmu/armeb-softmmu.vcxproj.filters @@ -57,12 +57,6 @@ target\arm - - tcg - - - tcg - tcg diff --git a/msvc/unicorn/m68k-softmmu/m68k-softmmu.vcxproj b/msvc/unicorn/m68k-softmmu/m68k-softmmu.vcxproj index 5ec0039c..b3df903f 100644 --- a/msvc/unicorn/m68k-softmmu/m68k-softmmu.vcxproj +++ b/msvc/unicorn/m68k-softmmu/m68k-softmmu.vcxproj @@ -22,8 +22,6 @@ - - @@ -39,6 +37,7 @@ + diff --git a/msvc/unicorn/m68k-softmmu/m68k-softmmu.vcxproj.filters b/msvc/unicorn/m68k-softmmu/m68k-softmmu.vcxproj.filters index a8da982b..37382642 100644 --- a/msvc/unicorn/m68k-softmmu/m68k-softmmu.vcxproj.filters +++ b/msvc/unicorn/m68k-softmmu/m68k-softmmu.vcxproj.filters @@ -27,12 +27,6 @@ fpu - - tcg - - - tcg - tcg diff --git a/msvc/unicorn/mips-softmmu/mips-softmmu.vcxproj b/msvc/unicorn/mips-softmmu/mips-softmmu.vcxproj index cdea02b2..307a4f84 100644 --- a/msvc/unicorn/mips-softmmu/mips-softmmu.vcxproj +++ b/msvc/unicorn/mips-softmmu/mips-softmmu.vcxproj @@ -27,8 +27,6 @@ - - @@ -39,6 +37,7 @@ + diff --git a/msvc/unicorn/mips-softmmu/mips-softmmu.vcxproj.filters b/msvc/unicorn/mips-softmmu/mips-softmmu.vcxproj.filters index 10da716a..e4ab4831 100644 --- a/msvc/unicorn/mips-softmmu/mips-softmmu.vcxproj.filters +++ b/msvc/unicorn/mips-softmmu/mips-softmmu.vcxproj.filters @@ -30,12 +30,6 @@ tcg - - tcg - - - tcg - tcg diff --git a/msvc/unicorn/mips64-softmmu/mips64-softmmu.vcxproj b/msvc/unicorn/mips64-softmmu/mips64-softmmu.vcxproj index ca7edec3..38ca4f91 100644 --- a/msvc/unicorn/mips64-softmmu/mips64-softmmu.vcxproj +++ b/msvc/unicorn/mips64-softmmu/mips64-softmmu.vcxproj @@ -27,8 +27,6 @@ - - @@ -39,6 +37,7 @@ + diff --git a/msvc/unicorn/mips64-softmmu/mips64-softmmu.vcxproj.filters b/msvc/unicorn/mips64-softmmu/mips64-softmmu.vcxproj.filters index bc4d3c88..d927420f 100644 --- a/msvc/unicorn/mips64-softmmu/mips64-softmmu.vcxproj.filters +++ b/msvc/unicorn/mips64-softmmu/mips64-softmmu.vcxproj.filters @@ -30,12 +30,6 @@ tcg - - tcg - - - tcg - tcg diff --git a/msvc/unicorn/mips64el-softmmu/mips64el-softmmu.vcxproj b/msvc/unicorn/mips64el-softmmu/mips64el-softmmu.vcxproj index 52dca2df..a82b47ae 100644 --- a/msvc/unicorn/mips64el-softmmu/mips64el-softmmu.vcxproj +++ b/msvc/unicorn/mips64el-softmmu/mips64el-softmmu.vcxproj @@ -27,8 +27,6 @@ - - @@ -39,6 +37,7 @@ + diff --git a/msvc/unicorn/mips64el-softmmu/mips64el-softmmu.vcxproj.filters b/msvc/unicorn/mips64el-softmmu/mips64el-softmmu.vcxproj.filters index 1c68bf0f..1cb85734 100644 --- a/msvc/unicorn/mips64el-softmmu/mips64el-softmmu.vcxproj.filters +++ b/msvc/unicorn/mips64el-softmmu/mips64el-softmmu.vcxproj.filters @@ -30,12 +30,6 @@ tcg - - tcg - - - tcg - tcg diff --git a/msvc/unicorn/mipsel-softmmu/mipsel-softmmu.vcxproj b/msvc/unicorn/mipsel-softmmu/mipsel-softmmu.vcxproj index e90ecf8e..1b8279cc 100644 --- a/msvc/unicorn/mipsel-softmmu/mipsel-softmmu.vcxproj +++ b/msvc/unicorn/mipsel-softmmu/mipsel-softmmu.vcxproj @@ -27,8 +27,6 @@ - - @@ -39,6 +37,7 @@ + diff --git a/msvc/unicorn/mipsel-softmmu/mipsel-softmmu.vcxproj.filters b/msvc/unicorn/mipsel-softmmu/mipsel-softmmu.vcxproj.filters index f5dfc766..e2f64d26 100644 --- a/msvc/unicorn/mipsel-softmmu/mipsel-softmmu.vcxproj.filters +++ b/msvc/unicorn/mipsel-softmmu/mipsel-softmmu.vcxproj.filters @@ -30,12 +30,6 @@ tcg - - tcg - - - tcg - tcg diff --git a/msvc/unicorn/sparc-softmmu/sparc-softmmu.vcxproj b/msvc/unicorn/sparc-softmmu/sparc-softmmu.vcxproj index d1debf85..8401dc85 100644 --- a/msvc/unicorn/sparc-softmmu/sparc-softmmu.vcxproj +++ b/msvc/unicorn/sparc-softmmu/sparc-softmmu.vcxproj @@ -22,8 +22,6 @@ - - @@ -39,6 +37,7 @@ + diff --git a/msvc/unicorn/sparc-softmmu/sparc-softmmu.vcxproj.filters b/msvc/unicorn/sparc-softmmu/sparc-softmmu.vcxproj.filters index c0ad8ca0..ae515b9d 100644 --- a/msvc/unicorn/sparc-softmmu/sparc-softmmu.vcxproj.filters +++ b/msvc/unicorn/sparc-softmmu/sparc-softmmu.vcxproj.filters @@ -27,12 +27,6 @@ fpu - - tcg - - - tcg - tcg diff --git a/msvc/unicorn/sparc64-softmmu/sparc64-softmmu.vcxproj b/msvc/unicorn/sparc64-softmmu/sparc64-softmmu.vcxproj index c3406102..b224ed49 100644 --- a/msvc/unicorn/sparc64-softmmu/sparc64-softmmu.vcxproj +++ b/msvc/unicorn/sparc64-softmmu/sparc64-softmmu.vcxproj @@ -22,8 +22,6 @@ - - @@ -39,6 +37,7 @@ + diff --git a/msvc/unicorn/sparc64-softmmu/sparc64-softmmu.vcxproj.filters b/msvc/unicorn/sparc64-softmmu/sparc64-softmmu.vcxproj.filters index be038db4..cc6281d1 100644 --- a/msvc/unicorn/sparc64-softmmu/sparc64-softmmu.vcxproj.filters +++ b/msvc/unicorn/sparc64-softmmu/sparc64-softmmu.vcxproj.filters @@ -27,12 +27,6 @@ fpu - - tcg - - - tcg - tcg diff --git a/msvc/unicorn/x86_64-softmmu/x86_64-softmmu.vcxproj b/msvc/unicorn/x86_64-softmmu/x86_64-softmmu.vcxproj index 9be567d9..cc559cde 100644 --- a/msvc/unicorn/x86_64-softmmu/x86_64-softmmu.vcxproj +++ b/msvc/unicorn/x86_64-softmmu/x86_64-softmmu.vcxproj @@ -32,8 +32,6 @@ - - @@ -44,6 +42,7 @@ + diff --git a/msvc/unicorn/x86_64-softmmu/x86_64-softmmu.vcxproj.filters b/msvc/unicorn/x86_64-softmmu/x86_64-softmmu.vcxproj.filters index 056af29b..60513a25 100644 --- a/msvc/unicorn/x86_64-softmmu/x86_64-softmmu.vcxproj.filters +++ b/msvc/unicorn/x86_64-softmmu/x86_64-softmmu.vcxproj.filters @@ -27,12 +27,6 @@ tcg - - tcg - - - tcg - tcg diff --git a/qemu/tcg/aarch64/tcg-target.h b/qemu/tcg/aarch64/tcg-target.h index 719861fe..1bdbd705 100644 --- a/qemu/tcg/aarch64/tcg-target.h +++ b/qemu/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/qemu/tcg/aarch64/tcg-target.inc.c b/qemu/tcg/aarch64/tcg-target.inc.c index 09342d73..80ba1ed5 100644 --- a/qemu/tcg/aarch64/tcg-target.inc.c +++ b/qemu/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 @@ -1085,6 +1084,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/qemu/tcg/arm/tcg-target.h b/qemu/tcg/arm/tcg-target.h index 2a028795..0b8566b7 100644 --- a/qemu/tcg/arm/tcg-target.h +++ b/qemu/tcg/arm/tcg-target.h @@ -141,4 +141,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/qemu/tcg/arm/tcg-target.inc.c b/qemu/tcg/arm/tcg-target.inc.c index 3e04979d..c4967d83 100644 --- a/qemu/tcg/arm/tcg-target.inc.c +++ b/qemu/tcg/arm/tcg-target.inc.c @@ -23,7 +23,6 @@ */ #include "elf.h" -#include "tcg-be-ldst.h" static int arm_arch = __ARM_ARCH; @@ -1069,6 +1068,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/qemu/tcg/i386/tcg-target.h b/qemu/tcg/i386/tcg-target.h index 32b44a25..a433d9c1 100644 --- a/qemu/tcg/i386/tcg-target.h +++ b/qemu/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/qemu/tcg/i386/tcg-target.inc.c b/qemu/tcg/i386/tcg-target.inc.c index 139bf675..47dde612 100644 --- a/qemu/tcg/i386/tcg-target.inc.c +++ b/qemu/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 @@ -1246,6 +1244,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/qemu/tcg/mips/tcg-target.h b/qemu/tcg/mips/tcg-target.h index 928a762b..a8222476 100644 --- a/qemu/tcg/mips/tcg-target.h +++ b/qemu/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/qemu/tcg/mips/tcg-target.inc.c b/qemu/tcg/mips/tcg-target.inc.c index 2f02e6b6..d0f7e308 100644 --- a/qemu/tcg/mips/tcg-target.inc.c +++ b/qemu/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 @@ -1068,6 +1066,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/qemu/tcg/ppc/tcg-target.h b/qemu/tcg/ppc/tcg-target.h index dcf53214..0d79d03f 100644 --- a/qemu/tcg/ppc/tcg-target.h +++ b/qemu/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/qemu/tcg/ppc/tcg-target.inc.c b/qemu/tcg/ppc/tcg-target.inc.c index d51541c6..ffd9b9dd 100644 --- a/qemu/tcg/ppc/tcg-target.inc.c +++ b/qemu/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 @@ -1415,6 +1413,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/qemu/tcg/s390/tcg-target.h b/qemu/tcg/s390/tcg-target.h index 31a9eb4a..52010c30 100644 --- a/qemu/tcg/s390/tcg-target.h +++ b/qemu/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/qemu/tcg/s390/tcg-target.inc.c b/qemu/tcg/s390/tcg-target.inc.c index f92fdfcc..b0a4e655 100644 --- a/qemu/tcg/s390/tcg-target.inc.c +++ b/qemu/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" @@ -1464,6 +1462,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/qemu/tcg/sparc/tcg-target.inc.c b/qemu/tcg/sparc/tcg-target.inc.c index 8dd33b9c..099600b2 100644 --- a/qemu/tcg/sparc/tcg-target.inc.c +++ b/qemu/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/qemu/tcg/tcg-be-null.h b/qemu/tcg/tcg-be-null.h deleted file mode 100644 index 5217d62c..00000000 --- a/qemu/tcg/tcg-be-null.h +++ /dev/null @@ -1,46 +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. - */ - -#include "tcg.h" - -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/qemu/tcg/tcg-be-ldst.h b/qemu/tcg/tcg-ldst.inc.c similarity index 85% rename from qemu/tcg/tcg-be-ldst.h rename to qemu/tcg/tcg-ldst.inc.c index 5fd608d3..e08f8cbb 100644 --- a/qemu/tcg/tcg-be-ldst.h +++ b/qemu/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,20 +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 +40,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 +69,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(s, 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/qemu/tcg/tcg.c b/qemu/tcg/tcg.c index 5496f64e..e49578a7 100644 --- a/qemu/tcg/tcg.c +++ b/qemu/tcg/tcg.c @@ -108,8 +108,10 @@ 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 #if TCG_TARGET_INSN_UNIT_SIZE == 1 static QEMU_UNUSED_FUNC inline void tcg_out8(TCGContext *s, uint8_t v) @@ -463,8 +465,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(s, sizeof(TCGBackendData)); } static inline int temp_idx(TCGContext *s, TCGTemp *ts) @@ -2678,7 +2678,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) { @@ -2753,9 +2755,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/qemu/tcg/tcg.h b/qemu/tcg/tcg.h index b2f6ce7f..09cd1ecb 100644 --- a/qemu/tcg/tcg.h +++ b/qemu/tcg/tcg.h @@ -842,8 +842,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 */