-cmake_minimum_required(VERSION 3.0)
-project(lightrec LANGUAGES C VERSION 0.5)
+cmake_minimum_required(VERSION 3.5)
+project(lightrec LANGUAGES C VERSION 0.8)
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries")
if (NOT BUILD_SHARED_LIBS)
list(APPEND LIGHTREC_SOURCES
blockcache.c
+ constprop.c
emitter.c
interpreter.c
lightrec.c
)
list(APPEND LIGHTREC_HEADERS
blockcache.h
+ constprop.h
debug.h
disassembler.h
emitter.h
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 reaper.c)
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_STORES "(optimization) Flag stores that don't require invalidation" ON)
-option(OPT_FLAG_IO "(optimization) Flag I/O opcodes whose target is known" 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)
+option(OPT_PRELOAD_PC "(optimization) Preload PC value into register" ON)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
)
if (CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
- target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wno-parentheses)
+ target_compile_options(${PROJECT_NAME} PRIVATE -Wall)
endif()
if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(${PROJECT_NAME} PRIVATE -Wno-initializer-overrides)
endif()
-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 (ENABLE_THREADED_COMPILER)
find_library(PTHREAD_LIBRARIES pthread REQUIRED)
find_path(PTHREAD_INCLUDE_DIR pthread.h REQUIRED)
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)