Merge pull request #2896 from lioncash/using

Core: Minor CPU core typedef cleanup
This commit is contained in:
Lioncash
2015-08-22 19:00:23 -04:00
14 changed files with 45 additions and 57 deletions

View File

@ -26,12 +26,12 @@ namespace
bool Interpreter::m_EndBlock; bool Interpreter::m_EndBlock;
// function tables // function tables
Interpreter::_interpreterInstruction Interpreter::m_opTable[64]; Interpreter::Instruction Interpreter::m_opTable[64];
Interpreter::_interpreterInstruction Interpreter::m_opTable4[1024]; Interpreter::Instruction Interpreter::m_opTable4[1024];
Interpreter::_interpreterInstruction Interpreter::m_opTable19[1024]; Interpreter::Instruction Interpreter::m_opTable19[1024];
Interpreter::_interpreterInstruction Interpreter::m_opTable31[1024]; Interpreter::Instruction Interpreter::m_opTable31[1024];
Interpreter::_interpreterInstruction Interpreter::m_opTable59[32]; Interpreter::Instruction Interpreter::m_opTable59[32];
Interpreter::_interpreterInstruction Interpreter::m_opTable63[1024]; Interpreter::Instruction Interpreter::m_opTable63[1024];
void Interpreter::RunTable4(UGeckoInstruction _inst) { m_opTable4 [_inst.SUBOP10](_inst); } void Interpreter::RunTable4(UGeckoInstruction _inst) { m_opTable4 [_inst.SUBOP10](_inst); }
void Interpreter::RunTable19(UGeckoInstruction _inst) { m_opTable19[_inst.SUBOP10](_inst); } void Interpreter::RunTable19(UGeckoInstruction _inst) { m_opTable19[_inst.SUBOP10](_inst); }

View File

@ -273,13 +273,13 @@ public:
static void sync(UGeckoInstruction _inst); static void sync(UGeckoInstruction _inst);
static void isync(UGeckoInstruction _inst); static void isync(UGeckoInstruction _inst);
typedef void(*_interpreterInstruction)(UGeckoInstruction instCode); using Instruction = void (*)(UGeckoInstruction instCode);
static _interpreterInstruction m_opTable[64]; static Instruction m_opTable[64];
static _interpreterInstruction m_opTable4[1024]; static Instruction m_opTable4[1024];
static _interpreterInstruction m_opTable19[1024]; static Instruction m_opTable19[1024];
static _interpreterInstruction m_opTable31[1024]; static Instruction m_opTable31[1024];
static _interpreterInstruction m_opTable59[32]; static Instruction m_opTable59[32];
static _interpreterInstruction m_opTable63[1024]; static Instruction m_opTable63[1024];
// singleton // singleton
static Interpreter* getInstance(); static Interpreter* getInstance();

View File

@ -2,14 +2,15 @@
// Licensed under GPLv2+ // Licensed under GPLv2+
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "Core/PowerPC/Gekko.h"
#include "Core/PowerPC/PPCTables.h"
#include "Core/PowerPC/Interpreter/Interpreter.h"
#include "Core/PowerPC/Interpreter/Interpreter_Tables.h" #include "Core/PowerPC/Interpreter/Interpreter_Tables.h"
typedef void (*_Instruction) (UGeckoInstruction instCode);
struct GekkoOPTemplate struct GekkoOPTemplate
{ {
int opcode; int opcode;
_Instruction Inst; Interpreter::Instruction Inst;
GekkoOPInfo opinfo; GekkoOPInfo opinfo;
}; };

View File

@ -4,10 +4,6 @@
#pragma once #pragma once
#include "../Gekko.h"
#include "../PPCTables.h"
#include "Core/PowerPC/Interpreter/Interpreter.h"
namespace InterpreterTables namespace InterpreterTables
{ {
void InitTables(); void InitTables();

View File

@ -240,7 +240,7 @@ void Jit64::FallBackToInterpreter(UGeckoInstruction inst)
MOV(32, PPCSTATE(pc), Imm32(js.compilerPC)); MOV(32, PPCSTATE(pc), Imm32(js.compilerPC));
MOV(32, PPCSTATE(npc), Imm32(js.compilerPC + 4)); MOV(32, PPCSTATE(npc), Imm32(js.compilerPC + 4));
} }
Interpreter::_interpreterInstruction instr = GetInterpreterOp(inst); Interpreter::Instruction instr = GetInterpreterOp(inst);
ABI_PushRegistersAndAdjustStack({}, 0); ABI_PushRegistersAndAdjustStack({}, 0);
ABI_CallFunctionC((void*)instr, inst.hex); ABI_CallFunctionC((void*)instr, inst.hex);
ABI_PopRegistersAndAdjustStack({}, 0); ABI_PopRegistersAndAdjustStack({}, 0);

View File

@ -151,6 +151,7 @@ public:
void UpdateRoundingMode(); void UpdateRoundingMode();
// OPCODES // OPCODES
using Instruction = void (Jit64::*)(UGeckoInstruction instCode);
void FallBackToInterpreter(UGeckoInstruction _inst); void FallBackToInterpreter(UGeckoInstruction _inst);
void DoNothing(UGeckoInstruction _inst); void DoNothing(UGeckoInstruction _inst);
void HLEFunction(UGeckoInstruction _inst); void HLEFunction(UGeckoInstruction _inst);

View File

@ -2,18 +2,16 @@
// Licensed under GPLv2+ // Licensed under GPLv2+
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "Core/PowerPC/Gekko.h"
#include "Core/PowerPC/Jit64/Jit.h" #include "Core/PowerPC/Jit64/Jit.h"
#include "Core/PowerPC/Jit64/Jit64_Tables.h" #include "Core/PowerPC/Jit64/Jit64_Tables.h"
// Should be moved in to the Jit class static Jit64::Instruction dynaOpTable[64];
typedef void (Jit64::*_Instruction) (UGeckoInstruction instCode); static Jit64::Instruction dynaOpTable4[1024];
static Jit64::Instruction dynaOpTable19[1024];
static _Instruction dynaOpTable[64]; static Jit64::Instruction dynaOpTable31[1024];
static _Instruction dynaOpTable4[1024]; static Jit64::Instruction dynaOpTable59[32];
static _Instruction dynaOpTable19[1024]; static Jit64::Instruction dynaOpTable63[1024];
static _Instruction dynaOpTable31[1024];
static _Instruction dynaOpTable59[32];
static _Instruction dynaOpTable63[1024];
void Jit64::DynaRunTable4(UGeckoInstruction _inst) {(this->*dynaOpTable4 [_inst.SUBOP10])(_inst);} void Jit64::DynaRunTable4(UGeckoInstruction _inst) {(this->*dynaOpTable4 [_inst.SUBOP10])(_inst);}
void Jit64::DynaRunTable19(UGeckoInstruction _inst) {(this->*dynaOpTable19[_inst.SUBOP10])(_inst);} void Jit64::DynaRunTable19(UGeckoInstruction _inst) {(this->*dynaOpTable19[_inst.SUBOP10])(_inst);}
void Jit64::DynaRunTable31(UGeckoInstruction _inst) {(this->*dynaOpTable31[_inst.SUBOP10])(_inst);} void Jit64::DynaRunTable31(UGeckoInstruction _inst) {(this->*dynaOpTable31[_inst.SUBOP10])(_inst);}
@ -23,8 +21,7 @@ void Jit64::DynaRunTable63(UGeckoInstruction _inst) {(this->*dynaOpTable63[_inst
struct GekkoOPTemplate struct GekkoOPTemplate
{ {
int opcode; int opcode;
_Instruction Inst; Jit64::Instruction Inst;
//GekkoOPInfo opinfo; // Doesn't need opinfo, Interpreter fills it out
}; };
static GekkoOPTemplate primarytable[] = static GekkoOPTemplate primarytable[] =

View File

@ -4,12 +4,10 @@
#pragma once #pragma once
#include "Core/PowerPC/Gekko.h" namespace PPCAnalyst { struct CodeOp; }
#include "Core/PowerPC/PPCTables.h"
#include "Core/PowerPC/Jit64/Jit.h"
namespace Jit64Tables namespace Jit64Tables
{ {
void CompileInstruction(PPCAnalyst::CodeOp & op); void CompileInstruction(PPCAnalyst::CodeOp& op);
void InitTables(); void InitTables();
} }

View File

@ -87,6 +87,7 @@ public:
void WriteCode(u32 exitAddress); void WriteCode(u32 exitAddress);
// OPCODES // OPCODES
using Instruction = void (JitIL::*)(UGeckoInstruction instCode);
void FallBackToInterpreter(UGeckoInstruction _inst) override; void FallBackToInterpreter(UGeckoInstruction _inst) override;
void DoNothing(UGeckoInstruction _inst) override; void DoNothing(UGeckoInstruction _inst) override;
void HLEFunction(UGeckoInstruction _inst) override; void HLEFunction(UGeckoInstruction _inst) override;
@ -96,5 +97,4 @@ public:
void DynaRunTable31(UGeckoInstruction _inst) override; void DynaRunTable31(UGeckoInstruction _inst) override;
void DynaRunTable59(UGeckoInstruction _inst) override; void DynaRunTable59(UGeckoInstruction _inst) override;
void DynaRunTable63(UGeckoInstruction _inst) override; void DynaRunTable63(UGeckoInstruction _inst) override;
}; };

View File

@ -2,17 +2,17 @@
// Licensed under GPLv2+ // Licensed under GPLv2+
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "Core/PowerPC/Gekko.h"
#include "Core/PowerPC/PPCTables.h"
#include "Core/PowerPC/Jit64IL/JitIL.h"
#include "Core/PowerPC/Jit64IL/JitIL_Tables.h" #include "Core/PowerPC/Jit64IL/JitIL_Tables.h"
// Should be moved in to the Jit class static JitIL::Instruction dynaOpTable[64];
typedef void (JitIL::*_Instruction) (UGeckoInstruction instCode); static JitIL::Instruction dynaOpTable4[1024];
static JitIL::Instruction dynaOpTable19[1024];
static _Instruction dynaOpTable[64]; static JitIL::Instruction dynaOpTable31[1024];
static _Instruction dynaOpTable4[1024]; static JitIL::Instruction dynaOpTable59[32];
static _Instruction dynaOpTable19[1024]; static JitIL::Instruction dynaOpTable63[1024];
static _Instruction dynaOpTable31[1024];
static _Instruction dynaOpTable59[32];
static _Instruction dynaOpTable63[1024];
void JitIL::DynaRunTable4(UGeckoInstruction _inst) {(this->*dynaOpTable4 [_inst.SUBOP10])(_inst);} void JitIL::DynaRunTable4(UGeckoInstruction _inst) {(this->*dynaOpTable4 [_inst.SUBOP10])(_inst);}
void JitIL::DynaRunTable19(UGeckoInstruction _inst) {(this->*dynaOpTable19[_inst.SUBOP10])(_inst);} void JitIL::DynaRunTable19(UGeckoInstruction _inst) {(this->*dynaOpTable19[_inst.SUBOP10])(_inst);}
@ -20,13 +20,10 @@ void JitIL::DynaRunTable31(UGeckoInstruction _inst) {(this->*dynaOpTable31[_inst
void JitIL::DynaRunTable59(UGeckoInstruction _inst) {(this->*dynaOpTable59[_inst.SUBOP5 ])(_inst);} void JitIL::DynaRunTable59(UGeckoInstruction _inst) {(this->*dynaOpTable59[_inst.SUBOP5 ])(_inst);}
void JitIL::DynaRunTable63(UGeckoInstruction _inst) {(this->*dynaOpTable63[_inst.SUBOP10])(_inst);} void JitIL::DynaRunTable63(UGeckoInstruction _inst) {(this->*dynaOpTable63[_inst.SUBOP10])(_inst);}
struct GekkoOPTemplate struct GekkoOPTemplate
{ {
int opcode; int opcode;
_Instruction Inst; JitIL::Instruction Inst;
//GekkoOPInfo opinfo; // Doesn't need opinfo, Interpreter fills it out
}; };
static GekkoOPTemplate primarytable[] = static GekkoOPTemplate primarytable[] =

View File

@ -4,12 +4,10 @@
#pragma once #pragma once
#include "Core/PowerPC/Gekko.h" namespace PPCAnalyst { struct CodeOp; }
#include "Core/PowerPC/PPCTables.h"
#include "Core/PowerPC/Jit64IL/JitIL.h"
namespace JitILTables namespace JitILTables
{ {
void CompileInstruction(PPCAnalyst::CodeOp & op); void CompileInstruction(PPCAnalyst::CodeOp& op);
void InitTables(); void InitTables();
} }

View File

@ -70,7 +70,7 @@ void JitArm64::FallBackToInterpreter(UGeckoInstruction inst)
gpr.Unlock(WA); gpr.Unlock(WA);
} }
Interpreter::_interpreterInstruction instr = GetInterpreterOp(inst); Interpreter::Instruction instr = GetInterpreterOp(inst);
MOVI2R(W0, inst.hex); MOVI2R(W0, inst.hex);
MOVI2R(X30, (u64)instr); MOVI2R(X30, (u64)instr);
BLR(X30); BLR(X30);

View File

@ -63,7 +63,7 @@ GekkoOPInfo *GetOpInfo(UGeckoInstruction _inst)
} }
} }
Interpreter::_interpreterInstruction GetInterpreterOp(UGeckoInstruction _inst) Interpreter::Instruction GetInterpreterOp(UGeckoInstruction _inst)
{ {
const GekkoOPInfo *info = m_infoTable[_inst.OPCD]; const GekkoOPInfo *info = m_infoTable[_inst.OPCD];
if ((info->type & 0xFFFFFF) == OPTYPE_SUBTABLE) if ((info->type & 0xFFFFFF) == OPTYPE_SUBTABLE)

View File

@ -100,7 +100,7 @@ extern GekkoOPInfo *m_allInstructions[512];
extern int m_numInstructions; extern int m_numInstructions;
GekkoOPInfo *GetOpInfo(UGeckoInstruction _inst); GekkoOPInfo *GetOpInfo(UGeckoInstruction _inst);
Interpreter::_interpreterInstruction GetInterpreterOp(UGeckoInstruction _inst); Interpreter::Instruction GetInterpreterOp(UGeckoInstruction _inst);
namespace PPCTables namespace PPCTables
{ {