88 |
|
static bool avoid_fpu = true; // Flag: compile FPU instructions ? |
89 |
|
static bool have_cmov = false; // target has CMOV instructions ? |
90 |
|
static bool have_rat_stall = true; // target has partial register stalls ? |
91 |
+ |
static bool tune_alignment = false; // Tune code alignments for running CPU ? |
92 |
+ |
static int align_loops = 32; // Align the start of loops |
93 |
+ |
static int align_jumps = 32; // Align the start of jumps |
94 |
|
static int zero_fd = -1; |
95 |
|
static int optcount[10] = { |
96 |
|
10, // How often a block has to be executed before it is translated |
107 |
|
}; |
108 |
|
static op_properties prop[65536]; |
109 |
|
|
107 |
– |
// gb-- Control Flow Predicates |
108 |
– |
|
110 |
|
static inline int end_block(uae_u32 opcode) |
111 |
|
{ |
112 |
|
return (prop[opcode].cflow & fl_end_block); |
113 |
|
} |
114 |
|
|
114 |
– |
static inline bool may_trap(uae_u32 opcode) |
115 |
– |
{ |
116 |
– |
return (prop[opcode].cflow & fl_trap); |
117 |
– |
} |
118 |
– |
|
115 |
|
uae_u8* start_pc_p; |
116 |
|
uae_u32 start_pc; |
117 |
|
uae_u32 current_block_pc_p; |
4558 |
|
raw_init_cpu(); |
4559 |
|
write_log("<JIT compiler> : target processor has CMOV instructions : %s\n", have_cmov ? "yes" : "no"); |
4560 |
|
write_log("<JIT compiler> : target processor can suffer from partial register stalls : %s\n", have_rat_stall ? "yes" : "no"); |
4561 |
+ |
write_log("<JIT compiler> : alignment for loops, jumps are %d, %d\n", align_loops, align_jumps); |
4562 |
|
|
4563 |
|
// Translation cache flush mechanism |
4564 |
|
lazy_flush = PrefsFindBool("jitlazyflush"); |
5404 |
|
registers before jumping back to the various get-out routines. |
5405 |
|
This generates the code for it. |
5406 |
|
*/ |
5407 |
< |
popall_do_nothing=current_compile_p; |
5407 |
> |
align_target(align_jumps); |
5408 |
> |
popall_do_nothing=get_target(); |
5409 |
|
for (i=0;i<N_REGS;i++) { |
5410 |
|
if (need_to_preserve[i]) |
5411 |
|
raw_pop_l_r(i); |
5412 |
|
} |
5413 |
|
raw_jmp((uae_u32)do_nothing); |
5416 |
– |
align_target(32); |
5414 |
|
|
5415 |
+ |
align_target(align_jumps); |
5416 |
|
popall_execute_normal=get_target(); |
5417 |
|
for (i=0;i<N_REGS;i++) { |
5418 |
|
if (need_to_preserve[i]) |
5419 |
|
raw_pop_l_r(i); |
5420 |
|
} |
5421 |
|
raw_jmp((uae_u32)execute_normal); |
5424 |
– |
align_target(32); |
5422 |
|
|
5423 |
+ |
align_target(align_jumps); |
5424 |
|
popall_cache_miss=get_target(); |
5425 |
|
for (i=0;i<N_REGS;i++) { |
5426 |
|
if (need_to_preserve[i]) |
5427 |
|
raw_pop_l_r(i); |
5428 |
|
} |
5429 |
|
raw_jmp((uae_u32)cache_miss); |
5432 |
– |
align_target(32); |
5430 |
|
|
5431 |
+ |
align_target(align_jumps); |
5432 |
|
popall_recompile_block=get_target(); |
5433 |
|
for (i=0;i<N_REGS;i++) { |
5434 |
|
if (need_to_preserve[i]) |
5435 |
|
raw_pop_l_r(i); |
5436 |
|
} |
5437 |
|
raw_jmp((uae_u32)recompile_block); |
5438 |
< |
align_target(32); |
5439 |
< |
|
5438 |
> |
|
5439 |
> |
align_target(align_jumps); |
5440 |
|
popall_exec_nostats=get_target(); |
5441 |
|
for (i=0;i<N_REGS;i++) { |
5442 |
|
if (need_to_preserve[i]) |
5443 |
|
raw_pop_l_r(i); |
5444 |
|
} |
5445 |
|
raw_jmp((uae_u32)exec_nostats); |
5446 |
< |
align_target(32); |
5447 |
< |
|
5446 |
> |
|
5447 |
> |
align_target(align_jumps); |
5448 |
|
popall_check_checksum=get_target(); |
5449 |
|
for (i=0;i<N_REGS;i++) { |
5450 |
|
if (need_to_preserve[i]) |
5451 |
|
raw_pop_l_r(i); |
5452 |
|
} |
5453 |
|
raw_jmp((uae_u32)check_checksum); |
5454 |
< |
align_target(32); |
5455 |
< |
|
5454 |
> |
|
5455 |
> |
align_target(align_jumps); |
5456 |
|
current_compile_p=get_target(); |
5457 |
|
#else |
5458 |
|
popall_exec_nostats=(void *)exec_nostats; |
5494 |
|
int i; |
5495 |
|
|
5496 |
|
set_target(current_compile_p); |
5497 |
< |
align_target(32); |
5497 |
> |
align_target(align_jumps); |
5498 |
|
bi->direct_pen=(cpuop_func *)get_target(); |
5499 |
|
raw_mov_l_rm(0,(uae_u32)&(bi->pc_p)); |
5500 |
|
raw_mov_l_mr((uae_u32)®s.pc_p,0); |
5501 |
|
raw_jmp((uae_u32)popall_execute_normal); |
5502 |
|
|
5503 |
< |
align_target(32); |
5503 |
> |
align_target(align_jumps); |
5504 |
|
bi->direct_pcc=(cpuop_func *)get_target(); |
5505 |
|
raw_mov_l_rm(0,(uae_u32)&(bi->pc_p)); |
5506 |
|
raw_mov_l_mr((uae_u32)®s.pc_p,0); |
5507 |
|
raw_jmp((uae_u32)popall_check_checksum); |
5510 |
– |
|
5511 |
– |
align_target(32); |
5508 |
|
current_compile_p=get_target(); |
5509 |
|
|
5510 |
|
bi->deplist=NULL; |
5916 |
|
|
5917 |
|
bi->needed_flags=liveflags[0]; |
5918 |
|
|
5919 |
< |
align_target(32); |
5919 |
> |
align_target(align_loops); |
5920 |
|
was_comp=0; |
5921 |
|
|
5922 |
|
bi->direct_handler=(cpuop_func *)get_target(); |
6091 |
|
raw_jmp((uae_u32)popall_do_nothing); |
6092 |
|
create_jmpdep(bi,0,tba,t1); |
6093 |
|
|
6094 |
< |
align_target(16); |
6094 |
> |
align_target(align_jumps); |
6095 |
|
/* not-predicted outcome */ |
6096 |
|
*branchadd=(uae_u32)get_target()-((uae_u32)branchadd+4); |
6097 |
|
live=tmp; /* Ouch again */ |
6197 |
|
#endif |
6198 |
|
|
6199 |
|
log_dump(); |
6200 |
< |
align_target(32); |
6200 |
> |
align_target(align_jumps); |
6201 |
|
|
6202 |
|
/* This is the non-direct handler */ |
6203 |
|
bi->handler= |
6213 |
|
|
6214 |
|
raw_jmp((uae_u32)bi->direct_handler); |
6215 |
|
|
6220 |
– |
align_target(32); |
6216 |
|
current_compile_p=get_target(); |
6222 |
– |
|
6217 |
|
raise_in_cl_list(bi); |
6218 |
|
|
6219 |
|
/* We will flush soon, anyway, so let's do it now */ |