[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/5] tcg: add tcg_enabled() and stop compiling trans
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [PATCH 3/5] tcg: add tcg_enabled() and stop compiling translate.o when TCG is disabled |
Date: |
Fri, 2 Sep 2011 16:48:01 -0500 |
Signed-off-by: Anthony Liguori <address@hidden>
---
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
- [Qemu-devel] [RFC PATCH 0/5] Add configure flag to disable TCG, Anthony Liguori, 2011/09/02
- [Qemu-devel] [PATCH 1/5] configure: add --disable-tcg configure option, Anthony Liguori, 2011/09/02
- [Qemu-devel] [PATCH 4/5] tcg: don't build tcg/tcg.o, tcg/optimize.o, or translate-all.o when TCG disabled, Anthony Liguori, 2011/09/02
- [Qemu-devel] [PATCH 2/5] vl: don't expose TCG as a supported accelerator if TCG is disabled, Anthony Liguori, 2011/09/02
- [Qemu-devel] [PATCH 3/5] tcg: add tcg_enabled() and stop compiling translate.o when TCG is disabled,
Anthony Liguori <=
- [Qemu-devel] [PATCH 5/5] tcg: don't build cpu-exec.o, op_helper.o, or fpu/softloat.o when TCG disabled, Anthony Liguori, 2011/09/02
- Re: [Qemu-devel] [RFC PATCH 0/5] Add configure flag to disable TCG, Blue Swirl, 2011/09/03
- Re: [Qemu-devel] [RFC PATCH 0/5] Add configure flag to disable TCG, Stefano Stabellini, 2011/09/05