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

View File

@ -395,7 +395,7 @@ void EmuThread()
CBoot::BootUp();
// 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))
{
PowerPC::SetMode(PowerPC::MODE_JIT);

View File

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

View File

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

View File

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

View File

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

View File

@ -143,18 +143,17 @@ void Init(int cpu_core)
switch (cpu_core)
{
case 0:
case PowerPC::CORE_INTERPRETER:
cpu_core_base = interpreter;
break;
default:
cpu_core_base = JitInterface::InitJitCore(cpu_core);
if (!cpu_core_base) // Handle Situations where JIT core isn't available
{
WARN_LOG(POWERPC, "Jit core %d not available. Defaulting to interpreter.", cpu_core);
cpu_core_base = interpreter;
break;
}
default:
cpu_core_base = JitInterface::InitJitCore(cpu_core);
if (!cpu_core_base) // Handle Situations where JIT core isn't available
{
WARN_LOG(POWERPC, "Jit core %d not available. Defaulting to interpreter.", cpu_core);
cpu_core_base = interpreter;
}
break;
}

View File

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

View File

@ -41,6 +41,7 @@
#include "Core/HW/DSPHLE/DSPHLE.h"
#include "Core/HW/DSPLLE/DSPLLE.h"
#include "Core/IPC_HLE/WII_IPC_HLE.h"
#include "Core/PowerPC/PowerPC.h"
#include "DiscIO/NANDContentLoader.h"
@ -884,7 +885,7 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
startup_params.iCPUCore = CPUCores[CPUEngine->GetSelection()].CPUid;
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);
}
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"
" slow, perhaps slower than 1 fps."),
wxITEM_CHECK);
interpreter->Check(core_startup_parameter.iCPUCore == SCoreStartupParameter::CORE_INTERPRETER);
interpreter->Check(core_startup_parameter.iCPUCore == PowerPC::CORE_INTERPRETER);
pCoreMenu->AppendSeparator();
pCoreMenu->Append(IDM_JIT_NO_BLOCK_LINKING, _("&JIT Block Linking off"),