Merge pull request #4711 from lioncash/tables

JIT Instruction Tables: Eliminate JIT global usages
This commit is contained in:
Markus Wick
2017-02-08 09:39:50 +01:00
committed by GitHub
9 changed files with 34 additions and 25 deletions

View File

@ -874,7 +874,7 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBloc
fpr.BindToRegister(reg, true, false); fpr.BindToRegister(reg, true, false);
} }
Jit64Tables::CompileInstruction(ops[i]); Jit64Tables::CompileInstruction(*this, ops[i]);
if (jo.memcheck && (opinfo->flags & FL_LOADSTORE)) if (jo.memcheck && (opinfo->flags & FL_LOADSTORE))
{ {

View File

@ -360,21 +360,20 @@ static GekkoOPTemplate table63_2[] = {
namespace Jit64Tables namespace Jit64Tables
{ {
void CompileInstruction(PPCAnalyst::CodeOp& op) void CompileInstruction(Jit64& jit, PPCAnalyst::CodeOp& op)
{ {
Jit64* jit64 = (Jit64*)g_jit; (jit.*dynaOpTable[op.inst.OPCD])(op.inst);
(jit64->*dynaOpTable[op.inst.OPCD])(op.inst);
GekkoOPInfo* info = op.opinfo; GekkoOPInfo* info = op.opinfo;
if (info) if (info)
{ {
#ifdef OPLOG #ifdef OPLOG
if (!strcmp(info->opname, OP_TO_LOG)) // "mcrfs" if (!strcmp(info->opname, OP_TO_LOG)) // "mcrfs"
{ {
rsplocations.push_back(g_jit.js.compilerPC); rsplocations.push_back(jit.js.compilerPC);
} }
#endif #endif
info->compileCount++; info->compileCount++;
info->lastUse = g_jit->js.compilerPC; info->lastUse = jit.js.compilerPC;
} }
} }

View File

@ -4,6 +4,8 @@
#pragma once #pragma once
class Jit64;
namespace PPCAnalyst namespace PPCAnalyst
{ {
struct CodeOp; struct CodeOp;
@ -11,6 +13,6 @@ struct CodeOp;
namespace Jit64Tables namespace Jit64Tables
{ {
void CompileInstruction(PPCAnalyst::CodeOp& op); void CompileInstruction(Jit64& jit, PPCAnalyst::CodeOp& op);
void InitTables(); void InitTables();
} }

View File

@ -640,7 +640,7 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBloc
ibuild.EmitBreakPointCheck(ibuild.EmitIntConst(ops[i].address)); ibuild.EmitBreakPointCheck(ibuild.EmitIntConst(ops[i].address));
} }
JitILTables::CompileInstruction(ops[i]); JitILTables::CompileInstruction(*this, ops[i]);
if (jo.memcheck && (opinfo->flags & FL_LOADSTORE)) if (jo.memcheck && (opinfo->flags & FL_LOADSTORE))
{ {

View File

@ -378,26 +378,25 @@ static GekkoOPTemplate table63_2[] = {
namespace JitILTables namespace JitILTables
{ {
void CompileInstruction(PPCAnalyst::CodeOp& op) void CompileInstruction(JitIL& jit, PPCAnalyst::CodeOp& op)
{ {
JitIL* jitil = (JitIL*)g_jit; (jit.*dynaOpTable[op.inst.OPCD])(op.inst);
(jitil->*dynaOpTable[op.inst.OPCD])(op.inst);
GekkoOPInfo* info = op.opinfo; GekkoOPInfo* info = op.opinfo;
if (info) if (info)
{ {
#ifdef OPLOG #ifdef OPLOG
if (!strcmp(info->opname, OP_TO_LOG)) // "mcrfs" if (!strcmp(info->opname, OP_TO_LOG)) // "mcrfs"
{ {
rsplocations.push_back(g_jit.js.compilerPC); rsplocations.push_back(jit.js.compilerPC);
} }
#endif #endif
info->compileCount++; info->compileCount++;
info->lastUse = g_jit->js.compilerPC; info->lastUse = jit.js.compilerPC;
} }
else else
{ {
PanicAlert("Tried to compile illegal (or unknown) instruction %08x, at %08x", op.inst.hex, PanicAlert("Tried to compile illegal (or unknown) instruction %08x, at %08x", op.inst.hex,
g_jit->js.compilerPC); jit.js.compilerPC);
} }
} }

View File

@ -4,6 +4,8 @@
#pragma once #pragma once
class JitIL;
namespace PPCAnalyst namespace PPCAnalyst
{ {
struct CodeOp; struct CodeOp;
@ -11,6 +13,6 @@ struct CodeOp;
namespace JitILTables namespace JitILTables
{ {
void CompileInstruction(PPCAnalyst::CodeOp& op); void CompileInstruction(JitIL& jit, PPCAnalyst::CodeOp& op);
void InitTables(); void InitTables();
} }

View File

@ -741,7 +741,7 @@ void JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBlock*
js.firstFPInstructionFound = true; js.firstFPInstructionFound = true;
} }
JitArm64Tables::CompileInstruction(ops[i]); JitArm64Tables::CompileInstruction(*this, ops[i]);
if (!MergeAllowedNextInstructions(1) || js.op[1].opinfo->type != OPTYPE_INTEGER) if (!MergeAllowedNextInstructions(1) || js.op[1].opinfo->type != OPTYPE_INTEGER)
FlushCarry(); FlushCarry();

View File

@ -2,9 +2,13 @@
// Licensed under GPLv2+ // Licensed under GPLv2+
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "Core/PowerPC/JitArm64/Jit.h"
#include "Core/PowerPC/JitArm64/JitArm64_Tables.h" #include "Core/PowerPC/JitArm64/JitArm64_Tables.h"
#include "Core/PowerPC/Gekko.h"
#include "Core/PowerPC/JitArm64/Jit.h"
#include "Core/PowerPC/JitInterface.h" #include "Core/PowerPC/JitInterface.h"
#include "Core/PowerPC/PPCAnalyst.h"
#include "Core/PowerPC/PPCTables.h"
// Should be moved in to the Jit class // Should be moved in to the Jit class
typedef void (JitArm64::*_Instruction)(UGeckoInstruction instCode); typedef void (JitArm64::*_Instruction)(UGeckoInstruction instCode);
@ -365,21 +369,20 @@ static GekkoOPTemplate table63_2[] = {
namespace JitArm64Tables namespace JitArm64Tables
{ {
void CompileInstruction(PPCAnalyst::CodeOp& op) void CompileInstruction(JitArm64& jit, PPCAnalyst::CodeOp& op)
{ {
JitArm64* jitarm = (JitArm64*)g_jit; (jit.*dynaOpTable[op.inst.OPCD])(op.inst);
(jitarm->*dynaOpTable[op.inst.OPCD])(op.inst);
GekkoOPInfo* info = op.opinfo; GekkoOPInfo* info = op.opinfo;
if (info) if (info)
{ {
#ifdef OPLOG #ifdef OPLOG
if (!strcmp(info->opname, OP_TO_LOG)) if (!strcmp(info->opname, OP_TO_LOG))
{ ///"mcrfs" { ///"mcrfs"
rsplocations.push_back(g_jit.js.compilerPC); rsplocations.push_back(jit.js.compilerPC);
} }
#endif #endif
info->compileCount++; info->compileCount++;
info->lastUse = g_jit->js.compilerPC; info->lastUse = jit.js.compilerPC;
} }
} }

View File

@ -4,11 +4,15 @@
#pragma once #pragma once
#include "Core/PowerPC/Gekko.h" class JitArm64;
#include "Core/PowerPC/PPCTables.h"
namespace PPCAnalyst
{
struct CodeOp;
}
namespace JitArm64Tables namespace JitArm64Tables
{ {
void CompileInstruction(PPCAnalyst::CodeOp& op); void CompileInstruction(JitArm64& jit, PPCAnalyst::CodeOp& op);
void InitTables(); void InitTables();
} }