X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=deps%2Flightrec%2FCMakeLists.txt;h=9518a9ab9eb5388d26626e81968ca10ed7177c4a;hb=cb72ea130a5ef1b2f47691ed586ad48bb0c39269;hp=6ac5cd468177285078f366c848a7ab8db18ba7fc;hpb=d16005f843cd28ae90f091bd4e39a90b355e1d45;p=pcsx_rearmed.git diff --git a/deps/lightrec/CMakeLists.txt b/deps/lightrec/CMakeLists.txt index 6ac5cd46..9518a9ab 100644 --- a/deps/lightrec/CMakeLists.txt +++ b/deps/lightrec/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.0) -project(lightrec LANGUAGES C VERSION 0.3) +project(lightrec LANGUAGES C VERSION 0.7) set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries") if (NOT BUILD_SHARED_LIBS) @@ -25,9 +25,11 @@ if (CMAKE_COMPILER_IS_GNUCC) add_compile_options(-fvisibility=hidden) endif() +set(HAS_DEFAULT_ELM ${CMAKE_COMPILER_IS_GNUCC}) + list(APPEND LIGHTREC_SOURCES blockcache.c - disassembler.c + constprop.c emitter.c interpreter.c lightrec.c @@ -37,6 +39,7 @@ list(APPEND LIGHTREC_SOURCES ) list(APPEND LIGHTREC_HEADERS blockcache.h + constprop.h debug.h disassembler.h emitter.h @@ -51,15 +54,26 @@ list(APPEND LIGHTREC_HEADERS option(ENABLE_FIRST_PASS "Run the interpreter as first-pass optimization" ON) -option(ENABLE_THREADED_COMPILER "Enable threaded compiler" ON) +option(ENABLE_THREADED_COMPILER "Enable threaded compiler" OFF) if (ENABLE_THREADED_COMPILER) - list(APPEND LIGHTREC_SOURCES recompiler.c) + list(APPEND LIGHTREC_SOURCES recompiler.c reaper.c) if (NOT ENABLE_FIRST_PASS) message(SEND_ERROR "Threaded compiler requires first-pass optimization") endif (NOT ENABLE_FIRST_PASS) endif (ENABLE_THREADED_COMPILER) +option(OPT_REMOVE_DIV_BY_ZERO_SEQ "(optimization) Remove div-by-zero check sequence" ON) +option(OPT_REPLACE_MEMSET "(optimization) Detect and replace memset with host variant" ON) +option(OPT_DETECT_IMPOSSIBLE_BRANCHES "(optimization) Detect impossible branches" ON) +option(OPT_HANDLE_LOAD_DELAYS "(optimization) Detect load delays" ON) +option(OPT_TRANSFORM_OPS "(optimization) Transform opcodes" ON) +option(OPT_LOCAL_BRANCHES "(optimization) Detect local branches" ON) +option(OPT_SWITCH_DELAY_SLOTS "(optimization) Switch delay slots" ON) +option(OPT_FLAG_IO "(optimization) Flag I/O opcodes when the target can be detected" ON) +option(OPT_FLAG_MULT_DIV "(optimization) Flag MULT/DIV that only use one of HI/LO" ON) +option(OPT_EARLY_UNLOAD "(optimization) Unload registers early" ON) + include_directories(${CMAKE_CURRENT_BINARY_DIR}) add_library(${PROJECT_NAME} ${LIGHTREC_SOURCES} ${LIGHTREC_HEADERS}) @@ -72,14 +86,12 @@ set_target_properties(${PROJECT_NAME} PROPERTIES C_EXTENSIONS OFF ) -option(ENABLE_TINYMM "Enable optional libtinymm dependency" OFF) -if (ENABLE_TINYMM) - find_library(TINYMM_LIBRARIES tinymm REQUIRED) - find_path(TINYMM_INCLUDE_DIR tinymm.h REQUIRED) - - include_directories(${TINYMM_INCLUDE_DIR}) - target_link_libraries(${PROJECT_NAME} PRIVATE ${TINYMM_LIBRARIES}) -endif (ENABLE_TINYMM) +if (CMAKE_C_COMPILER_ID MATCHES "GNU|Clang") + target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wno-parentheses) +endif() +if (CMAKE_C_COMPILER_ID STREQUAL "Clang") + target_compile_options(${PROJECT_NAME} PRIVATE -Wno-initializer-overrides) +endif() if (ENABLE_THREADED_COMPILER) find_library(PTHREAD_LIBRARIES pthread REQUIRED) @@ -89,6 +101,12 @@ if (ENABLE_THREADED_COMPILER) target_link_libraries(${PROJECT_NAME} PRIVATE ${PTHREAD_LIBRARIES}) endif (ENABLE_THREADED_COMPILER) +option(ENABLE_CODE_BUFFER "Enable external code buffer" ON) +if (ENABLE_CODE_BUFFER) + target_sources(${PROJECT_NAME} PRIVATE tlsf/tlsf.c) + target_include_directories(${PROJECT_NAME} PRIVATE tlsf) +endif (ENABLE_CODE_BUFFER) + find_library(LIBLIGHTNING lightning REQUIRED) find_path(LIBLIGHTNING_INCLUDE_DIR lightning.h REQUIRED) @@ -96,19 +114,11 @@ include_directories(${LIBLIGHTNING_INCLUDE_DIR}) target_link_libraries(${PROJECT_NAME} PRIVATE ${LIBLIGHTNING}) if (LOG_LEVEL STREQUAL Debug) - find_library(LIBOPCODES NAMES opcodes-multiarch opcodes) - find_path(LIBOPCODES_INCLUDE_DIR dis-asm.h) - - if (NOT LIBOPCODES OR NOT LIBOPCODES_INCLUDE_DIR) - message(SEND_ERROR "Debug log level requires libopcodes (from binutils) to be installed.") - endif () - set(ENABLE_DISASSEMBLER ON) - include_directories(${LIBOPCODES_INCLUDE_DIR}) - target_link_libraries(${PROJECT_NAME} PRIVATE ${LIBOPCODES}) + target_sources(${PROJECT_NAME} PRIVATE disassembler.c) endif() -configure_file(config.h.cmakein config.h @ONLY) +configure_file(lightrec-config.h.cmakein lightrec-config.h @ONLY) include(GNUInstallDirs) install(TARGETS ${PROJECT_NAME}