aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2008-07-18 18:01:29 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2008-07-18 18:01:29 +0000
commit2cfc5f17d366b801484b36b548708fe0f3552737 (patch)
treebf35a5924a55035f6a44089943a0b5dccae32d09
parentd1b5c20dcde176df50f1955e498af252e87a3e9d (diff)
Small cleanup of gen_intermediate_code(_internal), by Laurent Desnogues.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4891 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--exec-all.h4
-rw-r--r--target-alpha/translate.c16
-rw-r--r--target-arm/translate.c15
-rw-r--r--target-cris/translate.c11
-rw-r--r--target-i386/translate.c15
-rw-r--r--target-m68k/translate.c11
-rw-r--r--target-mips/translate.c12
-rw-r--r--target-ppc/translate.c15
-rw-r--r--target-sh4/translate.c11
-rw-r--r--target-sparc/translate.c13
-rw-r--r--translate-all.c8
11 files changed, 59 insertions, 72 deletions
diff --git a/exec-all.h b/exec-all.h
index 943297755a..5241abe5b3 100644
--- a/exec-all.h
+++ b/exec-all.h
@@ -60,8 +60,8 @@ typedef void (GenOpFunc3)(long, long, long);
extern FILE *logfile;
extern int loglevel;
-int gen_intermediate_code(CPUState *env, struct TranslationBlock *tb);
-int gen_intermediate_code_pc(CPUState *env, struct TranslationBlock *tb);
+void gen_intermediate_code(CPUState *env, struct TranslationBlock *tb);
+void gen_intermediate_code_pc(CPUState *env, struct TranslationBlock *tb);
void gen_pc_load(CPUState *env, struct TranslationBlock *tb,
unsigned long searched_pc, int pc_pos, void *puc);
diff --git a/target-alpha/translate.c b/target-alpha/translate.c
index 9bf6163e6b..be905bfbd0 100644
--- a/target-alpha/translate.c
+++ b/target-alpha/translate.c
@@ -1970,9 +1970,9 @@ static always_inline int translate_one (DisasContext *ctx, uint32_t insn)
return ret;
}
-static always_inline int gen_intermediate_code_internal (CPUState *env,
- TranslationBlock *tb,
- int search_pc)
+static always_inline void gen_intermediate_code_internal (CPUState *env,
+ TranslationBlock *tb,
+ int search_pc)
{
#if defined ALPHA_DEBUG_DISAS
static int insn_count;
@@ -2086,18 +2086,16 @@ static always_inline int gen_intermediate_code_internal (CPUState *env,
fprintf(logfile, "\n");
}
#endif
-
- return 0;
}
-int gen_intermediate_code (CPUState *env, struct TranslationBlock *tb)
+void gen_intermediate_code (CPUState *env, struct TranslationBlock *tb)
{
- return gen_intermediate_code_internal(env, tb, 0);
+ gen_intermediate_code_internal(env, tb, 0);
}
-int gen_intermediate_code_pc (CPUState *env, struct TranslationBlock *tb)
+void gen_intermediate_code_pc (CPUState *env, struct TranslationBlock *tb)
{
- return gen_intermediate_code_internal(env, tb, 1);
+ gen_intermediate_code_internal(env, tb, 1);
}
CPUAlphaState * cpu_alpha_init (const char *cpu_model)
diff --git a/target-arm/translate.c b/target-arm/translate.c
index 1753213f49..3183ef8ba0 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -8544,9 +8544,9 @@ undef:
/* generate intermediate code in gen_opc_buf and gen_opparam_buf for
basic block 'tb'. If search_pc is TRUE, also generate PC
information for each intermediate instruction. */
-static inline int gen_intermediate_code_internal(CPUState *env,
- TranslationBlock *tb,
- int search_pc)
+static inline void gen_intermediate_code_internal(CPUState *env,
+ TranslationBlock *tb,
+ int search_pc)
{
DisasContext dc1, *dc = &dc1;
uint16_t *gen_opc_end;
@@ -8787,17 +8787,16 @@ done_generating:
tb->size = dc->pc - pc_start;
tb->icount = num_insns;
}
- return 0;
}
-int gen_intermediate_code(CPUState *env, TranslationBlock *tb)
+void gen_intermediate_code(CPUState *env, TranslationBlock *tb)
{
- return gen_intermediate_code_internal(env, tb, 0);
+ gen_intermediate_code_internal(env, tb, 0);
}
-int gen_intermediate_code_pc(CPUState *env, TranslationBlock *tb)
+void gen_intermediate_code_pc(CPUState *env, TranslationBlock *tb)
{
- return gen_intermediate_code_internal(env, tb, 1);
+ gen_intermediate_code_internal(env, tb, 1);
}
static const char *cpu_mode_names[16] = {
diff --git a/target-cris/translate.c b/target-cris/translate.c
index d971d1d2bf..0c23cdf28f 100644
--- a/target-cris/translate.c
+++ b/target-cris/translate.c
@@ -3022,7 +3022,7 @@ static void check_breakpoint(CPUState *env, DisasContext *dc)
*/
/* generate intermediate code for basic block 'tb'. */
-static int
+static void
gen_intermediate_code_internal(CPUState *env, TranslationBlock *tb,
int search_pc)
{
@@ -3233,17 +3233,16 @@ gen_intermediate_code_internal(CPUState *env, TranslationBlock *tb,
dc->pc - pc_start, gen_opc_ptr - gen_opc_buf);
}
#endif
- return 0;
}
-int gen_intermediate_code (CPUState *env, struct TranslationBlock *tb)
+void gen_intermediate_code (CPUState *env, struct TranslationBlock *tb)
{
- return gen_intermediate_code_internal(env, tb, 0);
+ gen_intermediate_code_internal(env, tb, 0);
}
-int gen_intermediate_code_pc (CPUState *env, struct TranslationBlock *tb)
+void gen_intermediate_code_pc (CPUState *env, struct TranslationBlock *tb)
{
- return gen_intermediate_code_internal(env, tb, 1);
+ gen_intermediate_code_internal(env, tb, 1);
}
void cpu_dump_state (CPUState *env, FILE *f,
diff --git a/target-i386/translate.c b/target-i386/translate.c
index 7dc317171a..c4a119543a 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -7148,9 +7148,9 @@ void optimize_flags_init(void)
/* generate intermediate code in gen_opc_buf and gen_opparam_buf for
basic block 'tb'. If search_pc is TRUE, also generate PC
information for each intermediate instruction. */
-static inline int gen_intermediate_code_internal(CPUState *env,
- TranslationBlock *tb,
- int search_pc)
+static inline void gen_intermediate_code_internal(CPUState *env,
+ TranslationBlock *tb,
+ int search_pc)
{
DisasContext dc1, *dc = &dc1;
target_ulong pc_ptr;
@@ -7321,17 +7321,16 @@ static inline int gen_intermediate_code_internal(CPUState *env,
tb->size = pc_ptr - pc_start;
tb->icount = num_insns;
}
- return 0;
}
-int gen_intermediate_code(CPUState *env, TranslationBlock *tb)
+void gen_intermediate_code(CPUState *env, TranslationBlock *tb)
{
- return gen_intermediate_code_internal(env, tb, 0);
+ gen_intermediate_code_internal(env, tb, 0);
}
-int gen_intermediate_code_pc(CPUState *env, TranslationBlock *tb)
+void gen_intermediate_code_pc(CPUState *env, TranslationBlock *tb)
{
- return gen_intermediate_code_internal(env, tb, 1);
+ gen_intermediate_code_internal(env, tb, 1);
}
void gen_pc_load(CPUState *env, TranslationBlock *tb,
diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index e3e56d0364..d5872a10b5 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -2911,7 +2911,7 @@ static void disas_m68k_insn(CPUState * env, DisasContext *s)
}
/* generate intermediate code for basic block 'tb'. */
-static inline int
+static inline void
gen_intermediate_code_internal(CPUState *env, TranslationBlock *tb,
int search_pc)
{
@@ -3039,17 +3039,16 @@ gen_intermediate_code_internal(CPUState *env, TranslationBlock *tb,
//optimize_flags();
//expand_target_qops();
- return 0;
}
-int gen_intermediate_code(CPUState *env, TranslationBlock *tb)
+void gen_intermediate_code(CPUState *env, TranslationBlock *tb)
{
- return gen_intermediate_code_internal(env, tb, 0);
+ gen_intermediate_code_internal(env, tb, 0);
}
-int gen_intermediate_code_pc(CPUState *env, TranslationBlock *tb)
+void gen_intermediate_code_pc(CPUState *env, TranslationBlock *tb)
{
- return gen_intermediate_code_internal(env, tb, 1);
+ gen_intermediate_code_internal(env, tb, 1);
}
void cpu_dump_state(CPUState *env, FILE *f,
diff --git a/target-mips/translate.c b/target-mips/translate.c
index bdc0f7b21d..4a2fb24827 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -8453,7 +8453,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx)
}
}
-static inline int
+static inline void
gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb,
int search_pc)
{
@@ -8598,18 +8598,16 @@ done_generating:
fprintf(logfile, "---------------- %d %08x\n", ctx.bstate, ctx.hflags);
}
#endif
-
- return 0;
}
-int gen_intermediate_code (CPUState *env, struct TranslationBlock *tb)
+void gen_intermediate_code (CPUState *env, struct TranslationBlock *tb)
{
- return gen_intermediate_code_internal(env, tb, 0);
+ gen_intermediate_code_internal(env, tb, 0);
}
-int gen_intermediate_code_pc (CPUState *env, struct TranslationBlock *tb)
+void gen_intermediate_code_pc (CPUState *env, struct TranslationBlock *tb)
{
- return gen_intermediate_code_internal(env, tb, 1);
+ gen_intermediate_code_internal(env, tb, 1);
}
void fpu_dump_state(CPUState *env, FILE *f,
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index e0c318582c..146ba3af16 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -6171,9 +6171,9 @@ void cpu_dump_statistics (CPUState *env, FILE*f,
}
/*****************************************************************************/
-static always_inline int gen_intermediate_code_internal (CPUState *env,
- TranslationBlock *tb,
- int search_pc)
+static always_inline void gen_intermediate_code_internal (CPUState *env,
+ TranslationBlock *tb,
+ int search_pc)
{
DisasContext ctx, *ctxp = &ctx;
opc_handler_t **table, *handler;
@@ -6379,17 +6379,16 @@ static always_inline int gen_intermediate_code_internal (CPUState *env,
fprintf(logfile, "\n");
}
#endif
- return 0;
}
-int gen_intermediate_code (CPUState *env, struct TranslationBlock *tb)
+void gen_intermediate_code (CPUState *env, struct TranslationBlock *tb)
{
- return gen_intermediate_code_internal(env, tb, 0);
+ gen_intermediate_code_internal(env, tb, 0);
}
-int gen_intermediate_code_pc (CPUState *env, struct TranslationBlock *tb)
+void gen_intermediate_code_pc (CPUState *env, struct TranslationBlock *tb)
{
- return gen_intermediate_code_internal(env, tb, 1);
+ gen_intermediate_code_internal(env, tb, 1);
}
void gen_pc_load(CPUState *env, TranslationBlock *tb,
diff --git a/target-sh4/translate.c b/target-sh4/translate.c
index 0a6f4171fd..a73805f64a 100644
--- a/target-sh4/translate.c
+++ b/target-sh4/translate.c
@@ -1195,7 +1195,7 @@ void decode_opc(DisasContext * ctx)
}
}
-static inline int
+static inline void
gen_intermediate_code_internal(CPUState * env, TranslationBlock * tb,
int search_pc)
{
@@ -1326,17 +1326,16 @@ gen_intermediate_code_internal(CPUState * env, TranslationBlock * tb,
fprintf(logfile, "\n");
}
#endif
- return 0;
}
-int gen_intermediate_code(CPUState * env, struct TranslationBlock *tb)
+void gen_intermediate_code(CPUState * env, struct TranslationBlock *tb)
{
- return gen_intermediate_code_internal(env, tb, 0);
+ gen_intermediate_code_internal(env, tb, 0);
}
-int gen_intermediate_code_pc(CPUState * env, struct TranslationBlock *tb)
+void gen_intermediate_code_pc(CPUState * env, struct TranslationBlock *tb)
{
- return gen_intermediate_code_internal(env, tb, 1);
+ gen_intermediate_code_internal(env, tb, 1);
}
void gen_pc_load(CPUState *env, TranslationBlock *tb,
diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index aac15454d0..25842b16c8 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -4724,8 +4724,8 @@ static void disas_sparc_insn(DisasContext * dc)
#endif
}
-static inline int gen_intermediate_code_internal(TranslationBlock * tb,
- int spc, CPUSPARCState *env)
+static inline void gen_intermediate_code_internal(TranslationBlock * tb,
+ int spc, CPUSPARCState *env)
{
target_ulong pc_start, last_pc;
uint16_t *gen_opc_end;
@@ -4869,17 +4869,16 @@ static inline int gen_intermediate_code_internal(TranslationBlock * tb,
fprintf(logfile, "\n");
}
#endif
- return 0;
}
-int gen_intermediate_code(CPUSPARCState * env, TranslationBlock * tb)
+void gen_intermediate_code(CPUSPARCState * env, TranslationBlock * tb)
{
- return gen_intermediate_code_internal(tb, 0, env);
+ gen_intermediate_code_internal(tb, 0, env);
}
-int gen_intermediate_code_pc(CPUSPARCState * env, TranslationBlock * tb)
+void gen_intermediate_code_pc(CPUSPARCState * env, TranslationBlock * tb)
{
- return gen_intermediate_code_internal(tb, 1, env);
+ gen_intermediate_code_internal(tb, 1, env);
}
void gen_intermediate_code_init(CPUSPARCState *env)
diff --git a/translate-all.c b/translate-all.c
index 263649578b..1c27fd3296 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -94,9 +94,8 @@ int cpu_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr)
#endif
tcg_func_start(s);
- if (gen_intermediate_code(env, tb) < 0)
- return -1;
-
+ gen_intermediate_code(env, tb);
+
/* generate machine code */
gen_code_buf = tb->tc_ptr;
tb->tb_next_offset[0] = 0xffff;
@@ -156,8 +155,7 @@ int cpu_restore_state(TranslationBlock *tb,
#endif
tcg_func_start(s);
- if (gen_intermediate_code_pc(env, tb) < 0)
- return -1;
+ gen_intermediate_code_pc(env, tb);
if (use_icount) {
/* Reset the cycle counter to the start of the block. */