From e6856a8ab807fc7720620ed68b6cc1a02c9600c9 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Tue, 28 Jul 2020 16:06:18 +0300 Subject: [PATCH] Separated NOFLAGS_SUPPORT to NOFLAGS_SUPPORT_GENCOMP and NOFLAGS_SUPPORT_GENCPU --- gencpu.cpp | 32 +++++++++++++++++++++---- include/newcpu.h | 2 ++ jit/compemu_support.cpp | 52 ++++++++++++++++++++++------------------- od-win32/sysconfig.h | 3 ++- 4 files changed, 59 insertions(+), 30 deletions(-) diff --git a/gencpu.cpp b/gencpu.cpp index b4f3fe51..62d0469f 100644 --- a/gencpu.cpp +++ b/gencpu.cpp @@ -9246,6 +9246,7 @@ struct cputbl_tmp uae_s16 length; uae_s8 disp020[2]; uae_s8 branch; + uae_s8 nf; }; static struct cputbl_tmp cputbltmp[65536]; @@ -9323,12 +9324,20 @@ static void generate_one_opcode (int rp, const char *extra) if (opcode_next_clev[rp] != cpu_level) { char *name = ua (lookuptab[idx].name); - if (generate_stbl) - fprintf(stblfile, "{ %sop_%04x_%d%s_ff, %sop_%04x_%d%s_ff, 0x%04x, %d, { %d, %d }, %d }, /* %s */\n", + if (generate_stbl) { +#ifdef NOFLAGS_SUPPORT_GENCPU + fprintf(stblfile, "{ %sop_%04x_%d%s_ff, %sop_%04x_%d%s_%s, 0x%04x, %d, { %d, %d }, %d }, /* %s */\n", (using_ce || using_ce020) ? "(cpuop_func*)" : "", opcode, opcode_last_postfix[rp], extra, + (using_ce || using_ce020) ? "(cpuop_func*)" : "", opcode, opcode_last_postfix[rp], extra, cputbltmp[opcode].nf ? "nf" : "ff", + opcode, + cputbltmp[opcode].length, cputbltmp[opcode].disp020[0], cputbltmp[opcode].disp020[1], cputbltmp[opcode].branch, name); +#else + fprintf(stblfile, "{ %sop_%04x_%d%s_ff, 0x%04x, %d, { %d, %d }, %d }, /* %s */\n", (using_ce || using_ce020) ? "(cpuop_func*)" : "", opcode, opcode_last_postfix[rp], extra, opcode, cputbltmp[opcode].length, cputbltmp[opcode].disp020[0], cputbltmp[opcode].disp020[1], cputbltmp[opcode].branch, name); +#endif + } xfree (name); return; } @@ -9425,6 +9434,7 @@ static void generate_one_opcode (int rp, const char *extra) if (genamode8r_offset[1] > 0) cputbltmp[opcode].disp020[1] = m68k_pc_total - genamode8r_offset[1] + 2; cputbltmp[opcode].branch = branch_inst / 2; + cputbltmp[opcode].nf = 0; if (m68k_pc_total > 0) out("/* %d %d,%d %c */\n", @@ -9438,23 +9448,31 @@ static void generate_one_opcode (int rp, const char *extra) printf("%s", outbuffer); - int nfgenerated = 0; // generate noflags variant if needed + int nfgenerated = 0; if (using_noflags && table68k[opcode].flagdead != 0 && !disable_noflags) { convert_to_noflags(outbuffer); printf("%s", outbuffer); nfgenerated = 1; + cputbltmp[opcode].nf = 1; } if (generate_stbl) { char *name = ua (lookuptab[idx].name); if (i68000) fprintf(stblfile, "#ifndef CPUEMU_68000_ONLY\n"); +#ifdef NOFLAGS_SUPPORT_GENCPU fprintf(stblfile, "{ %sop_%04x_%d%s_ff, %sop_%04x_%d%s_%s, 0x%04x, %d, { %d, %d }, %d }, /* %s */\n", (using_ce || using_ce020) ? "(cpuop_func*)" : "", opcode, postfix, extra, (using_ce || using_ce020) ? "(cpuop_func*)" : "", opcode, postfix, extra, nfgenerated ? "nf" : "ff", opcode, cputbltmp[opcode].length, cputbltmp[opcode].disp020[0], cputbltmp[opcode].disp020[1], cputbltmp[opcode].branch, name); +#else + fprintf(stblfile, "{ %sop_%04x_%d%s_ff, 0x%04x, %d, { %d, %d }, %d }, /* %s */\n", + (using_ce || using_ce020) ? "(cpuop_func*)" : "", opcode, postfix, extra, + opcode, + cputbltmp[opcode].length, cputbltmp[opcode].disp020[0], cputbltmp[opcode].disp020[1], cputbltmp[opcode].branch, name); +#endif if (i68000) fprintf(stblfile, "#endif\n"); xfree (name); @@ -9742,8 +9760,10 @@ static void generate_cpu (int id, int mode) opcode_next_clev[rp] = cpu_level; } using_indirect = -1; - using_noflags = 1; using_nocycles = 1; +#ifdef NOFLAGS_SUPPORT_GENCPU + using_noflags = 1; +#endif #ifdef HAVE_GET_WORD_UNSWAPPED using_get_word_unswapped = 1; #endif @@ -9752,8 +9772,10 @@ static void generate_cpu (int id, int mode) cpu_generic = true; need_special_fixup = 1; need_exception_oldpc = 1; - using_noflags = 1; using_nocycles = 1; +#ifdef NOFLAGS_SUPPORT_GENCPU + using_noflags = 1; +#endif #ifdef HAVE_GET_WORD_UNSWAPPED using_get_word_unswapped = 1; #endif diff --git a/include/newcpu.h b/include/newcpu.h index 355fb132..41fab0bd 100644 --- a/include/newcpu.h +++ b/include/newcpu.h @@ -59,7 +59,9 @@ typedef void REGPARAM3 cpuop_func_ce (uae_u32) REGPARAM; struct cputbl { cpuop_func *handler_ff; +#ifdef NOFLAGS_SUPPORT_GENCPU cpuop_func *handler_nf; +#endif uae_u16 opcode; uae_s8 length; uae_s8 disp020[2]; diff --git a/jit/compemu_support.cpp b/jit/compemu_support.cpp index 96412351..15463388 100644 --- a/jit/compemu_support.cpp +++ b/jit/compemu_support.cpp @@ -259,7 +259,7 @@ static int untranslated_compfn(const void *e1, const void *e2) static compop_func *compfunctbl[65536]; static compop_func *nfcompfunctbl[65536]; -#ifdef NOFLAGS_SUPPORT +#ifdef NOFLAGS_SUPPORT_GENCOMP static cpuop_func *nfcpufunctbl[65536]; #endif uae_u8* comp_pc_p; @@ -400,26 +400,13 @@ static blockinfo* hold_bi[MAX_HOLD_BI]; static blockinfo* active; static blockinfo* dormant; -#ifdef NOFLAGS_SUPPORT +#ifdef NOFLAGS_SUPPORT_GENCOMP /* 68040 */ extern const struct cputbl op_smalltbl_0[]; #endif extern const struct comptbl op_smalltbl_0_comp_nf[]; extern const struct comptbl op_smalltbl_0_comp_ff[]; -#ifdef NOFLAGS_SUPPORT -/* 68020 + 68881 */ -extern const struct cputbl op_smalltbl_1[]; -/* 68020 */ -extern const struct cputbl op_smalltbl_2[]; -/* 68010 */ -extern const struct cputbl op_smalltbl_3[]; -/* 68000 */ -extern const struct cputbl op_smalltbl_4[]; -/* 68000 slow but compatible. */ -extern const struct cputbl op_smalltbl_5[]; -#endif - static void flush_icache_hard(int); static void flush_icache_lazy(int); static void flush_icache_none(int); @@ -4270,7 +4257,7 @@ void build_comp(void) unsigned int cpu_level = (currprefs.cpu_model - 68000) / 10; if (cpu_level > 4) cpu_level--; -#ifdef NOFLAGS_SUPPORT +#ifdef NOFLAGS_SUPPORT_GENCOMP extern const struct cputbl *uaegetjitcputbl(void); const struct cputbl *nfctbl = uaegetjitcputbl(); #endif @@ -4290,7 +4277,7 @@ void build_comp(void) for (opcode = 0; opcode < 65536; opcode++) { reset_compop(opcode); -#ifdef NOFLAGS_SUPPORT +#ifdef NOFLAGS_SUPPORT_GENCOMP nfcpufunctbl[opcode] = op_illg; #endif prop[opcode].use_flags = FLAG_ALL; @@ -4319,21 +4306,31 @@ void build_comp(void) nfcompfunctbl[cft_map(nftbl[i].opcode)] = NULL; else nfcompfunctbl[cft_map(nftbl[i].opcode)] = nftbl[i].handler; -#ifdef NOFLAGS_SUPPORT +#ifdef NOFLAGS_SUPPORT_GENCOMP +#ifdef NOFLAGS_SUPPORT_GENCPU nfcpufunctbl[cft_map(nftbl[i].opcode)] = nfctbl[i].handler_nf; +#else + nfcpufunctbl[cft_map(nftbl[i].opcode)] = nfctbl[i].handler_ff; +#endif #endif } -#ifdef NOFLAGS_SUPPORT +#ifdef NOFLAGS_SUPPORT_GENCOMP +#ifdef NOFLAGS_SUPPORT_GENCPU for (i = 0; nfctbl[i].handler_nf; i++) { nfcpufunctbl[cft_map(nfctbl[i].opcode)] = nfctbl[i].handler_nf; } +#else + for (i = 0; nfctbl[i].handler_ff; i++) { + nfcpufunctbl[cft_map(nfctbl[i].opcode)] = nfctbl[i].handler_ff; + } +#endif #endif for (opcode = 0; opcode < 65536; opcode++) { compop_func *f; compop_func *nff; -#ifdef NOFLAGS_SUPPORT +#ifdef NOFLAGS_SUPPORT_GENCOMP cpuop_func *nfcf; #endif int isaddx; @@ -4345,7 +4342,7 @@ void build_comp(void) if (table68k[opcode].handler != -1) { f = compfunctbl[cft_map(table68k[opcode].handler)]; nff = nfcompfunctbl[cft_map(table68k[opcode].handler)]; -#ifdef NOFLAGS_SUPPORT +#ifdef NOFLAGS_SUPPORT_GENCOMP nfcf = nfcpufunctbl[cft_map(table68k[opcode].handler)]; #endif isaddx = prop[cft_map(table68k[opcode].handler)].is_addx; @@ -4354,7 +4351,7 @@ void build_comp(void) prop[cft_map(opcode)].cflow = cflow; compfunctbl[cft_map(opcode)] = f; nfcompfunctbl[cft_map(opcode)] = nff; -#ifdef NOFLAGS_SUPPORT +#ifdef NOFLAGS_SUPPORT_GENCOMP Dif (nfcf == op_illg) abort(); nfcpufunctbl[cft_map(opcode)] = nfcf; @@ -4367,11 +4364,18 @@ void build_comp(void) if (prop[cft_map(opcode)].cflow & fl_const_jump) prop[cft_map(opcode)].use_flags = 0; } -#ifdef NOFLAGS_SUPPORT +#ifdef NOFLAGS_SUPPORT_GENCOMP +#ifdef NOFLAGS_SUPPORT_GENCPU for (i = 0; nfctbl[i].handler_nf != NULL; i++) { if (nfctbl[i].specific) nfcpufunctbl[cft_map(tbl[i].opcode)] = nfctbl[i].handler_nf; } +#else + for (i = 0; nfctbl[i].handler_ff != NULL; i++) { + if (nfctbl[i].specific) + nfcpufunctbl[cft_map(tbl[i].opcode)] = nfctbl[i].handler_ff; + } +#endif #endif /* Merge in blacklist */ @@ -4848,7 +4852,7 @@ static void compile_block(cpu_history* pc_hist, int blocklen) if (!needed_flags) #endif { -#ifdef NOFLAGS_SUPPORT +#ifdef NOFLAGS_SUPPORT_GENCOMP cputbl=nfcpufunctbl; #else cputbl=cpufunctbl; diff --git a/od-win32/sysconfig.h b/od-win32/sysconfig.h index 38cb09a5..d1369746 100644 --- a/od-win32/sysconfig.h +++ b/od-win32/sysconfig.h @@ -30,7 +30,8 @@ #define AUTOCONFIG /* autoconfig support, fast ram, harddrives etc.. */ #define JIT /* JIT compiler support */ #define USE_JIT_FPU -#define NOFLAGS_SUPPORT +//#define NOFLAGS_SUPPORT_GENCPU +#define NOFLAGS_SUPPORT_GENCOMP //#define HAVE_GET_WORD_UNSWAPPED #define NATMEM_OFFSET natmem_offset #define USE_NORMAL_CALLING_CONVENTION 0 -- 2.47.3