From: Anthony Liguori <aliguori@us.ibm.com>
To: qemu-devel@nongnu.org
Cc: Anthony Liguori <aliguori@us.ibm.com>, Alex Graf <agraf@suse.de>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
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 [thread overview]
Message-ID: <1315000083-20576-4-git-send-email-aliguori@us.ibm.com> (raw)
In-Reply-To: <1315000083-20576-1-git-send-email-aliguori@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
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
next prev parent reply other threads:[~2011-09-02 21:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-02 21:47 [Qemu-devel] [RFC PATCH 0/5] Add configure flag to disable TCG Anthony Liguori
2011-09-02 21:47 ` [Qemu-devel] [PATCH 1/5] configure: add --disable-tcg configure option Anthony Liguori
2011-09-02 21:48 ` [Qemu-devel] [PATCH 2/5] vl: don't expose TCG as a supported accelerator if TCG is disabled Anthony Liguori
2011-09-02 21:48 ` Anthony Liguori [this message]
2011-09-02 23:51 ` [Qemu-devel] [PATCH 3/5] tcg: add tcg_enabled() and stop compiling translate.o when " Peter Maydell
2011-09-02 21:48 ` [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-03 12:07 ` Blue Swirl
2011-09-02 21:48 ` [Qemu-devel] [PATCH 5/5] tcg: don't build cpu-exec.o, op_helper.o, or fpu/softloat.o " Anthony Liguori
2011-09-02 23:26 ` Peter Maydell
2011-09-03 12:02 ` Blue Swirl
2011-09-03 11:58 ` [Qemu-devel] [RFC PATCH 0/5] Add configure flag to disable TCG Blue Swirl
2011-09-03 12:50 ` Alexander Graf
2011-09-05 14:53 ` Stefano Stabellini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1315000083-20576-4-git-send-email-aliguori@us.ibm.com \
--to=aliguori@us.ibm.com \
--cc=agraf@suse.de \
--cc=qemu-devel@nongnu.org \
--cc=stefano.stabellini@eu.citrix.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).