From: Frode Solheim Date: Sun, 6 Sep 2015 15:46:23 +0000 (+0200) Subject: JIT: removed unused optimizer code (USE_OPTIMIZER) X-Git-Tag: 3200~79^2~46 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=725df13cc2eafad2e27fb32b22a20137a320adee;p=francis%2Fwinuae.git JIT: removed unused optimizer code (USE_OPTIMIZER) --- diff --git a/jit/codegen_x86.cpp b/jit/codegen_x86.cpp index 5b2629b9..66ef7b2a 100644 --- a/jit/codegen_x86.cpp +++ b/jit/codegen_x86.cpp @@ -123,8 +123,6 @@ uae_u8 need_to_preserve[]={1,1,1,1,0,1,1,1}; * Actual encoding of the instructions on the target CPU * *************************************************************************/ -//#include "compemu_optimizer_x86.c" - STATIC_INLINE uae_u16 swap16(uae_u16 x) { return ((x&0xff00)>>8)|((x&0x00ff)<<8); @@ -1469,14 +1467,12 @@ LENDFUNC(WRITE,READ,0,raw_popfl,(void)) STATIC_INLINE void raw_call_r(R4 r) { - lopt_emit_all(); emit_byte(0xff); emit_byte(0xd0+r); } STATIC_INLINE void raw_jmp_r(R4 r) { - lopt_emit_all(); emit_byte(0xff); emit_byte(0xe0+r); } @@ -1492,7 +1488,6 @@ STATIC_INLINE void raw_jmp_m_indexed(uae_u32 base, uae_u32 r, uae_u32 m) case 8: sib = 0xC5; break; default: abort(); } - lopt_emit_all(); emit_byte(0xff); emit_byte(0x24); emit_byte(8*r+sib); @@ -1501,7 +1496,6 @@ STATIC_INLINE void raw_jmp_m_indexed(uae_u32 base, uae_u32 r, uae_u32 m) STATIC_INLINE void raw_jmp_m(uae_u32 base) { - lopt_emit_all(); emit_byte(0xff); emit_byte(0x25); emit_long(base); @@ -1509,21 +1503,18 @@ STATIC_INLINE void raw_jmp_m(uae_u32 base) STATIC_INLINE void raw_call(uae_u32 t) { - lopt_emit_all(); emit_byte(0xe8); emit_long(t-(uae_u32)target-4); } STATIC_INLINE void raw_jmp(uae_u32 t) { - lopt_emit_all(); emit_byte(0xe9); emit_long(t-(uae_u32)target-4); } STATIC_INLINE void raw_jl(uae_u32 t) { - lopt_emit_all(); emit_byte(0x0f); emit_byte(0x8c); emit_long(t-(uae_u32)target-4); @@ -1531,7 +1522,6 @@ STATIC_INLINE void raw_jl(uae_u32 t) STATIC_INLINE void raw_jz(uae_u32 t) { - lopt_emit_all(); emit_byte(0x0f); emit_byte(0x84); emit_long(t-(uae_u32)target-4); @@ -1539,7 +1529,6 @@ STATIC_INLINE void raw_jz(uae_u32 t) STATIC_INLINE void raw_jnz(uae_u32 t) { - lopt_emit_all(); emit_byte(0x0f); emit_byte(0x85); emit_long(t-(uae_u32)target-4); @@ -1547,51 +1536,43 @@ STATIC_INLINE void raw_jnz(uae_u32 t) STATIC_INLINE void raw_jnz_l_oponly(void) { - lopt_emit_all(); emit_byte(0x0f); emit_byte(0x85); } STATIC_INLINE void raw_jcc_l_oponly(int cc) { - lopt_emit_all(); emit_byte(0x0f); emit_byte(0x80+cc); } STATIC_INLINE void raw_jnz_b_oponly(void) { - lopt_emit_all(); emit_byte(0x75); } STATIC_INLINE void raw_jz_b_oponly(void) { - lopt_emit_all(); emit_byte(0x74); } STATIC_INLINE void raw_jmp_l_oponly(void) { - lopt_emit_all(); emit_byte(0xe9); } STATIC_INLINE void raw_jmp_b_oponly(void) { - lopt_emit_all(); emit_byte(0xeb); } STATIC_INLINE void raw_ret(void) { - lopt_emit_all(); emit_byte(0xc3); } STATIC_INLINE void raw_nop(void) { - lopt_emit_all(); emit_byte(0x90); } diff --git a/jit/compemu.h b/jit/compemu.h index 8d1fec9a..58a190a0 100644 --- a/jit/compemu.h +++ b/jit/compemu.h @@ -35,8 +35,6 @@ typedef union { extern signed long pissoff; -#define USE_OPTIMIZER 0 -#define USE_LOW_OPTIMIZER 0 #define USE_ALIAS 1 #define USE_F_ALIAS 1 #define USE_SOFT_FLUSH 1 @@ -269,15 +267,9 @@ extern int touchcnt; #define LOWFUNC(flags,mem,nargs,func,args) STATIC_INLINE void func args #define LENDFUNC(flags,mem,nargs,func,args) -#if USE_OPTIMIZER -#define REGALLOC_O 2 -#define PEEPHOLE_O 3 /* Has to be >= REGALLOC */ -#define DECLARE(func) extern void func; extern void do_##func -#else #define REGALLOC_O 2000000 #define PEEPHOLE_O 2000000 #define DECLARE(func) extern void func -#endif /* What we expose to the outside */ @@ -515,7 +507,6 @@ extern void sync_m68k_pc(void); extern uae_u32 get_const(int r); extern int is_const(int r); extern void register_branch(uae_u32 not_taken, uae_u32 taken, uae_u8 cond); -extern void empty_optimizer(void); #define comp_get_ibyte(o) do_get_mem_byte((uae_u8 *)(comp_pc_p + (o) + 1)) #define comp_get_iword(o) do_get_mem_word((uae_u16 *)(comp_pc_p + (o))) diff --git a/jit/compemu_optimizer_x86.cpp b/jit/compemu_optimizer_x86.cpp deleted file mode 100644 index f84fdc62..00000000 --- a/jit/compemu_optimizer_x86.cpp +++ /dev/null @@ -1,421 +0,0 @@ -#if USE_LOW_OPTIMIZER -/* Welcome to the magical world of cpp ;-) */ - -/* This was broken by the advent of FPU emulation. It also didn't - provide any useful speedup while it worked. *Sigh* Someone fix my - software, please ;-) */ - -#define MAXLOPTINST 100 - -#define LDECISION currprefs.comp_lowopt - -#define lopt_op0(dummy) lopt_store_op0( -#define lopt_op1(a1) lopt_store_op1(LOPT_##a1, -#define lopt_op2(a1,a2) lopt_store_op2(LOPT_##a1,LOPT_##a2, -#define lopt_op3(a1,a2,a3) lopt_store_op3(LOPT_##a1,LOPT_##a2,LOPT_##a3, -#define lopt_op4(a1,a2,a3,a4) lopt_store_op4(LOPT_##a1,LOPT_##a2,LOPT_##a3,LOPT_##a4, -#define lopt_op5(a1,a2,a3,a4,a5) lopt_store_op5(LOPT_##a1,LOPT_##a2,LOPT_##a3,LOPT_##a4,LOPT_##a5, - -#define ldirect0(dummy) () -#define ldirect1(a1) (LDIR_##a1) -#define ldirect2(a1,a2) (LDIR_##a1,LDIR_##a2) -#define ldirect3(a1,a2,a3) (LDIR_##a1,LDIR_##a2,LDIR_##a3) -#define ldirect4(a1,a2,a3,a4) (LDIR_##a1,LDIR_##a2,LDIR_##a3,LDIR_##a4) -#define ldirect5(a1,a2,a3,a4,a5) (LDIR_##a1,LDIR_##a2,LDIR_##a3,LDIR_##a4,LDIR_##a5) - -#define NONE 0 -#define READ 1 -#define WRITE 2 -#define RMW (READ|WRITE) - -#define SIZE1 4 -#define SIZE2 8 -#define SIZE4 12 -#define FLOAT 16 -#define SIZEMASK 12 - -#define LIMM NONE -#define LR1 (READ | SIZE1) -#define LR2 (READ | SIZE2) -#define LR4 (READ | SIZE4) -#define LW1 (WRITE | SIZE1) -#define LW2 (WRITE | SIZE2) -#define LW4 (WRITE | SIZE4) -#define LRW1 (RMW | SIZE1) -#define LRW2 (RMW | SIZE2) -#define LRW4 (RMW | SIZE4) -#define LFW (READ | FLOAT) -#define LFR (WRITE | FLOAT) -#define LFRW (RMW | FLOAT) -#define LMEMR NONE -#define LMEMW NONE -#define LMEMRW NONE - -#define LOPT_IMM LIMM, -#define LOPT_R1 LR1 , -#define LOPT_R2 LR2 , -#define LOPT_R4 LR4 , -#define LOPT_W1 LW1 , -#define LOPT_W2 LW2 , -#define LOPT_W4 LW4 , -#define LOPT_RW1 LRW1, -#define LOPT_RW2 LRW2, -#define LOPT_RW4 LRW4, -#define LOPT_FR LFR, -#define LOPT_FW LFW, -#define LOPT_FRW LFRW, -#define LOPT_MEMR LMEMR, -#define LOPT_MEMW LMEMW, -#define LOPT_MEMRW LMEMRW, - -#define LDIR_IMM -#define LDIR_R1 -#define LDIR_R2 -#define LDIR_R4 -#define LDIR_W1 -#define LDIR_W2 -#define LDIR_W4 -#define LDIR_RW1 -#define LDIR_RW2 -#define LDIR_RW4 -#define LDIR_FW -#define LDIR_FR -#define LDIR_FRW -#define LDIR_MEMR -#define LDIR_MEMW -#define LDIR_MEMRW - - -#undef LOWFUNC -#undef LENDFUNC - -#define LOWFUNC(flags,mem,nargs,func,args) \ - STATIC_INLINE void do_##func args - -#define LENDFUNC(flags,mem,nargs,func,args) \ - STATIC_INLINE void func args \ - { \ - if (LDECISION) { \ - lopt_op##nargs##args do_##func, mem, flags); \ - } else { \ - do_##func ldirect##nargs##args; \ - } \ - } - -typedef struct lopt_inst_rec { - void* func; - uae_u32 args[5]; - uae_u8 argtype[5]; - uae_s8 nargs; - uae_u8 mem; - uae_u8 flags; -} lopt_inst; - - - -static lopt_inst linst[MAXLOPTINST]; -static int lopt_index=0; - -STATIC_INLINE int argsize(int type) -{ - return type&SIZEMASK; -} - -STATIC_INLINE int reads_mem(int i) { - return linst[i].mem & READ; -} - - -STATIC_INLINE int access_reg(int i, int r, int mode) -{ - int k; - for (k=0;k=i-4 && j>=0 && !depends_on(i,j)) { - j--; - } - if (j!=i-1) { - lopt_inst x=linst[i]; - int k=i; - - j++; - while (k>j) { - linst[k]=linst[k-1]; - k--; - } - linst[j]=x; - } - } - } -} - - -typedef void lopt_handler0(void); -typedef void lopt_handler1(uae_u32); -typedef void lopt_handler2(uae_u32,uae_u32); -typedef void lopt_handler3(uae_u32,uae_u32,uae_u32); -typedef void lopt_handler4(uae_u32,uae_u32,uae_u32,uae_u32); -typedef void lopt_handler5(uae_u32,uae_u32,uae_u32,uae_u32,uae_u32); - -static void lopt_emit_all(void) -{ - int i; - lopt_inst* x; - static int inemit=0; - - if (inemit) { - printf("WARNING: lopt_emit is not reentrant!\n"); - } - inemit=1; - - low_peephole(); - - for (i=0;inargs) { - case 0: ((lopt_handler0*)x->func)(); break; - case 1: ((lopt_handler1*)x->func)(x->args[0]); break; - case 2: ((lopt_handler2*)x->func)(x->args[0],x->args[1]); break; - case 3: ((lopt_handler3*)x->func)(x->args[0],x->args[1],x->args[2]); break; - case 4: ((lopt_handler4*)x->func)(x->args[0],x->args[1],x->args[2], - x->args[3]); break; - case 5: ((lopt_handler5*)x->func)(x->args[0],x->args[1],x->args[2], - x->args[3],x->args[4]); break; - default: abort(); - } - } - lopt_index=0; - inemit=0; -} - -STATIC_INLINE void low_advance(void) -{ - lopt_index++; - if (lopt_index==MAXLOPTINST) - lopt_emit_all(); -} - -STATIC_INLINE void lopt_store_op0(void* lfuncptr, uae_u32 lmem, - uae_u32 lflags) -{ - linst[lopt_index].func=lfuncptr; - linst[lopt_index].mem=lmem; - linst[lopt_index].flags=lflags; - linst[lopt_index].nargs=0; - low_advance(); -} - -STATIC_INLINE void lopt_store_op1(uae_u8 t1, uae_u32 a1, - void* lfuncptr, uae_u32 lmem, - uae_u32 lflags) -{ - linst[lopt_index].func=lfuncptr; - linst[lopt_index].mem=lmem; - linst[lopt_index].flags=lflags; - linst[lopt_index].nargs=1; - linst[lopt_index].argtype[0]=t1; - linst[lopt_index].args[0]=a1; - low_advance(); -} - -STATIC_INLINE void lopt_store_op2(uae_u8 t1, uae_u32 a1, - uae_u8 t2, uae_u32 a2, - void* lfuncptr, uae_u32 lmem, - uae_u32 lflags) -{ - linst[lopt_index].func=lfuncptr; - linst[lopt_index].mem=lmem; - linst[lopt_index].flags=lflags; - linst[lopt_index].nargs=2; - linst[lopt_index].argtype[0]=t1; - linst[lopt_index].args[0]=a1; - linst[lopt_index].argtype[1]=t2; - linst[lopt_index].args[1]=a2; - low_advance(); -} - -STATIC_INLINE void lopt_store_op3(uae_u8 t1, uae_u32 a1, - uae_u8 t2, uae_u32 a2, - uae_u8 t3, uae_u32 a3, - void* lfuncptr, uae_u32 lmem, - uae_u32 lflags) -{ - linst[lopt_index].func=lfuncptr; - linst[lopt_index].mem=lmem; - linst[lopt_index].flags=lflags; - linst[lopt_index].nargs=3; - linst[lopt_index].argtype[0]=t1; - linst[lopt_index].args[0]=a1; - linst[lopt_index].argtype[1]=t2; - linst[lopt_index].args[1]=a2; - linst[lopt_index].argtype[2]=t3; - linst[lopt_index].args[2]=a3; - low_advance(); -} - -STATIC_INLINE void lopt_store_op4(uae_u8 t1, uae_u32 a1, - uae_u8 t2, uae_u32 a2, - uae_u8 t3, uae_u32 a3, - uae_u8 t4, uae_u32 a4, - void* lfuncptr, uae_u32 lmem, - uae_u32 lflags) -{ - linst[lopt_index].func=lfuncptr; - linst[lopt_index].mem=lmem; - linst[lopt_index].flags=lflags; - linst[lopt_index].nargs=4; - linst[lopt_index].argtype[0]=t1; - linst[lopt_index].args[0]=a1; - linst[lopt_index].argtype[1]=t2; - linst[lopt_index].args[1]=a2; - linst[lopt_index].argtype[2]=t3; - linst[lopt_index].args[2]=a3; - linst[lopt_index].argtype[3]=t4; - linst[lopt_index].args[3]=a4; - low_advance(); -} - -STATIC_INLINE void lopt_store_op5(uae_u8 t1, uae_u32 a1, - uae_u8 t2, uae_u32 a2, - uae_u8 t3, uae_u32 a3, - uae_u8 t4, uae_u32 a4, - uae_u8 t5, uae_u32 a5, - void* lfuncptr, uae_u32 lmem, - uae_u32 lflags) -{ - linst[lopt_index].func=lfuncptr; - linst[lopt_index].mem=lmem; - linst[lopt_index].flags=lflags; - linst[lopt_index].nargs=5; - linst[lopt_index].argtype[0]=t1; - linst[lopt_index].args[0]=a1; - linst[lopt_index].argtype[1]=t2; - linst[lopt_index].args[1]=a2; - linst[lopt_index].argtype[2]=t3; - linst[lopt_index].args[2]=a3; - linst[lopt_index].argtype[3]=t4; - linst[lopt_index].args[3]=a4; - linst[lopt_index].argtype[4]=t5; - linst[lopt_index].args[4]=a5; - low_advance(); -} - -STATIC_INLINE void empty_low_optimizer(void) -{ - lopt_emit_all(); -} - -#else -#define lopt_emit_all() -#define empty_low_optimizer() -#endif diff --git a/jit/compemu_support.cpp b/jit/compemu_support.cpp index 0c593f04..5e0d49d0 100644 --- a/jit/compemu_support.cpp +++ b/jit/compemu_support.cpp @@ -562,10 +562,6 @@ static inline blockinfo* get_blockinfo_addr_new(void* addr, int /* setstate */) blockinfo* bi=get_blockinfo_addr(addr); int i; -#if USE_OPTIMIZER - if (reg_alloc_run) - return NULL; -#endif if (!bi) { for (i=0;idirect_handler_to_use); } */ @@ -2754,11 +2729,6 @@ static uae_u32 get_handler(uae_u32 addr) { (void)cacheline(addr); blockinfo* bi=get_blockinfo_addr_new((void*)(uintptr)addr,0); - -#if USE_OPTIMIZER - if (!bi && reg_alloc_run) - return 0; -#endif return (uintptr)bi->direct_handler_to_use; }