PowerPC: Get rid of magic numbers related to interp/JIT initialization.

This commit is contained in:
Lioncash 2015-02-19 10:29:21 -05:00
parent d32359c915
commit a60d3306b1
10 changed files with 76 additions and 101 deletions

View File

@ -8,6 +8,7 @@
#include "Common/IniFile.h" #include "Common/IniFile.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/HW/SI.h" #include "Core/HW/SI.h"
#include "Core/PowerPC/PowerPC.h"
#include "DiscIO/NANDContentLoader.h" #include "DiscIO/NANDContentLoader.h"
SConfig* SConfig::m_Instance; SConfig* SConfig::m_Instance;
@ -542,13 +543,13 @@ void SConfig::LoadCoreSettings(IniFile& ini)
core->Get("HLE_BS2", &m_LocalCoreStartupParameter.bHLE_BS2, false); core->Get("HLE_BS2", &m_LocalCoreStartupParameter.bHLE_BS2, false);
#ifdef _M_X86 #ifdef _M_X86
core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, SCoreStartupParameter::CORE_JIT64); core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, PowerPC::CORE_JIT64);
#elif _M_ARM_32 #elif _M_ARM_32
core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, SCoreStartupParameter::CORE_JITARM); core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, PowerPC::CORE_JITARM);
#elif _M_ARM_64 #elif _M_ARM_64
core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, SCoreStartupParameter::CORE_JITARM64); core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, PowerPC::CORE_JITARM64);
#else #else
core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, SCoreStartupParameter::CORE_INTERPRETER); core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, PowerPC::CORE_INTERPRETER);
#endif #endif
core->Get("Fastmem", &m_LocalCoreStartupParameter.bFastmem, true); core->Get("Fastmem", &m_LocalCoreStartupParameter.bFastmem, true);
core->Get("DSPHLE", &m_LocalCoreStartupParameter.bDSPHLE, true); core->Get("DSPHLE", &m_LocalCoreStartupParameter.bDSPHLE, true);

View File

@ -395,7 +395,7 @@ void EmuThread()
CBoot::BootUp(); CBoot::BootUp();
// Setup our core, but can't use dynarec if we are compare server // Setup our core, but can't use dynarec if we are compare server
if (core_parameter.iCPUCore != SCoreStartupParameter::CORE_INTERPRETER if (core_parameter.iCPUCore != PowerPC::CORE_INTERPRETER
&& (!core_parameter.bRunCompareServer || core_parameter.bRunCompareClient)) && (!core_parameter.bRunCompareServer || core_parameter.bRunCompareClient))
{ {
PowerPC::SetMode(PowerPC::MODE_JIT); PowerPC::SetMode(PowerPC::MODE_JIT);

View File

@ -17,6 +17,7 @@
#include "Core/Boot/Boot.h" #include "Core/Boot/Boot.h"
#include "Core/Boot/Boot_DOL.h" #include "Core/Boot/Boot_DOL.h"
#include "Core/FifoPlayer/FifoDataFile.h" #include "Core/FifoPlayer/FifoDataFile.h"
#include "Core/PowerPC/PowerPC.h"
#include "DiscIO/NANDContentLoader.h" #include "DiscIO/NANDContentLoader.h"
#include "DiscIO/VolumeCreator.h" #include "DiscIO/VolumeCreator.h"
@ -66,7 +67,7 @@ void SCoreStartupParameter::LoadDefaults()
iGDBPort = -1; iGDBPort = -1;
#endif #endif
iCPUCore = CORE_JIT64; iCPUCore = PowerPC::CORE_JIT64;
bCPUThread = false; bCPUThread = false;
bSkipIdle = false; bSkipIdle = false;
bSyncGPUOnSkipIdleHack = true; bSyncGPUOnSkipIdleHack = true;

View File

@ -136,14 +136,6 @@ struct SCoreStartupParameter
bool bAutomaticStart; bool bAutomaticStart;
bool bBootToPause; bool bBootToPause;
enum
{
CORE_INTERPRETER,
CORE_JIT64,
CORE_JITIL64,
CORE_JITARM,
CORE_JITARM64
};
int iCPUCore; int iCPUCore;
// JIT (shared between JIT and JITIL) // JIT (shared between JIT and JITIL)

View File

@ -15,6 +15,7 @@
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/HW/Memmap.h" #include "Core/HW/Memmap.h"
#include "Core/PowerPC/JitInterface.h" #include "Core/PowerPC/JitInterface.h"
#include "Core/PowerPC/PowerPC.h"
#include "Core/PowerPC/PPCSymbolDB.h" #include "Core/PowerPC/PPCSymbolDB.h"
#include "Core/PowerPC/Profiler.h" #include "Core/PowerPC/Profiler.h"
#include "Core/PowerPC/JitCommon/JitBase.h" #include "Core/PowerPC/JitCommon/JitBase.h"
@ -55,38 +56,28 @@ namespace JitInterface
switch (core) switch (core)
{ {
#if _M_X86 #if _M_X86
case 1: case PowerPC::CORE_JIT64:
{
ptr = new Jit64(); ptr = new Jit64();
break; break;
} case PowerPC::CORE_JITIL64:
case 2:
{
ptr = new JitIL(); ptr = new JitIL();
break; break;
}
#endif #endif
#if _M_ARM_32 #if _M_ARM_32
case 3: case PowerPC::CORE_JITARM:
{
ptr = new JitArm(); ptr = new JitArm();
break; break;
}
#endif #endif
#if _M_ARM_64 #if _M_ARM_64
case 4: case PowerPC::CORE_JITARM64:
{
ptr = new JitArm64(); ptr = new JitArm64();
break; break;
}
#endif #endif
default: default:
{
PanicAlert("Unrecognizable cpu_core: %d", core); PanicAlert("Unrecognizable cpu_core: %d", core);
jit = nullptr; jit = nullptr;
return nullptr; return nullptr;
} }
}
jit = static_cast<JitBase*>(ptr); jit = static_cast<JitBase*>(ptr);
jit->Init(); jit->Init();
return ptr; return ptr;
@ -96,38 +87,28 @@ namespace JitInterface
switch (core) switch (core)
{ {
#if _M_X86 #if _M_X86
case 1: case PowerPC::CORE_JIT64:
{
Jit64Tables::InitTables(); Jit64Tables::InitTables();
break; break;
} case PowerPC::CORE_JITIL64:
case 2:
{
JitILTables::InitTables(); JitILTables::InitTables();
break; break;
}
#endif #endif
#if _M_ARM_32 #if _M_ARM_32
case 3: case PowerPC::CORE_JITARM:
{
JitArmTables::InitTables(); JitArmTables::InitTables();
break; break;
}
#endif #endif
#if _M_ARM_64 #if _M_ARM_64
case 4: case PowerPC::CORE_JITARM64:
{
JitArm64Tables::InitTables(); JitArm64Tables::InitTables();
break; break;
}
#endif #endif
default: default:
{
PanicAlert("Unrecognizable cpu_core: %d", core); PanicAlert("Unrecognizable cpu_core: %d", core);
break; break;
} }
} }
}
CPUCoreBase *GetCore() CPUCoreBase *GetCore()
{ {
return jit; return jit;

View File

@ -11,6 +11,7 @@
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/PowerPC/JitInterface.h" #include "Core/PowerPC/JitInterface.h"
#include "Core/PowerPC/PowerPC.h"
#include "Core/PowerPC/PPCTables.h" #include "Core/PowerPC/PPCTables.h"
#include "Core/PowerPC/Interpreter/Interpreter.h" #include "Core/PowerPC/Interpreter/Interpreter.h"
#include "Core/PowerPC/Interpreter/Interpreter_Tables.h" #include "Core/PowerPC/Interpreter/Interpreter_Tables.h"
@ -104,19 +105,9 @@ void InitTables(int cpu_core)
{ {
// Interpreter ALWAYS needs to be initialized // Interpreter ALWAYS needs to be initialized
InterpreterTables::InitTables(); InterpreterTables::InitTables();
switch (cpu_core)
{ if (cpu_core != PowerPC::CORE_INTERPRETER)
case 0:
{
// Interpreter
break;
}
default:
{
JitInterface::InitTables(cpu_core); JitInterface::InitTables(cpu_core);
break;
}
}
} }
#define OPLOG #define OPLOG

View File

@ -143,11 +143,10 @@ void Init(int cpu_core)
switch (cpu_core) switch (cpu_core)
{ {
case 0: case PowerPC::CORE_INTERPRETER:
{
cpu_core_base = interpreter; cpu_core_base = interpreter;
break; break;
}
default: default:
cpu_core_base = JitInterface::InitJitCore(cpu_core); cpu_core_base = JitInterface::InitJitCore(cpu_core);
if (!cpu_core_base) // Handle Situations where JIT core isn't available if (!cpu_core_base) // Handle Situations where JIT core isn't available

View File

@ -21,6 +21,15 @@ extern CPUCoreBase *cpu_core_base;
namespace PowerPC namespace PowerPC
{ {
enum
{
CORE_INTERPRETER,
CORE_JIT64,
CORE_JITIL64,
CORE_JITARM,
CORE_JITARM64
};
enum CoreMode enum CoreMode
{ {
MODE_INTERPRETER, MODE_INTERPRETER,

View File

@ -41,6 +41,7 @@
#include "Core/HW/DSPHLE/DSPHLE.h" #include "Core/HW/DSPHLE/DSPHLE.h"
#include "Core/HW/DSPLLE/DSPLLE.h" #include "Core/HW/DSPLLE/DSPLLE.h"
#include "Core/IPC_HLE/WII_IPC_HLE.h" #include "Core/IPC_HLE/WII_IPC_HLE.h"
#include "Core/PowerPC/PowerPC.h"
#include "DiscIO/NANDContentLoader.h" #include "DiscIO/NANDContentLoader.h"
@ -884,7 +885,7 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
startup_params.iCPUCore = CPUCores[CPUEngine->GetSelection()].CPUid; startup_params.iCPUCore = CPUCores[CPUEngine->GetSelection()].CPUid;
if (main_frame->g_pCodeWindow) if (main_frame->g_pCodeWindow)
{ {
bool using_interp = (startup_params.iCPUCore == SCoreStartupParameter::CORE_INTERPRETER); bool using_interp = (startup_params.iCPUCore == PowerPC::CORE_INTERPRETER);
main_frame->g_pCodeWindow->GetMenuBar()->Check(IDM_INTERPRETER, using_interp); main_frame->g_pCodeWindow->GetMenuBar()->Check(IDM_INTERPRETER, using_interp);
} }
break; break;

View File

@ -436,7 +436,7 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& core_startup_parameter
" and stepping to work as explained in the Developer Documentation. But it can be very" " and stepping to work as explained in the Developer Documentation. But it can be very"
" slow, perhaps slower than 1 fps."), " slow, perhaps slower than 1 fps."),
wxITEM_CHECK); wxITEM_CHECK);
interpreter->Check(core_startup_parameter.iCPUCore == SCoreStartupParameter::CORE_INTERPRETER); interpreter->Check(core_startup_parameter.iCPUCore == PowerPC::CORE_INTERPRETER);
pCoreMenu->AppendSeparator(); pCoreMenu->AppendSeparator();
pCoreMenu->Append(IDM_JIT_NO_BLOCK_LINKING, _("&JIT Block Linking off"), pCoreMenu->Append(IDM_JIT_NO_BLOCK_LINKING, _("&JIT Block Linking off"),