Commit 2cfc5f17d366b801484b36b548708fe0f3552737
1 parent
d1b5c20d
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
Showing
11 changed files
with
59 additions
and
72 deletions
exec-all.h
@@ -60,8 +60,8 @@ typedef void (GenOpFunc3)(long, long, long); | @@ -60,8 +60,8 @@ typedef void (GenOpFunc3)(long, long, long); | ||
60 | extern FILE *logfile; | 60 | extern FILE *logfile; |
61 | extern int loglevel; | 61 | extern int loglevel; |
62 | 62 | ||
63 | -int gen_intermediate_code(CPUState *env, struct TranslationBlock *tb); | ||
64 | -int gen_intermediate_code_pc(CPUState *env, struct TranslationBlock *tb); | 63 | +void gen_intermediate_code(CPUState *env, struct TranslationBlock *tb); |
64 | +void gen_intermediate_code_pc(CPUState *env, struct TranslationBlock *tb); | ||
65 | void gen_pc_load(CPUState *env, struct TranslationBlock *tb, | 65 | void gen_pc_load(CPUState *env, struct TranslationBlock *tb, |
66 | unsigned long searched_pc, int pc_pos, void *puc); | 66 | unsigned long searched_pc, int pc_pos, void *puc); |
67 | 67 |
target-alpha/translate.c
@@ -1970,9 +1970,9 @@ static always_inline int translate_one (DisasContext *ctx, uint32_t insn) | @@ -1970,9 +1970,9 @@ static always_inline int translate_one (DisasContext *ctx, uint32_t insn) | ||
1970 | return ret; | 1970 | return ret; |
1971 | } | 1971 | } |
1972 | 1972 | ||
1973 | -static always_inline int gen_intermediate_code_internal (CPUState *env, | ||
1974 | - TranslationBlock *tb, | ||
1975 | - int search_pc) | 1973 | +static always_inline void gen_intermediate_code_internal (CPUState *env, |
1974 | + TranslationBlock *tb, | ||
1975 | + int search_pc) | ||
1976 | { | 1976 | { |
1977 | #if defined ALPHA_DEBUG_DISAS | 1977 | #if defined ALPHA_DEBUG_DISAS |
1978 | static int insn_count; | 1978 | static int insn_count; |
@@ -2086,18 +2086,16 @@ static always_inline int gen_intermediate_code_internal (CPUState *env, | @@ -2086,18 +2086,16 @@ static always_inline int gen_intermediate_code_internal (CPUState *env, | ||
2086 | fprintf(logfile, "\n"); | 2086 | fprintf(logfile, "\n"); |
2087 | } | 2087 | } |
2088 | #endif | 2088 | #endif |
2089 | - | ||
2090 | - return 0; | ||
2091 | } | 2089 | } |
2092 | 2090 | ||
2093 | -int gen_intermediate_code (CPUState *env, struct TranslationBlock *tb) | 2091 | +void gen_intermediate_code (CPUState *env, struct TranslationBlock *tb) |
2094 | { | 2092 | { |
2095 | - return gen_intermediate_code_internal(env, tb, 0); | 2093 | + gen_intermediate_code_internal(env, tb, 0); |
2096 | } | 2094 | } |
2097 | 2095 | ||
2098 | -int gen_intermediate_code_pc (CPUState *env, struct TranslationBlock *tb) | 2096 | +void gen_intermediate_code_pc (CPUState *env, struct TranslationBlock *tb) |
2099 | { | 2097 | { |
2100 | - return gen_intermediate_code_internal(env, tb, 1); | 2098 | + gen_intermediate_code_internal(env, tb, 1); |
2101 | } | 2099 | } |
2102 | 2100 | ||
2103 | CPUAlphaState * cpu_alpha_init (const char *cpu_model) | 2101 | CPUAlphaState * cpu_alpha_init (const char *cpu_model) |
target-arm/translate.c
@@ -8544,9 +8544,9 @@ undef: | @@ -8544,9 +8544,9 @@ undef: | ||
8544 | /* generate intermediate code in gen_opc_buf and gen_opparam_buf for | 8544 | /* generate intermediate code in gen_opc_buf and gen_opparam_buf for |
8545 | basic block 'tb'. If search_pc is TRUE, also generate PC | 8545 | basic block 'tb'. If search_pc is TRUE, also generate PC |
8546 | information for each intermediate instruction. */ | 8546 | information for each intermediate instruction. */ |
8547 | -static inline int gen_intermediate_code_internal(CPUState *env, | ||
8548 | - TranslationBlock *tb, | ||
8549 | - int search_pc) | 8547 | +static inline void gen_intermediate_code_internal(CPUState *env, |
8548 | + TranslationBlock *tb, | ||
8549 | + int search_pc) | ||
8550 | { | 8550 | { |
8551 | DisasContext dc1, *dc = &dc1; | 8551 | DisasContext dc1, *dc = &dc1; |
8552 | uint16_t *gen_opc_end; | 8552 | uint16_t *gen_opc_end; |
@@ -8787,17 +8787,16 @@ done_generating: | @@ -8787,17 +8787,16 @@ done_generating: | ||
8787 | tb->size = dc->pc - pc_start; | 8787 | tb->size = dc->pc - pc_start; |
8788 | tb->icount = num_insns; | 8788 | tb->icount = num_insns; |
8789 | } | 8789 | } |
8790 | - return 0; | ||
8791 | } | 8790 | } |
8792 | 8791 | ||
8793 | -int gen_intermediate_code(CPUState *env, TranslationBlock *tb) | 8792 | +void gen_intermediate_code(CPUState *env, TranslationBlock *tb) |
8794 | { | 8793 | { |
8795 | - return gen_intermediate_code_internal(env, tb, 0); | 8794 | + gen_intermediate_code_internal(env, tb, 0); |
8796 | } | 8795 | } |
8797 | 8796 | ||
8798 | -int gen_intermediate_code_pc(CPUState *env, TranslationBlock *tb) | 8797 | +void gen_intermediate_code_pc(CPUState *env, TranslationBlock *tb) |
8799 | { | 8798 | { |
8800 | - return gen_intermediate_code_internal(env, tb, 1); | 8799 | + gen_intermediate_code_internal(env, tb, 1); |
8801 | } | 8800 | } |
8802 | 8801 | ||
8803 | static const char *cpu_mode_names[16] = { | 8802 | static const char *cpu_mode_names[16] = { |
target-cris/translate.c
@@ -3022,7 +3022,7 @@ static void check_breakpoint(CPUState *env, DisasContext *dc) | @@ -3022,7 +3022,7 @@ static void check_breakpoint(CPUState *env, DisasContext *dc) | ||
3022 | */ | 3022 | */ |
3023 | 3023 | ||
3024 | /* generate intermediate code for basic block 'tb'. */ | 3024 | /* generate intermediate code for basic block 'tb'. */ |
3025 | -static int | 3025 | +static void |
3026 | gen_intermediate_code_internal(CPUState *env, TranslationBlock *tb, | 3026 | gen_intermediate_code_internal(CPUState *env, TranslationBlock *tb, |
3027 | int search_pc) | 3027 | int search_pc) |
3028 | { | 3028 | { |
@@ -3233,17 +3233,16 @@ gen_intermediate_code_internal(CPUState *env, TranslationBlock *tb, | @@ -3233,17 +3233,16 @@ gen_intermediate_code_internal(CPUState *env, TranslationBlock *tb, | ||
3233 | dc->pc - pc_start, gen_opc_ptr - gen_opc_buf); | 3233 | dc->pc - pc_start, gen_opc_ptr - gen_opc_buf); |
3234 | } | 3234 | } |
3235 | #endif | 3235 | #endif |
3236 | - return 0; | ||
3237 | } | 3236 | } |
3238 | 3237 | ||
3239 | -int gen_intermediate_code (CPUState *env, struct TranslationBlock *tb) | 3238 | +void gen_intermediate_code (CPUState *env, struct TranslationBlock *tb) |
3240 | { | 3239 | { |
3241 | - return gen_intermediate_code_internal(env, tb, 0); | 3240 | + gen_intermediate_code_internal(env, tb, 0); |
3242 | } | 3241 | } |
3243 | 3242 | ||
3244 | -int gen_intermediate_code_pc (CPUState *env, struct TranslationBlock *tb) | 3243 | +void gen_intermediate_code_pc (CPUState *env, struct TranslationBlock *tb) |
3245 | { | 3244 | { |
3246 | - return gen_intermediate_code_internal(env, tb, 1); | 3245 | + gen_intermediate_code_internal(env, tb, 1); |
3247 | } | 3246 | } |
3248 | 3247 | ||
3249 | void cpu_dump_state (CPUState *env, FILE *f, | 3248 | void cpu_dump_state (CPUState *env, FILE *f, |
target-i386/translate.c
@@ -7148,9 +7148,9 @@ void optimize_flags_init(void) | @@ -7148,9 +7148,9 @@ void optimize_flags_init(void) | ||
7148 | /* generate intermediate code in gen_opc_buf and gen_opparam_buf for | 7148 | /* generate intermediate code in gen_opc_buf and gen_opparam_buf for |
7149 | basic block 'tb'. If search_pc is TRUE, also generate PC | 7149 | basic block 'tb'. If search_pc is TRUE, also generate PC |
7150 | information for each intermediate instruction. */ | 7150 | information for each intermediate instruction. */ |
7151 | -static inline int gen_intermediate_code_internal(CPUState *env, | ||
7152 | - TranslationBlock *tb, | ||
7153 | - int search_pc) | 7151 | +static inline void gen_intermediate_code_internal(CPUState *env, |
7152 | + TranslationBlock *tb, | ||
7153 | + int search_pc) | ||
7154 | { | 7154 | { |
7155 | DisasContext dc1, *dc = &dc1; | 7155 | DisasContext dc1, *dc = &dc1; |
7156 | target_ulong pc_ptr; | 7156 | target_ulong pc_ptr; |
@@ -7321,17 +7321,16 @@ static inline int gen_intermediate_code_internal(CPUState *env, | @@ -7321,17 +7321,16 @@ static inline int gen_intermediate_code_internal(CPUState *env, | ||
7321 | tb->size = pc_ptr - pc_start; | 7321 | tb->size = pc_ptr - pc_start; |
7322 | tb->icount = num_insns; | 7322 | tb->icount = num_insns; |
7323 | } | 7323 | } |
7324 | - return 0; | ||
7325 | } | 7324 | } |
7326 | 7325 | ||
7327 | -int gen_intermediate_code(CPUState *env, TranslationBlock *tb) | 7326 | +void gen_intermediate_code(CPUState *env, TranslationBlock *tb) |
7328 | { | 7327 | { |
7329 | - return gen_intermediate_code_internal(env, tb, 0); | 7328 | + gen_intermediate_code_internal(env, tb, 0); |
7330 | } | 7329 | } |
7331 | 7330 | ||
7332 | -int gen_intermediate_code_pc(CPUState *env, TranslationBlock *tb) | 7331 | +void gen_intermediate_code_pc(CPUState *env, TranslationBlock *tb) |
7333 | { | 7332 | { |
7334 | - return gen_intermediate_code_internal(env, tb, 1); | 7333 | + gen_intermediate_code_internal(env, tb, 1); |
7335 | } | 7334 | } |
7336 | 7335 | ||
7337 | void gen_pc_load(CPUState *env, TranslationBlock *tb, | 7336 | void gen_pc_load(CPUState *env, TranslationBlock *tb, |
target-m68k/translate.c
@@ -2911,7 +2911,7 @@ static void disas_m68k_insn(CPUState * env, DisasContext *s) | @@ -2911,7 +2911,7 @@ static void disas_m68k_insn(CPUState * env, DisasContext *s) | ||
2911 | } | 2911 | } |
2912 | 2912 | ||
2913 | /* generate intermediate code for basic block 'tb'. */ | 2913 | /* generate intermediate code for basic block 'tb'. */ |
2914 | -static inline int | 2914 | +static inline void |
2915 | gen_intermediate_code_internal(CPUState *env, TranslationBlock *tb, | 2915 | gen_intermediate_code_internal(CPUState *env, TranslationBlock *tb, |
2916 | int search_pc) | 2916 | int search_pc) |
2917 | { | 2917 | { |
@@ -3039,17 +3039,16 @@ gen_intermediate_code_internal(CPUState *env, TranslationBlock *tb, | @@ -3039,17 +3039,16 @@ gen_intermediate_code_internal(CPUState *env, TranslationBlock *tb, | ||
3039 | 3039 | ||
3040 | //optimize_flags(); | 3040 | //optimize_flags(); |
3041 | //expand_target_qops(); | 3041 | //expand_target_qops(); |
3042 | - return 0; | ||
3043 | } | 3042 | } |
3044 | 3043 | ||
3045 | -int gen_intermediate_code(CPUState *env, TranslationBlock *tb) | 3044 | +void gen_intermediate_code(CPUState *env, TranslationBlock *tb) |
3046 | { | 3045 | { |
3047 | - return gen_intermediate_code_internal(env, tb, 0); | 3046 | + gen_intermediate_code_internal(env, tb, 0); |
3048 | } | 3047 | } |
3049 | 3048 | ||
3050 | -int gen_intermediate_code_pc(CPUState *env, TranslationBlock *tb) | 3049 | +void gen_intermediate_code_pc(CPUState *env, TranslationBlock *tb) |
3051 | { | 3050 | { |
3052 | - return gen_intermediate_code_internal(env, tb, 1); | 3051 | + gen_intermediate_code_internal(env, tb, 1); |
3053 | } | 3052 | } |
3054 | 3053 | ||
3055 | void cpu_dump_state(CPUState *env, FILE *f, | 3054 | void cpu_dump_state(CPUState *env, FILE *f, |
target-mips/translate.c
@@ -8453,7 +8453,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | @@ -8453,7 +8453,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | ||
8453 | } | 8453 | } |
8454 | } | 8454 | } |
8455 | 8455 | ||
8456 | -static inline int | 8456 | +static inline void |
8457 | gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb, | 8457 | gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb, |
8458 | int search_pc) | 8458 | int search_pc) |
8459 | { | 8459 | { |
@@ -8598,18 +8598,16 @@ done_generating: | @@ -8598,18 +8598,16 @@ done_generating: | ||
8598 | fprintf(logfile, "---------------- %d %08x\n", ctx.bstate, ctx.hflags); | 8598 | fprintf(logfile, "---------------- %d %08x\n", ctx.bstate, ctx.hflags); |
8599 | } | 8599 | } |
8600 | #endif | 8600 | #endif |
8601 | - | ||
8602 | - return 0; | ||
8603 | } | 8601 | } |
8604 | 8602 | ||
8605 | -int gen_intermediate_code (CPUState *env, struct TranslationBlock *tb) | 8603 | +void gen_intermediate_code (CPUState *env, struct TranslationBlock *tb) |
8606 | { | 8604 | { |
8607 | - return gen_intermediate_code_internal(env, tb, 0); | 8605 | + gen_intermediate_code_internal(env, tb, 0); |
8608 | } | 8606 | } |
8609 | 8607 | ||
8610 | -int gen_intermediate_code_pc (CPUState *env, struct TranslationBlock *tb) | 8608 | +void gen_intermediate_code_pc (CPUState *env, struct TranslationBlock *tb) |
8611 | { | 8609 | { |
8612 | - return gen_intermediate_code_internal(env, tb, 1); | 8610 | + gen_intermediate_code_internal(env, tb, 1); |
8613 | } | 8611 | } |
8614 | 8612 | ||
8615 | void fpu_dump_state(CPUState *env, FILE *f, | 8613 | void fpu_dump_state(CPUState *env, FILE *f, |
target-ppc/translate.c
@@ -6171,9 +6171,9 @@ void cpu_dump_statistics (CPUState *env, FILE*f, | @@ -6171,9 +6171,9 @@ void cpu_dump_statistics (CPUState *env, FILE*f, | ||
6171 | } | 6171 | } |
6172 | 6172 | ||
6173 | /*****************************************************************************/ | 6173 | /*****************************************************************************/ |
6174 | -static always_inline int gen_intermediate_code_internal (CPUState *env, | ||
6175 | - TranslationBlock *tb, | ||
6176 | - int search_pc) | 6174 | +static always_inline void gen_intermediate_code_internal (CPUState *env, |
6175 | + TranslationBlock *tb, | ||
6176 | + int search_pc) | ||
6177 | { | 6177 | { |
6178 | DisasContext ctx, *ctxp = &ctx; | 6178 | DisasContext ctx, *ctxp = &ctx; |
6179 | opc_handler_t **table, *handler; | 6179 | opc_handler_t **table, *handler; |
@@ -6379,17 +6379,16 @@ static always_inline int gen_intermediate_code_internal (CPUState *env, | @@ -6379,17 +6379,16 @@ static always_inline int gen_intermediate_code_internal (CPUState *env, | ||
6379 | fprintf(logfile, "\n"); | 6379 | fprintf(logfile, "\n"); |
6380 | } | 6380 | } |
6381 | #endif | 6381 | #endif |
6382 | - return 0; | ||
6383 | } | 6382 | } |
6384 | 6383 | ||
6385 | -int gen_intermediate_code (CPUState *env, struct TranslationBlock *tb) | 6384 | +void gen_intermediate_code (CPUState *env, struct TranslationBlock *tb) |
6386 | { | 6385 | { |
6387 | - return gen_intermediate_code_internal(env, tb, 0); | 6386 | + gen_intermediate_code_internal(env, tb, 0); |
6388 | } | 6387 | } |
6389 | 6388 | ||
6390 | -int gen_intermediate_code_pc (CPUState *env, struct TranslationBlock *tb) | 6389 | +void gen_intermediate_code_pc (CPUState *env, struct TranslationBlock *tb) |
6391 | { | 6390 | { |
6392 | - return gen_intermediate_code_internal(env, tb, 1); | 6391 | + gen_intermediate_code_internal(env, tb, 1); |
6393 | } | 6392 | } |
6394 | 6393 | ||
6395 | void gen_pc_load(CPUState *env, TranslationBlock *tb, | 6394 | void gen_pc_load(CPUState *env, TranslationBlock *tb, |
target-sh4/translate.c
@@ -1195,7 +1195,7 @@ void decode_opc(DisasContext * ctx) | @@ -1195,7 +1195,7 @@ void decode_opc(DisasContext * ctx) | ||
1195 | } | 1195 | } |
1196 | } | 1196 | } |
1197 | 1197 | ||
1198 | -static inline int | 1198 | +static inline void |
1199 | gen_intermediate_code_internal(CPUState * env, TranslationBlock * tb, | 1199 | gen_intermediate_code_internal(CPUState * env, TranslationBlock * tb, |
1200 | int search_pc) | 1200 | int search_pc) |
1201 | { | 1201 | { |
@@ -1326,17 +1326,16 @@ gen_intermediate_code_internal(CPUState * env, TranslationBlock * tb, | @@ -1326,17 +1326,16 @@ gen_intermediate_code_internal(CPUState * env, TranslationBlock * tb, | ||
1326 | fprintf(logfile, "\n"); | 1326 | fprintf(logfile, "\n"); |
1327 | } | 1327 | } |
1328 | #endif | 1328 | #endif |
1329 | - return 0; | ||
1330 | } | 1329 | } |
1331 | 1330 | ||
1332 | -int gen_intermediate_code(CPUState * env, struct TranslationBlock *tb) | 1331 | +void gen_intermediate_code(CPUState * env, struct TranslationBlock *tb) |
1333 | { | 1332 | { |
1334 | - return gen_intermediate_code_internal(env, tb, 0); | 1333 | + gen_intermediate_code_internal(env, tb, 0); |
1335 | } | 1334 | } |
1336 | 1335 | ||
1337 | -int gen_intermediate_code_pc(CPUState * env, struct TranslationBlock *tb) | 1336 | +void gen_intermediate_code_pc(CPUState * env, struct TranslationBlock *tb) |
1338 | { | 1337 | { |
1339 | - return gen_intermediate_code_internal(env, tb, 1); | 1338 | + gen_intermediate_code_internal(env, tb, 1); |
1340 | } | 1339 | } |
1341 | 1340 | ||
1342 | void gen_pc_load(CPUState *env, TranslationBlock *tb, | 1341 | void gen_pc_load(CPUState *env, TranslationBlock *tb, |
target-sparc/translate.c
@@ -4724,8 +4724,8 @@ static void disas_sparc_insn(DisasContext * dc) | @@ -4724,8 +4724,8 @@ static void disas_sparc_insn(DisasContext * dc) | ||
4724 | #endif | 4724 | #endif |
4725 | } | 4725 | } |
4726 | 4726 | ||
4727 | -static inline int gen_intermediate_code_internal(TranslationBlock * tb, | ||
4728 | - int spc, CPUSPARCState *env) | 4727 | +static inline void gen_intermediate_code_internal(TranslationBlock * tb, |
4728 | + int spc, CPUSPARCState *env) | ||
4729 | { | 4729 | { |
4730 | target_ulong pc_start, last_pc; | 4730 | target_ulong pc_start, last_pc; |
4731 | uint16_t *gen_opc_end; | 4731 | uint16_t *gen_opc_end; |
@@ -4869,17 +4869,16 @@ static inline int gen_intermediate_code_internal(TranslationBlock * tb, | @@ -4869,17 +4869,16 @@ static inline int gen_intermediate_code_internal(TranslationBlock * tb, | ||
4869 | fprintf(logfile, "\n"); | 4869 | fprintf(logfile, "\n"); |
4870 | } | 4870 | } |
4871 | #endif | 4871 | #endif |
4872 | - return 0; | ||
4873 | } | 4872 | } |
4874 | 4873 | ||
4875 | -int gen_intermediate_code(CPUSPARCState * env, TranslationBlock * tb) | 4874 | +void gen_intermediate_code(CPUSPARCState * env, TranslationBlock * tb) |
4876 | { | 4875 | { |
4877 | - return gen_intermediate_code_internal(tb, 0, env); | 4876 | + gen_intermediate_code_internal(tb, 0, env); |
4878 | } | 4877 | } |
4879 | 4878 | ||
4880 | -int gen_intermediate_code_pc(CPUSPARCState * env, TranslationBlock * tb) | 4879 | +void gen_intermediate_code_pc(CPUSPARCState * env, TranslationBlock * tb) |
4881 | { | 4880 | { |
4882 | - return gen_intermediate_code_internal(tb, 1, env); | 4881 | + gen_intermediate_code_internal(tb, 1, env); |
4883 | } | 4882 | } |
4884 | 4883 | ||
4885 | void gen_intermediate_code_init(CPUSPARCState *env) | 4884 | void gen_intermediate_code_init(CPUSPARCState *env) |
translate-all.c
@@ -94,9 +94,8 @@ int cpu_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr) | @@ -94,9 +94,8 @@ int cpu_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr) | ||
94 | #endif | 94 | #endif |
95 | tcg_func_start(s); | 95 | tcg_func_start(s); |
96 | 96 | ||
97 | - if (gen_intermediate_code(env, tb) < 0) | ||
98 | - return -1; | ||
99 | - | 97 | + gen_intermediate_code(env, tb); |
98 | + | ||
100 | /* generate machine code */ | 99 | /* generate machine code */ |
101 | gen_code_buf = tb->tc_ptr; | 100 | gen_code_buf = tb->tc_ptr; |
102 | tb->tb_next_offset[0] = 0xffff; | 101 | tb->tb_next_offset[0] = 0xffff; |
@@ -156,8 +155,7 @@ int cpu_restore_state(TranslationBlock *tb, | @@ -156,8 +155,7 @@ int cpu_restore_state(TranslationBlock *tb, | ||
156 | #endif | 155 | #endif |
157 | tcg_func_start(s); | 156 | tcg_func_start(s); |
158 | 157 | ||
159 | - if (gen_intermediate_code_pc(env, tb) < 0) | ||
160 | - return -1; | 158 | + gen_intermediate_code_pc(env, tb); |
161 | 159 | ||
162 | if (use_icount) { | 160 | if (use_icount) { |
163 | /* Reset the cycle counter to the start of the block. */ | 161 | /* Reset the cycle counter to the start of the block. */ |