BII: prepare JIT

This commit is contained in:
kanjitalk755 2020-08-13 21:00:42 +09:00
parent 630f4ffafb
commit 6985ad67fe
7 changed files with 56 additions and 102 deletions

View File

@ -97,6 +97,10 @@
E4555EED2354434B00139FCE /* Credits.html in Resources */ = {isa = PBXBuildFile; fileRef = 7539E00A1F23B25A006B2DF2 /* Credits.html */; };
E490334E20D3A5890012DD5F /* clip_macosx64.mm in Sources */ = {isa = PBXBuildFile; fileRef = E490334D20D3A5890012DD5F /* clip_macosx64.mm */; };
E4D8245323543D9800849B78 /* fpu_ieee.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4D8245223543D9700849B78 /* fpu_ieee.cpp */; };
E4ED8EDE24E39AFE00843219 /* compemu_support.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4ED8EDD24E39AFE00843219 /* compemu_support.cpp */; };
E4ED8EE224E39BC400843219 /* compemu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4ED8EE024E39BC400843219 /* compemu.cpp */; };
E4ED8EE324E39BC400843219 /* compstbl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4ED8EE124E39BC400843219 /* compstbl.cpp */; };
E4ED8EE524E39C0D00843219 /* compemu_fpp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4ED8EE424E39C0D00843219 /* compemu_fpp.cpp */; };
E4EE777523D7D71400BAE63A /* defs68k.c in Sources */ = {isa = PBXBuildFile; fileRef = E417913123D7D67C0009AD63 /* defs68k.c */; };
/* End PBXBuildFile section */
@ -337,6 +341,11 @@
E417913123D7D67C0009AD63 /* defs68k.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = defs68k.c; path = gencpu_output/defs68k.c; sourceTree = BUILT_PRODUCTS_DIR; };
E490334D20D3A5890012DD5F /* clip_macosx64.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = clip_macosx64.mm; sourceTree = "<group>"; };
E4D8245223543D9700849B78 /* fpu_ieee.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fpu_ieee.cpp; sourceTree = "<group>"; };
E4ED8EDD24E39AFE00843219 /* compemu_support.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = compemu_support.cpp; sourceTree = "<group>"; };
E4ED8EDF24E39B2A00843219 /* comptbl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = comptbl.h; path = gencpu_output/comptbl.h; sourceTree = BUILT_PRODUCTS_DIR; };
E4ED8EE024E39BC400843219 /* compemu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = compemu.cpp; path = gencpu_output/compemu.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
E4ED8EE124E39BC400843219 /* compstbl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = compstbl.cpp; path = gencpu_output/compstbl.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
E4ED8EE424E39C0D00843219 /* compemu_fpp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = compemu_fpp.cpp; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -428,6 +437,9 @@
7532532B1F53675E0024025B /* gencpu output */ = {
isa = PBXGroup;
children = (
E4ED8EE024E39BC400843219 /* compemu.cpp */,
E4ED8EE124E39BC400843219 /* compstbl.cpp */,
E4ED8EDF24E39B2A00843219 /* comptbl.h */,
7532532C1F5368370024025B /* cpuemu_nf.cpp */,
7532532D1F5368370024025B /* cpuemu.cpp */,
7532532E1F5368370024025B /* cpustbl_nf.cpp */,
@ -588,6 +600,8 @@
isa = PBXGroup;
children = (
7539E0AB1F23B25A006B2DF2 /* compemu.h */,
E4ED8EE424E39C0D00843219 /* compemu_fpp.cpp */,
E4ED8EDD24E39AFE00843219 /* compemu_support.cpp */,
7539E0AE1F23B25A006B2DF2 /* flags_x86.h */,
);
path = compiler;
@ -818,6 +832,8 @@
$BUILT_PRODUCTS_DIR/gencpu_output/cpustbl.cpp,
$BUILT_PRODUCTS_DIR/gencpu_output/cpustbl_nf.cpp,
$BUILT_PRODUCTS_DIR/gencpu_output/defs68k.c,
$BUILT_PRODUCTS_DIR/gencpu_output/compemu.cpp,
$BUILT_PRODUCTS_DIR/gencpu_output/compstbl.cpp,
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
@ -831,6 +847,7 @@
buildActionMask = 2147483647;
files = (
E4EE777523D7D71400BAE63A /* defs68k.c in Sources */,
E4ED8EE524E39C0D00843219 /* compemu_fpp.cpp in Sources */,
7539E19E1F23B25A006B2DF2 /* rounding.cpp in Sources */,
7539E29D1F23C83F006B2DF2 /* sys_darwin.cpp in Sources */,
7539E1291F23B25A006B2DF2 /* video_blit.cpp in Sources */,
@ -840,6 +857,8 @@
7539E1A01F23B25A006B2DF2 /* memory.cpp in Sources */,
E40CEEC620D7910E00BCB88D /* SDLMain.m in Sources */,
753253351F53688D0024025B /* readcpu.cpp in Sources */,
E4ED8EDE24E39AFE00843219 /* compemu_support.cpp in Sources */,
E4ED8EE324E39BC400843219 /* compstbl.cpp in Sources */,
7539E1741F23B25A006B2DF2 /* audio_sdl.cpp in Sources */,
E413D93120D260BC00E437D8 /* ip_output.c in Sources */,
7539E1E21F23B25A006B2DF2 /* video.cpp in Sources */,
@ -847,6 +866,7 @@
7539E1711F23B25A006B2DF2 /* rom_patches.cpp in Sources */,
7539E1281F23B25A006B2DF2 /* sigsegv.cpp in Sources */,
753253341F5368370024025B /* cpustbl.cpp in Sources */,
E4ED8EE224E39BC400843219 /* compemu.cpp in Sources */,
756C1B341F252FC100620917 /* utils_macosx.mm in Sources */,
E413D92620D260BC00E437D8 /* misc.c in Sources */,
753253321F5368370024025B /* cpuemu.cpp in Sources */,
@ -1068,10 +1088,6 @@
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
ENABLE_MACOSX_ETHERHELPER,
HAVE_CONFIG_H,
"USE_XCODE=1",
"DEBUG=1",
"USE_SDL_AUDIO=1",
"BINCUE=1",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
@ -1091,6 +1107,10 @@
MACOSX_DEPLOYMENT_TARGET = 10.7;
ONLY_ACTIVE_ARCH = NO;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = (
"-pagezero_size",
0x1000,
);
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
PRODUCT_BUNDLE_IDENTIFIER = net.cebix.basilisk;
PRODUCT_NAME = "$(TARGET_NAME)";
@ -1129,9 +1149,6 @@
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
ENABLE_MACOSX_ETHERHELPER,
HAVE_CONFIG_H,
"USE_XCODE=1",
"USE_SDL_AUDIO=1",
"BINCUE=1",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
@ -1150,6 +1167,10 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.7;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = (
"-pagezero_size",
0x1000,
);
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
PRODUCT_BUNDLE_IDENTIFIER = net.cebix.basilisk;
PRODUCT_NAME = "$(TARGET_NAME)";

View File

@ -1,14 +1,16 @@
SRC = $(PROJECT_DIR)/../uae_cpu
DST = $(BUILT_PRODUCTS_DIR)/gencpu_output
VPATH = $(SRC)
VPATH = $(SRC) $(SRC)/compiler
CFLAGS = -DUSE_XCODE=1 -I. -I../uae_cpu -I../UNIX
CXXFLAGS = -stdlib=libc++ $(CFLAGS)
OBJS = $(addprefix $(DST)/, defs68k.o gencpu.o readcpu.o)
all: $(DST)/gencpu
cd $(DST); ./gencpu
all: $(DST)/gencpu $(DST)/gencomp
cd $(DST); ./gencpu; ./gencomp
$(DST)/gencpu: $(OBJS)
$(DST)/gencpu: $(addprefix $(DST)/, defs68k.o readcpu.o gencpu.o)
$(CXX) $(CXXFLAGS) -o $@ $^
$(DST)/gencomp: $(addprefix $(DST)/, defs68k.o readcpu.o gencomp.o)
$(CXX) $(CXXFLAGS) -o $@ $^
$(DST)/%.o: %.c

View File

@ -817,4 +817,11 @@
#define FPU_IEEE
#if USE_JIT
#define DIRECT_ADDRESSING 1
#define USE_JIT_FPU
#define X86_64_ASSEMBLY
#define OPTIMIZED_FLAGS
#endif
#endif

View File

@ -184,96 +184,6 @@ typedef off_t loff_t;
typedef char * caddr_t;
#endif
/**
* Helper functions to byteswap data
**/
#if defined(__GNUC__)
#if defined(__x86_64__) || defined(__i386__)
// Linux/AMD64 currently has no asm optimized bswap_32() in <byteswap.h>
#define opt_bswap_32 do_opt_bswap_32
static inline uint32 do_opt_bswap_32(uint32 x)
{
uint32 v;
__asm__ __volatile__ ("bswap %0" : "=r" (v) : "0" (x));
return v;
}
#endif
#endif
#ifdef HAVE_BYTESWAP_H
#include <byteswap.h>
#endif
#ifdef opt_bswap_16
#undef bswap_16
#define bswap_16 opt_bswap_16
#endif
#ifndef bswap_16
#define bswap_16 generic_bswap_16
#endif
static inline uint16 generic_bswap_16(uint16 x)
{
return ((x & 0xff) << 8) | ((x >> 8) & 0xff);
}
#ifdef opt_bswap_32
#undef bswap_32
#define bswap_32 opt_bswap_32
#endif
#ifndef bswap_32
#define bswap_32 generic_bswap_32
#endif
static inline uint32 generic_bswap_32(uint32 x)
{
return (((x & 0xff000000) >> 24) |
((x & 0x00ff0000) >> 8) |
((x & 0x0000ff00) << 8) |
((x & 0x000000ff) << 24) );
}
#if defined(__i386__)
#define opt_bswap_64 do_opt_bswap_64
static inline uint64 do_opt_bswap_64(uint64 x)
{
return (bswap_32(x >> 32) | (((uint64)bswap_32((uint32)x)) << 32));
}
#endif
#ifdef opt_bswap_64
#undef bswap_64
#define bswap_64 opt_bswap_64
#endif
#ifndef bswap_64
#define bswap_64 generic_bswap_64
#endif
static inline uint64 generic_bswap_64(uint64 x)
{
return (((x & UVAL64(0xff00000000000000)) >> 56) |
((x & UVAL64(0x00ff000000000000)) >> 40) |
((x & UVAL64(0x0000ff0000000000)) >> 24) |
((x & UVAL64(0x000000ff00000000)) >> 8) |
((x & UVAL64(0x00000000ff000000)) << 8) |
((x & UVAL64(0x0000000000ff0000)) << 24) |
((x & UVAL64(0x000000000000ff00)) << 40) |
((x & UVAL64(0x00000000000000ff)) << 56) );
}
#ifdef WORDS_BIGENDIAN
static inline uint16 tswap16(uint16 x) { return x; }
static inline uint32 tswap32(uint32 x) { return x; }
static inline uint64 tswap64(uint64 x) { return x; }
#else
static inline uint16 tswap16(uint16 x) { return bswap_16(x); }
static inline uint32 tswap32(uint32 x) { return bswap_32(x); }
static inline uint64 tswap64(uint64 x) { return bswap_64(x); }
#endif
/* Time data type for Time Manager emulation */
#if defined(__MACH__)
typedef mach_timespec_t tm_time_t;

View File

@ -34,6 +34,8 @@
#include "sysdeps.h"
#if USE_JIT
#include <math.h>
#include <stdio.h>
@ -1635,3 +1637,5 @@ void comp_fpp_opp (uae_u32 opcode, uae_u16 extra)
m68k_setpc (m68k_getpc () - 4);
fpuop_illg (opcode,extra);
}
#endif //USE_JIT

View File

@ -25,6 +25,8 @@
#include "sysdeps.h"
#if USE_JIT
#if !REAL_ADDRESSING && !DIRECT_ADDRESSING
#error "Only Real or Direct Addressing is supported with the JIT Compiler"
#endif
@ -7125,3 +7127,5 @@ void m68k_compile_execute (void)
m68k_do_compile_execute();
}
}
#endif //USE_JIT

View File

@ -3038,6 +3038,9 @@ main (int argc, char **argv)
stblfile = fopen ("compstbl.cpp", "wb");
freopen ("compemu.cpp", "wb", stdout);
fprintf(stblfile, "#if USE_JIT\n");
printf("#if USE_JIT\n");
generate_includes (stdout);
generate_includes (stblfile);
@ -3059,6 +3062,9 @@ main (int argc, char **argv)
noflags=1;
generate_func (noflags);
fprintf(stblfile, "#endif //USE_JIT\n");
printf("#endif //USE_JIT\n");
free(opcode_map);
free(opcode_last_postfix);
free(opcode_next_clev);