diff --git a/rpcs3/Emu/Cell/PPUAnalyser.cpp b/rpcs3/Emu/Cell/PPUAnalyser.cpp index fdf3c6defafe..56de9f737439 100644 --- a/rpcs3/Emu/Cell/PPUAnalyser.cpp +++ b/rpcs3/Emu/Cell/PPUAnalyser.cpp @@ -10,7 +10,7 @@ LOG_CHANNEL(ppu_validator); -const ppu_decoder s_ppu_itype; +constexpr ppu_decoder s_ppu_itype; template<> void fmt_class_string::format(std::string& out, u64 arg) diff --git a/rpcs3/Emu/Cell/PPUDisAsm.cpp b/rpcs3/Emu/Cell/PPUDisAsm.cpp index 04d2231466bc..f84097b03fa5 100644 --- a/rpcs3/Emu/Cell/PPUDisAsm.cpp +++ b/rpcs3/Emu/Cell/PPUDisAsm.cpp @@ -2,7 +2,7 @@ #include "PPUDisAsm.h" #include "PPUFunction.h" -const ppu_decoder s_ppu_disasm; +constexpr ppu_decoder s_ppu_disasm; u32 PPUDisAsm::disasm(u32 pc) { diff --git a/rpcs3/Emu/Cell/PPUOpcodes.h b/rpcs3/Emu/Cell/PPUOpcodes.h index e221fed15b62..8f6ff4abd9cd 100644 --- a/rpcs3/Emu/Cell/PPUOpcodes.h +++ b/rpcs3/Emu/Cell/PPUOpcodes.h @@ -77,7 +77,7 @@ template class ppu_decoder { // Fast lookup table - std::array m_table; + std::array m_table{}; struct instruction_info { @@ -85,14 +85,14 @@ class ppu_decoder T pointer; u32 magn; // Non-zero for "columns" (effectively, number of most significant bits "eaten") - instruction_info(u32 v, T p, u32 m = 0) + constexpr instruction_info(u32 v, T p, u32 m = 0) : value(v) , pointer(p) , magn(m) { } - instruction_info(u32 v, const T* p, u32 m = 0) + constexpr instruction_info(u32 v, const T* p, u32 m = 0) : value(v) , pointer(*p) , magn(m) @@ -101,7 +101,7 @@ class ppu_decoder }; // Fill lookup table - void fill_table(u32 main_op, u32 count, u32 sh, std::initializer_list entries) + constexpr void fill_table(u32 main_op, u32 count, u32 sh, std::initializer_list entries) { if (sh < 11) { @@ -130,9 +130,12 @@ class ppu_decoder } public: - ppu_decoder() + constexpr ppu_decoder() { - m_table.fill(&D::UNK); + for (auto& x : m_table) + { + x = &D::UNK; + } // Main opcodes (field 0..5) fill_table(0x00, 6, -1, diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index 8b037a8e7f65..9768bf8502e8 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -117,7 +117,7 @@ const std::pair s_ppu_dispatch_table[] #undef FUNC }; -extern const ppu_decoder g_ppu_interpreter_precise([](auto& table) +static const ppu_decoder g_ppu_interpreter_precise([](auto& table) { if (s_use_ssse3) { @@ -135,7 +135,7 @@ extern const ppu_decoder g_ppu_interpreter_precise([](a } }); -extern const ppu_decoder g_ppu_interpreter_fast([](auto& table) +static const ppu_decoder g_ppu_interpreter_fast([](auto& table) { if (!s_use_ssse3) { diff --git a/rpcs3/Emu/Cell/PPUTranslator.cpp b/rpcs3/Emu/Cell/PPUTranslator.cpp index 79d0f8774b18..81804f940444 100644 --- a/rpcs3/Emu/Cell/PPUTranslator.cpp +++ b/rpcs3/Emu/Cell/PPUTranslator.cpp @@ -9,7 +9,7 @@ using namespace llvm; -const ppu_decoder s_ppu_decoder; +constexpr ppu_decoder s_ppu_decoder; PPUTranslator::PPUTranslator(LLVMContext& context, Module* module, const ppu_module& info, ExecutionEngine& engine) : cpu_translator(module, false) diff --git a/rpcs3/cmake_modules/ConfigureCompiler.cmake b/rpcs3/cmake_modules/ConfigureCompiler.cmake index 2bbc89d3f74e..e2cfc43d09b5 100644 --- a/rpcs3/cmake_modules/ConfigureCompiler.cmake +++ b/rpcs3/cmake_modules/ConfigureCompiler.cmake @@ -1,7 +1,7 @@ # Check and configure compiler options for RPCS3 if(MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:throwingNew /D _CRT_SECURE_NO_DEPRECATE=1 /D _CRT_NON_CONFORMING_SWPRINTFS=1 /D _SCL_SECURE_NO_WARNINGS=1") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:throwingNew /constexpr:steps16777216 /D _CRT_SECURE_NO_DEPRECATE=1 /D _CRT_NON_CONFORMING_SWPRINTFS=1 /D _SCL_SECURE_NO_WARNINGS=1") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D _ENABLE_EXTENDED_ALIGNED_STORAGE=1 /D _HAS_EXCEPTIONS=0") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS /DYNAMICBASE:NO /BASE:0x10000 /FIXED") @@ -40,6 +40,7 @@ else() add_compile_options(-Wno-comment) if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-fconstexpr-steps=16777216) add_compile_options(-Wno-sometimes-uninitialized) add_compile_options(-Wno-unused-lambda-capture) add_compile_options(-Wno-unused-private-field) diff --git a/rpcs3_default.props b/rpcs3_default.props index 4b672af78d1d..0252b99c1b6b 100644 --- a/rpcs3_default.props +++ b/rpcs3_default.props @@ -20,7 +20,7 @@ false true NotUsing - /Zc:throwingNew %(AdditionalOptions) + /Zc:throwingNew /constexpr:steps16777216 %(AdditionalOptions) xxhash.lib;ws2_32.lib;Bcrypt.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib