From b8f619550d54ca4cc956f331b18e1659ab1813b6 Mon Sep 17 00:00:00 2001 From: hrydgard Date: Thu, 18 Dec 2008 13:21:02 +0000 Subject: [PATCH] add ppc disassembly to jit results viewer windowTurn the JIT into a class. Indentation cleanup will be in a separate CL, and the block cache will later be split out into its own class. Cannot detect any speed difference whatsoever - the games spend 99.9% of their time in already jitted code anyway. I have a good reason for doing this - see upcoming changes. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1585 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Core.vcproj | 8 - Source/Core/Core/Src/Console.cpp | 4 +- Source/Core/Core/Src/HW/Memmap.cpp | 3 +- Source/Core/Core/Src/MemTools.cpp | 5 +- .../Interpreter/Interpreter_LoadStore.cpp | 2 +- Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp | 32 +- Source/Core/Core/Src/PowerPC/Jit64/Jit.h | 148 ++++- Source/Core/Core/Src/PowerPC/Jit64/JitAsm.cpp | 10 +- Source/Core/Core/Src/PowerPC/Jit64/JitAsm.h | 40 +- .../Core/Src/PowerPC/Jit64/JitBackpatch.cpp | 6 +- .../Core/Src/PowerPC/Jit64/JitBackpatch.h | 50 -- .../Core/Core/Src/PowerPC/Jit64/JitCache.cpp | 69 ++- Source/Core/Core/Src/PowerPC/Jit64/JitCache.h | 80 +-- .../Core/Core/Src/PowerPC/Jit64/JitCore.cpp | 13 +- Source/Core/Core/Src/PowerPC/Jit64/JitCore.h | 15 +- .../Core/Src/PowerPC/Jit64/JitRegCache.cpp | 6 +- .../Core/Core/Src/PowerPC/Jit64/JitRegCache.h | 17 +- .../Core/Src/PowerPC/Jit64/Jit_Branch.cpp | 16 +- .../Src/PowerPC/Jit64/Jit_FloatingPoint.cpp | 16 +- .../Core/Src/PowerPC/Jit64/Jit_Integer.cpp | 62 +-- .../Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp | 23 +- .../PowerPC/Jit64/Jit_LoadStoreFloating.cpp | 17 +- .../Src/PowerPC/Jit64/Jit_LoadStorePaired.cpp | 10 +- .../Core/Src/PowerPC/Jit64/Jit_Paired.cpp | 35 +- .../Src/PowerPC/Jit64/Jit_SystemRegisters.cpp | 20 +- .../Core/Core/Src/PowerPC/Jit64/Jit_Util.cpp | 26 +- Source/Core/Core/Src/PowerPC/Jit64/Jit_Util.h | 39 -- Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp | 2 +- Source/Core/Core/Src/PowerPC/PPCTables.cpp | 524 +++++++++--------- Source/Core/Core/Src/PowerPC/PPCTables.h | 6 +- Source/Core/Core/Src/PowerPC/PowerPC.cpp | 11 +- Source/Core/Core/Src/PowerPC/Profiler.cpp | 8 +- Source/Core/Core/Src/State.cpp | 6 +- Source/Core/DebuggerWX/Src/CodeWindow.cpp | 10 +- Source/Core/DebuggerWX/Src/JitWindow.cpp | 11 +- 35 files changed, 604 insertions(+), 746 deletions(-) delete mode 100644 Source/Core/Core/Src/PowerPC/Jit64/JitBackpatch.h delete mode 100644 Source/Core/Core/Src/PowerPC/Jit64/Jit_Util.h diff --git a/Source/Core/Core/Core.vcproj b/Source/Core/Core/Core.vcproj index 0271e614f3..2de38a011b 100644 --- a/Source/Core/Core/Core.vcproj +++ b/Source/Core/Core/Core.vcproj @@ -990,10 +990,6 @@ RelativePath=".\Src\PowerPC\Jit64\Jit_Util.cpp" > - - @@ -1006,10 +1002,6 @@ RelativePath=".\Src\PowerPC\Jit64\JitBackpatch.cpp" > - - diff --git a/Source/Core/Core/Src/Console.cpp b/Source/Core/Core/Src/Console.cpp index 44c5123245..ebf99d92a1 100644 --- a/Source/Core/Core/Src/Console.cpp +++ b/Source/Core/Core/Src/Console.cpp @@ -25,7 +25,7 @@ #include "PowerPC/PPCTables.h" #include "CoreTiming.h" #include "Core.h" -#include "PowerPC/Jit64/JitCache.h" +#include "PowerPC/Jit64/Jit.h" #include "PowerPC/SymbolDB.h" #include "PowerPCDisasm.h" #include "Console.h" @@ -38,7 +38,7 @@ void Console_Submit(const char *cmd) CASE1("jits") { #ifdef _M_X64 - Jit64::PrintStats(); + jit.PrintStats(); #endif } CASE1("r") diff --git a/Source/Core/Core/Src/HW/Memmap.cpp b/Source/Core/Core/Src/HW/Memmap.cpp index bc30c9a443..0dd15705b3 100644 --- a/Source/Core/Core/Src/HW/Memmap.cpp +++ b/Source/Core/Core/Src/HW/Memmap.cpp @@ -23,6 +23,7 @@ #include "Memmap.h" #include "../Core.h" #include "../PowerPC/PowerPC.h" +#include "../PowerPC/Jit64/Jit.h" #include "../PowerPC/Jit64/JitCache.h" #include "CPU.h" #include "PeripheralInterface.h" @@ -758,7 +759,7 @@ bool AreMemoryBreakpointsActivated() u32 Read_Instruction(const u32 _Address) { - return Jit64::GetOriginalCode(_Address); + return jit.GetOriginalCode(_Address); } u32 Read_Opcode(const u32 _Address) diff --git a/Source/Core/Core/Src/MemTools.cpp b/Source/Core/Core/Src/MemTools.cpp index 960962ce2a..986ce63358 100644 --- a/Source/Core/Core/Src/MemTools.cpp +++ b/Source/Core/Core/Src/MemTools.cpp @@ -47,7 +47,6 @@ #include "HW/Memmap.h" #include "PowerPC/PowerPC.h" #include "PowerPC/Jit64/Jit.h" -#include "PowerPC/Jit64/JitBackpatch.h" #include "x64Analyzer.h" namespace EMM @@ -76,7 +75,7 @@ LONG NTAPI Handler(PEXCEPTION_POINTERS pPtrs) PVOID codeAddr = pPtrs->ExceptionRecord->ExceptionAddress; unsigned char *codePtr = (unsigned char*)codeAddr; - if (!Jit64::IsInJitCode(codePtr)) { + if (!jit.IsInJitCode(codePtr)) { // Let's not prevent debugging. return (DWORD)EXCEPTION_CONTINUE_SEARCH; } @@ -105,7 +104,7 @@ LONG NTAPI Handler(PEXCEPTION_POINTERS pPtrs) //We could emulate the memory accesses here, but then they would still be around to take up //execution resources. Instead, we backpatch into a generic memory call and retry. - u8 *new_rip = Jit64::BackPatch(codePtr, accessType, emAddress, ctx); + u8 *new_rip = jit.BackPatch(codePtr, accessType, emAddress, ctx); // Rip/Eip needs to be updated. if (new_rip) diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp index 02571262df..c9945f789a 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp @@ -340,7 +340,7 @@ void icbi(UGeckoInstruction _inst) // VERY IMPORTANT when we start linking blocks // There are a TON of these so hopefully we can make this mechanism // fast in the JIT - Jit64::InvalidateCodeRange(address, 0x20); + jit.InvalidateCodeRange(address, 0x20); } void lbzux(UGeckoInstruction _inst) diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp index 32f06aed2f..21427735cc 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp @@ -161,20 +161,15 @@ ps_adds1 */ +Jit64 jit; +PPCAnalyst::CodeBuffer code_buffer(32000); namespace CPUCompare { extern u32 m_BlockStart; } - -namespace Jit64 -{ - JitState js; - JitOptions jo; - PPCAnalyst::CodeBuffer code_buffer(32000); - - void Init() + void Jit64::Init() { jo.optimizeStack = true; jo.enableBlocklink = true; // Speed boost, but not 100% safe @@ -189,7 +184,7 @@ namespace Jit64 jo.fastInterrupts = false; } - void WriteCallInterpreter(UGeckoInstruction _inst) + void Jit64::WriteCallInterpreter(UGeckoInstruction _inst) { gpr.Flush(FLUSH_ALL); fpr.Flush(FLUSH_ALL); @@ -202,12 +197,12 @@ namespace Jit64 ABI_CallFunctionC((void*)instr, _inst.hex); } - void Default(UGeckoInstruction _inst) + void Jit64::Default(UGeckoInstruction _inst) { WriteCallInterpreter(_inst.hex); } - void HLEFunction(UGeckoInstruction _inst) + void Jit64::HLEFunction(UGeckoInstruction _inst) { gpr.Flush(FLUSH_ALL); fpr.Flush(FLUSH_ALL); @@ -216,7 +211,7 @@ namespace Jit64 WriteExitDestInEAX(0); } - void DoNothing(UGeckoInstruction _inst) + void Jit64::DoNothing(UGeckoInstruction _inst) { // Yup, just don't do anything. } @@ -249,13 +244,13 @@ namespace Jit64 been_here[PC] = 1; } - void Cleanup() + void Jit64::Cleanup() { if (jo.optimizeGatherPipe && js.fifoBytesThisBlock > 0) CALL((void *)&GPFifo::CheckGatherPipe); } - void WriteExit(u32 destination, int exit_num) + void Jit64::WriteExit(u32 destination, int exit_num) { Cleanup(); SUB(32, M(&CoreTiming::downcount), js.downcountAmount > 127 ? Imm32(js.downcountAmount) : Imm8(js.downcountAmount)); @@ -280,7 +275,7 @@ namespace Jit64 } } - void WriteExitDestInEAX(int exit_num) + void Jit64::WriteExitDestInEAX(int exit_num) { MOV(32, M(&PC), R(EAX)); Cleanup(); @@ -288,7 +283,7 @@ namespace Jit64 JMP(Asm::dispatcher, true); } - void WriteRfiExitDestInEAX() + void Jit64::WriteRfiExitDestInEAX() { MOV(32, M(&PC), R(EAX)); Cleanup(); @@ -296,7 +291,7 @@ namespace Jit64 JMP(Asm::testExceptions, true); } - void WriteExceptionExit(u32 exception) + void Jit64::WriteExceptionExit(u32 exception) { Cleanup(); OR(32, M(&PowerPC::ppcState.Exceptions), Imm32(exception)); @@ -304,7 +299,7 @@ namespace Jit64 JMP(Asm::testExceptions, true); } - const u8* DoJit(u32 emaddress, JitBlock &b) + const u8* Jit64::DoJit(u32 emaddress, JitBlock &b) { if (emaddress == 0) PanicAlert("ERROR : Trying to compile at 0. LR=%08x", LR); @@ -424,4 +419,3 @@ namespace Jit64 b.originalSize = size; return normalEntry; } -} diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit.h b/Source/Core/Core/Src/PowerPC/Jit64/Jit.h index 092c200101..c93dbf1a58 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit.h +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit.h @@ -26,20 +26,71 @@ #include "JitCache.h" #include "x64Emitter.h" -namespace Jit64 +#ifdef _WIN32 + +#include + +#else + +// A bit of a hack to get things building under linux. We manually fill in this structure as needed +// from the real context. +struct CONTEXT { - struct JitStats +#ifdef _M_X64 + u64 Rip; + u64 Rax; +#else + u32 Eip; + u32 Eax; +#endif +}; + +#endif + +class Jit64 +{ +public: + typedef void (*CompiledCode)(); + + void unknown_instruction(UGeckoInstruction _inst); + + //Code pointers are stored separately, they will be accessed much more frequently + + enum BlockFlag { - u32 compiledBlocks; - float averageCodeExpansion; - float ratioOpsCompiled; //how many really were compiled, how many became "call interpreter"? + BLOCK_USE_GQR0 = 0x1, + BLOCK_USE_GQR1 = 0x2, + BLOCK_USE_GQR2 = 0x4, + BLOCK_USE_GQR3 = 0x8, + BLOCK_USE_GQR4 = 0x10, + BLOCK_USE_GQR5 = 0x20, + BLOCK_USE_GQR6 = 0x40, + BLOCK_USE_GQR7 = 0x80, }; -#define JIT_OPCODE 0 + // TODO(ector) - optimize this struct for size + struct JitBlock + { + u32 exitAddress[2]; // 0xFFFFFFFF == unknown + u8 *exitPtrs[2]; // to be able to rewrite the exit jump + bool linkStatus[2]; - struct JitBlock; - const u8* DoJit(u32 emaddress, JitBlock &b); - bool IsInJitCode(const u8 *codePtr); + u32 originalAddress; + u32 originalFirstOpcode; //to be able to restore + u32 codeSize; + u32 originalSize; + int runCount; // for profiling. +#ifdef _WIN32 + // we don't really need to save start and stop + // TODO (mb2): ticStart and ticStop -> "local var" mean "in block" ... low priority ;) + LARGE_INTEGER ticStart; // for profiling - time. + LARGE_INTEGER ticStop; // for profiling - time. + LARGE_INTEGER ticCounter; // for profiling - time. +#endif + const u8 *checkedEntry; + bool invalid; + int flags; + }; struct JitState { @@ -77,21 +128,84 @@ namespace Jit64 bool fastInterrupts; }; - extern JitState js; - extern JitOptions jo; + JitState js; + JitOptions jo; + + void PrintStats(); + void EnterFastRun(); + + // Code Cache + + u32 GetOriginalCode(u32 address); + JitBlock *GetBlock(int no); + void InvalidateCodeRange(u32 address, u32 length); + int GetBlockNumberFromAddress(u32 address); + CompiledCode GetCompiledCode(u32 address); + CompiledCode GetCompiledCodeFromBlock(int blockNumber); + int GetCodeSize(); + int GetNumBlocks(); + u8 **GetCodePointers(); + void DestroyBlocksWithFlag(BlockFlag death_flag); + void LinkBlocks(); + void LinkBlockExits(int i); + void LinkBlock(int i); + void ClearCache(); + void InitCache(); + void ShutdownCache(); + void ResetCache(); + void DestroyBlock(int blocknum, bool invalidate); + bool RangeIntersect(int s1, int e1, int s2, int e2) const; + bool IsInJitCode(const u8 *codePtr); + + u8 *BackPatch(u8 *codePtr, int accessType, u32 emAddress, CONTEXT *ctx); + +#define JIT_OPCODE 0 + + const u8* Jit(u32 emaddress); + const u8* DoJit(u32 emaddress, JitBlock &b); void Init(); - void Default(UGeckoInstruction _inst); - void DoNothing(UGeckoInstruction _inst); - + // Utilities for use by opcodes + void WriteExit(u32 destination, int exit_num); void WriteExitDestInEAX(int exit_num); void WriteExceptionExit(u32 exception); void WriteRfiExitDestInEAX(); + void WriteCallInterpreter(UGeckoInstruction _inst); + void Cleanup(); + + void UnsafeLoadRegToReg(Gen::X64Reg reg_addr, Gen::X64Reg reg_value, int accessSize, s32 offset = 0, bool signExtend = false); + void UnsafeWriteRegToReg(Gen::X64Reg reg_value, Gen::X64Reg reg_addr, int accessSize, s32 offset = 0); + void SafeLoadRegToEAX(Gen::X64Reg reg, int accessSize, s32 offset, bool signExtend = false); + void SafeWriteRegToReg(Gen::X64Reg reg_value, Gen::X64Reg reg_addr, int accessSize, s32 offset); + void WriteToConstRamAddress(int accessSize, const Gen::OpArg& arg, u32 address); + void WriteFloatToConstRamAddress(const Gen::X64Reg& xmm_reg, u32 address); + void GenerateCarry(Gen::X64Reg temp_reg); + + void ForceSinglePrecisionS(Gen::X64Reg xmm); + void ForceSinglePrecisionP(Gen::X64Reg xmm); + void JitClearCA(); + void JitSetCA(); + void tri_op(int d, int a, int b, bool reversible, void (*op)(Gen::X64Reg, Gen::OpArg)); + typedef u32 (*Operation)(u32 a, u32 b); + void regimmop(int d, int a, bool binary, u32 value, Operation doop, void(*op)(int, const Gen::OpArg&, const Gen::OpArg&), bool Rc = false, bool carry = false); + void fp_tri_op(int d, int a, int b, bool reversible, bool dupe, void (*op)(Gen::X64Reg, Gen::OpArg)); + + + // OPCODES + + void Default(UGeckoInstruction _inst); + void DoNothing(UGeckoInstruction _inst); void HLEFunction(UGeckoInstruction _inst); + void DynaRunTable4(UGeckoInstruction _inst); + void DynaRunTable19(UGeckoInstruction _inst); + void DynaRunTable31(UGeckoInstruction _inst); + void DynaRunTable59(UGeckoInstruction _inst); + void DynaRunTable63(UGeckoInstruction _inst); + void addx(UGeckoInstruction inst); void orx(UGeckoInstruction inst); void xorx(UGeckoInstruction inst); @@ -176,7 +290,11 @@ namespace Jit64 void lmw(UGeckoInstruction inst); void stmw(UGeckoInstruction inst); -} +}; + +extern Jit64 jit; + +const u8 *Jit(u32 emaddress); #endif diff --git a/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.cpp b/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.cpp index 0e4fc0a32b..35c33ca3a8 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.cpp @@ -35,9 +35,6 @@ using namespace Gen; int blocksExecuted; -namespace Jit64 -{ - namespace Asm { const u8 *enterCode; @@ -133,7 +130,7 @@ void Generate() } //grab from list and jump to it //INT3(); - MOV(32, R(EDX), ImmPtr(GetCodePointers())); + MOV(32, R(EDX), ImmPtr(jit.GetCodePointers())); JMPptr(MComplex(EDX, EAX, 4, 0)); SetJumpTarget(notfound); @@ -190,7 +187,7 @@ void Generate() ABI_PushAllCalleeSavedRegsAndAdjustStack(); MOV(64, R(RBX), Imm64((u64)Memory::base)); - MOV(64, R(R15), Imm64((u64)GetCodePointers())); //It's below 2GB so 32 bits are good enough + MOV(64, R(R15), Imm64((u64)jit.GetCodePointers())); //It's below 2GB so 32 bits are good enough const u8 *outerLoop = GetCodePtr(); CALL((void *)&CoreTiming::Advance); @@ -369,6 +366,3 @@ void GenerateCommon() } } // namespace Asm - -} // namespace Jit64 - diff --git a/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.h b/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.h index d0251f83e8..b2d0b4620a 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.h +++ b/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.h @@ -17,33 +17,29 @@ #ifndef _JITASM_H #define _JITASM_H - -namespace Jit64 +namespace Asm { - namespace Asm - { - extern const u8 *enterCode; + extern const u8 *enterCode; - extern const u8 *dispatcher; - extern const u8 *dispatcherNoCheck; - extern const u8 *dispatcherPcInEAX; + extern const u8 *dispatcher; + extern const u8 *dispatcherNoCheck; + extern const u8 *dispatcherPcInEAX; - extern const u8 *fpException; - extern const u8 *computeRc; - extern const u8 *computeRcFp; - extern const u8 *testExceptions; - extern const u8 *dispatchPcInEAX; - extern const u8 *doTiming; + extern const u8 *fpException; + extern const u8 *computeRc; + extern const u8 *computeRcFp; + extern const u8 *testExceptions; + extern const u8 *dispatchPcInEAX; + extern const u8 *doTiming; - extern const u8 *fifoDirectWrite8; - extern const u8 *fifoDirectWrite16; - extern const u8 *fifoDirectWrite32; - extern const u8 *fifoDirectWriteFloat; - extern const u8 *fifoDirectWriteXmm64; + extern const u8 *fifoDirectWrite8; + extern const u8 *fifoDirectWrite16; + extern const u8 *fifoDirectWrite32; + extern const u8 *fifoDirectWriteFloat; + extern const u8 *fifoDirectWriteXmm64; - extern bool compareEnabled; - void Generate(); - } + extern bool compareEnabled; + void Generate(); } #endif diff --git a/Source/Core/Core/Src/PowerPC/Jit64/JitBackpatch.cpp b/Source/Core/Core/Src/PowerPC/Jit64/JitBackpatch.cpp index 87c7f2ef17..b0e1f5dfa2 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/JitBackpatch.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/JitBackpatch.cpp @@ -20,7 +20,6 @@ #include "Common.h" #include "disasm.h" #include "JitAsm.h" -#include "JitBackpatch.h" #include "../../HW/Memmap.h" #include "x64Emitter.h" @@ -33,8 +32,6 @@ using namespace Gen; -namespace Jit64 { - extern u8 *trampolineCodePtr; void BackPatchError(const std::string &text, u8 *codePtr, u32 emAddress) { @@ -58,7 +55,7 @@ void BackPatchError(const std::string &text, u8 *codePtr, u32 emAddress) { // 1) It's really necessary. We don't know anything about the context. // 2) It doesn't really hurt. Only instructions that access I/O will get these, and there won't be // that many of them in a typical program/game. -u8 *BackPatch(u8 *codePtr, int accessType, u32 emAddress, CONTEXT *ctx) +u8 *Jit64::BackPatch(u8 *codePtr, int accessType, u32 emAddress, CONTEXT *ctx) { #ifdef _M_X64 if (!IsInJitCode(codePtr)) @@ -194,4 +191,3 @@ u8 *BackPatch(u8 *codePtr, int accessType, u32 emAddress, CONTEXT *ctx) #endif } -} // namespace diff --git a/Source/Core/Core/Src/PowerPC/Jit64/JitBackpatch.h b/Source/Core/Core/Src/PowerPC/Jit64/JitBackpatch.h deleted file mode 100644 index f3e923e97e..0000000000 --- a/Source/Core/Core/Src/PowerPC/Jit64/JitBackpatch.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _JITBACKPATCH_H -#define _JITBACKPATCH_H - -#include "Common.h" - -#ifdef _WIN32 - -#include - -#else - -// A bit of a hack to get things building under linux. We manually fill in this structure as needed -// from the real context. -struct CONTEXT -{ -#ifdef _M_X64 - u64 Rip; - u64 Rax; -#else - u32 Eip; - u32 Eax; -#endif -}; - -#endif - -namespace Jit64 { -// Returns the new RIP value -u8 *BackPatch(u8 *codePtr, int accessType, u32 emAddress, CONTEXT *ctx); - -} // namespace - -#endif diff --git a/Source/Core/Core/Src/PowerPC/Jit64/JitCache.cpp b/Source/Core/Core/Src/PowerPC/Jit64/JitCache.cpp index fbdd532952..7b69b34457 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/JitCache.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/JitCache.cpp @@ -52,8 +52,6 @@ using namespace Gen; -namespace Jit64 -{ #ifdef OPROFILE_REPORT op_agent_t agent; #endif @@ -62,8 +60,6 @@ namespace Jit64 static u8 *trampolineCache; u8 *trampolineCodePtr; #define INVALID_EXIT 0xFFFFFFFF - void LinkBlockExits(int i); - void LinkBlock(int i); enum { @@ -79,12 +75,11 @@ namespace Jit64 static std::multimap links_to; - static JitBlock *blocks; + static Jit64::JitBlock *blocks; static int numBlocks; - void DestroyBlock(int blocknum, bool invalidate); - void PrintStats() + void Jit64::PrintStats() { LOG(DYNA_REC, "JIT Statistics ======================="); LOG(DYNA_REC, "Number of blocks currently: %i", numBlocks); @@ -92,7 +87,7 @@ namespace Jit64 LOG(DYNA_REC, "======================================"); } - void InitCache() + void Jit64::InitCache() { if(Core::g_CoreStartupParameter.bJITUnlimitedCache) { @@ -118,7 +113,7 @@ namespace Jit64 SetCodePtr(codeCache); } - void ShutdownCache() + void Jit64::ShutdownCache() { UnWriteProtectMemory(genFunctions, GEN_SIZE, true); FreeMemoryPages(codeCache, CODE_SIZE); @@ -136,7 +131,7 @@ namespace Jit64 // This clears the JIT cache. It's called from JitCache.cpp when the JIT cache // is full and when saving and loading states. - void ClearCache() + void Jit64::ClearCache() { Core::DisplayMessage("Cleared code cache.", 3000); // Is destroying the blocks really necessary? @@ -151,7 +146,7 @@ namespace Jit64 SetCodePtr(codeCache); } - void DestroyBlocksWithFlag(BlockFlag death_flag) + void Jit64::DestroyBlocksWithFlag(BlockFlag death_flag) { for (int i = 0; i < numBlocks; i++) { if (blocks[i].flags & death_flag) { @@ -160,28 +155,23 @@ namespace Jit64 } } - void ResetCache() + void Jit64::ResetCache() { ShutdownCache(); InitCache(); } - JitBlock *CurBlock() - { - return &blocks[numBlocks]; - } - - JitBlock *GetBlock(int no) + Jit64::JitBlock *Jit64::GetBlock(int no) { return &blocks[no]; } - int GetNumBlocks() + int Jit64::GetNumBlocks() { return numBlocks; } - bool RangeIntersect(int s1, int e1, int s2, int e2) + bool Jit64::RangeIntersect(int s1, int e1, int s2, int e2) const { // check if any endpoint is inside the other range if ( (s1 >= s2 && s1 <= e2) || @@ -193,7 +183,12 @@ namespace Jit64 return false; } - u8 *Jit(u32 emAddress) + const u8 *Jit(u32 emAddress) + { + return jit.Jit(emAddress); + } + + const u8 *Jit64::Jit(u32 emAddress) { if (GetCodePtr() >= codeCache + CODE_SIZE - 0x10000 || numBlocks >= MAX_NUM_BLOCKS - 1) { @@ -244,30 +239,30 @@ namespace Jit64 return 0; } - void unknown_instruction(UGeckoInstruction _inst) + void Jit64::unknown_instruction(UGeckoInstruction _inst) { // CCPU::Break(); PanicAlert("unknown_instruction Jit64 - Fix me ;)"); _dbg_assert_(DYNA_REC, 0); } - u8 **GetCodePointers() + u8 **Jit64::GetCodePointers() { return blockCodePointers; } - bool IsInJitCode(const u8 *codePtr) { + bool Jit64::IsInJitCode(const u8 *codePtr) { return codePtr >= codeCache && codePtr <= GetCodePtr(); } - void EnterFastRun() + void Jit64::EnterFastRun() { CompiledCode pExecAddr = (CompiledCode)Asm::enterCode; pExecAddr(); //Will return when PowerPC::state changes } - int GetBlockNumberFromAddress(u32 addr) + int Jit64::GetBlockNumberFromAddress(u32 addr) { if (!blocks) return -1; @@ -293,7 +288,7 @@ namespace Jit64 } } - u32 GetOriginalCode(u32 address) + u32 Jit64::GetOriginalCode(u32 address) { int num = GetBlockNumberFromAddress(address); if (num == -1) @@ -302,7 +297,7 @@ namespace Jit64 return blocks[num].originalFirstOpcode; } - CompiledCode GetCompiledCode(u32 address) + Jit64::CompiledCode Jit64::GetCompiledCode(u32 address) { int num = GetBlockNumberFromAddress(address); if (num == -1) @@ -311,12 +306,12 @@ namespace Jit64 return (CompiledCode)blockCodePointers[num]; } - CompiledCode GetCompiledCodeFromBlock(int blockNumber) + Jit64::CompiledCode Jit64::GetCompiledCodeFromBlock(int blockNumber) { return (CompiledCode)blockCodePointers[blockNumber]; } - int GetCodeSize() { + int Jit64::GetCodeSize() { return (int)(GetCodePtr() - codeCache); } @@ -326,7 +321,7 @@ namespace Jit64 //Can be faster by doing a queue for blocks to link up, and only process those //Should probably be done - void LinkBlockExits(int i) + void Jit64::LinkBlockExits(int i) { JitBlock &b = blocks[i]; if (b.invalid) @@ -350,10 +345,10 @@ namespace Jit64 } using namespace std; - void LinkBlock(int i) + void Jit64::LinkBlock(int i) { LinkBlockExits(i); - JitBlock &b = blocks[i]; + Jit64::JitBlock &b = blocks[i]; std::map::iterator iter; pair::iterator, multimap::iterator> ppp; // equal_range(b) returns pair representing the range @@ -367,10 +362,10 @@ namespace Jit64 } } - void DestroyBlock(int blocknum, bool invalidate) + void Jit64::DestroyBlock(int blocknum, bool invalidate) { u32 codebytes = (JIT_OPCODE << 26) | blocknum; //generate from i - JitBlock &b = blocks[blocknum]; + Jit64::JitBlock &b = blocks[blocknum]; b.invalid = 1; if (codebytes == Memory::ReadFast32(b.originalAddress)) { @@ -403,7 +398,7 @@ namespace Jit64 } - void InvalidateCodeRange(u32 address, u32 length) + void Jit64::InvalidateCodeRange(u32 address, u32 length) { if (!jo.enableBlocklink) return; @@ -418,5 +413,3 @@ namespace Jit64 } } } - -} // namespace diff --git a/Source/Core/Core/Src/PowerPC/Jit64/JitCache.h b/Source/Core/Core/Src/PowerPC/Jit64/JitCache.h index 8eca449e9d..87a8814536 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/JitCache.h +++ b/Source/Core/Core/Src/PowerPC/Jit64/JitCache.h @@ -18,85 +18,7 @@ #define _JITCACHE_H #include "../Gekko.h" -#ifdef _WIN32 -#include // -> LARGE_INTEGER -#endif -namespace Jit64 -{ - - typedef void (*CompiledCode)(); - - void unknown_instruction(UGeckoInstruction _inst); - - //Code pointers are stored separately, they will be accessed much more frequently - - enum BlockFlag - { - BLOCK_USE_GQR0 = 0x1, - BLOCK_USE_GQR1 = 0x2, - BLOCK_USE_GQR2 = 0x4, - BLOCK_USE_GQR3 = 0x8, - BLOCK_USE_GQR4 = 0x10, - BLOCK_USE_GQR5 = 0x20, - BLOCK_USE_GQR6 = 0x40, - BLOCK_USE_GQR7 = 0x80, - }; - - // TODO(ector) - optimize this struct for size - struct JitBlock - { - u32 exitAddress[2]; // 0xFFFFFFFF == unknown - u8 *exitPtrs[2]; // to be able to rewrite the exit jump - bool linkStatus[2]; - - u32 originalAddress; - u32 originalFirstOpcode; //to be able to restore - u32 codeSize; - u32 originalSize; - int runCount; // for profiling. -#ifdef _WIN32 - // we don't really need to save start and stop - // TODO (mb2): ticStart and ticStop -> "local var" mean "in block" ... low priority ;) - LARGE_INTEGER ticStart; // for profiling - time. - LARGE_INTEGER ticStop; // for profiling - time. - LARGE_INTEGER ticCounter; // for profiling - time. -#endif - const u8 *checkedEntry; - bool invalid; - int flags; - }; - - void PrintStats(); - - JitBlock *CurBlock(); - JitBlock *GetBlock(int no); - - u32 GetOriginalCode(u32 address); - - void InvalidateCodeRange(u32 address, u32 length); - int GetBlockNumberFromAddress(u32 address); - CompiledCode GetCompiledCode(u32 address); - CompiledCode GetCompiledCodeFromBlock(int blockNumber); - - int GetCodeSize(); - int GetNumBlocks(); - - u8 **GetCodePointers(); - - u8 *Jit(u32 emaddress); - - void DestroyBlocksWithFlag(BlockFlag death_flag); - - void LinkBlocks(); - void ClearCache(); - - void EnterFastRun(); - - void InitCache(); - void ShutdownCache(); - void ResetCache(); -} +// Will soon introduced the JitBlockCache class here. #endif - diff --git a/Source/Core/Core/Src/PowerPC/Jit64/JitCore.cpp b/Source/Core/Core/Src/PowerPC/Jit64/JitCore.cpp index fe39963dc2..5b4635a439 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/JitCore.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/JitCore.cpp @@ -28,21 +28,19 @@ #include "../../HW/SerialInterface.h" #include "../../Core.h" -namespace Jit64 -{ -namespace Core +namespace JitCore { void Init() { - ::Jit64::Init(); - InitCache(); + jit.Init(); + jit.InitCache(); Asm::compareEnabled = ::Core::g_CoreStartupParameter.bRunCompareClient; } void Shutdown() { - ShutdownCache(); + jit.ShutdownCache(); } void SingleStep() @@ -52,8 +50,7 @@ void SingleStep() void Run() { - EnterFastRun(); + jit.EnterFastRun(); } } // namespace -} // namespace diff --git a/Source/Core/Core/Src/PowerPC/Jit64/JitCore.h b/Source/Core/Core/Src/PowerPC/Jit64/JitCore.h index f02c6b5034..714c271d4e 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/JitCore.h +++ b/Source/Core/Core/Src/PowerPC/Jit64/JitCore.h @@ -17,16 +17,13 @@ #ifndef _JITCORE_H #define _JITCORE_H -namespace Jit64 +namespace JitCore { - namespace Core - { - void Init(); - void Shutdown(); - void Reset(); - void SingleStep(); - void Run(); - }; + void Init(); + void Shutdown(); + void Reset(); + void SingleStep(); + void Run(); } #endif diff --git a/Source/Core/Core/Src/PowerPC/Jit64/JitRegCache.cpp b/Source/Core/Core/Src/PowerPC/Jit64/JitRegCache.cpp index ad6b6c76fa..976eba58c6 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/JitRegCache.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/JitRegCache.cpp @@ -26,8 +26,7 @@ using namespace Gen; using namespace PowerPC; -namespace Jit64 -{ + GPRRegCache gpr; FPURegCache fpr; @@ -165,7 +164,7 @@ namespace Jit64 if (regs[i].location.IsSimpleReg()) { Gen::X64Reg simple = regs[i].location.GetSimpleReg(); if (xlocks[simple]) { - PanicAlert("%08x : PPC Reg %i is in locked x64 register %i", js.compilerPC, i, regs[i].location.GetSimpleReg()); + PanicAlert("%08x : PPC Reg %i is in locked x64 register %i", /*js.compilerPC*/ 0, i, regs[i].location.GetSimpleReg()); } if (xregs[simple].ppcReg != i) { PanicAlert("%08x : Xreg/ppcreg mismatch"); @@ -394,4 +393,3 @@ namespace Jit64 } } } -} diff --git a/Source/Core/Core/Src/PowerPC/Jit64/JitRegCache.h b/Source/Core/Core/Src/PowerPC/Jit64/JitRegCache.h index 6c9ee71a4a..c3a0fa07a6 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/JitRegCache.h +++ b/Source/Core/Core/Src/PowerPC/Jit64/JitRegCache.h @@ -20,12 +20,9 @@ #include "x64Emitter.h" -namespace Jit64 -{ using namespace Gen; enum FlushMode { - // FLUSH_ALLNONSTATIC, FLUSH_ALL }; @@ -36,11 +33,10 @@ namespace Jit64 M_READWRITE = 3, }; - //Regcache sketch struct PPCCachedReg { OpArg location; - bool away; //not in source register + bool away; // value not in source register }; struct X64CachedReg @@ -65,6 +61,7 @@ namespace Jit64 bool locks[32]; bool saved_locks[32]; bool saved_xlocks[NUMXREGS]; + protected: bool xlocks[NUMXREGS]; PPCCachedReg regs[32]; @@ -72,6 +69,10 @@ namespace Jit64 PPCCachedReg saved_regs[32]; X64CachedReg saved_xregs[NUMXREGS]; + + void DiscardRegContentsIfCached(int preg); + virtual const int *GetAllocationOrder(int &count) = 0; + public: virtual ~RegCache() {} virtual void Start(PPCAnalyst::BlockRegStats &stats) = 0; @@ -90,8 +91,6 @@ namespace Jit64 void SanityCheck() const; void KillImmediate(int preg); - virtual const int *GetAllocationOrder(int &count) = 0; - //TODO - instead of doload, use "read", "write" //read only will not set dirty flag virtual void LoadToX64(int preg, bool doLoad = true, bool makeDirty = true) = 0; @@ -107,11 +106,12 @@ namespace Jit64 } virtual OpArg GetDefaultLocation(int reg) const = 0; - void DiscardRegContentsIfCached(int preg); + // Register locking. void Lock(int p1, int p2=0xff, int p3=0xff, int p4=0xff); void LockX(int x1, int x2=0xff, int x3=0xff, int x4=0xff); void UnlockAll(); void UnlockAllX(); + bool IsFreeX(int xreg) const; X64Reg GetFreeXReg(); @@ -144,7 +144,6 @@ namespace Jit64 extern GPRRegCache gpr; extern FPURegCache fpr; -} #endif diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Branch.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Branch.cpp index cc361869b4..db3aaa0cc7 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Branch.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Branch.cpp @@ -40,16 +40,14 @@ using namespace Gen; -namespace Jit64 -{ - void sc(UGeckoInstruction _inst) + void Jit64::sc(UGeckoInstruction _inst) { gpr.Flush(FLUSH_ALL); fpr.Flush(FLUSH_ALL); WriteExceptionExit(EXCEPTION_SYSCALL); } - void rfi(UGeckoInstruction _inst) + void Jit64::rfi(UGeckoInstruction _inst) { gpr.Flush(FLUSH_ALL); fpr.Flush(FLUSH_ALL); @@ -70,7 +68,7 @@ namespace Jit64 WriteRfiExitDestInEAX(); } - void bx(UGeckoInstruction inst) + void Jit64::bx(UGeckoInstruction inst) { if (inst.LK) MOV(32, M(&LR), Imm32(js.compilerPC + 4)); @@ -107,7 +105,7 @@ namespace Jit64 // TODO - optimize to hell and beyond // TODO - make nice easy to optimize special cases for the most common // variants of this instruction. - void bcx(UGeckoInstruction inst) + void Jit64::bcx(UGeckoInstruction inst) { // USES_CR _assert_msg_(DYNA_REC, js.isLastInstruction, "bcx not last instruction of block"); @@ -198,7 +196,7 @@ namespace Jit64 } } - void bcctrx(UGeckoInstruction inst) + void Jit64::bcctrx(UGeckoInstruction inst) { gpr.Flush(FLUSH_ALL); fpr.Flush(FLUSH_ALL); @@ -237,7 +235,7 @@ namespace Jit64 } - void bclrx(UGeckoInstruction inst) + void Jit64::bclrx(UGeckoInstruction inst) { gpr.Flush(FLUSH_ALL); fpr.Flush(FLUSH_ALL); @@ -260,5 +258,3 @@ namespace Jit64 MOV(32, R(EAX), M(&NPC)); WriteExitDestInEAX(0); } - -} // namespace diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_FloatingPoint.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_FloatingPoint.cpp index 51f0f2d153..fa3e003d51 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_FloatingPoint.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_FloatingPoint.cpp @@ -25,18 +25,15 @@ #include "Jit.h" #include "JitCache.h" #include "JitRegCache.h" -#include "Jit_Util.h" #define INSTRUCTION_START // #define INSTRUCTION_START Default(inst); return; -namespace Jit64 -{ const u64 GC_ALIGNED16(psSignBits2[2]) = {0x8000000000000000ULL, 0x8000000000000000ULL}; const u64 GC_ALIGNED16(psAbsMask2[2]) = {0x7FFFFFFFFFFFFFFFULL, 0x7FFFFFFFFFFFFFFFULL}; const double GC_ALIGNED16(psOneOne2[2]) = {1.0, 1.0}; - void fp_tri_op(int d, int a, int b, bool reversible, bool dupe, void (*op)(X64Reg, OpArg)) + void Jit64::fp_tri_op(int d, int a, int b, bool reversible, bool dupe, void (*op)(Gen::X64Reg, Gen::OpArg)) { fpr.Lock(d, a, b); if (d == a) @@ -78,7 +75,7 @@ namespace Jit64 fpr.UnlockAll(); } - void fp_arith_s(UGeckoInstruction inst) + void Jit64::fp_arith_s(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITFloatingPointOff) {Default(inst); return;} // turn off from debugger @@ -104,7 +101,7 @@ namespace Jit64 } } - void fmaddXX(UGeckoInstruction inst) + void Jit64::fmaddXX(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITFloatingPointOff) {Default(inst); return;} // turn off from debugger @@ -155,7 +152,7 @@ namespace Jit64 fpr.UnlockAll(); } - void fmrx(UGeckoInstruction inst) + void Jit64::fmrx(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITFloatingPointOff) {Default(inst); return;} // turn off from debugger @@ -169,7 +166,7 @@ namespace Jit64 MOVSD(fpr.RX(d), fpr.R(b)); } - void fcmpx(UGeckoInstruction inst) + void Jit64::fcmpx(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITFloatingPointOff) {Default(inst); return;} // turn off from debugger @@ -225,6 +222,3 @@ namespace Jit64 SetJumpTarget(continue2); fpr.UnlockAll(); } - -} - diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp index e0626b8621..68d374136c 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp @@ -24,15 +24,12 @@ #include "JitCache.h" #include "JitRegCache.h" #include "JitAsm.h" -#include "Jit_Util.h" // #define INSTRUCTION_START Default(inst); return; #define INSTRUCTION_START -namespace Jit64 -{ // Assumes that the flags were just set through an addition. - void GenerateCarry(X64Reg temp_reg) { + void Jit64::GenerateCarry(Gen::X64Reg temp_reg) { // USES_XER SETcc(CC_C, R(temp_reg)); AND(32, M(&PowerPC::ppcState.spr[SPR_XER]), Imm32(~(1 << 29))); @@ -40,13 +37,12 @@ namespace Jit64 OR(32, M(&PowerPC::ppcState.spr[SPR_XER]), R(temp_reg)); } - typedef u32 (*Operation)(u32 a, u32 b); u32 Add(u32 a, u32 b) {return a + b;} u32 Or (u32 a, u32 b) {return a | b;} u32 And(u32 a, u32 b) {return a & b;} u32 Xor(u32 a, u32 b) {return a ^ b;} - void regimmop(int d, int a, bool binary, u32 value, Operation doop, void(*op)(int, const OpArg&, const OpArg&), bool Rc = false, bool carry = false) + void Jit64::regimmop(int d, int a, bool binary, u32 value, Operation doop, void(*op)(int, const Gen::OpArg&, const Gen::OpArg&), bool Rc, bool carry) { gpr.Lock(d, a); if (a || binary || carry) // yeh nasty special case addic @@ -93,7 +89,7 @@ namespace Jit64 gpr.UnlockAll(); } - void reg_imm(UGeckoInstruction inst) + void Jit64::reg_imm(UGeckoInstruction inst) { #ifdef JIT_OFF_OPTIONS if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) @@ -147,7 +143,7 @@ namespace Jit64 */ // unsigned - void cmpXX(UGeckoInstruction inst) + void Jit64::cmpXX(UGeckoInstruction inst) { // USES_CR #ifdef JIT_OFF_OPTIONS @@ -263,7 +259,7 @@ namespace Jit64 gpr.UnlockAll(); } - void orx(UGeckoInstruction inst) + void Jit64::orx(UGeckoInstruction inst) { #ifdef JIT_OFF_OPTIONS if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) @@ -305,7 +301,7 @@ namespace Jit64 // m_GPR[_inst.RA] = m_GPR[_inst.RS] ^ m_GPR[_inst.RB]; - void xorx(UGeckoInstruction inst) + void Jit64::xorx(UGeckoInstruction inst) { #ifdef JIT_OFF_OPTIONS if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) @@ -336,7 +332,7 @@ namespace Jit64 } } - void andx(UGeckoInstruction inst) + void Jit64::andx(UGeckoInstruction inst) { #ifdef JIT_OFF_OPTIONS if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) @@ -361,7 +357,7 @@ namespace Jit64 } } - void extsbx(UGeckoInstruction inst) + void Jit64::extsbx(UGeckoInstruction inst) { #ifdef JIT_OFF_OPTIONS if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) @@ -382,7 +378,7 @@ namespace Jit64 } } - void extshx(UGeckoInstruction inst) + void Jit64::extshx(UGeckoInstruction inst) { #ifdef JIT_OFF_OPTIONS if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) @@ -402,7 +398,7 @@ namespace Jit64 } } - void subfic(UGeckoInstruction inst) + void Jit64::subfic(UGeckoInstruction inst) { #ifdef JIT_OFF_OPTIONS if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) @@ -424,7 +420,7 @@ namespace Jit64 // This instruction has no RC flag } - void subfcx(UGeckoInstruction inst) + void Jit64::subfcx(UGeckoInstruction inst) { INSTRUCTION_START; Default(inst); @@ -440,7 +436,7 @@ namespace Jit64 */ } - void subfex(UGeckoInstruction inst) + void Jit64::subfex(UGeckoInstruction inst) { INSTRUCTION_START; Default(inst); @@ -457,7 +453,7 @@ namespace Jit64 */ } - void subfx(UGeckoInstruction inst) + void Jit64::subfx(UGeckoInstruction inst) { #ifdef JIT_OFF_OPTIONS if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) @@ -482,7 +478,7 @@ namespace Jit64 } } - void mulli(UGeckoInstruction inst) + void Jit64::mulli(UGeckoInstruction inst) { #ifdef JIT_OFF_OPTIONS if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) @@ -497,7 +493,7 @@ namespace Jit64 gpr.UnlockAll(); } - void mullwx(UGeckoInstruction inst) + void Jit64::mullwx(UGeckoInstruction inst) { #ifdef JIT_OFF_OPTIONS if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) @@ -522,7 +518,7 @@ namespace Jit64 } } - void mulhwux(UGeckoInstruction inst) + void Jit64::mulhwux(UGeckoInstruction inst) { #ifdef JIT_OFF_OPTIONS if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) @@ -555,7 +551,7 @@ namespace Jit64 } // skipped some of the special handling in here - if we get crashes, let the interpreter handle this op - void divwux(UGeckoInstruction inst) { + void Jit64::divwux(UGeckoInstruction inst) { Default(inst); return; int a = inst.RA, b = inst.RB, d = inst.RD; @@ -587,7 +583,7 @@ namespace Jit64 ); } - void addx(UGeckoInstruction inst) + void Jit64::addx(UGeckoInstruction inst) { #ifdef JIT_OFF_OPTIONS if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) @@ -645,7 +641,7 @@ namespace Jit64 } // This can be optimized - void addex(UGeckoInstruction inst) + void Jit64::addex(UGeckoInstruction inst) { // USES_XER #ifdef JIT_OFF_OPTIONS @@ -674,7 +670,7 @@ namespace Jit64 } } - void rlwinmx(UGeckoInstruction inst) + void Jit64::rlwinmx(UGeckoInstruction inst) { #ifdef JIT_OFF_OPTIONS if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) @@ -739,7 +735,7 @@ namespace Jit64 } - void rlwimix(UGeckoInstruction inst) + void Jit64::rlwimix(UGeckoInstruction inst) { #ifdef JIT_OFF_OPTIONS if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) @@ -775,7 +771,7 @@ namespace Jit64 } } - void rlwnmx(UGeckoInstruction inst) + void Jit64::rlwnmx(UGeckoInstruction inst) { #ifdef JIT_OFF_OPTIONS if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) @@ -807,7 +803,7 @@ namespace Jit64 } } - void negx(UGeckoInstruction inst) + void Jit64::negx(UGeckoInstruction inst) { #ifdef JIT_OFF_OPTIONS if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) @@ -829,7 +825,7 @@ namespace Jit64 } } - void srwx(UGeckoInstruction inst) + void Jit64::srwx(UGeckoInstruction inst) { #ifdef JIT_OFF_OPTIONS if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) @@ -859,7 +855,7 @@ namespace Jit64 } } - void slwx(UGeckoInstruction inst) + void Jit64::slwx(UGeckoInstruction inst) { #ifdef JIT_OFF_OPTIONS if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) @@ -889,7 +885,7 @@ namespace Jit64 } } - void srawx(UGeckoInstruction inst) + void Jit64::srawx(UGeckoInstruction inst) { // USES_XER #ifdef JIT_OFF_OPTIONS @@ -937,7 +933,7 @@ namespace Jit64 } } - void srawix(UGeckoInstruction inst) + void Jit64::srawix(UGeckoInstruction inst) { #ifdef JIT_OFF_OPTIONS if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) @@ -984,7 +980,7 @@ namespace Jit64 } // count leading zeroes - void cntlzwx(UGeckoInstruction inst) + void Jit64::cntlzwx(UGeckoInstruction inst) { #ifdef JIT_OFF_OPTIONS if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) @@ -1014,5 +1010,3 @@ namespace Jit64 // TODO: Check PPC manual too } } - -} diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp index 49427426c5..2e3156eea1 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp @@ -35,14 +35,11 @@ #include "JitCache.h" #include "JitAsm.h" #include "JitRegCache.h" -#include "Jit_Util.h" // #define INSTRUCTION_START Default(inst); return; #define INSTRUCTION_START -namespace Jit64 -{ - void lbzx(UGeckoInstruction inst) + void Jit64::lbzx(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff || Core::g_CoreStartupParameter.bJITLoadStorelbzxOff) @@ -69,7 +66,7 @@ namespace Jit64 gpr.UnlockAllX(); } - void lwzx(UGeckoInstruction inst) + void Jit64::lwzx(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) {Default(inst); return;} // turn off from debugger @@ -95,7 +92,7 @@ namespace Jit64 gpr.UnlockAllX(); } - void lhax(UGeckoInstruction inst) + void Jit64::lhax(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) {Default(inst); return;} // turn off from debugger @@ -120,7 +117,7 @@ namespace Jit64 gpr.UnlockAllX(); } - void lXz(UGeckoInstruction inst) + void Jit64::lXz(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff || Core::g_CoreStartupParameter.bJITLoadStorelXzOff) @@ -212,7 +209,7 @@ namespace Jit64 gpr.UnlockAll(); } - void lha(UGeckoInstruction inst) + void Jit64::lha(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) {Default(inst); return;} // turn off from debugger @@ -234,7 +231,7 @@ namespace Jit64 } // Zero cache line. - void dcbz(UGeckoInstruction inst) + void Jit64::dcbz(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) {Default(inst); return;} // turn off from debugger @@ -255,7 +252,7 @@ namespace Jit64 #endif } - void stX(UGeckoInstruction inst) + void Jit64::stX(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) {Default(inst); return;} // turn off from debugger @@ -395,7 +392,7 @@ namespace Jit64 } // A few games use these heavily in video codecs. - void lmw(UGeckoInstruction inst) + void Jit64::lmw(UGeckoInstruction inst) { Default(inst); return; @@ -421,7 +418,7 @@ namespace Jit64 gpr.UnlockAllX();*/ } - void stmw(UGeckoInstruction inst) + void Jit64::stmw(UGeckoInstruction inst) { Default(inst); return; @@ -434,5 +431,3 @@ namespace Jit64 return; }*/ } -} - diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStoreFloating.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStoreFloating.cpp index d2314468f0..bdeb188d40 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStoreFloating.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStoreFloating.cpp @@ -35,14 +35,10 @@ #include "JitCache.h" #include "JitAsm.h" #include "JitRegCache.h" -#include "Jit_Util.h" // #define INSTRUCTION_START Default(inst); return; #define INSTRUCTION_START -namespace Jit64 -{ - // pshufb todo: MOVQ const u8 GC_ALIGNED16(bswapShuffle1x4[16]) = {3, 2, 1, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; const u8 GC_ALIGNED16(bswapShuffle2x4[16]) = {3, 2, 1, 0, 7, 6, 5, 4, 8, 9, 10, 11, 12, 13, 14, 15}; @@ -58,7 +54,7 @@ u32 GC_ALIGNED16(temp32); // and pshufb could help a lot. // Also add hacks for things like lfs/stfs the same reg consecutively, that is, simple memory moves. -void lfs(UGeckoInstruction inst) +void Jit64::lfs(UGeckoInstruction inst) { if (Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreFloatingOff) {Default(inst); return;} // turn off from debugger @@ -95,7 +91,7 @@ void lfs(UGeckoInstruction inst) } -void lfd(UGeckoInstruction inst) +void Jit64::lfd(UGeckoInstruction inst) { if (Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreFloatingOff) {Default(inst); return;} // turn off from debugger @@ -162,7 +158,7 @@ void lfd(UGeckoInstruction inst) } -void stfd(UGeckoInstruction inst) +void Jit64::stfd(UGeckoInstruction inst) { if (Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreFloatingOff) {Default(inst); return;} // turn off from debugger @@ -215,7 +211,7 @@ void stfd(UGeckoInstruction inst) } -void stfs(UGeckoInstruction inst) +void Jit64::stfs(UGeckoInstruction inst) { if (Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreFloatingOff) {Default(inst); return;} // turn off from debugger @@ -272,7 +268,7 @@ void stfs(UGeckoInstruction inst) } -void stfsx(UGeckoInstruction inst) +void Jit64::stfsx(UGeckoInstruction inst) { if (Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreFloatingOff) {Default(inst); return;} // turn off from debugger @@ -299,7 +295,7 @@ void stfsx(UGeckoInstruction inst) } -void lfsx(UGeckoInstruction inst) +void Jit64::lfsx(UGeckoInstruction inst) { if (Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreFloatingOff) {Default(inst); return;} // turn off from debugger @@ -330,4 +326,3 @@ void lfsx(UGeckoInstruction inst) fpr.UnlockAll(); } -} // namespace diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStorePaired.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStorePaired.cpp index 545d011a5d..ad225244aa 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStorePaired.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStorePaired.cpp @@ -40,8 +40,6 @@ #define INSTRUCTION_START // #define INSTRUCTION_START Default(inst); return; -namespace Jit64 { - const u8 GC_ALIGNED16(pbswapShuffle2x4[16]) = {3, 2, 1, 0, 7, 6, 5, 4, 8, 9, 10, 11, 12, 13, 14, 15}; const u8 GC_ALIGNED16(pbswapShuffleNoop[16]) = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; @@ -49,7 +47,7 @@ static double GC_ALIGNED16(psTemp[2]) = {1.0, 1.0}; static u64 GC_ALIGNED16(temp64); // TODO(ector): Improve 64-bit version -void WriteDual32(u64 value, u32 address) +static void WriteDual32(u64 value, u32 address) { Memory::Write_U32((u32)(value >> 32), address); Memory::Write_U32((u32)value, address + 4); @@ -97,7 +95,7 @@ const double GC_ALIGNED16(m_dequantizeTableD[]) = // The big problem is likely instructions that set the quantizers in the same block. // We will have to break block after quantizers are written to. -void psq_st(UGeckoInstruction inst) +void Jit64::psq_st(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStorePairedOff) {Default(inst); return;} // turn off from debugger @@ -309,7 +307,7 @@ void psq_st(UGeckoInstruction inst) } } -void psq_l(UGeckoInstruction inst) +void Jit64::psq_l(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStorePairedOff) {Default(inst); return;} // turn off from debugger @@ -459,5 +457,3 @@ void psq_l(UGeckoInstruction inst) //u32 EA = (m_GPR[_inst.RA] + _inst.SIMM_12) : _inst.SIMM_12; } - -} // namespace diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Paired.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Paired.cpp index 07a1801be5..5deda52833 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Paired.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Paired.cpp @@ -26,7 +26,6 @@ #include "Jit.h" #include "JitCache.h" #include "JitRegCache.h" -#include "Jit_Util.h" // TODO // ps_madds0 @@ -39,20 +38,12 @@ // #define INSTRUCTION_START Default(inst); return; #define INSTRUCTION_START -#ifdef _M_IX86 -#define DISABLE_32BIT Default(inst); return; -#else -#define DISABLE_32BIT ; -#endif - -namespace Jit64 -{ const u64 GC_ALIGNED16(psSignBits[2]) = {0x8000000000000000ULL, 0x8000000000000000ULL}; const u64 GC_ALIGNED16(psAbsMask[2]) = {0x7FFFFFFFFFFFFFFFULL, 0x7FFFFFFFFFFFFFFFULL}; const double GC_ALIGNED16(psOneOne[2]) = {1.0, 1.0}; const double GC_ALIGNED16(psZeroZero[2]) = {0.0, 0.0}; - void ps_mr(UGeckoInstruction inst) + void Jit64::ps_mr(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) {Default(inst); return;} // turn off from debugger @@ -68,7 +59,7 @@ namespace Jit64 MOVAPD(fpr.RX(d), fpr.R(b)); } - void ps_sel(UGeckoInstruction inst) + void Jit64::ps_sel(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) {Default(inst); return;} // turn off from debugger @@ -101,7 +92,7 @@ namespace Jit64 fpr.UnlockAllX(); } - void ps_sign(UGeckoInstruction inst) + void Jit64::ps_sign(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) {Default(inst); return;} // turn off from debugger @@ -139,7 +130,7 @@ namespace Jit64 fpr.UnlockAll(); } - void ps_rsqrte(UGeckoInstruction inst) + void Jit64::ps_rsqrte(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) {Default(inst); return;} // turn off from debugger @@ -172,7 +163,7 @@ namespace Jit64 */ //There's still a little bit more optimization that can be squeezed out of this - void tri_op(int d, int a, int b, bool reversible, void (*op)(X64Reg, OpArg)) + void Jit64::tri_op(int d, int a, int b, bool reversible, void (*op)(X64Reg, OpArg)) { fpr.Lock(d, a, b); @@ -212,7 +203,7 @@ namespace Jit64 fpr.UnlockAll(); } - void ps_arith(UGeckoInstruction inst) + void Jit64::ps_arith(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) {Default(inst); return;} // turn off from debugger @@ -237,7 +228,7 @@ namespace Jit64 } } - void ps_sum(UGeckoInstruction inst) + void Jit64::ps_sum(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) {Default(inst); return;} // turn off from debugger @@ -279,7 +270,7 @@ namespace Jit64 } - void ps_muls(UGeckoInstruction inst) + void Jit64::ps_muls(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) {Default(inst); return;} // turn off from debugger @@ -319,7 +310,7 @@ namespace Jit64 //TODO: find easy cases and optimize them, do a breakout like ps_arith - void ps_mergeXX(UGeckoInstruction inst) + void Jit64::ps_mergeXX(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) {Default(inst); return;} // turn off from debugger @@ -355,14 +346,9 @@ namespace Jit64 fpr.UnlockAll(); } - //one op is assumed to be add - void quad_op(int d, int a, int b, int c, void (*op)(X64Reg, OpArg)) - { - - } //TODO: add optimized cases - void ps_maddXX(UGeckoInstruction inst) + void Jit64::ps_maddXX(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) {Default(inst); return;} // turn off from debugger @@ -419,4 +405,3 @@ namespace Jit64 ForceSinglePrecisionP(fpr.RX(d)); fpr.UnlockAll(); } -} diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_SystemRegisters.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_SystemRegisters.cpp index 36b5b134be..45a5a1bad4 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_SystemRegisters.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_SystemRegisters.cpp @@ -33,9 +33,7 @@ #define INSTRUCTION_START // #define INSTRUCTION_START Default(inst); return; -namespace Jit64 -{ - void mtspr(UGeckoInstruction inst) + void Jit64::mtspr(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITSystemRegistersOff) {Default(inst); return;} // turn off from debugger @@ -86,7 +84,7 @@ namespace Jit64 gpr.UnlockAll(); } - void mfspr(UGeckoInstruction inst) + void Jit64::mfspr(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITSystemRegistersOff) {Default(inst); return;} // turn off from debugger @@ -103,7 +101,7 @@ namespace Jit64 //break; case SPR_TL: case SPR_TU: - //CALL((void *)&CoreTiming::Advance); + //CALL((void Jit64::*)&CoreTiming::Advance); // fall through default: gpr.Lock(d); @@ -118,7 +116,7 @@ namespace Jit64 // ======================================================================================= // Don't interpret this, if we do we get thrown out // -------------- - void mtmsr(UGeckoInstruction inst) + void Jit64::mtmsr(UGeckoInstruction inst) { //if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITSystemRegistersOff) // {Default(inst); return;} // turn off from debugger @@ -132,7 +130,7 @@ namespace Jit64 // ============== - void mfmsr(UGeckoInstruction inst) + void Jit64::mfmsr(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITSystemRegistersOff) {Default(inst); return;} // turn off from debugger @@ -142,7 +140,7 @@ namespace Jit64 MOV(32, gpr.R(inst.RD), M(&MSR)); } - void mftb(UGeckoInstruction inst) + void Jit64::mftb(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITSystemRegistersOff) {Default(inst); return;} // turn off from debugger @@ -150,7 +148,7 @@ namespace Jit64 mfspr(inst); } - void mfcr(UGeckoInstruction inst) + void Jit64::mfcr(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITSystemRegistersOff) {Default(inst); return;} // turn off from debugger @@ -168,7 +166,7 @@ namespace Jit64 MOV(32, gpr.R(d), R(EAX)); } - void mtcrf(UGeckoInstruction inst) + void Jit64::mtcrf(UGeckoInstruction inst) { if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITSystemRegistersOff) {Default(inst); return;} // turn off from debugger @@ -204,5 +202,3 @@ namespace Jit64 MOV(32, M(&PowerPC::ppcState.cr), R(EAX)); } } - -} // namespace diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Util.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Util.cpp index 763515599e..fb3d535812 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Util.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Util.cpp @@ -33,21 +33,17 @@ #include "JitAsm.h" #include "JitRegCache.h" - -namespace Jit64 -{ - -void JitClearCA() +void Jit64::JitClearCA() { AND(32, M(&PowerPC::ppcState.spr[SPR_XER]), Imm32(~XER_CA_MASK)); //XER.CA = 0 } -void JitSetCA() +void Jit64::JitSetCA() { OR(32, M(&PowerPC::ppcState.spr[SPR_XER]), Imm32(XER_CA_MASK)); //XER.CA = 1 } -void UnsafeLoadRegToReg(X64Reg reg_addr, X64Reg reg_value, int accessSize, s32 offset, bool signExtend) +void Jit64::UnsafeLoadRegToReg(X64Reg reg_addr, X64Reg reg_value, int accessSize, s32 offset, bool signExtend) { #ifdef _M_IX86 AND(32, R(reg_addr), Imm32(Memory::MEMVIEW32_MASK)); @@ -72,7 +68,7 @@ void UnsafeLoadRegToReg(X64Reg reg_addr, X64Reg reg_value, int accessSize, s32 o } } -void SafeLoadRegToEAX(X64Reg reg, int accessSize, s32 offset, bool signExtend) +void Jit64::SafeLoadRegToEAX(X64Reg reg, int accessSize, s32 offset, bool signExtend) { if (offset) ADD(32, R(reg), Imm32((u32)offset)); @@ -94,7 +90,7 @@ void SafeLoadRegToEAX(X64Reg reg, int accessSize, s32 offset, bool signExtend) SetJumpTarget(arg2); } -void UnsafeWriteRegToReg(X64Reg reg_value, X64Reg reg_addr, int accessSize, s32 offset) +void Jit64::UnsafeWriteRegToReg(X64Reg reg_value, X64Reg reg_addr, int accessSize, s32 offset) { if (accessSize != 32) { PanicAlert("UnsafeWriteRegToReg can't handle %i byte accesses", accessSize); @@ -109,7 +105,7 @@ void UnsafeWriteRegToReg(X64Reg reg_value, X64Reg reg_addr, int accessSize, s32 } // Destroys both arg registers -void SafeWriteRegToReg(X64Reg reg_value, X64Reg reg_addr, int accessSize, s32 offset) +void Jit64::SafeWriteRegToReg(X64Reg reg_value, X64Reg reg_addr, int accessSize, s32 offset) { if (offset) ADD(32, R(reg_addr), Imm32(offset)); @@ -122,7 +118,7 @@ void SafeWriteRegToReg(X64Reg reg_value, X64Reg reg_addr, int accessSize, s32 of SetJumpTarget(skip_call); } -void WriteToConstRamAddress(int accessSize, const Gen::OpArg& arg, u32 address) +void Jit64::WriteToConstRamAddress(int accessSize, const Gen::OpArg& arg, u32 address) { #ifdef _M_X64 MOV(accessSize, MDisp(RBX, address & 0x3FFFFFFF), arg); @@ -131,7 +127,7 @@ void WriteToConstRamAddress(int accessSize, const Gen::OpArg& arg, u32 address) #endif } -void WriteFloatToConstRamAddress(const Gen::X64Reg& xmm_reg, u32 address) +void Jit64::WriteFloatToConstRamAddress(const Gen::X64Reg& xmm_reg, u32 address) { #ifdef _M_X64 MOV(32, R(RAX), Imm32(address)); @@ -141,15 +137,13 @@ void WriteFloatToConstRamAddress(const Gen::X64Reg& xmm_reg, u32 address) #endif } -void ForceSinglePrecisionS(X64Reg xmm) { +void Jit64::ForceSinglePrecisionS(X64Reg xmm) { // Most games don't need these. Zelda requires it though - some platforms get stuck without them. CVTSD2SS(xmm, R(xmm)); CVTSS2SD(xmm, R(xmm)); } -void ForceSinglePrecisionP(X64Reg xmm) { +void Jit64::ForceSinglePrecisionP(X64Reg xmm) { // Most games don't need these. Zelda requires it though - some platforms get stuck without them. CVTPD2PS(xmm, R(xmm)); CVTPS2PD(xmm, R(xmm)); } - -} // namespace diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Util.h b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Util.h deleted file mode 100644 index 49e168a4b8..0000000000 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Util.h +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - - -#include "x64Emitter.h" - -namespace Jit64 -{ - -// Memory Load/Store -void UnsafeLoadRegToReg(Gen::X64Reg reg_addr, Gen::X64Reg reg_value, int accessSize, s32 offset = 0, bool signExtend = false); -void UnsafeWriteRegToReg(Gen::X64Reg reg_value, Gen::X64Reg reg_addr, int accessSize, s32 offset = 0); -void SafeLoadRegToEAX(Gen::X64Reg reg, int accessSize, s32 offset, bool signExtend = false); -void SafeWriteRegToReg(Gen::X64Reg reg_value, Gen::X64Reg reg_addr, int accessSize, s32 offset); - -void WriteToConstRamAddress(int accessSize, const Gen::OpArg& arg, u32 address); -void WriteFloatToConstRamAddress(const Gen::X64Reg& xmm_reg, u32 address); - -void ForceSinglePrecisionS(X64Reg xmm); -void ForceSinglePrecisionP(X64Reg xmm); - -void JitClearCA(); -void JitSetCA(); - -} // namespace diff --git a/Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp b/Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp index ac281857ad..88ce8d74ea 100644 --- a/Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp +++ b/Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp @@ -364,7 +364,7 @@ bool Flatten(u32 address, int *realsize, BlockStats *st, BlockRegStats *gpa, Blo } gpa->any = true; - for (size_t i = 0; i < num_inst; i++) + for (int i = 0; i < num_inst; i++) { UGeckoInstruction inst = code[i].inst; if (PPCTables::UsesFPU(inst)) diff --git a/Source/Core/Core/Src/PowerPC/PPCTables.cpp b/Source/Core/Core/Src/PowerPC/PPCTables.cpp index 08e9b53da2..fbe51954ed 100644 --- a/Source/Core/Core/Src/PowerPC/PPCTables.cpp +++ b/Source/Core/Core/Src/PowerPC/PPCTables.cpp @@ -30,8 +30,6 @@ #error Unknown architecture! #endif -typedef void (*_recompilerInstruction) (UGeckoInstruction instCode); - struct GekkoOPTemplate { int opcode; @@ -59,18 +57,18 @@ static GekkoOPInfo *m_infoTable31[1024]; static GekkoOPInfo *m_infoTable59[32]; static GekkoOPInfo *m_infoTable63[1024]; -static _recompilerInstruction dynaOpTable[64]; -static _recompilerInstruction dynaOpTable4[1024]; -static _recompilerInstruction dynaOpTable19[1024]; -static _recompilerInstruction dynaOpTable31[1024]; -static _recompilerInstruction dynaOpTable59[32]; -static _recompilerInstruction dynaOpTable63[1024]; +static PPCTables::_recompilerInstruction dynaOpTable[64]; +static PPCTables::_recompilerInstruction dynaOpTable4[1024]; +static PPCTables::_recompilerInstruction dynaOpTable19[1024]; +static PPCTables::_recompilerInstruction dynaOpTable31[1024]; +static PPCTables::_recompilerInstruction dynaOpTable59[32]; +static PPCTables::_recompilerInstruction dynaOpTable63[1024]; -void DynaRunTable4(UGeckoInstruction _inst) {dynaOpTable4 [_inst.SUBOP10](_inst);} -void DynaRunTable19(UGeckoInstruction _inst) {dynaOpTable19[_inst.SUBOP10](_inst);} -void DynaRunTable31(UGeckoInstruction _inst) {dynaOpTable31[_inst.SUBOP10](_inst);} -void DynaRunTable59(UGeckoInstruction _inst) {dynaOpTable59[_inst.SUBOP5 ](_inst);} -void DynaRunTable63(UGeckoInstruction _inst) {dynaOpTable63[_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::DynaRunTable31(UGeckoInstruction _inst) {(this->*dynaOpTable31[_inst.SUBOP10])(_inst);} +void Jit64::DynaRunTable59(UGeckoInstruction _inst) {(this->*dynaOpTable59[_inst.SUBOP5 ])(_inst);} +void Jit64::DynaRunTable63(UGeckoInstruction _inst) {(this->*dynaOpTable63[_inst.SUBOP10])(_inst);} static GekkoOPInfo *m_allInstructions[2048]; static int m_numInstructions; @@ -135,334 +133,334 @@ Interpreter::_interpreterInstruction GetInterpreterOp(UGeckoInstruction _inst) static GekkoOPTemplate primarytable[] = { - {4, Interpreter::RunTable4, DynaRunTable4, {"RunTable4", OPTYPE_SUBTABLE | (4<<24), 0}}, - {19, Interpreter::RunTable19, DynaRunTable19, {"RunTable19", OPTYPE_SUBTABLE | (19<<24), 0}}, - {31, Interpreter::RunTable31, DynaRunTable31, {"RunTable31", OPTYPE_SUBTABLE | (31<<24), 0}}, - {59, Interpreter::RunTable59, DynaRunTable59, {"RunTable59", OPTYPE_SUBTABLE | (59<<24), 0}}, - {63, Interpreter::RunTable63, DynaRunTable63, {"RunTable63", OPTYPE_SUBTABLE | (63<<24), 0}}, + {4, Interpreter::RunTable4, &Jit64::DynaRunTable4, {"RunTable4", OPTYPE_SUBTABLE | (4<<24), 0}}, + {19, Interpreter::RunTable19, &Jit64::DynaRunTable19, {"RunTable19", OPTYPE_SUBTABLE | (19<<24), 0}}, + {31, Interpreter::RunTable31, &Jit64::DynaRunTable31, {"RunTable31", OPTYPE_SUBTABLE | (31<<24), 0}}, + {59, Interpreter::RunTable59, &Jit64::DynaRunTable59, {"RunTable59", OPTYPE_SUBTABLE | (59<<24), 0}}, + {63, Interpreter::RunTable63, &Jit64::DynaRunTable63, {"RunTable63", OPTYPE_SUBTABLE | (63<<24), 0}}, - {16, Interpreter::bcx, Jit64::bcx, {"bcx", OPTYPE_SYSTEM, FL_ENDBLOCK}}, - {18, Interpreter::bx, Jit64::bx, {"bx", OPTYPE_SYSTEM, FL_ENDBLOCK}}, + {16, Interpreter::bcx, &Jit64::bcx, {"bcx", OPTYPE_SYSTEM, FL_ENDBLOCK}}, + {18, Interpreter::bx, &Jit64::bx, {"bx", OPTYPE_SYSTEM, FL_ENDBLOCK}}, - {1, Interpreter::HLEFunction, Jit64::HLEFunction, {"HLEFunction", OPTYPE_SYSTEM, FL_ENDBLOCK}}, - {2, Interpreter::CompiledBlock, Jit64::Default, {"DynaBlock", OPTYPE_SYSTEM, 0}}, - {3, Interpreter::twi, Jit64::Default, {"twi", OPTYPE_SYSTEM, 0}}, - {17, Interpreter::sc, Jit64::sc, {"sc", OPTYPE_SYSTEM, FL_ENDBLOCK, 1}}, + {1, Interpreter::HLEFunction, &Jit64::HLEFunction, {"HLEFunction", OPTYPE_SYSTEM, FL_ENDBLOCK}}, + {2, Interpreter::CompiledBlock, &Jit64::Default, {"DynaBlock", OPTYPE_SYSTEM, 0}}, + {3, Interpreter::twi, &Jit64::Default, {"twi", OPTYPE_SYSTEM, 0}}, + {17, Interpreter::sc, &Jit64::sc, {"sc", OPTYPE_SYSTEM, FL_ENDBLOCK, 1}}, - {7, Interpreter::mulli, Jit64::mulli, {"mulli", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_RC_BIT, 2}}, - {8, Interpreter::subfic, Jit64::subfic, {"subfic", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CA}}, - {10, Interpreter::cmpli, Jit64::cmpXX, {"cmpli", OPTYPE_INTEGER, FL_IN_A | FL_SET_CRn}}, - {11, Interpreter::cmpi, Jit64::cmpXX, {"cmpi", OPTYPE_INTEGER, FL_IN_A | FL_SET_CRn}}, - {12, Interpreter::addic, Jit64::reg_imm, {"addic", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CA}}, - {13, Interpreter::addic_rc, Jit64::reg_imm, {"addic_rc", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CR0}}, - {14, Interpreter::addi, Jit64::reg_imm, {"addi", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A0}}, - {15, Interpreter::addis, Jit64::reg_imm, {"addis", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A0}}, + {7, Interpreter::mulli, &Jit64::mulli, {"mulli", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_RC_BIT, 2}}, + {8, Interpreter::subfic, &Jit64::subfic, {"subfic", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CA}}, + {10, Interpreter::cmpli, &Jit64::cmpXX, {"cmpli", OPTYPE_INTEGER, FL_IN_A | FL_SET_CRn}}, + {11, Interpreter::cmpi, &Jit64::cmpXX, {"cmpi", OPTYPE_INTEGER, FL_IN_A | FL_SET_CRn}}, + {12, Interpreter::addic, &Jit64::reg_imm, {"addic", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CA}}, + {13, Interpreter::addic_rc, &Jit64::reg_imm, {"addic_rc", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CR0}}, + {14, Interpreter::addi, &Jit64::reg_imm, {"addi", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A0}}, + {15, Interpreter::addis, &Jit64::reg_imm, {"addis", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A0}}, - {20, Interpreter::rlwimix, Jit64::rlwimix, {"rlwimix", OPTYPE_INTEGER, FL_OUT_A | FL_IN_A | FL_IN_S | FL_RC_BIT}}, - {21, Interpreter::rlwinmx, Jit64::rlwinmx, {"rlwinmx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}}, - {23, Interpreter::rlwnmx, Jit64::rlwnmx, {"rlwnmx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_IN_B | FL_RC_BIT}}, + {20, Interpreter::rlwimix, &Jit64::rlwimix, {"rlwimix", OPTYPE_INTEGER, FL_OUT_A | FL_IN_A | FL_IN_S | FL_RC_BIT}}, + {21, Interpreter::rlwinmx, &Jit64::rlwinmx, {"rlwinmx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}}, + {23, Interpreter::rlwnmx, &Jit64::rlwnmx, {"rlwnmx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_IN_B | FL_RC_BIT}}, - {24, Interpreter::ori, Jit64::reg_imm, {"ori", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S}}, - {25, Interpreter::oris, Jit64::reg_imm, {"oris", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S}}, - {26, Interpreter::xori, Jit64::reg_imm, {"xori", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S}}, - {27, Interpreter::xoris, Jit64::reg_imm, {"xoris", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S}}, - {28, Interpreter::andi_rc, Jit64::reg_imm, {"andi_rc", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_SET_CR0}}, - {29, Interpreter::andis_rc, Jit64::reg_imm, {"andis_rc", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_SET_CR0}}, + {24, Interpreter::ori, &Jit64::reg_imm, {"ori", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S}}, + {25, Interpreter::oris, &Jit64::reg_imm, {"oris", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S}}, + {26, Interpreter::xori, &Jit64::reg_imm, {"xori", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S}}, + {27, Interpreter::xoris, &Jit64::reg_imm, {"xoris", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S}}, + {28, Interpreter::andi_rc, &Jit64::reg_imm, {"andi_rc", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_SET_CR0}}, + {29, Interpreter::andis_rc, &Jit64::reg_imm, {"andis_rc", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_SET_CR0}}, - {32, Interpreter::lwz, Jit64::lXz, {"lwz", OPTYPE_LOAD, FL_OUT_D | FL_IN_A}}, - {33, Interpreter::lwzu, Jit64::Default, {"lwzu", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A}}, - {34, Interpreter::lbz, Jit64::lXz, {"lbz", OPTYPE_LOAD, FL_OUT_D | FL_IN_A}}, - {35, Interpreter::lbzu, Jit64::Default, {"lbzu", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A}}, - {40, Interpreter::lhz, Jit64::lXz, {"lhz", OPTYPE_LOAD, FL_OUT_D | FL_IN_A}}, - {41, Interpreter::lhzu, Jit64::Default, {"lhzu", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A}}, - {42, Interpreter::lha, Jit64::lha, {"lha", OPTYPE_LOAD, FL_OUT_D | FL_IN_A}}, - {43, Interpreter::lhau, Jit64::Default, {"lhau", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A}}, + {32, Interpreter::lwz, &Jit64::lXz, {"lwz", OPTYPE_LOAD, FL_OUT_D | FL_IN_A}}, + {33, Interpreter::lwzu, &Jit64::Default, {"lwzu", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A}}, + {34, Interpreter::lbz, &Jit64::lXz, {"lbz", OPTYPE_LOAD, FL_OUT_D | FL_IN_A}}, + {35, Interpreter::lbzu, &Jit64::Default, {"lbzu", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A}}, + {40, Interpreter::lhz, &Jit64::lXz, {"lhz", OPTYPE_LOAD, FL_OUT_D | FL_IN_A}}, + {41, Interpreter::lhzu, &Jit64::Default, {"lhzu", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A}}, + {42, Interpreter::lha, &Jit64::lha, {"lha", OPTYPE_LOAD, FL_OUT_D | FL_IN_A}}, + {43, Interpreter::lhau, &Jit64::Default, {"lhau", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A}}, - {44, Interpreter::sth, Jit64::stX, {"sth", OPTYPE_STORE, FL_IN_A | FL_IN_S}}, - {45, Interpreter::sthu, Jit64::stX, {"sthu", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_S}}, - {36, Interpreter::stw, Jit64::stX, {"stw", OPTYPE_STORE, FL_IN_A | FL_IN_S}}, - {37, Interpreter::stwu, Jit64::stX, {"stwu", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_S}}, - {38, Interpreter::stb, Jit64::stX, {"stb", OPTYPE_STORE, FL_IN_A | FL_IN_S}}, - {39, Interpreter::stbu, Jit64::stX, {"stbu", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_S}}, + {44, Interpreter::sth, &Jit64::stX, {"sth", OPTYPE_STORE, FL_IN_A | FL_IN_S}}, + {45, Interpreter::sthu, &Jit64::stX, {"sthu", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_S}}, + {36, Interpreter::stw, &Jit64::stX, {"stw", OPTYPE_STORE, FL_IN_A | FL_IN_S}}, + {37, Interpreter::stwu, &Jit64::stX, {"stwu", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_S}}, + {38, Interpreter::stb, &Jit64::stX, {"stb", OPTYPE_STORE, FL_IN_A | FL_IN_S}}, + {39, Interpreter::stbu, &Jit64::stX, {"stbu", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_S}}, - {46, Interpreter::lmw, Jit64::lmw, {"lmw", OPTYPE_SYSTEM, FL_EVIL, 10}}, - {47, Interpreter::stmw, Jit64::stmw, {"stmw", OPTYPE_SYSTEM, FL_EVIL, 10}}, + {46, Interpreter::lmw, &Jit64::lmw, {"lmw", OPTYPE_SYSTEM, FL_EVIL, 10}}, + {47, Interpreter::stmw, &Jit64::stmw, {"stmw", OPTYPE_SYSTEM, FL_EVIL, 10}}, - {48, Interpreter::lfs, Jit64::lfs, {"lfs", OPTYPE_LOADFP, FL_IN_A}}, - {49, Interpreter::lfsu, Jit64::Default, {"lfsu", OPTYPE_LOADFP, FL_OUT_A | FL_IN_A}}, - {50, Interpreter::lfd, Jit64::lfd, {"lfd", OPTYPE_LOADFP, FL_IN_A}}, - {51, Interpreter::lfdu, Jit64::Default, {"lfdu", OPTYPE_LOADFP, FL_OUT_A | FL_IN_A}}, + {48, Interpreter::lfs, &Jit64::lfs, {"lfs", OPTYPE_LOADFP, FL_IN_A}}, + {49, Interpreter::lfsu, &Jit64::Default, {"lfsu", OPTYPE_LOADFP, FL_OUT_A | FL_IN_A}}, + {50, Interpreter::lfd, &Jit64::lfd, {"lfd", OPTYPE_LOADFP, FL_IN_A}}, + {51, Interpreter::lfdu, &Jit64::Default, {"lfdu", OPTYPE_LOADFP, FL_OUT_A | FL_IN_A}}, - {52, Interpreter::stfs, Jit64::stfs, {"stfs", OPTYPE_STOREFP, FL_IN_A}}, - {53, Interpreter::stfsu, Jit64::stfs, {"stfsu", OPTYPE_STOREFP, FL_OUT_A | FL_IN_A}}, - {54, Interpreter::stfd, Jit64::stfd, {"stfd", OPTYPE_STOREFP, FL_IN_A}}, - {55, Interpreter::stfdu, Jit64::Default, {"stfdu", OPTYPE_STOREFP, FL_OUT_A | FL_IN_A}}, + {52, Interpreter::stfs, &Jit64::stfs, {"stfs", OPTYPE_STOREFP, FL_IN_A}}, + {53, Interpreter::stfsu, &Jit64::stfs, {"stfsu", OPTYPE_STOREFP, FL_OUT_A | FL_IN_A}}, + {54, Interpreter::stfd, &Jit64::stfd, {"stfd", OPTYPE_STOREFP, FL_IN_A}}, + {55, Interpreter::stfdu, &Jit64::Default, {"stfdu", OPTYPE_STOREFP, FL_OUT_A | FL_IN_A}}, - {56, Interpreter::psq_l, Jit64::psq_l, {"psq_l", OPTYPE_PS, FL_IN_A}}, - {57, Interpreter::psq_lu, Jit64::psq_l, {"psq_lu", OPTYPE_PS, FL_OUT_A | FL_IN_A}}, - {60, Interpreter::psq_st, Jit64::psq_st, {"psq_st", OPTYPE_PS, FL_IN_A}}, - {61, Interpreter::psq_stu, Jit64::psq_st, {"psq_stu", OPTYPE_PS, FL_OUT_A | FL_IN_A}}, + {56, Interpreter::psq_l, &Jit64::psq_l, {"psq_l", OPTYPE_PS, FL_IN_A}}, + {57, Interpreter::psq_lu, &Jit64::psq_l, {"psq_lu", OPTYPE_PS, FL_OUT_A | FL_IN_A}}, + {60, Interpreter::psq_st, &Jit64::psq_st, {"psq_st", OPTYPE_PS, FL_IN_A}}, + {61, Interpreter::psq_stu, &Jit64::psq_st, {"psq_stu", OPTYPE_PS, FL_OUT_A | FL_IN_A}}, //missing: 0, 5, 6, 9, 22, 30, 62, 58 - {0, Interpreter::unknown_instruction, Jit64::Default, {"unknown_instruction", OPTYPE_UNKNOWN, 0}}, - {5, Interpreter::unknown_instruction, Jit64::Default, {"unknown_instruction", OPTYPE_UNKNOWN, 0}}, - {6, Interpreter::unknown_instruction, Jit64::Default, {"unknown_instruction", OPTYPE_UNKNOWN, 0}}, - {9, Interpreter::unknown_instruction, Jit64::Default, {"unknown_instruction", OPTYPE_UNKNOWN, 0}}, - {22, Interpreter::unknown_instruction, Jit64::Default, {"unknown_instruction", OPTYPE_UNKNOWN, 0}}, - {30, Interpreter::unknown_instruction, Jit64::Default, {"unknown_instruction", OPTYPE_UNKNOWN, 0}}, - {62, Interpreter::unknown_instruction, Jit64::Default, {"unknown_instruction", OPTYPE_UNKNOWN, 0}}, - {58, Interpreter::unknown_instruction, Jit64::Default, {"unknown_instruction", OPTYPE_UNKNOWN, 0}}, + {0, Interpreter::unknown_instruction, &Jit64::Default, {"unknown_instruction", OPTYPE_UNKNOWN, 0}}, + {5, Interpreter::unknown_instruction, &Jit64::Default, {"unknown_instruction", OPTYPE_UNKNOWN, 0}}, + {6, Interpreter::unknown_instruction, &Jit64::Default, {"unknown_instruction", OPTYPE_UNKNOWN, 0}}, + {9, Interpreter::unknown_instruction, &Jit64::Default, {"unknown_instruction", OPTYPE_UNKNOWN, 0}}, + {22, Interpreter::unknown_instruction, &Jit64::Default, {"unknown_instruction", OPTYPE_UNKNOWN, 0}}, + {30, Interpreter::unknown_instruction, &Jit64::Default, {"unknown_instruction", OPTYPE_UNKNOWN, 0}}, + {62, Interpreter::unknown_instruction, &Jit64::Default, {"unknown_instruction", OPTYPE_UNKNOWN, 0}}, + {58, Interpreter::unknown_instruction, &Jit64::Default, {"unknown_instruction", OPTYPE_UNKNOWN, 0}}, }; static GekkoOPTemplate table4[] = { //SUBOP10 - {0, Interpreter::ps_cmpu0, Jit64::Default, {"ps_cmpu0", OPTYPE_PS, FL_SET_CRn}}, - {32, Interpreter::ps_cmpo0, Jit64::Default, {"ps_cmpo0", OPTYPE_PS, FL_SET_CRn}}, - {40, Interpreter::ps_neg, Jit64::ps_sign, {"ps_neg", OPTYPE_PS, FL_RC_BIT}}, - {136, Interpreter::ps_nabs, Jit64::ps_sign, {"ps_nabs", OPTYPE_PS, FL_RC_BIT}}, - {264, Interpreter::ps_abs, Jit64::ps_sign, {"ps_abs", OPTYPE_PS, FL_RC_BIT}}, - {64, Interpreter::ps_cmpu1, Jit64::Default, {"ps_cmpu1", OPTYPE_PS, FL_RC_BIT}}, - {72, Interpreter::ps_mr, Jit64::ps_mr, {"ps_mr", OPTYPE_PS, FL_RC_BIT}}, - {96, Interpreter::ps_cmpo1, Jit64::Default, {"ps_cmpo1", OPTYPE_PS, FL_RC_BIT}}, - {528, Interpreter::ps_merge00, Jit64::ps_mergeXX, {"ps_merge00", OPTYPE_PS, FL_RC_BIT}}, - {560, Interpreter::ps_merge01, Jit64::ps_mergeXX, {"ps_merge01", OPTYPE_PS, FL_RC_BIT}}, - {592, Interpreter::ps_merge10, Jit64::ps_mergeXX, {"ps_merge10", OPTYPE_PS, FL_RC_BIT}}, - {624, Interpreter::ps_merge11, Jit64::ps_mergeXX, {"ps_merge11", OPTYPE_PS, FL_RC_BIT}}, + {0, Interpreter::ps_cmpu0, &Jit64::Default, {"ps_cmpu0", OPTYPE_PS, FL_SET_CRn}}, + {32, Interpreter::ps_cmpo0, &Jit64::Default, {"ps_cmpo0", OPTYPE_PS, FL_SET_CRn}}, + {40, Interpreter::ps_neg, &Jit64::ps_sign, {"ps_neg", OPTYPE_PS, FL_RC_BIT}}, + {136, Interpreter::ps_nabs, &Jit64::ps_sign, {"ps_nabs", OPTYPE_PS, FL_RC_BIT}}, + {264, Interpreter::ps_abs, &Jit64::ps_sign, {"ps_abs", OPTYPE_PS, FL_RC_BIT}}, + {64, Interpreter::ps_cmpu1, &Jit64::Default, {"ps_cmpu1", OPTYPE_PS, FL_RC_BIT}}, + {72, Interpreter::ps_mr, &Jit64::ps_mr, {"ps_mr", OPTYPE_PS, FL_RC_BIT}}, + {96, Interpreter::ps_cmpo1, &Jit64::Default, {"ps_cmpo1", OPTYPE_PS, FL_RC_BIT}}, + {528, Interpreter::ps_merge00, &Jit64::ps_mergeXX, {"ps_merge00", OPTYPE_PS, FL_RC_BIT}}, + {560, Interpreter::ps_merge01, &Jit64::ps_mergeXX, {"ps_merge01", OPTYPE_PS, FL_RC_BIT}}, + {592, Interpreter::ps_merge10, &Jit64::ps_mergeXX, {"ps_merge10", OPTYPE_PS, FL_RC_BIT}}, + {624, Interpreter::ps_merge11, &Jit64::ps_mergeXX, {"ps_merge11", OPTYPE_PS, FL_RC_BIT}}, - {1014, Interpreter::dcbz_l, Jit64::Default, {"dcbz_l", OPTYPE_SYSTEM, 0}}, + {1014, Interpreter::dcbz_l, &Jit64::Default, {"dcbz_l", OPTYPE_SYSTEM, 0}}, }; static GekkoOPTemplate table4_2[] = { - {10, Interpreter::ps_sum0, Jit64::ps_sum, {"ps_sum0", OPTYPE_PS, 0}}, - {11, Interpreter::ps_sum1, Jit64::ps_sum, {"ps_sum1", OPTYPE_PS, 0}}, - {12, Interpreter::ps_muls0, Jit64::ps_muls, {"ps_muls0", OPTYPE_PS, 0}}, - {13, Interpreter::ps_muls1, Jit64::ps_muls, {"ps_muls1", OPTYPE_PS, 0}}, - {14, Interpreter::ps_madds0, Jit64::ps_maddXX, {"ps_madds0", OPTYPE_PS, 0}}, - {15, Interpreter::ps_madds1, Jit64::ps_maddXX, {"ps_madds1", OPTYPE_PS, 0}}, - {18, Interpreter::ps_div, Jit64::ps_arith, {"ps_div", OPTYPE_PS, 0, 16}}, - {20, Interpreter::ps_sub, Jit64::ps_arith, {"ps_sub", OPTYPE_PS, 0}}, - {21, Interpreter::ps_add, Jit64::ps_arith, {"ps_add", OPTYPE_PS, 0}}, - {23, Interpreter::ps_sel, Jit64::ps_sel, {"ps_sel", OPTYPE_PS, 0}}, - {24, Interpreter::ps_res, Jit64::Default, {"ps_res", OPTYPE_PS, 0}}, - {25, Interpreter::ps_mul, Jit64::ps_arith, {"ps_mul", OPTYPE_PS, 0}}, - {26, Interpreter::ps_rsqrte, Jit64::ps_rsqrte, {"ps_rsqrte", OPTYPE_PS, 0, 1}}, - {28, Interpreter::ps_msub, Jit64::ps_maddXX, {"ps_msub", OPTYPE_PS, 0}}, - {29, Interpreter::ps_madd, Jit64::ps_maddXX, {"ps_madd", OPTYPE_PS, 0}}, - {30, Interpreter::ps_nmsub, Jit64::ps_maddXX, {"ps_nmsub", OPTYPE_PS, 0}}, - {31, Interpreter::ps_nmadd, Jit64::ps_maddXX, {"ps_nmadd", OPTYPE_PS, 0}}, + {10, Interpreter::ps_sum0, &Jit64::ps_sum, {"ps_sum0", OPTYPE_PS, 0}}, + {11, Interpreter::ps_sum1, &Jit64::ps_sum, {"ps_sum1", OPTYPE_PS, 0}}, + {12, Interpreter::ps_muls0, &Jit64::ps_muls, {"ps_muls0", OPTYPE_PS, 0}}, + {13, Interpreter::ps_muls1, &Jit64::ps_muls, {"ps_muls1", OPTYPE_PS, 0}}, + {14, Interpreter::ps_madds0, &Jit64::ps_maddXX, {"ps_madds0", OPTYPE_PS, 0}}, + {15, Interpreter::ps_madds1, &Jit64::ps_maddXX, {"ps_madds1", OPTYPE_PS, 0}}, + {18, Interpreter::ps_div, &Jit64::ps_arith, {"ps_div", OPTYPE_PS, 0, 16}}, + {20, Interpreter::ps_sub, &Jit64::ps_arith, {"ps_sub", OPTYPE_PS, 0}}, + {21, Interpreter::ps_add, &Jit64::ps_arith, {"ps_add", OPTYPE_PS, 0}}, + {23, Interpreter::ps_sel, &Jit64::ps_sel, {"ps_sel", OPTYPE_PS, 0}}, + {24, Interpreter::ps_res, &Jit64::Default, {"ps_res", OPTYPE_PS, 0}}, + {25, Interpreter::ps_mul, &Jit64::ps_arith, {"ps_mul", OPTYPE_PS, 0}}, + {26, Interpreter::ps_rsqrte, &Jit64::ps_rsqrte, {"ps_rsqrte", OPTYPE_PS, 0, 1}}, + {28, Interpreter::ps_msub, &Jit64::ps_maddXX, {"ps_msub", OPTYPE_PS, 0}}, + {29, Interpreter::ps_madd, &Jit64::ps_maddXX, {"ps_madd", OPTYPE_PS, 0}}, + {30, Interpreter::ps_nmsub, &Jit64::ps_maddXX, {"ps_nmsub", OPTYPE_PS, 0}}, + {31, Interpreter::ps_nmadd, &Jit64::ps_maddXX, {"ps_nmadd", OPTYPE_PS, 0}}, }; static GekkoOPTemplate table4_3[] = { - {6, Interpreter::psq_lx, Jit64::Default, {"psq_lx", OPTYPE_PS, 0}}, - {7, Interpreter::psq_stx, Jit64::Default, {"psq_stx", OPTYPE_PS, 0}}, - {38, Interpreter::psq_lux, Jit64::Default, {"psq_lux", OPTYPE_PS, 0}}, - {39, Interpreter::psq_stux, Jit64::Default, {"psq_stux", OPTYPE_PS, 0}}, + {6, Interpreter::psq_lx, &Jit64::Default, {"psq_lx", OPTYPE_PS, 0}}, + {7, Interpreter::psq_stx, &Jit64::Default, {"psq_stx", OPTYPE_PS, 0}}, + {38, Interpreter::psq_lux, &Jit64::Default, {"psq_lux", OPTYPE_PS, 0}}, + {39, Interpreter::psq_stux, &Jit64::Default, {"psq_stux", OPTYPE_PS, 0}}, }; static GekkoOPTemplate table19[] = { - {528, Interpreter::bcctrx, Jit64::bcctrx, {"bcctrx", OPTYPE_BRANCH, FL_ENDBLOCK}}, - {16, Interpreter::bclrx, Jit64::bclrx, {"bclrx", OPTYPE_BRANCH, FL_ENDBLOCK}}, - {257, Interpreter::crand, Jit64::Default, {"crand", OPTYPE_CR, FL_EVIL}}, - {129, Interpreter::crandc, Jit64::Default, {"crandc", OPTYPE_CR, FL_EVIL}}, - {289, Interpreter::creqv, Jit64::Default, {"creqv", OPTYPE_CR, FL_EVIL}}, - {225, Interpreter::crnand, Jit64::Default, {"crnand", OPTYPE_CR, FL_EVIL}}, - {33, Interpreter::crnor, Jit64::Default, {"crnor", OPTYPE_CR, FL_EVIL}}, - {449, Interpreter::cror, Jit64::Default, {"cror", OPTYPE_CR, FL_EVIL}}, - {417, Interpreter::crorc, Jit64::Default, {"crorc", OPTYPE_CR, FL_EVIL}}, - {193, Interpreter::crxor, Jit64::Default, {"crxor", OPTYPE_CR, FL_EVIL}}, + {528, Interpreter::bcctrx, &Jit64::bcctrx, {"bcctrx", OPTYPE_BRANCH, FL_ENDBLOCK}}, + {16, Interpreter::bclrx, &Jit64::bclrx, {"bclrx", OPTYPE_BRANCH, FL_ENDBLOCK}}, + {257, Interpreter::crand, &Jit64::Default, {"crand", OPTYPE_CR, FL_EVIL}}, + {129, Interpreter::crandc, &Jit64::Default, {"crandc", OPTYPE_CR, FL_EVIL}}, + {289, Interpreter::creqv, &Jit64::Default, {"creqv", OPTYPE_CR, FL_EVIL}}, + {225, Interpreter::crnand, &Jit64::Default, {"crnand", OPTYPE_CR, FL_EVIL}}, + {33, Interpreter::crnor, &Jit64::Default, {"crnor", OPTYPE_CR, FL_EVIL}}, + {449, Interpreter::cror, &Jit64::Default, {"cror", OPTYPE_CR, FL_EVIL}}, + {417, Interpreter::crorc, &Jit64::Default, {"crorc", OPTYPE_CR, FL_EVIL}}, + {193, Interpreter::crxor, &Jit64::Default, {"crxor", OPTYPE_CR, FL_EVIL}}, - {150, Interpreter::isync, Jit64::DoNothing, {"isync", OPTYPE_ICACHE, FL_EVIL}}, - {0, Interpreter::mcrf, Jit64::Default, {"mcrf", OPTYPE_SYSTEM, FL_EVIL}}, + {150, Interpreter::isync, &Jit64::DoNothing, {"isync", OPTYPE_ICACHE, FL_EVIL}}, + {0, Interpreter::mcrf, &Jit64::Default, {"mcrf", OPTYPE_SYSTEM, FL_EVIL}}, - {50, Interpreter::rfi, Jit64::rfi, {"rfi", OPTYPE_SYSTEM, FL_ENDBLOCK | FL_CHECKEXCEPTIONS, 1}}, - {18, Interpreter::rfid, Jit64::Default, {"rfid", OPTYPE_SYSTEM, FL_ENDBLOCK | FL_CHECKEXCEPTIONS}} + {50, Interpreter::rfi, &Jit64::rfi, {"rfi", OPTYPE_SYSTEM, FL_ENDBLOCK | FL_CHECKEXCEPTIONS, 1}}, + {18, Interpreter::rfid, &Jit64::Default, {"rfid", OPTYPE_SYSTEM, FL_ENDBLOCK | FL_CHECKEXCEPTIONS}} }; static GekkoOPTemplate table31[] = { - {28, Interpreter::andx, Jit64::andx, {"andx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}}, - {60, Interpreter::andcx, Jit64::Default, {"andcx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}}, - {444, Interpreter::orx, Jit64::orx, {"orx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}}, - {124, Interpreter::norx, Jit64::Default, {"norx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}}, - {316, Interpreter::xorx, Jit64::xorx, {"xorx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}}, - {412, Interpreter::orcx, Jit64::Default, {"orcx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}}, - {476, Interpreter::nandx, Jit64::Default, {"nandx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}}, - {284, Interpreter::eqvx, Jit64::Default, {"eqvx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}}, - {0, Interpreter::cmp, Jit64::cmpXX, {"cmp", OPTYPE_INTEGER, FL_IN_AB | FL_SET_CRn}}, - {32, Interpreter::cmpl, Jit64::cmpXX, {"cmpl", OPTYPE_INTEGER, FL_IN_AB | FL_SET_CRn}}, - {26, Interpreter::cntlzwx, Jit64::cntlzwx, {"cntlzwx",OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}}, - {922, Interpreter::extshx, Jit64::extshx, {"extshx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}}, - {954, Interpreter::extsbx, Jit64::extsbx, {"extsbx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}}, - {536, Interpreter::srwx, Jit64::srwx, {"srwx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}}, - {792, Interpreter::srawx, Jit64::srawx, {"srawx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}}, - {824, Interpreter::srawix, Jit64::srawix, {"srawix", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}}, - {24, Interpreter::slwx, Jit64::slwx, {"slwx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}}, + {28, Interpreter::andx, &Jit64::andx, {"andx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}}, + {60, Interpreter::andcx, &Jit64::Default, {"andcx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}}, + {444, Interpreter::orx, &Jit64::orx, {"orx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}}, + {124, Interpreter::norx, &Jit64::Default, {"norx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}}, + {316, Interpreter::xorx, &Jit64::xorx, {"xorx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}}, + {412, Interpreter::orcx, &Jit64::Default, {"orcx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}}, + {476, Interpreter::nandx, &Jit64::Default, {"nandx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}}, + {284, Interpreter::eqvx, &Jit64::Default, {"eqvx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}}, + {0, Interpreter::cmp, &Jit64::cmpXX, {"cmp", OPTYPE_INTEGER, FL_IN_AB | FL_SET_CRn}}, + {32, Interpreter::cmpl, &Jit64::cmpXX, {"cmpl", OPTYPE_INTEGER, FL_IN_AB | FL_SET_CRn}}, + {26, Interpreter::cntlzwx, &Jit64::cntlzwx, {"cntlzwx",OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}}, + {922, Interpreter::extshx, &Jit64::extshx, {"extshx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}}, + {954, Interpreter::extsbx, &Jit64::extsbx, {"extsbx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}}, + {536, Interpreter::srwx, &Jit64::srwx, {"srwx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}}, + {792, Interpreter::srawx, &Jit64::srawx, {"srawx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}}, + {824, Interpreter::srawix, &Jit64::srawix, {"srawix", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}}, + {24, Interpreter::slwx, &Jit64::slwx, {"slwx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}}, - {54, Interpreter::dcbst, Jit64::Default, {"dcbst", OPTYPE_DCACHE, 0, 4}}, - {86, Interpreter::dcbf, Jit64::Default, {"dcbf", OPTYPE_DCACHE, 0, 4}}, - {246, Interpreter::dcbtst, Jit64::Default, {"dcbtst", OPTYPE_DCACHE, 0, 1}}, - {278, Interpreter::dcbt, Jit64::Default, {"dcbt", OPTYPE_DCACHE, 0, 1}}, - {470, Interpreter::dcbi, Jit64::Default, {"dcbi", OPTYPE_DCACHE, 0, 4}}, - {758, Interpreter::dcba, Jit64::Default, {"dcba", OPTYPE_DCACHE, 0, 4}}, - {1014, Interpreter::dcbz, Jit64::dcbz, {"dcbz", OPTYPE_DCACHE, 0, 4}}, + {54, Interpreter::dcbst, &Jit64::Default, {"dcbst", OPTYPE_DCACHE, 0, 4}}, + {86, Interpreter::dcbf, &Jit64::Default, {"dcbf", OPTYPE_DCACHE, 0, 4}}, + {246, Interpreter::dcbtst, &Jit64::Default, {"dcbtst", OPTYPE_DCACHE, 0, 1}}, + {278, Interpreter::dcbt, &Jit64::Default, {"dcbt", OPTYPE_DCACHE, 0, 1}}, + {470, Interpreter::dcbi, &Jit64::Default, {"dcbi", OPTYPE_DCACHE, 0, 4}}, + {758, Interpreter::dcba, &Jit64::Default, {"dcba", OPTYPE_DCACHE, 0, 4}}, + {1014, Interpreter::dcbz, &Jit64::dcbz, {"dcbz", OPTYPE_DCACHE, 0, 4}}, //load word - {23, Interpreter::lwzx, Jit64::lwzx, {"lwzx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}}, - {55, Interpreter::lwzux, Jit64::Default, {"lwzux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}}, + {23, Interpreter::lwzx, &Jit64::lwzx, {"lwzx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}}, + {55, Interpreter::lwzux, &Jit64::Default, {"lwzux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}}, //load halfword - {279, Interpreter::lhzx, Jit64::Default, {"lhzx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}}, - {311, Interpreter::lhzux, Jit64::Default, {"lhzux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}}, + {279, Interpreter::lhzx, &Jit64::Default, {"lhzx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}}, + {311, Interpreter::lhzux, &Jit64::Default, {"lhzux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}}, //load halfword signextend - {343, Interpreter::lhax, Jit64::lhax, {"lhax", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}}, - {375, Interpreter::lhaux, Jit64::Default, {"lhaux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}}, + {343, Interpreter::lhax, &Jit64::lhax, {"lhax", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}}, + {375, Interpreter::lhaux, &Jit64::Default, {"lhaux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}}, //load byte - {87, Interpreter::lbzx, Jit64::lbzx, {"lbzx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}}, - {119, Interpreter::lbzux, Jit64::Default, {"lbzux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}}, + {87, Interpreter::lbzx, &Jit64::lbzx, {"lbzx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}}, + {119, Interpreter::lbzux, &Jit64::Default, {"lbzux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}}, //load byte reverse - {534, Interpreter::lwbrx, Jit64::Default, {"lwbrx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}}, - {790, Interpreter::lhbrx, Jit64::Default, {"lhbrx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}}, + {534, Interpreter::lwbrx, &Jit64::Default, {"lwbrx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}}, + {790, Interpreter::lhbrx, &Jit64::Default, {"lhbrx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}}, // Conditional load/store (Wii SMP) - {150, Interpreter::stwcxd, Jit64::Default, {"stwcxd", OPTYPE_STORE, FL_EVIL}}, - {20, Interpreter::lwarx, Jit64::Default, {"lwarx", OPTYPE_LOAD, FL_EVIL | FL_OUT_D | FL_IN_A0B}}, + {150, Interpreter::stwcxd, &Jit64::Default, {"stwcxd", OPTYPE_STORE, FL_EVIL}}, + {20, Interpreter::lwarx, &Jit64::Default, {"lwarx", OPTYPE_LOAD, FL_EVIL | FL_OUT_D | FL_IN_A0B}}, //load string (interpret these) - {533, Interpreter::lswx, Jit64::Default, {"lswx", OPTYPE_LOAD, FL_EVIL | FL_IN_A | FL_OUT_D}}, - {597, Interpreter::lswi, Jit64::Default, {"lswi", OPTYPE_LOAD, FL_EVIL | FL_IN_AB | FL_OUT_D}}, + {533, Interpreter::lswx, &Jit64::Default, {"lswx", OPTYPE_LOAD, FL_EVIL | FL_IN_A | FL_OUT_D}}, + {597, Interpreter::lswi, &Jit64::Default, {"lswi", OPTYPE_LOAD, FL_EVIL | FL_IN_AB | FL_OUT_D}}, //store word - {151, Interpreter::stwx, Jit64::Default, {"stwx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}}, - {183, Interpreter::stwux, Jit64::Default, {"stwux", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_B}}, + {151, Interpreter::stwx, &Jit64::Default, {"stwx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}}, + {183, Interpreter::stwux, &Jit64::Default, {"stwux", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_B}}, //store halfword - {407, Interpreter::sthx, Jit64::Default, {"sthx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}}, - {439, Interpreter::sthux, Jit64::Default, {"sthux", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_B}}, + {407, Interpreter::sthx, &Jit64::Default, {"sthx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}}, + {439, Interpreter::sthux, &Jit64::Default, {"sthux", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_B}}, //store byte - {215, Interpreter::stbx, Jit64::Default, {"stbx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}}, - {247, Interpreter::stbux, Jit64::Default, {"stbux", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_B}}, + {215, Interpreter::stbx, &Jit64::Default, {"stbx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}}, + {247, Interpreter::stbux, &Jit64::Default, {"stbux", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_B}}, //store bytereverse - {662, Interpreter::stwbrx, Jit64::Default, {"stwbrx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}}, - {918, Interpreter::sthbrx, Jit64::Default, {"sthbrx", OPTYPE_STORE, FL_IN_A | FL_IN_B}}, + {662, Interpreter::stwbrx, &Jit64::Default, {"stwbrx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}}, + {918, Interpreter::sthbrx, &Jit64::Default, {"sthbrx", OPTYPE_STORE, FL_IN_A | FL_IN_B}}, - {661, Interpreter::stswx, Jit64::Default, {"stswx", OPTYPE_STORE, FL_EVIL}}, - {725, Interpreter::stswi, Jit64::Default, {"stswi", OPTYPE_STORE, FL_EVIL}}, + {661, Interpreter::stswx, &Jit64::Default, {"stswx", OPTYPE_STORE, FL_EVIL}}, + {725, Interpreter::stswi, &Jit64::Default, {"stswi", OPTYPE_STORE, FL_EVIL}}, // fp load/store - {535, Interpreter::lfsx, Jit64::lfsx, {"lfsx", OPTYPE_LOADFP, FL_IN_A0 | FL_IN_B}}, - {567, Interpreter::lfsux, Jit64::Default, {"lfsux", OPTYPE_LOADFP, FL_IN_A | FL_IN_B}}, - {599, Interpreter::lfdx, Jit64::Default, {"lfdx", OPTYPE_LOADFP, FL_IN_A0 | FL_IN_B}}, - {631, Interpreter::lfdux, Jit64::Default, {"lfdux", OPTYPE_LOADFP, FL_IN_A | FL_IN_B}}, + {535, Interpreter::lfsx, &Jit64::lfsx, {"lfsx", OPTYPE_LOADFP, FL_IN_A0 | FL_IN_B}}, + {567, Interpreter::lfsux, &Jit64::Default, {"lfsux", OPTYPE_LOADFP, FL_IN_A | FL_IN_B}}, + {599, Interpreter::lfdx, &Jit64::Default, {"lfdx", OPTYPE_LOADFP, FL_IN_A0 | FL_IN_B}}, + {631, Interpreter::lfdux, &Jit64::Default, {"lfdux", OPTYPE_LOADFP, FL_IN_A | FL_IN_B}}, - {663, Interpreter::stfsx, Jit64::stfsx, {"stfsx", OPTYPE_STOREFP, FL_IN_A0 | FL_IN_B}}, - {695, Interpreter::stfsux, Jit64::Default, {"stfsux", OPTYPE_STOREFP, FL_IN_A | FL_IN_B}}, - {727, Interpreter::stfdx, Jit64::Default, {"stfdx", OPTYPE_STOREFP, FL_IN_A0 | FL_IN_B}}, - {759, Interpreter::stfdux, Jit64::Default, {"stfdux", OPTYPE_STOREFP, FL_IN_A | FL_IN_B}}, - {983, Interpreter::stfiwx, Jit64::Default, {"stfiwx", OPTYPE_STOREFP, FL_IN_A0 | FL_IN_B}}, + {663, Interpreter::stfsx, &Jit64::stfsx, {"stfsx", OPTYPE_STOREFP, FL_IN_A0 | FL_IN_B}}, + {695, Interpreter::stfsux, &Jit64::Default, {"stfsux", OPTYPE_STOREFP, FL_IN_A | FL_IN_B}}, + {727, Interpreter::stfdx, &Jit64::Default, {"stfdx", OPTYPE_STOREFP, FL_IN_A0 | FL_IN_B}}, + {759, Interpreter::stfdux, &Jit64::Default, {"stfdux", OPTYPE_STOREFP, FL_IN_A | FL_IN_B}}, + {983, Interpreter::stfiwx, &Jit64::Default, {"stfiwx", OPTYPE_STOREFP, FL_IN_A0 | FL_IN_B}}, - {19, Interpreter::mfcr, Jit64::mfcr, {"mfcr", OPTYPE_SYSTEM, FL_OUT_D}}, - {83, Interpreter::mfmsr, Jit64::mfmsr, {"mfmsr", OPTYPE_SYSTEM, FL_OUT_D}}, - {144, Interpreter::mtcrf, Jit64::mtcrf, {"mtcrf", OPTYPE_SYSTEM, 0}}, - {146, Interpreter::mtmsr, Jit64::mtmsr, {"mtmsr", OPTYPE_SYSTEM, FL_ENDBLOCK}}, - {210, Interpreter::mtsr, Jit64::Default, {"mtsr", OPTYPE_SYSTEM, 0}}, - {242, Interpreter::mtsrin, Jit64::Default, {"mtsrin", OPTYPE_SYSTEM, 0}}, - {339, Interpreter::mfspr, Jit64::mfspr, {"mfspr", OPTYPE_SPR, FL_OUT_D}}, - {467, Interpreter::mtspr, Jit64::mtspr, {"mtspr", OPTYPE_SPR, 0, 2}}, - {371, Interpreter::mftb, Jit64::mftb, {"mftb", OPTYPE_SYSTEM, FL_OUT_D | FL_TIMER}}, - {512, Interpreter::mcrxr, Jit64::Default, {"mcrxr", OPTYPE_SYSTEM, 0}}, - {595, Interpreter::mfsr, Jit64::Default, {"mfsr", OPTYPE_SYSTEM, FL_OUT_D, 2}}, - {659, Interpreter::mfsrin, Jit64::Default, {"mfsrin", OPTYPE_SYSTEM, FL_OUT_D, 2}}, + {19, Interpreter::mfcr, &Jit64::mfcr, {"mfcr", OPTYPE_SYSTEM, FL_OUT_D}}, + {83, Interpreter::mfmsr, &Jit64::mfmsr, {"mfmsr", OPTYPE_SYSTEM, FL_OUT_D}}, + {144, Interpreter::mtcrf, &Jit64::mtcrf, {"mtcrf", OPTYPE_SYSTEM, 0}}, + {146, Interpreter::mtmsr, &Jit64::mtmsr, {"mtmsr", OPTYPE_SYSTEM, FL_ENDBLOCK}}, + {210, Interpreter::mtsr, &Jit64::Default, {"mtsr", OPTYPE_SYSTEM, 0}}, + {242, Interpreter::mtsrin, &Jit64::Default, {"mtsrin", OPTYPE_SYSTEM, 0}}, + {339, Interpreter::mfspr, &Jit64::mfspr, {"mfspr", OPTYPE_SPR, FL_OUT_D}}, + {467, Interpreter::mtspr, &Jit64::mtspr, {"mtspr", OPTYPE_SPR, 0, 2}}, + {371, Interpreter::mftb, &Jit64::mftb, {"mftb", OPTYPE_SYSTEM, FL_OUT_D | FL_TIMER}}, + {512, Interpreter::mcrxr, &Jit64::Default, {"mcrxr", OPTYPE_SYSTEM, 0}}, + {595, Interpreter::mfsr, &Jit64::Default, {"mfsr", OPTYPE_SYSTEM, FL_OUT_D, 2}}, + {659, Interpreter::mfsrin, &Jit64::Default, {"mfsrin", OPTYPE_SYSTEM, FL_OUT_D, 2}}, - {4, Interpreter::tw, Jit64::Default, {"tw", OPTYPE_SYSTEM, 0, 1}}, - {598, Interpreter::sync, Jit64::DoNothing, {"sync", OPTYPE_SYSTEM, 0, 2}}, - {982, Interpreter::icbi, Jit64::Default, {"icbi", OPTYPE_SYSTEM, 0, 3}}, + {4, Interpreter::tw, &Jit64::Default, {"tw", OPTYPE_SYSTEM, 0, 1}}, + {598, Interpreter::sync, &Jit64::DoNothing, {"sync", OPTYPE_SYSTEM, 0, 2}}, + {982, Interpreter::icbi, &Jit64::Default, {"icbi", OPTYPE_SYSTEM, 0, 3}}, // Unused instructions on GC - {310, Interpreter::eciwx, Jit64::Default, {"eciwx", OPTYPE_INTEGER, FL_RC_BIT}}, - {438, Interpreter::ecowx, Jit64::Default, {"ecowx", OPTYPE_INTEGER, FL_RC_BIT}}, - {854, Interpreter::eieio, Jit64::Default, {"eieio", OPTYPE_INTEGER, FL_RC_BIT}}, - {306, Interpreter::tlbie, Jit64::Default, {"tlbie", OPTYPE_SYSTEM, 0}}, - {370, Interpreter::tlbia, Jit64::Default, {"tlbia", OPTYPE_SYSTEM, 0}}, - {566, Interpreter::tlbsync, Jit64::Default, {"tlbsync", OPTYPE_SYSTEM, 0}}, + {310, Interpreter::eciwx, &Jit64::Default, {"eciwx", OPTYPE_INTEGER, FL_RC_BIT}}, + {438, Interpreter::ecowx, &Jit64::Default, {"ecowx", OPTYPE_INTEGER, FL_RC_BIT}}, + {854, Interpreter::eieio, &Jit64::Default, {"eieio", OPTYPE_INTEGER, FL_RC_BIT}}, + {306, Interpreter::tlbie, &Jit64::Default, {"tlbie", OPTYPE_SYSTEM, 0}}, + {370, Interpreter::tlbia, &Jit64::Default, {"tlbia", OPTYPE_SYSTEM, 0}}, + {566, Interpreter::tlbsync, &Jit64::Default, {"tlbsync", OPTYPE_SYSTEM, 0}}, }; static GekkoOPTemplate table31_2[] = { - {266, Interpreter::addx, Jit64::addx, {"addx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}}, - {10, Interpreter::addcx, Jit64::Default, {"addcx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT}}, - {138, Interpreter::addex, Jit64::addex, {"addex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}}, - {234, Interpreter::addmex, Jit64::Default, {"addmex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}}, - {202, Interpreter::addzex, Jit64::Default, {"addzex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}}, - {491, Interpreter::divwx, Jit64::Default, {"divwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 39}}, - {459, Interpreter::divwux, Jit64::divwux, {"divwux", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 39}}, - {75, Interpreter::mulhwx, Jit64::Default, {"mulhwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 4}}, - {11, Interpreter::mulhwux, Jit64::mulhwux, {"mulhwux", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 4}}, - {235, Interpreter::mullwx, Jit64::mullwx, {"mullwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 4}}, - {104, Interpreter::negx, Jit64::negx, {"negx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}}, - {40, Interpreter::subfx, Jit64::subfx, {"subfx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}}, - {8, Interpreter::subfcx, Jit64::subfcx, {"subfcx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT}}, - {136, Interpreter::subfex, Jit64::subfex, {"subfex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}}, - {232, Interpreter::subfmex, Jit64::Default, {"subfmex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}}, - {200, Interpreter::subfzex, Jit64::Default, {"subfzex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}}, + {266, Interpreter::addx, &Jit64::addx, {"addx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}}, + {10, Interpreter::addcx, &Jit64::Default, {"addcx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT}}, + {138, Interpreter::addex, &Jit64::addex, {"addex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}}, + {234, Interpreter::addmex, &Jit64::Default, {"addmex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}}, + {202, Interpreter::addzex, &Jit64::Default, {"addzex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}}, + {491, Interpreter::divwx, &Jit64::Default, {"divwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 39}}, + {459, Interpreter::divwux, &Jit64::divwux, {"divwux", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 39}}, + {75, Interpreter::mulhwx, &Jit64::Default, {"mulhwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 4}}, + {11, Interpreter::mulhwux, &Jit64::mulhwux, {"mulhwux", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 4}}, + {235, Interpreter::mullwx, &Jit64::mullwx, {"mullwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 4}}, + {104, Interpreter::negx, &Jit64::negx, {"negx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}}, + {40, Interpreter::subfx, &Jit64::subfx, {"subfx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}}, + {8, Interpreter::subfcx, &Jit64::subfcx, {"subfcx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT}}, + {136, Interpreter::subfex, &Jit64::subfex, {"subfex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}}, + {232, Interpreter::subfmex, &Jit64::Default, {"subfmex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}}, + {200, Interpreter::subfzex, &Jit64::Default, {"subfzex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}}, }; static GekkoOPTemplate table59[] = { - {18, Interpreter::fdivsx, Jit64::fp_arith_s, {"fdivsx", OPTYPE_FPU, FL_RC_BIT_F, 16}}, - {20, Interpreter::fsubsx, Jit64::fp_arith_s, {"fsubsx", OPTYPE_FPU, FL_RC_BIT_F}}, - {21, Interpreter::faddsx, Jit64::fp_arith_s, {"faddsx", OPTYPE_FPU, FL_RC_BIT_F}}, -// {22, Interpreter::fsqrtsx, Jit64::Default, {"fsqrtsx", OPTYPE_FPU, FL_RC_BIT_F}}, // Not implemented on gekko - {24, Interpreter::fresx, Jit64::Default, {"fresx", OPTYPE_FPU, FL_RC_BIT_F}}, - {25, Interpreter::fmulsx, Jit64::fp_arith_s, {"fmulsx", OPTYPE_FPU, FL_RC_BIT_F}}, - {28, Interpreter::fmsubsx, Jit64::fmaddXX, {"fmsubsx", OPTYPE_FPU, FL_RC_BIT_F}}, - {29, Interpreter::fmaddsx, Jit64::fmaddXX, {"fmaddsx", OPTYPE_FPU, FL_RC_BIT_F}}, - {30, Interpreter::fnmsubsx, Jit64::fmaddXX, {"fnmsubsx", OPTYPE_FPU, FL_RC_BIT_F}}, - {31, Interpreter::fnmaddsx, Jit64::fmaddXX, {"fnmaddsx", OPTYPE_FPU, FL_RC_BIT_F}}, + {18, Interpreter::fdivsx, &Jit64::fp_arith_s, {"fdivsx", OPTYPE_FPU, FL_RC_BIT_F, 16}}, + {20, Interpreter::fsubsx, &Jit64::fp_arith_s, {"fsubsx", OPTYPE_FPU, FL_RC_BIT_F}}, + {21, Interpreter::faddsx, &Jit64::fp_arith_s, {"faddsx", OPTYPE_FPU, FL_RC_BIT_F}}, +// {22, Interpreter::fsqrtsx, &Jit64::Default, {"fsqrtsx", OPTYPE_FPU, FL_RC_BIT_F}}, // Not implemented on gekko + {24, Interpreter::fresx, &Jit64::Default, {"fresx", OPTYPE_FPU, FL_RC_BIT_F}}, + {25, Interpreter::fmulsx, &Jit64::fp_arith_s, {"fmulsx", OPTYPE_FPU, FL_RC_BIT_F}}, + {28, Interpreter::fmsubsx, &Jit64::fmaddXX, {"fmsubsx", OPTYPE_FPU, FL_RC_BIT_F}}, + {29, Interpreter::fmaddsx, &Jit64::fmaddXX, {"fmaddsx", OPTYPE_FPU, FL_RC_BIT_F}}, + {30, Interpreter::fnmsubsx, &Jit64::fmaddXX, {"fnmsubsx", OPTYPE_FPU, FL_RC_BIT_F}}, + {31, Interpreter::fnmaddsx, &Jit64::fmaddXX, {"fnmaddsx", OPTYPE_FPU, FL_RC_BIT_F}}, }; static GekkoOPTemplate table63[] = { - {264, Interpreter::fabsx, Jit64::Default, {"fabsx", OPTYPE_FPU, FL_RC_BIT_F}}, - {32, Interpreter::fcmpo, Jit64::fcmpx, {"fcmpo", OPTYPE_FPU, FL_RC_BIT_F}}, - {0, Interpreter::fcmpu, Jit64::fcmpx, {"fcmpu", OPTYPE_FPU, FL_RC_BIT_F}}, - {14, Interpreter::fctiwx, Jit64::Default, {"fctiwx", OPTYPE_FPU, FL_RC_BIT_F}}, - {15, Interpreter::fctiwzx, Jit64::Default, {"fctiwzx", OPTYPE_FPU, FL_RC_BIT_F}}, - {72, Interpreter::fmrx, Jit64::fmrx, {"fmrx", OPTYPE_FPU, FL_RC_BIT_F}}, - {136, Interpreter::fnabsx, Jit64::Default, {"fnabsx", OPTYPE_FPU, FL_RC_BIT_F}}, - {40, Interpreter::fnegx, Jit64::Default, {"fnegx", OPTYPE_FPU, FL_RC_BIT_F}}, - {12, Interpreter::frspx, Jit64::Default, {"frspx", OPTYPE_FPU, FL_RC_BIT_F}}, + {264, Interpreter::fabsx, &Jit64::Default, {"fabsx", OPTYPE_FPU, FL_RC_BIT_F}}, + {32, Interpreter::fcmpo, &Jit64::fcmpx, {"fcmpo", OPTYPE_FPU, FL_RC_BIT_F}}, + {0, Interpreter::fcmpu, &Jit64::fcmpx, {"fcmpu", OPTYPE_FPU, FL_RC_BIT_F}}, + {14, Interpreter::fctiwx, &Jit64::Default, {"fctiwx", OPTYPE_FPU, FL_RC_BIT_F}}, + {15, Interpreter::fctiwzx, &Jit64::Default, {"fctiwzx", OPTYPE_FPU, FL_RC_BIT_F}}, + {72, Interpreter::fmrx, &Jit64::fmrx, {"fmrx", OPTYPE_FPU, FL_RC_BIT_F}}, + {136, Interpreter::fnabsx, &Jit64::Default, {"fnabsx", OPTYPE_FPU, FL_RC_BIT_F}}, + {40, Interpreter::fnegx, &Jit64::Default, {"fnegx", OPTYPE_FPU, FL_RC_BIT_F}}, + {12, Interpreter::frspx, &Jit64::Default, {"frspx", OPTYPE_FPU, FL_RC_BIT_F}}, - {64, Interpreter::mcrfs, Jit64::Default, {"mcrfs", OPTYPE_SYSTEMFP, 0}}, - {583, Interpreter::mffsx, Jit64::Default, {"mffsx", OPTYPE_SYSTEMFP, 0}}, - {70, Interpreter::mtfsb0x, Jit64::Default, {"mtfsb0x", OPTYPE_SYSTEMFP, 0, 2}}, - {38, Interpreter::mtfsb1x, Jit64::Default, {"mtfsb1x", OPTYPE_SYSTEMFP, 0, 2}}, - {134, Interpreter::mtfsfix, Jit64::Default, {"mtfsfix", OPTYPE_SYSTEMFP, 0, 2}}, - {711, Interpreter::mtfsfx, Jit64::Default, {"mtfsfx", OPTYPE_SYSTEMFP, 0, 2}}, + {64, Interpreter::mcrfs, &Jit64::Default, {"mcrfs", OPTYPE_SYSTEMFP, 0}}, + {583, Interpreter::mffsx, &Jit64::Default, {"mffsx", OPTYPE_SYSTEMFP, 0}}, + {70, Interpreter::mtfsb0x, &Jit64::Default, {"mtfsb0x", OPTYPE_SYSTEMFP, 0, 2}}, + {38, Interpreter::mtfsb1x, &Jit64::Default, {"mtfsb1x", OPTYPE_SYSTEMFP, 0, 2}}, + {134, Interpreter::mtfsfix, &Jit64::Default, {"mtfsfix", OPTYPE_SYSTEMFP, 0, 2}}, + {711, Interpreter::mtfsfx, &Jit64::Default, {"mtfsfx", OPTYPE_SYSTEMFP, 0, 2}}, }; static GekkoOPTemplate table63_2[] = { - {18, Interpreter::fdivx, Jit64::Default, {"fdivx", OPTYPE_FPU, FL_RC_BIT_F, 30}}, - {20, Interpreter::fsubx, Jit64::Default, {"fsubx", OPTYPE_FPU, FL_RC_BIT_F}}, - {21, Interpreter::faddx, Jit64::Default, {"faddx", OPTYPE_FPU, FL_RC_BIT_F}}, - {22, Interpreter::fsqrtx, Jit64::Default, {"fsqrtx", OPTYPE_FPU, FL_RC_BIT_F}}, - {23, Interpreter::fselx, Jit64::Default, {"fselx", OPTYPE_FPU, FL_RC_BIT_F}}, - {25, Interpreter::fmulx, Jit64::fp_arith_s, {"fmulx", OPTYPE_FPU, FL_RC_BIT_F}}, - {26, Interpreter::frsqrtex,Jit64::Default, {"frsqrtex", OPTYPE_FPU, FL_RC_BIT_F}}, - {28, Interpreter::fmsubx, Jit64::fmaddXX, {"fmsubx", OPTYPE_FPU, FL_RC_BIT_F}}, - {29, Interpreter::fmaddx, Jit64::fmaddXX, {"fmaddx", OPTYPE_FPU, FL_RC_BIT_F}}, - {30, Interpreter::fnmsubx, Jit64::fmaddXX, {"fnmsubx", OPTYPE_FPU, FL_RC_BIT_F}}, - {31, Interpreter::fnmaddx, Jit64::fmaddXX, {"fnmaddx", OPTYPE_FPU, FL_RC_BIT_F}}, + {18, Interpreter::fdivx, &Jit64::Default, {"fdivx", OPTYPE_FPU, FL_RC_BIT_F, 30}}, + {20, Interpreter::fsubx, &Jit64::Default, {"fsubx", OPTYPE_FPU, FL_RC_BIT_F}}, + {21, Interpreter::faddx, &Jit64::Default, {"faddx", OPTYPE_FPU, FL_RC_BIT_F}}, + {22, Interpreter::fsqrtx, &Jit64::Default, {"fsqrtx", OPTYPE_FPU, FL_RC_BIT_F}}, + {23, Interpreter::fselx, &Jit64::Default, {"fselx", OPTYPE_FPU, FL_RC_BIT_F}}, + {25, Interpreter::fmulx, &Jit64::fp_arith_s, {"fmulx", OPTYPE_FPU, FL_RC_BIT_F}}, + {26, Interpreter::frsqrtex,&Jit64::Default, {"frsqrtex", OPTYPE_FPU, FL_RC_BIT_F}}, + {28, Interpreter::fmsubx, &Jit64::fmaddXX, {"fmsubx", OPTYPE_FPU, FL_RC_BIT_F}}, + {29, Interpreter::fmaddx, &Jit64::fmaddXX, {"fmaddx", OPTYPE_FPU, FL_RC_BIT_F}}, + {30, Interpreter::fnmsubx, &Jit64::fmaddXX, {"fnmsubx", OPTYPE_FPU, FL_RC_BIT_F}}, + {31, Interpreter::fnmaddx, &Jit64::fmaddXX, {"fnmaddx", OPTYPE_FPU, FL_RC_BIT_F}}, }; namespace PPCTables @@ -519,7 +517,7 @@ void InitTables() for (int i = 0; i < 32; i++) { Interpreter::m_opTable59[i] = Interpreter::unknown_instruction; - dynaOpTable59[i] = Jit64::unknown_instruction; + dynaOpTable59[i] = &Jit64::unknown_instruction; m_infoTable59[i] = 0; } @@ -529,10 +527,10 @@ void InitTables() Interpreter::m_opTable19[i] = Interpreter::unknown_instruction; Interpreter::m_opTable31[i] = Interpreter::unknown_instruction; Interpreter::m_opTable63[i] = Interpreter::unknown_instruction; - dynaOpTable4 [i] = Jit64::unknown_instruction; - dynaOpTable19[i] = Jit64::unknown_instruction; - dynaOpTable31[i] = Jit64::unknown_instruction; - dynaOpTable63[i] = Jit64::unknown_instruction; + dynaOpTable4 [i] = &Jit64::unknown_instruction; + dynaOpTable19[i] = &Jit64::unknown_instruction; + dynaOpTable31[i] = &Jit64::unknown_instruction; + dynaOpTable63[i] = &Jit64::unknown_instruction; m_infoTable4[i] = 0; m_infoTable19[i] = 0; m_infoTable31[i] = 0; @@ -669,7 +667,7 @@ namespace { void CompileInstruction(UGeckoInstruction _inst) { - dynaOpTable[_inst.OPCD](_inst); + (jit.*dynaOpTable[_inst.OPCD])(_inst); GekkoOPInfo *info = GetOpInfo(_inst); if (info) { #ifdef OPLOG @@ -678,9 +676,9 @@ void CompileInstruction(UGeckoInstruction _inst) } #endif info->compileCount++; - info->lastUse = Jit64::js.compilerPC; + info->lastUse = jit.js.compilerPC; } else { - PanicAlert("Tried to compile illegal (or unknown) instruction %08x, at %08x", _inst.hex, Jit64::js.compilerPC); + PanicAlert("Tried to compile illegal (or unknown) instruction %08x, at %08x", _inst.hex, jit.js.compilerPC); } } diff --git a/Source/Core/Core/Src/PowerPC/PPCTables.h b/Source/Core/Core/Src/PowerPC/PPCTables.h index 4885cb681d..6ec5a3e1ef 100644 --- a/Source/Core/Core/Src/PowerPC/PPCTables.h +++ b/Source/Core/Core/Src/PowerPC/PPCTables.h @@ -97,10 +97,14 @@ struct GekkoOPInfo GekkoOPInfo *GetOpInfo(UGeckoInstruction _inst); Interpreter::_interpreterInstruction GetInterpreterOp(UGeckoInstruction _inst); +class Jit64; + namespace PPCTables { -typedef void (*_recompilerInstruction) (UGeckoInstruction instCode); + + +typedef void (Jit64::*_recompilerInstruction) (UGeckoInstruction instCode); typedef void (*_interpreterInstruction)(UGeckoInstruction instCode); void InitTables(); diff --git a/Source/Core/Core/Src/PowerPC/PowerPC.cpp b/Source/Core/Core/Src/PowerPC/PowerPC.cpp index e9a2d5b05f..18b201c63a 100644 --- a/Source/Core/Core/Src/PowerPC/PowerPC.cpp +++ b/Source/Core/Core/Src/PowerPC/PowerPC.cpp @@ -26,6 +26,7 @@ #include "../CoreTiming.h" #include "Interpreter/Interpreter.h" +#include "Jit64/Jit.h" #include "Jit64/JitCore.h" #include "Jit64/JitCache.h" #include "PowerPC.h" @@ -117,7 +118,7 @@ void Init() // Initialize both execution engines ... Interpreter::Init(); - Jit64::Core::Init(); + JitCore::Init(); // ... but start as interpreter by default. mode = MODE_INTERPRETER; state = CPU_STEPPING; @@ -126,7 +127,7 @@ void Init() void Shutdown() { // Shutdown both execution engines. Doesn't matter which one is active. - Jit64::Core::Shutdown(); + JitCore::Shutdown(); Interpreter::Shutdown(); } @@ -139,7 +140,7 @@ void SetMode(CoreMode new_mode) switch (mode) { case MODE_INTERPRETER: // Switching from JIT to interpreter - Jit64::ClearCache(); // Remove all those nasty JIT patches. + jit.ClearCache(); // Remove all those nasty JIT patches. break; case MODE_JIT: // Switching from interpreter to JIT. @@ -156,7 +157,7 @@ void SingleStep() Interpreter::SingleStep(); break; case MODE_JIT: - Jit64::Core::SingleStep(); + JitCore::SingleStep(); break; } } @@ -170,7 +171,7 @@ void RunLoop() Interpreter::Run(); break; case MODE_JIT: - Jit64::Core::Run(); + JitCore::Run(); break; } Host_UpdateDisasmDialog(); diff --git a/Source/Core/Core/Src/PowerPC/Profiler.cpp b/Source/Core/Core/Src/PowerPC/Profiler.cpp index 18e1fc1d12..2d5a7c2dc1 100644 --- a/Source/Core/Core/Src/PowerPC/Profiler.cpp +++ b/Source/Core/Core/Src/PowerPC/Profiler.cpp @@ -41,16 +41,16 @@ struct BlockStat void WriteProfileResults(const char *filename) { std::vector stats; - stats.reserve(Jit64::GetNumBlocks()); + stats.reserve(jit.GetNumBlocks()); u64 cost_sum = 0; #ifdef _WIN32 u64 timecost_sum = 0; LARGE_INTEGER countsPerSec; QueryPerformanceFrequency(&countsPerSec); #endif - for (int i = 0; i < Jit64::GetNumBlocks(); i++) + for (int i = 0; i < jit.GetNumBlocks(); i++) { - const Jit64::JitBlock *block = Jit64::GetBlock(i); + const Jit64::JitBlock *block = jit.GetBlock(i); u64 cost = (block->originalSize / 4) * block->runCount; // rough heuristic. mem instructions should cost more. #ifdef _WIN32 u64 timecost = block->ticCounter.QuadPart; // Indeed ;) @@ -73,7 +73,7 @@ void WriteProfileResults(const char *filename) { fprintf(f, "origAddr\tblkName\tcost\ttimeCost\tpercent\ttimePercent\tOvAllinBlkTime(ms)\tblkCodeSize\n"); for (unsigned int i = 0; i < stats.size(); i++) { - const Jit64::JitBlock *block = Jit64::GetBlock(stats[i].blockNum); + const Jit64::JitBlock *block = jit.GetBlock(stats[i].blockNum); if (block) { std::string name = g_symbolDB.GetDescription(block->originalAddress); double percent = 100.0 * (double)stats[i].cost / (double)cost_sum; diff --git a/Source/Core/Core/Src/State.cpp b/Source/Core/Core/Src/State.cpp index 11fd468f61..dd238ed5d1 100644 --- a/Source/Core/Core/Src/State.cpp +++ b/Source/Core/Core/Src/State.cpp @@ -23,7 +23,7 @@ #include "CoreTiming.h" #include "HW/HW.h" #include "PowerPC/PowerPC.h" -#include "PowerPC/Jit64/JitCache.h" +#include "PowerPC/Jit64/Jit.h" #include "Plugins/Plugin_Video.h" #include "Plugins/Plugin_DSP.h" @@ -87,7 +87,7 @@ void SaveStateCallback(u64 userdata, int cyclesLate) return; } - Jit64::ClearCache(); + jit.ClearCache(); u8 *ptr = 0; PointerWrap p(&ptr, PointerWrap::MODE_MEASURE); DoState(p); @@ -154,7 +154,7 @@ void LoadStateCallback(u64 userdata, int cyclesLate) return; } - Jit64::ClearCache(); + jit.ClearCache(); u8 *buffer = NULL; diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.cpp b/Source/Core/DebuggerWX/Src/CodeWindow.cpp index d0b91984cb..4931c090b1 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindow.cpp +++ b/Source/Core/DebuggerWX/Src/CodeWindow.cpp @@ -503,8 +503,8 @@ void CCodeWindow::OnJITOff(wxCommandEvent& event) { case IDM_JITUNLIMITED: Core::g_CoreStartupParameter.bJITUnlimitedCache = event.IsChecked(); - Jit64::ClearCache(); // allow InitCache() even after the game has started - Jit64::InitCache(); + jit.ClearCache(); // allow InitCache() even after the game has started + jit.InitCache(); GetMenuBar()->Enable(event.GetId(),!event.IsChecked()); break; case IDM_JITOFF: @@ -530,7 +530,7 @@ void CCodeWindow::OnJITOff(wxCommandEvent& event) case IDM_JITSROFF: Core::g_CoreStartupParameter.bJITSystemRegistersOff = event.IsChecked(); break; } - Jit64::ClearCache(); + jit.ClearCache(); } else { //event.Skip(); // this doesn't work GetMenuBar()->Check(event.GetId(),!event.IsChecked()); @@ -546,7 +546,7 @@ void CCodeWindow::OnJitMenu(wxCommandEvent& event) switch (event.GetId()) { case IDM_CLEARCODECACHE: - Jit64::ClearCache(); + jit.ClearCache(); break; case IDM_LOGINSTRUCTIONS: PPCTables::LogCompiledInstructions(); @@ -563,7 +563,7 @@ void CCodeWindow::OnProfilerMenu(wxCommandEvent& event) switch (event.GetId()) { case IDM_PROFILEBLOCKS: - Jit64::ClearCache(); + jit.ClearCache(); Profiler::g_ProfileBlocks = GetMenuBar()->IsChecked(IDM_PROFILEBLOCKS); break; case IDM_WRITEPROFILE: diff --git a/Source/Core/DebuggerWX/Src/JitWindow.cpp b/Source/Core/DebuggerWX/Src/JitWindow.cpp index 2abd8b5ffb..2ac65dda36 100644 --- a/Source/Core/DebuggerWX/Src/JitWindow.cpp +++ b/Source/Core/DebuggerWX/Src/JitWindow.cpp @@ -125,7 +125,9 @@ void CJitWindow::OnRefresh(wxCommandEvent& /*event*/) { void CJitWindow::ViewAddr(u32 em_address) { + the_jit_window->Show(true); the_jit_window->Compare(em_address); + the_jit_window->SetFocus(); } void CJitWindow::Compare(u32 em_address) @@ -136,14 +138,14 @@ void CJitWindow::Compare(u32 em_address) disassembler x64disasm; x64disasm.set_syntax_intel(); - int block_num = Jit64::GetBlockNumberFromAddress(em_address); + int block_num = jit.GetBlockNumberFromAddress(em_address); if (block_num < 0) { ppc_box->SetValue(wxString::FromAscii(StringFromFormat("(non-code address: %08x)", em_address).c_str())); x86_box->SetValue(wxString::FromAscii(StringFromFormat("(no translation)").c_str())); return; } - Jit64::JitBlock *block = Jit64::GetBlock(block_num); + Jit64::JitBlock *block = jit.GetBlock(block_num); // == Fill in ppc box u32 ppc_addr = block->originalAddress; @@ -152,7 +154,8 @@ void CJitWindow::Compare(u32 em_address) PPCAnalyst::BlockStats st; PPCAnalyst::BlockRegStats gpa; PPCAnalyst::BlockRegStats fpa; - if (PPCAnalyst::Flatten(ppc_addr, &size, &st, &gpa, &fpa, &code_buffer)) { + if (PPCAnalyst::Flatten(ppc_addr, &size, &st, &gpa, &fpa, &code_buffer)) + { char *sptr = (char*)xDis; for (int i = 0; i < size; i++) { @@ -169,7 +172,7 @@ void CJitWindow::Compare(u32 em_address) // == Fill in x86 box memset(xDis, 0, 65536); - const u8 *code = (const u8 *)Jit64::GetCompiledCodeFromBlock(block_num); + const u8 *code = (const u8 *)jit.GetCompiledCodeFromBlock(block_num); u64 disasmPtr = (u64)code; size = block->codeSize; const u8 *end = code + size;