diff --git a/src/nxemu-cpu/CMakeLists.txt b/src/nxemu-cpu/CMakeLists.txt index dda0cc21..4568da08 100644 --- a/src/nxemu-cpu/CMakeLists.txt +++ b/src/nxemu-cpu/CMakeLists.txt @@ -516,6 +516,21 @@ target_include_directories(nxemu-cpu PRIVATE ${CMAKE_SOURCE_DIR}/external/xbyak ) +# Optimize the x64 JIT together at link time in native MSVC Release builds. +# Keep other compilers, architectures and configurations on their existing path. +if(ARCHITECTURE_x86_64 AND CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + get_target_property(_nxemu_jit_sources nxemu-cpu SOURCES) + foreach(_nxemu_jit_source IN LISTS _nxemu_jit_sources) + if(_nxemu_jit_source MATCHES "^dynarmic/(backend/x64|frontend/A64|ir|common)/.*[.]cpp$" + OR _nxemu_jit_source STREQUAL "dynarmic/frontend/imm.cpp" + OR _nxemu_jit_source STREQUAL "dynarmic/backend/block_range_information.cpp") + set_property(SOURCE ${_nxemu_jit_source} APPEND PROPERTY + COMPILE_OPTIONS "$<$:/GL>") + endif() + endforeach() + target_link_options(nxemu-cpu PRIVATE "$<$:/LTCG>") +endif() + target_link_libraries(nxemu-cpu PRIVATE common fmt diff --git a/src/nxemu-cpu/dynarmic/backend/x64/reg_alloc.cpp b/src/nxemu-cpu/dynarmic/backend/x64/reg_alloc.cpp index 61a3a6cd..8303c480 100644 --- a/src/nxemu-cpu/dynarmic/backend/x64/reg_alloc.cpp +++ b/src/nxemu-cpu/dynarmic/backend/x64/reg_alloc.cpp @@ -6,6 +6,7 @@ #include "dynarmic/backend/x64/reg_alloc.h" #include +#include #include #include @@ -520,7 +521,7 @@ void RegAlloc::EmitVerboseDebuggingOutput() { } HostLoc RegAlloc::SelectARegister(const std::vector& desired_locations) const { - std::vector candidates = desired_locations; + boost::container::small_vector candidates(desired_locations.begin(), desired_locations.end()); // Find all locations that have not been allocated.. const auto allocated_locs = std::partition(candidates.begin(), candidates.end(), [this](auto loc) { diff --git a/src/nxemu-cpu/nxemu-cpu.vcxproj b/src/nxemu-cpu/nxemu-cpu.vcxproj index 12808405..43c4b4f7 100644 --- a/src/nxemu-cpu/nxemu-cpu.vcxproj +++ b/src/nxemu-cpu/nxemu-cpu.vcxproj @@ -394,6 +394,16 @@ {250224f2-2e89-410e-8bdb-875959daba2c} + + + UseLinkTimeCodeGeneration + + + + + true + +