From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:59485) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qzbb1-0007ah-Ku for qemu-devel@nongnu.org; Fri, 02 Sep 2011 17:48:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qzbaz-0005Mj-Q8 for qemu-devel@nongnu.org; Fri, 02 Sep 2011 17:48:19 -0400 Received: from cpe-70-123-132-139.austin.res.rr.com ([70.123.132.139]:57122 helo=localhost6.localdomain6) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qzbaz-0005ML-Jf for qemu-devel@nongnu.org; Fri, 02 Sep 2011 17:48:17 -0400 From: Anthony Liguori Date: Fri, 2 Sep 2011 16:48:01 -0500 Message-Id: <1315000083-20576-4-git-send-email-aliguori@us.ibm.com> In-Reply-To: <1315000083-20576-1-git-send-email-aliguori@us.ibm.com> References: <1315000083-20576-1-git-send-email-aliguori@us.ibm.com> Subject: [Qemu-devel] [PATCH 3/5] tcg: add tcg_enabled() and stop compiling translate.o when TCG is disabled List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , Alex Graf , Stefano Stabellini Signed-off-by: Anthony Liguori --- Makefile.target | 3 ++- cpu-all.h | 6 ++++++ exec.c | 2 +- qemu-common.h | 2 +- translate-all.c | 12 +++++++++--- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Makefile.target b/Makefile.target index 0787758..70f52cc 100644 --- a/Makefile.target +++ b/Makefile.target @@ -67,10 +67,11 @@ all: $(PROGS) stap ######################################################### # cpu emulator library -libobj-y = exec.o translate-all.o cpu-exec.o translate.o +libobj-y = exec.o translate-all.o cpu-exec.o libobj-y += tcg/tcg.o tcg/optimize.o libobj-y += fpu/softfloat.o libobj-y += op_helper.o helper.o +libobj-$(CONFIG_TCG) += translate.o ifeq ($(TARGET_BASE_ARCH), i386) libobj-y += cpuid.o endif diff --git a/cpu-all.h b/cpu-all.h index f5c82cd..84a852c 100644 --- a/cpu-all.h +++ b/cpu-all.h @@ -22,6 +22,12 @@ #include "qemu-common.h" #include "cpu-common.h" +#if defined(CONFIG_TCG) +#define tcg_enabled() (tcg_in_use()) +#else +#define tcg_enabled() (0) +#endif + /* some important defines: * * WORDS_ALIGNED : if defined, the host cpu can only make word aligned diff --git a/exec.c b/exec.c index c1e045d..578da0e 100644 --- a/exec.c +++ b/exec.c @@ -585,7 +585,7 @@ void tcg_exec_init(unsigned long tb_size) #endif } -bool tcg_enabled(void) +bool tcg_in_use(void) { return code_gen_buffer != NULL; } diff --git a/qemu-common.h b/qemu-common.h index 404c421..02a3071 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -268,7 +268,7 @@ typedef struct QEMUSGList QEMUSGList; typedef uint64_t pcibus_t; void tcg_exec_init(unsigned long tb_size); -bool tcg_enabled(void); +bool tcg_in_use(void); void cpu_exec_init_all(void); diff --git a/translate-all.c b/translate-all.c index 041c108..ecb035a 100644 --- a/translate-all.c +++ b/translate-all.c @@ -67,7 +67,9 @@ int cpu_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr) #endif tcg_func_start(s); - gen_intermediate_code(env, tb); + if (tcg_enabled()) { + gen_intermediate_code(env, tb); + } /* generate machine code */ gen_code_buf = tb->tc_ptr; @@ -123,7 +125,9 @@ int cpu_restore_state(TranslationBlock *tb, #endif tcg_func_start(s); - gen_intermediate_code_pc(env, tb); + if (tcg_enabled()) { + gen_intermediate_code_pc(env, tb); + } if (use_icount) { /* Reset the cycle counter to the start of the block. */ @@ -153,7 +157,9 @@ int cpu_restore_state(TranslationBlock *tb, j--; env->icount_decr.u16.low -= gen_opc_icount[j]; - restore_state_to_opc(env, tb, j); + if (tcg_enabled()) { + restore_state_to_opc(env, tb, j); + } #ifdef CONFIG_PROFILER s->restore_time += profile_getclock() - ti; -- 1.7.4.1