mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-04 03:40:11 +00:00
Make ppu_decoder<> objects constexpr (partial)
This commit is contained in:
parent
ecb6d38451
commit
1ceb779a38
@ -10,7 +10,7 @@
|
||||
|
||||
LOG_CHANNEL(ppu_validator);
|
||||
|
||||
const ppu_decoder<ppu_itype> s_ppu_itype;
|
||||
constexpr ppu_decoder<ppu_itype> s_ppu_itype;
|
||||
|
||||
template<>
|
||||
void fmt_class_string<ppu_attr>::format(std::string& out, u64 arg)
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "PPUDisAsm.h"
|
||||
#include "PPUFunction.h"
|
||||
|
||||
const ppu_decoder<PPUDisAsm> s_ppu_disasm;
|
||||
constexpr ppu_decoder<PPUDisAsm> s_ppu_disasm;
|
||||
|
||||
u32 PPUDisAsm::disasm(u32 pc)
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ template <typename D, typename T = decltype(&D::UNK)>
|
||||
class ppu_decoder
|
||||
{
|
||||
// Fast lookup table
|
||||
std::array<T, 0x20000> m_table;
|
||||
std::array<T, 0x20000> 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<instruction_info> entries)
|
||||
constexpr void fill_table(u32 main_op, u32 count, u32 sh, std::initializer_list<instruction_info> 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,
|
||||
|
@ -117,7 +117,7 @@ const std::pair<ppu_inter_func_t, ppu_inter_func_t> s_ppu_dispatch_table[]
|
||||
#undef FUNC
|
||||
};
|
||||
|
||||
extern const ppu_decoder<ppu_interpreter_precise> g_ppu_interpreter_precise([](auto& table)
|
||||
static const ppu_decoder<ppu_interpreter_precise> g_ppu_interpreter_precise([](auto& table)
|
||||
{
|
||||
if (s_use_ssse3)
|
||||
{
|
||||
@ -135,7 +135,7 @@ extern const ppu_decoder<ppu_interpreter_precise> g_ppu_interpreter_precise([](a
|
||||
}
|
||||
});
|
||||
|
||||
extern const ppu_decoder<ppu_interpreter_fast> g_ppu_interpreter_fast([](auto& table)
|
||||
static const ppu_decoder<ppu_interpreter_fast> g_ppu_interpreter_fast([](auto& table)
|
||||
{
|
||||
if (!s_use_ssse3)
|
||||
{
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
const ppu_decoder<PPUTranslator> s_ppu_decoder;
|
||||
constexpr ppu_decoder<PPUTranslator> s_ppu_decoder;
|
||||
|
||||
PPUTranslator::PPUTranslator(LLVMContext& context, Module* module, const ppu_module& info, ExecutionEngine& engine)
|
||||
: cpu_translator(module, false)
|
||||
|
@ -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)
|
||||
|
@ -20,7 +20,7 @@
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<AdditionalOptions>/Zc:throwingNew %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions>/Zc:throwingNew /constexpr:steps16777216 %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>xxhash.lib;ws2_32.lib;Bcrypt.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib</AdditionalDependencies>
|
||||
|
Loading…
x
Reference in New Issue
Block a user