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
This commit is contained in:
		
							parent
							
								
									d1b5c20dcd
								
							
						
					
					
						commit
						2cfc5f17d3
					
				| @ -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); | ||||
| 
 | ||||
|  | ||||
| @ -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) | ||||
|  | ||||
| @ -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] = { | ||||
|  | ||||
| @ -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, | ||||
|  | ||||
| @ -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, | ||||
|  | ||||
| @ -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, | ||||
|  | ||||
| @ -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, | ||||
|  | ||||
| @ -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, | ||||
|  | ||||
| @ -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, | ||||
|  | ||||
| @ -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) | ||||
|  | ||||
| @ -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.  */ | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 ths
						ths