Small jit compilation optimization (#360)

This commit is contained in:
Bruno 2026-10-06 23:19:26 +02:00 committed by GitHub
parent f99dce60c0
commit e95e0f410e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 27 additions and 1 deletions

View File

@ -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 "$<$<CONFIG:Release>:/GL>")
endif()
endforeach()
target_link_options(nxemu-cpu PRIVATE "$<$<CONFIG:Release>:/LTCG>")
endif()
target_link_libraries(nxemu-cpu PRIVATE
common
fmt

View File

@ -6,6 +6,7 @@
#include "dynarmic/backend/x64/reg_alloc.h"
#include <algorithm>
#include <boost/container/small_vector.hpp>
#include <numeric>
#include <utility>
@ -520,7 +521,7 @@ void RegAlloc::EmitVerboseDebuggingOutput() {
}
HostLoc RegAlloc::SelectARegister(const std::vector<HostLoc>& desired_locations) const {
std::vector<HostLoc> candidates = desired_locations;
boost::container::small_vector<HostLoc, 16> 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) {

View File

@ -394,6 +394,16 @@
<Project>{250224f2-2e89-410e-8bdb-875959daba2c}</Project>
</ProjectReference>
</ItemGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Link>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
</ItemDefinitionGroup>
<ItemGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile Update="dynarmic\backend\x64\*.cpp;dynarmic\frontend\A64\**\*.cpp;dynarmic\ir\**\*.cpp;dynarmic\common\**\*.cpp;dynarmic\frontend\imm.cpp;dynarmic\backend\block_range_information.cpp">
<WholeProgramOptimization>true</WholeProgramOptimization>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>