Skip to content

Commit

Permalink
enable lightrec
Browse files Browse the repository at this point in the history
  • Loading branch information
notaz committed Oct 7, 2024
1 parent de0ed23 commit a4c7150
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 14 deletions.
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@
[submodule "libchdr"]
path = deps/libchdr
url = https://github.com/rtissera/libchdr.git
[submodule "deps/lightrec"]
path = deps/lightrec
url = https://github.com/pcercuei/lightrec.git
[submodule "deps/lightning"]
path = deps/lightning
url = https://github.com/pcercuei/gnu_lightning.git
56 changes: 54 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ CXXFLAGS += $(CFLAGS)
#DRC_DBG = 1
#PCNT = 1

# Suppress minor warnings for dependencies
deps/%: CFLAGS += -Wno-unused -Wno-unused-function

all: config.mak target_ plugins_

ifndef NO_CONFIG_MAK
Expand Down Expand Up @@ -67,7 +70,54 @@ endif
libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull

# dynarec
ifeq "$(USE_DYNAREC)" "1"
ifeq "$(DYNAREC)" "lightrec"
CFLAGS += -Ideps/lightning/include -Ideps/lightrec -Iinclude/lightning -Iinclude/lightrec \
-DLIGHTREC -DLIGHTREC_STATIC
LIGHTREC_CUSTOM_MAP ?= 0
LIGHTREC_CUSTOM_MAP_OBJ ?= libpcsxcore/lightrec/mem.o
LIGHTREC_THREADED_COMPILER ?= 0
LIGHTREC_CODE_INV ?= 0
CFLAGS += -DLIGHTREC_CUSTOM_MAP=$(LIGHTREC_CUSTOM_MAP) \
-DLIGHTREC_CODE_INV=$(LIGHTREC_CODE_INV) \
-DLIGHTREC_ENABLE_THREADED_COMPILER=$(LIGHTREC_THREADED_COMPILER)
ifeq ($(LIGHTREC_CUSTOM_MAP),1)
LDLIBS += -lrt
OBJS += $(LIGHTREC_CUSTOM_MAP_OBJ)
endif
ifeq ($(NEED_SYSCONF),1)
OBJS += libpcsxcore/lightrec/sysconf.o
endif
ifeq ($(LIGHTREC_THREADED_COMPILER),1)
OBJS += deps/lightrec/recompiler.o \
deps/lightrec/reaper.o
endif
OBJS += deps/lightrec/tlsf/tlsf.o
OBJS += libpcsxcore/lightrec/plugin.o
OBJS += deps/lightning/lib/jit_disasm.o \
deps/lightning/lib/jit_memory.o \
deps/lightning/lib/jit_names.o \
deps/lightning/lib/jit_note.o \
deps/lightning/lib/jit_print.o \
deps/lightning/lib/jit_size.o \
deps/lightning/lib/lightning.o \
deps/lightrec/blockcache.o \
deps/lightrec/constprop.o \
deps/lightrec/disassembler.o \
deps/lightrec/emitter.o \
deps/lightrec/interpreter.o \
deps/lightrec/lightrec.o \
deps/lightrec/memmanager.o \
deps/lightrec/optimizer.o \
deps/lightrec/regcache.o
deps/lightning/%.o: CFLAGS += -DHAVE_MMAP=P_HAVE_MMAP
deps/lightning/%: CFLAGS += -Wno-uninitialized
deps/lightrec/%: CFLAGS += -Wno-uninitialized
libpcsxcore/lightrec/mem.o: CFLAGS += -D_GNU_SOURCE
ifeq ($(MMAP_WIN32),1)
CFLAGS += -Iinclude/mman -I deps/mman
OBJS += deps/mman/mman.o
endif
else ifeq "$(DYNAREC)" "ari64"
OBJS += libpcsxcore/new_dynarec/new_dynarec.o
OBJS += libpcsxcore/new_dynarec/pcsxmem.o
ifeq "$(ARCH)" "arm"
Expand Down Expand Up @@ -176,7 +226,7 @@ OBJS += $(LCHDR)/src/libchdr_cdrom.o
OBJS += $(LCHDR)/src/libchdr_chd.o
OBJS += $(LCHDR)/src/libchdr_flac.o
OBJS += $(LCHDR)/src/libchdr_huffman.o
$(LCHDR)/src/%.o: CFLAGS += -Wno-unused -std=gnu11
$(LCHDR)/src/%.o: CFLAGS += -Wno-unused -Wno-maybe-uninitialized -std=gnu11
OBJS += $(LCHDR_LZMA)/src/Alloc.o
OBJS += $(LCHDR_LZMA)/src/CpuArch.o
OBJS += $(LCHDR_LZMA)/src/Delta.o
Expand Down Expand Up @@ -292,10 +342,12 @@ endif
OBJS += frontend/libretro.o
CFLAGS += -DFRONTEND_SUPPORTS_RGB565

ifneq ($(DYNAREC),lightrec)
ifeq ($(MMAP_WIN32),1)
OBJS += libpcsxcore/memmap_win32.o
endif
endif
endif

ifeq "$(USE_PLUGIN_LIB)" "1"
OBJS += frontend/plugin_lib.o
Expand Down
33 changes: 22 additions & 11 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ check_define_val()
platform_list="generic pandora maemo caanoo libretro"
platform="generic"
builtin_gpu_list="neon peops unai unai_old"
dynarec_list="ari64 lightrec none"
builtin_gpu=""
sound_driver_list="oss alsa pulseaudio sdl libretro"
sound_drivers=""
Expand All @@ -54,7 +55,7 @@ have_arm_neon_asm=""
have_tslib=""
have_gles=""
have_c64x_dsp=""
enable_dynarec="yes"
dynarec=""
need_sdl="no"
need_xlib="no"
need_libpicofe="yes"
Expand Down Expand Up @@ -145,7 +146,9 @@ for opt do
;;
--disable-neon) have_arm_neon="no"
;;
--disable-dynarec) enable_dynarec="no"
--dynarec=*) dynarec="$optarg"
;;
--disable-dynarec) dynarec="no"
;;
*) echo "ERROR: unknown option $opt"; show_help="yes"
;;
Expand All @@ -163,8 +166,8 @@ if [ "$show_help" = "yes" ]; then
echo " available: $sound_driver_list"
echo " --enable-neon"
echo " --disable-neon enable/disable ARM NEON optimizations [guessed]"
echo " --disable-dynarec disable dynamic recompiler"
echo " (dynarec is only available and enabled on ARM)"
echo " --dynarec=NAME select dynamic recompiler [guessed]"
echo " available: $dynarec_list"
echo "influential environment variables:"
echo " CROSS_COMPILE CC CXX AS AR CFLAGS ASFLAGS LDFLAGS LDLIBS"
exit 1
Expand Down Expand Up @@ -245,6 +248,10 @@ arm*)
have_armv5=`check_define HAVE_ARMV5 && echo yes` || true
fi

if [ "x$dynarec" = "x" ]; then
dynarec="ari64"
fi

if [ "x$builtin_gpu" = "x" ]; then
if [ "$have_arm_neon" = "yes" ]; then
builtin_gpu="neon"
Expand Down Expand Up @@ -295,19 +302,25 @@ arm*)
aarch64)
have_arm_neon="yes"
have_arm_neon_asm="no"
if [ "x$dynarec" = "x" ]; then
dynarec="ari64"
fi
if [ "x$builtin_gpu" = "x" ]; then
builtin_gpu="neon"
fi
;;
x86_64)
enable_dynarec="no"
if [ "x$dynarec" = "x" ]; then
dynarec="lightrec"
fi
if [ "x$builtin_gpu" = "x" ]; then
builtin_gpu="neon"
fi
;;
*)
# dynarec only available on ARM
enable_dynarec="no"
if [ "x$dynarec" = "x" ]; then
dynarec="lightrec"
fi
;;
esac

Expand Down Expand Up @@ -545,7 +558,7 @@ echo "C compiler $CC"
echo "C compiler flags $CFLAGS"
echo "libraries $MAIN_LDLIBS"
echo "linker flags $LDFLAGS$MAIN_LDFLAGS"
echo "enable dynarec $enable_dynarec"
echo "dynarec $dynarec"
if [ "$ARCH" = "arm" -o "$ARCH" = "aarch64" ]; then
echo "enable ARM NEON $have_arm_neon"
fi
Expand Down Expand Up @@ -596,9 +609,7 @@ if [ "$have_gles" = "yes" ]; then
echo "CFLAGS_GLES = $CFLAGS_GLES" >> $config_mak
echo "LDLIBS_GLES = $LDLIBS_GLES" >> $config_mak
fi
if [ "$enable_dynarec" = "yes" ]; then
echo "USE_DYNAREC = 1" >> $config_mak
fi
echo "DYNAREC = $dynarec" >> $config_mak
if [ "$drc_cache_base" = "yes" ]; then
echo "BASE_ADDR_DYNAMIC = 1" >> $config_mak
fi
Expand Down
1 change: 1 addition & 0 deletions deps/lightning
Submodule lightning added at de0267
1 change: 1 addition & 0 deletions deps/lightrec
Submodule lightrec added at ea2036

0 comments on commit a4c7150

Please sign in to comment.