diff --git a/CMakeLists.txt b/CMakeLists.txt
index aedacf9563..b018c10f2a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1342,6 +1342,8 @@ add_library(${CoreLibName} ${CoreLinkType}
Core/MIPS/JitCommon/NativeJit.h
Core/MIPS/JitCommon/JitBlockCache.cpp
Core/MIPS/JitCommon/JitBlockCache.h
+ Core/MIPS/JitCommon/JitState.cpp
+ Core/MIPS/JitCommon/JitState.h
Core/MIPS/MIPS.cpp
Core/MIPS/MIPS.h
Core/MIPS/MIPSAnalyst.cpp
diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj
index bc90969b8b..c7ea4a080f 100644
--- a/Core/Core.vcxproj
+++ b/Core/Core.vcxproj
@@ -415,17 +415,24 @@
-
-
+
+
+
-
+
-
+
-
+
-
+
+
+ true
+ true
+ true
+ true
+
@@ -654,17 +661,23 @@
-
-
+
+
-
+
-
+
-
+
-
+
+
+ true
+ true
+ true
+ true
+
@@ -718,4 +731,4 @@
-
+
\ No newline at end of file
diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters
index 214cc00400..7009e10d18 100644
--- a/Core/Core.vcxproj.filters
+++ b/Core/Core.vcxproj.filters
@@ -13,6 +13,9 @@
{8a5bebeb-575f-483d-8bd2-4b7eac163a7d}
+
+ {aaaaaaaa-575f-483d-8bd2-4b7eac163a7d}
+
{37896407-c373-44a3-b6ec-b57bceb2c4a3}
@@ -66,34 +69,34 @@
ELF
-
+
MIPS
MIPS
-
+
MIPS
MIPS
-
+
MIPS
MIPS
-
+
MIPS
MIPS
-
+
MIPS
-
+
MIPS
@@ -402,6 +405,9 @@
MIPS\ARM
+
+ MIPS\MIPS
+
MIPS\ARM
@@ -593,6 +599,9 @@
Util
+
+ MIPS\JitCommon
+
@@ -604,31 +613,31 @@
MIPS
-
+
MIPS
-
+
MIPS
MIPS
-
+
MIPS
MIPS
-
+
MIPS
MIPS
-
+
MIPS
-
+
MIPS
@@ -931,6 +940,9 @@
MIPS\ARM
+
+ MIPS\MIPS
+
MIPS\ARM
@@ -1122,4 +1134,4 @@
-
+
\ No newline at end of file
diff --git a/Core/MIPS/ARM/ArmCompVFPUNEON.cpp b/Core/MIPS/ARM/ArmCompVFPUNEON.cpp
index 5a29addf74..a96b86df83 100644
--- a/Core/MIPS/ARM/ArmCompVFPUNEON.cpp
+++ b/Core/MIPS/ARM/ArmCompVFPUNEON.cpp
@@ -286,7 +286,7 @@ void ArmJit::CompNEON_SVQ(MIPSOpcode op) {
op.encoding,
GetOffsetInstruction(1).encoding,
GetOffsetInstruction(2).encoding,
- GetOffsetInstruction(3).encoding
+ GetOffsetInstruction(3).encoding,
};
if (g_Config.bFastMemory && (ops[1] >> 26) == 54 && (ops[2] >> 26) == 54 && (ops[3] >> 26) == 54) {
int offsets[4] = {offset, (s16)(ops[1] & 0xFFFC), (s16)(ops[2] & 0xFFFC), (s16)(ops[3] & 0xFFFC)};
@@ -294,8 +294,7 @@ void ArmJit::CompNEON_SVQ(MIPSOpcode op) {
if (offsets[1] == offset + 16 && offsets[2] == offsets[1] + 16 && offsets[3] == offsets[2] + 16 &&
rss[0] == rss[1] && rss[1] == rss[2] && rss[2] == rss[3]) {
int vts[4] = {MIPS_GET_VQVT(op.encoding), MIPS_GET_VQVT(ops[1]), MIPS_GET_VQVT(ops[2]), MIPS_GET_VQVT(ops[3])};
- // Also check the destination registers!
-
+ // TODO: Also check the destination registers!
// Detected four consecutive ones!
// gpr.MapRegAsPointer(rs);
// fpr.QLoad4x4(vts[4], rs, offset);
@@ -352,7 +351,7 @@ void ArmJit::CompNEON_SVQ(MIPSOpcode op) {
op.encoding,
GetOffsetInstruction(1).encoding,
GetOffsetInstruction(2).encoding,
- GetOffsetInstruction(3).encoding
+ GetOffsetInstruction(3).encoding,
};
if (g_Config.bFastMemory && (ops[1] >> 26) == 54 && (ops[2] >> 26) == 54 && (ops[3] >> 26) == 54) {
int offsets[4] = { offset, (s16)(ops[1] & 0xFFFC), (s16)(ops[2] & 0xFFFC), (s16)(ops[3] & 0xFFFC) };
@@ -360,8 +359,7 @@ void ArmJit::CompNEON_SVQ(MIPSOpcode op) {
if (offsets[1] == offset + 16 && offsets[2] == offsets[1] + 16 && offsets[3] == offsets[2] + 16 &&
rss[0] == rss[1] && rss[1] == rss[2] && rss[2] == rss[3]) {
int vts[4] = { MIPS_GET_VQVT(op.encoding), MIPS_GET_VQVT(ops[1]), MIPS_GET_VQVT(ops[2]), MIPS_GET_VQVT(ops[3]) };
- // Also check the destination registers!
-
+ // TODO: Also check the destination registers!
// Detected four consecutive ones!
// gpr.MapRegAsPointer(rs);
// fpr.QLoad4x4(vts[4], rs, offset);
diff --git a/Core/MIPS/ARM/ArmJit.h b/Core/MIPS/ARM/ArmJit.h
index 1712ee025f..cc37f27eaa 100644
--- a/Core/MIPS/ARM/ArmJit.h
+++ b/Core/MIPS/ARM/ArmJit.h
@@ -34,36 +34,6 @@
namespace MIPSComp
{
-struct ArmJitOptions
-{
- ArmJitOptions() {
- enableBlocklink = true;
- downcountInRegister = true;
- useBackJump = false;
- useForwardJump = false;
- cachePointers = true;
- immBranches = false;
- continueBranches = false;
- continueJumps = false;
- continueMaxInstructions = 300;
-
- useNEONVFPU = false; // true
- if (!cpu_info.bNEON)
- useNEONVFPU = false;
- }
-
- bool useNEONVFPU;
- bool enableBlocklink;
- bool downcountInRegister;
- bool useBackJump;
- bool useForwardJump;
- bool cachePointers;
- bool immBranches;
- bool continueBranches;
- bool continueJumps;
- int continueMaxInstructions;
-};
-
class ArmJit : public ArmGen::ARMXCodeBlock
{
public:
@@ -305,7 +275,7 @@ private:
void Comp_ITypeMemLR(MIPSOpcode op, bool load);
JitBlockCache blocks;
- ArmJitOptions jo;
+ JitOptions jo;
JitState js;
ArmRegCache gpr;
diff --git a/Core/MIPS/ARM/ArmRegCache.cpp b/Core/MIPS/ARM/ArmRegCache.cpp
index 9e36c7f64c..2ab327834f 100644
--- a/Core/MIPS/ARM/ArmRegCache.cpp
+++ b/Core/MIPS/ARM/ArmRegCache.cpp
@@ -29,7 +29,7 @@
using namespace ArmGen;
using namespace ArmJitConstants;
-ArmRegCache::ArmRegCache(MIPSState *mips, MIPSComp::JitState *js, MIPSComp::ArmJitOptions *jo) : mips_(mips), js_(js), jo_(jo) {
+ArmRegCache::ArmRegCache(MIPSState *mips, MIPSComp::JitState *js, MIPSComp::JitOptions *jo) : mips_(mips), js_(js), jo_(jo) {
}
void ArmRegCache::Init(ARMXEmitter *emitter) {
diff --git a/Core/MIPS/ARM/ArmRegCache.h b/Core/MIPS/ARM/ArmRegCache.h
index d2f6ba393e..00dbd709dc 100644
--- a/Core/MIPS/ARM/ArmRegCache.h
+++ b/Core/MIPS/ARM/ArmRegCache.h
@@ -82,13 +82,13 @@ struct RegMIPS {
};
namespace MIPSComp {
- struct ArmJitOptions;
+ struct JitOptions;
struct JitState;
}
class ArmRegCache {
public:
- ArmRegCache(MIPSState *mips, MIPSComp::JitState *js, MIPSComp::ArmJitOptions *jo);
+ ArmRegCache(MIPSState *mips, MIPSComp::JitState *js, MIPSComp::JitOptions *jo);
~ArmRegCache() {}
void Init(ArmGen::ARMXEmitter *emitter);
@@ -143,7 +143,7 @@ private:
MIPSState *mips_;
ArmGen::ARMXEmitter *emit_;
MIPSComp::JitState *js_;
- MIPSComp::ArmJitOptions *jo_;
+ MIPSComp::JitOptions *jo_;
u32 compilerPC_;
enum {
diff --git a/Core/MIPS/ARM/ArmRegCacheFPU.cpp b/Core/MIPS/ARM/ArmRegCacheFPU.cpp
index 6c03a19b67..cde3cb11e6 100644
--- a/Core/MIPS/ARM/ArmRegCacheFPU.cpp
+++ b/Core/MIPS/ARM/ArmRegCacheFPU.cpp
@@ -27,7 +27,7 @@
using namespace ArmGen;
using namespace ArmJitConstants;
-ArmRegCacheFPU::ArmRegCacheFPU(MIPSState *mips, MIPSComp::JitState *js, MIPSComp::ArmJitOptions *jo) : mips_(mips), vr(mr + 32), js_(js), jo_(jo), initialReady(false) {
+ArmRegCacheFPU::ArmRegCacheFPU(MIPSState *mips, MIPSComp::JitState *js, MIPSComp::JitOptions *jo) : mips_(mips), vr(mr + 32), js_(js), jo_(jo), initialReady(false) {
if (cpu_info.bNEON) {
numARMFpuReg_ = 32;
} else {
diff --git a/Core/MIPS/ARM/ArmRegCacheFPU.h b/Core/MIPS/ARM/ArmRegCacheFPU.h
index 03efc32157..59bbd71de7 100644
--- a/Core/MIPS/ARM/ArmRegCacheFPU.h
+++ b/Core/MIPS/ARM/ArmRegCacheFPU.h
@@ -77,13 +77,13 @@ struct FPURegMIPS {
};
namespace MIPSComp {
- struct ArmJitOptions;
+ struct JitOptions;
struct JitState;
}
class ArmRegCacheFPU {
public:
- ArmRegCacheFPU(MIPSState *mips, MIPSComp::JitState *js, MIPSComp::ArmJitOptions *jo);
+ ArmRegCacheFPU(MIPSState *mips, MIPSComp::JitState *js, MIPSComp::JitOptions *jo);
~ArmRegCacheFPU() {}
void Init(ArmGen::ARMXEmitter *emitter);
@@ -191,7 +191,7 @@ private:
MIPSState *mips_;
ArmGen::ARMXEmitter *emit_;
MIPSComp::JitState *js_;
- MIPSComp::ArmJitOptions *jo_;
+ MIPSComp::JitOptions *jo_;
int numARMFpuReg_;
int qTime_;
diff --git a/Core/MIPS/ARM64/Arm64Jit.h b/Core/MIPS/ARM64/Arm64Jit.h
index a9e9d16e84..7966e53662 100644
--- a/Core/MIPS/ARM64/Arm64Jit.h
+++ b/Core/MIPS/ARM64/Arm64Jit.h
@@ -34,32 +34,6 @@
namespace MIPSComp
{
-struct Arm64JitOptions
-{
- Arm64JitOptions() {
- enableBlocklink = true;
- useBackJump = false;
- useForwardJump = false;
- cachePointers = true;
- immBranches = false;
- continueBranches = false;
- continueJumps = false;
- continueMaxInstructions = 300;
-
- useASIMDVFPU = false; // true
- }
-
- bool useASIMDVFPU;
- bool enableBlocklink;
- bool useBackJump;
- bool useForwardJump;
- bool cachePointers;
- bool immBranches;
- bool continueBranches;
- bool continueJumps;
- int continueMaxInstructions;
-};
-
class Arm64Jit : public Arm64Gen::ARM64CodeBlock
{
public:
@@ -263,7 +237,7 @@ private:
void Comp_ITypeMemLR(MIPSOpcode op, bool load);
JitBlockCache blocks;
- Arm64JitOptions jo;
+ JitOptions jo;
JitState js;
Arm64RegCache gpr;
diff --git a/Core/MIPS/ARM64/Arm64RegCache.cpp b/Core/MIPS/ARM64/Arm64RegCache.cpp
index cf75984c89..8337372185 100644
--- a/Core/MIPS/ARM64/Arm64RegCache.cpp
+++ b/Core/MIPS/ARM64/Arm64RegCache.cpp
@@ -29,7 +29,7 @@
using namespace Arm64Gen;
using namespace Arm64JitConstants;
-Arm64RegCache::Arm64RegCache(MIPSState *mips, MIPSComp::JitState *js, MIPSComp::Arm64JitOptions *jo) : mips_(mips), js_(js), jo_(jo) {
+Arm64RegCache::Arm64RegCache(MIPSState *mips, MIPSComp::JitState *js, MIPSComp::JitOptions *jo) : mips_(mips), js_(js), jo_(jo) {
}
void Arm64RegCache::Init(ARM64XEmitter *emitter) {
diff --git a/Core/MIPS/ARM64/Arm64RegCache.h b/Core/MIPS/ARM64/Arm64RegCache.h
index 0b4edf232a..b0572373c0 100644
--- a/Core/MIPS/ARM64/Arm64RegCache.h
+++ b/Core/MIPS/ARM64/Arm64RegCache.h
@@ -85,13 +85,13 @@ struct RegMIPS {
};
namespace MIPSComp {
- struct Arm64JitOptions;
+ struct JitOptions;
struct JitState;
}
class Arm64RegCache {
public:
- Arm64RegCache(MIPSState *mips, MIPSComp::JitState *js, MIPSComp::Arm64JitOptions *jo);
+ Arm64RegCache(MIPSState *mips, MIPSComp::JitState *js, MIPSComp::JitOptions *jo);
~Arm64RegCache() {}
void Init(Arm64Gen::ARM64XEmitter *emitter);
@@ -146,7 +146,7 @@ private:
MIPSState *mips_;
Arm64Gen::ARM64XEmitter *emit_;
MIPSComp::JitState *js_;
- MIPSComp::Arm64JitOptions *jo_;
+ MIPSComp::JitOptions *jo_;
u32 compilerPC_;
enum {
diff --git a/Core/MIPS/ARM64/Arm64RegCacheFPU.cpp b/Core/MIPS/ARM64/Arm64RegCacheFPU.cpp
index efa7942dc6..6754885f05 100644
--- a/Core/MIPS/ARM64/Arm64RegCacheFPU.cpp
+++ b/Core/MIPS/ARM64/Arm64RegCacheFPU.cpp
@@ -27,7 +27,7 @@
using namespace Arm64Gen;
using namespace Arm64JitConstants;
-Arm64RegCacheFPU::Arm64RegCacheFPU(MIPSState *mips, MIPSComp::JitState *js, MIPSComp::Arm64JitOptions *jo) : mips_(mips), vr(mr + 32), js_(js), jo_(jo), initialReady(false) {
+Arm64RegCacheFPU::Arm64RegCacheFPU(MIPSState *mips, MIPSComp::JitState *js, MIPSComp::JitOptions *jo) : mips_(mips), vr(mr + 32), js_(js), jo_(jo), initialReady(false) {
numARMFpuReg_ = 32;
}
diff --git a/Core/MIPS/ARM64/Arm64RegCacheFPU.h b/Core/MIPS/ARM64/Arm64RegCacheFPU.h
index 7ba3dd01de..49bf37356e 100644
--- a/Core/MIPS/ARM64/Arm64RegCacheFPU.h
+++ b/Core/MIPS/ARM64/Arm64RegCacheFPU.h
@@ -77,13 +77,13 @@ struct FPURegMIPS {
};
namespace MIPSComp {
- struct Arm64JitOptions;
+ struct JitOptions;
struct JitState;
}
class Arm64RegCacheFPU {
public:
- Arm64RegCacheFPU(MIPSState *mips, MIPSComp::JitState *js, MIPSComp::Arm64JitOptions *jo);
+ Arm64RegCacheFPU(MIPSState *mips, MIPSComp::JitState *js, MIPSComp::JitOptions *jo);
~Arm64RegCacheFPU() {}
void Init(Arm64Gen::ARM64XEmitter *emitter, Arm64Gen::ARM64FloatEmitter *fp);
@@ -159,7 +159,7 @@ private:
Arm64Gen::ARM64XEmitter *emit_;
Arm64Gen::ARM64FloatEmitter *fp_;
MIPSComp::JitState *js_;
- MIPSComp::Arm64JitOptions *jo_;
+ MIPSComp::JitOptions *jo_;
int numARMFpuReg_;
int qTime_;
diff --git a/Core/MIPS/JitCommon/JitState.cpp b/Core/MIPS/JitCommon/JitState.cpp
new file mode 100644
index 0000000000..a679df0676
--- /dev/null
+++ b/Core/MIPS/JitCommon/JitState.cpp
@@ -0,0 +1,49 @@
+// Copyright (c) 2013- PPSSPP 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 or later versions.
+
+// 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 git repository and contact information can be found at
+// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
+
+#include "Common/CPUDetect.h"
+#include "Core/MIPS/JitCommon/JitState.h"
+
+namespace MIPSComp {
+ JitOptions::JitOptions() {
+ // x86
+ enableVFPUSIMD = true;
+ // Set by Asm if needed.
+ reserveR15ForAsm = false;
+
+ // ARM/ARM64
+ useBackJump = false;
+ useForwardJump = false;
+ cachePointers = true;
+
+ // ARM only
+ downcountInRegister = true;
+ useNEONVFPU = false; // true
+ if (!cpu_info.bNEON)
+ useNEONVFPU = false;
+
+ //ARM64
+ useASIMDVFPU = false; // true
+
+ // Common
+ enableBlocklink = true;
+ immBranches = false;
+ continueBranches = false;
+ continueJumps = false;
+ continueMaxInstructions = 300;
+ }
+}
diff --git a/Core/MIPS/JitCommon/JitState.h b/Core/MIPS/JitCommon/JitState.h
index 0bb7007a6e..a296630a59 100644
--- a/Core/MIPS/JitCommon/JitState.h
+++ b/Core/MIPS/JitCommon/JitState.h
@@ -175,4 +175,29 @@ namespace MIPSComp {
}
}
};
+
+ struct JitOptions {
+ JitOptions();
+
+ // x86
+ bool enableVFPUSIMD;
+ bool reserveR15ForAsm;
+
+ // ARM/ARM64
+ bool useBackJump;
+ bool useForwardJump;
+ bool cachePointers;
+ // ARM only
+ bool useNEONVFPU;
+ bool downcountInRegister;
+ // ARM64 only
+ bool useASIMDVFPU;
+
+ // Common
+ bool enableBlocklink;
+ bool immBranches;
+ bool continueBranches;
+ bool continueJumps;
+ int continueMaxInstructions;
+ };
}
diff --git a/Core/MIPS/JitCommon/NativeJit.h b/Core/MIPS/JitCommon/NativeJit.h
index 67cc8f8556..96be0d0bfb 100644
--- a/Core/MIPS/JitCommon/NativeJit.h
+++ b/Core/MIPS/JitCommon/NativeJit.h
@@ -34,10 +34,7 @@ typedef MIPSComp::Arm64Jit NativeJit;
typedef MIPSComp::Jit NativeJit;
#elif defined(MIPS)
#include "../MIPS/MipsJit.h"
-typedef MIPSComp::Jit NativeJit;
-//#elif defined(ARM64)
-//#include "../ARM64/Arm64Jit.h"
-//typedef MIPSComp::Arm64Jit NativeJit;
+typedef MIPSComp::MipsJit NativeJit;
#else
#include "../fake/FakeJit.h"
typedef MIPSComp::FakeJit NativeJit;
@@ -48,5 +45,4 @@ namespace MIPSComp {
typedef void (NativeJit::*MIPSCompileFunc)(MIPSOpcode opcode);
typedef int (NativeJit::*MIPSReplaceFunc)();
-
}
diff --git a/Core/MIPS/MIPS/MipsJit.cpp b/Core/MIPS/MIPS/MipsJit.cpp
index 96d7f54d3a..ffb723b0b4 100644
--- a/Core/MIPS/MIPS/MipsJit.cpp
+++ b/Core/MIPS/MIPS/MipsJit.cpp
@@ -38,15 +38,7 @@ void DisassembleMIPS(const u8 *data, int size) {
namespace MIPSComp
{
-MIPSJitOptions::MIPSJitOptions() {
- enableBlocklink = true;
- immBranches = false;
- continueBranches = false;
- continueJumps = false;
- continueMaxInstructions = 300;
-}
-
-Jit::Jit(MIPSState *mips) : blocks(mips, this), mips_(mips)
+MipsJit::MipsJit(MIPSState *mips) : blocks(mips, this), mips_(mips)
{
logBlocks = 0;
dontLogBlocks = 0;
@@ -55,7 +47,7 @@ Jit::Jit(MIPSState *mips) : blocks(mips, this), mips_(mips)
js.startDefaultPrefix = mips_->HasDefaultPrefix();
}
-void Jit::DoState(PointerWrap &p)
+void MipsJit::DoState(PointerWrap &p)
{
auto s = p.Section("Jit", 1, 2);
if (!s)
@@ -71,7 +63,7 @@ void Jit::DoState(PointerWrap &p)
}
// This is here so the savestate matches between jit and non-jit.
-void Jit::DoDummyState(PointerWrap &p)
+void MipsJit::DoDummyState(PointerWrap &p)
{
auto s = p.Section("Jit", 1, 2);
if (!s)
@@ -85,35 +77,35 @@ void Jit::DoDummyState(PointerWrap &p)
}
}
-void Jit::FlushAll()
+void MipsJit::FlushAll()
{
//gpr.FlushAll();
//fpr.FlushAll();
FlushPrefixV();
}
-void Jit::FlushPrefixV()
+void MipsJit::FlushPrefixV()
{
}
-void Jit::ClearCache()
+void MipsJit::ClearCache()
{
blocks.Clear();
ClearCodeSpace();
//GenerateFixedCode();
}
-void Jit::InvalidateCache()
+void MipsJit::InvalidateCache()
{
blocks.Clear();
}
-void Jit::InvalidateCacheAt(u32 em_address, int length)
+void MipsJit::InvalidateCacheAt(u32 em_address, int length)
{
blocks.InvalidateICache(em_address, length);
}
-void Jit::EatInstruction(MIPSOpcode op) {
+void MipsJit::EatInstruction(MIPSOpcode op) {
MIPSInfo info = MIPSGetInfo(op);
if (info & DELAYSLOT) {
ERROR_LOG_REPORT_ONCE(ateDelaySlot, JIT, "Ate a branch op.");
@@ -127,7 +119,7 @@ void Jit::EatInstruction(MIPSOpcode op) {
js.downcountAmount += MIPSGetInstructionCycleEstimate(op);
}
-void Jit::CompileDelaySlot(int flags)
+void MipsJit::CompileDelaySlot(int flags)
{
//if (flags & DELAYSLOT_SAFE)
// Save flags here
@@ -144,7 +136,7 @@ void Jit::CompileDelaySlot(int flags)
}
-void Jit::Compile(u32 em_address) {
+void MipsJit::Compile(u32 em_address) {
if (GetSpaceLeft() < 0x10000 || blocks.IsFull()) {
ClearCache();
}
@@ -169,12 +161,12 @@ void Jit::Compile(u32 em_address) {
}
}
-void Jit::RunLoopUntil(u64 globalticks)
+void MipsJit::RunLoopUntil(u64 globalticks)
{
((void (*)())enterCode)();
}
-const u8 *Jit::DoJit(u32 em_address, JitBlock *b)
+const u8 *MipsJit::DoJit(u32 em_address, JitBlock *b)
{
js.cancel = false;
js.blockStart = js.compilerPC = mips_->pc;
@@ -224,7 +216,7 @@ const u8 *Jit::DoJit(u32 em_address, JitBlock *b)
return b->normalEntry;
}
-void Jit::AddContinuedBlock(u32 dest)
+void MipsJit::AddContinuedBlock(u32 dest)
{
// The first block is the root block. When we continue, we create proxy blocks after that.
if (js.lastContinuedPC == 0)
@@ -234,27 +226,27 @@ void Jit::AddContinuedBlock(u32 dest)
js.lastContinuedPC = dest;
}
-bool Jit::DescribeCodePtr(const u8 *ptr, std::string &name)
+bool MipsJit::DescribeCodePtr(const u8 *ptr, std::string &name)
{
// TODO: Not used by anything yet.
return false;
}
-void Jit::Comp_RunBlock(MIPSOpcode op)
+void MipsJit::Comp_RunBlock(MIPSOpcode op)
{
// This shouldn't be necessary, the dispatcher should catch us before we get here.
ERROR_LOG(JIT, "Comp_RunBlock should never be reached!");
}
-bool Jit::ReplaceJalTo(u32 dest) {
+bool MipsJit::ReplaceJalTo(u32 dest) {
return true;
}
-void Jit::Comp_ReplacementFunc(MIPSOpcode op)
+void MipsJit::Comp_ReplacementFunc(MIPSOpcode op)
{
}
-void Jit::Comp_Generic(MIPSOpcode op)
+void MipsJit::Comp_Generic(MIPSOpcode op)
{
FlushAll();
MIPSInterpretFunc func = MIPSGetInterpretFunc(op);
@@ -277,34 +269,34 @@ void Jit::Comp_Generic(MIPSOpcode op)
}
}
-void Jit::MovFromPC(MIPSReg r) {
+void MipsJit::MovFromPC(MIPSReg r) {
}
-void Jit::MovToPC(MIPSReg r) {
+void MipsJit::MovToPC(MIPSReg r) {
}
-void Jit::SaveDowncount() {
+void MipsJit::SaveDowncount() {
}
-void Jit::RestoreDowncount() {
+void MipsJit::RestoreDowncount() {
}
-void Jit::WriteDownCount(int offset) {
+void MipsJit::WriteDownCount(int offset) {
}
-void Jit::WriteDownCountR(MIPSReg reg) {
+void MipsJit::WriteDownCountR(MIPSReg reg) {
}
-void Jit::RestoreRoundingMode(bool force) {
+void MipsJit::RestoreRoundingMode(bool force) {
}
-void Jit::ApplyRoundingMode(bool force) {
+void MipsJit::ApplyRoundingMode(bool force) {
}
-void Jit::UpdateRoundingMode() {
+void MipsJit::UpdateRoundingMode() {
}
-void Jit::WriteExit(u32 destination, int exit_num)
+void MipsJit::WriteExit(u32 destination, int exit_num)
{
//WriteDownCount();
JitBlock *b = js.curBlock;
@@ -323,7 +315,7 @@ void Jit::WriteExit(u32 destination, int exit_num)
}
}
-void Jit::WriteExitDestInR(MIPSReg Reg)
+void MipsJit::WriteExitDestInR(MIPSReg Reg)
{
MovToPC(Reg);
//WriteDownCount();
@@ -331,7 +323,7 @@ void Jit::WriteExitDestInR(MIPSReg Reg)
B((const void *)dispatcher);
}
-void Jit::WriteSyscallExit()
+void MipsJit::WriteSyscallExit()
{
//WriteDownCount();
B((const void *)dispatcherCheckCoreState);
diff --git a/Core/MIPS/MIPS/MipsJit.h b/Core/MIPS/MIPS/MipsJit.h
index 99e760eeea..7adbb55aeb 100644
--- a/Core/MIPS/MIPS/MipsJit.h
+++ b/Core/MIPS/MIPS/MipsJit.h
@@ -28,21 +28,10 @@
namespace MIPSComp
{
-struct MIPSJitOptions
-{
- MIPSJitOptions();
-
- bool enableBlocklink;
- bool immBranches;
- bool continueBranches;
- bool continueJumps;
- int continueMaxInstructions;
-};
-
-class Jit : public MIPSGen::MIPSCodeBlock
+class MipsJit : public MIPSGen::MIPSCodeBlock
{
public:
- Jit(MIPSState *mips);
+ MipsJit(MIPSState *mips);
void DoState(PointerWrap &p);
static void DoDummyState(PointerWrap &p);
@@ -165,7 +154,7 @@ private:
void WriteSyscallExit();
JitBlockCache blocks;
- MIPSJitOptions jo;
+ JitOptions jo;
JitState js;
MIPSState *mips_;
@@ -187,8 +176,8 @@ public:
const u8 *breakpointBailout;
};
-typedef void (Jit::*MIPSCompileFunc)(MIPSOpcode opcode);
-typedef int (Jit::*MIPSReplaceFunc)();
+typedef void (MipsJit::*MIPSCompileFunc)(MIPSOpcode opcode);
+typedef int (MipsJit::*MIPSReplaceFunc)();
} // namespace MIPSComp
diff --git a/Core/MIPS/MIPSTables.cpp b/Core/MIPS/MIPSTables.cpp
index 646757f1c6..984f1030fb 100644
--- a/Core/MIPS/MIPSTables.cpp
+++ b/Core/MIPS/MIPSTables.cpp
@@ -142,10 +142,10 @@ const MIPSInstruction tableImmediate[64] = // xxxxxx ..... ..... ...............
ENCODING(VFPU1),
ENCODING(Emu),
ENCODING(VFPU3),
- ENCODING(Spe2),//special2
- INVALID, //, "jalx", 0, Dis_JumpType, Int_JumpType},
+ ENCODING(Spe2), //special2
INVALID,
- ENCODING(Spe3),//special3
+ INVALID,
+ ENCODING(Spe3), //special3
//32
INSTR("lb", JITFUNC(Comp_ITypeMem), Dis_ITypeMem, Int_ITypeMem, IN_MEM|IN_IMM16|IN_RS_ADDR|OUT_RT|MEMTYPE_BYTE),
INSTR("lh", JITFUNC(Comp_ITypeMem), Dis_ITypeMem, Int_ITypeMem, IN_MEM|IN_IMM16|IN_RS_ADDR|OUT_RT|MEMTYPE_HWORD),
@@ -168,7 +168,7 @@ const MIPSInstruction tableImmediate[64] = // xxxxxx ..... ..... ...............
INSTR("ll", JITFUNC(Comp_Generic), Dis_Generic, Int_StoreSync, IN_MEM|IN_IMM16|IN_RS_ADDR|OUT_RT|OUT_OTHER|MEMTYPE_WORD),
INSTR("lwc1", JITFUNC(Comp_FPULS), Dis_FPULS, Int_FPULS, IN_MEM|IN_IMM16|IN_RS_ADDR|OUT_FT|MEMTYPE_FLOAT|IS_FPU),
INSTR("lv.s", JITFUNC(Comp_SV), Dis_SV, Int_SV, IN_MEM|IN_IMM16|IN_RS_ADDR|OUT_OTHER|IS_VFPU|VFPU_NO_PREFIX|MEMTYPE_FLOAT),
- INVALID, // HIT THIS IN WIPEOUT
+ INVALID,
ENCODING(VFPU4Jump),
INSTR("lv", JITFUNC(Comp_SVQ), Dis_SVLRQ, Int_SVQ, IN_MEM|IN_IMM16|IN_RS_ADDR|OUT_OTHER|IS_VFPU|VFPU_NO_PREFIX|MEMTYPE_VQUAD),
INSTR("lv.q", JITFUNC(Comp_SVQ), Dis_SVQ, Int_SVQ, IN_MEM|IN_IMM16|IN_RS_ADDR|OUT_OTHER|IS_VFPU|VFPU_NO_PREFIX|MEMTYPE_VQUAD), //copU
@@ -434,13 +434,13 @@ const MIPSInstruction tableCop0CO[64] = // 010000 1.... ..... ..... ..... xxxxxx
const MIPSInstruction tableCop1[32] = // 010001 xxxxx ..... ..... ...........
{
- INSTR("mfc1", JITFUNC(Comp_mxc1), Dis_mxc1, Int_mxc1, IN_FS|OUT_RT),
+ INSTR("mfc1", JITFUNC(Comp_mxc1), Dis_mxc1, Int_mxc1, IN_FS|OUT_RT|IS_FPU),
INVALID,
- INSTR("cfc1", JITFUNC(Comp_mxc1), Dis_mxc1, Int_mxc1, IN_OTHER|IN_FPUFLAG|OUT_RT),
+ INSTR("cfc1", JITFUNC(Comp_mxc1), Dis_mxc1, Int_mxc1, IN_OTHER|IN_FPUFLAG|OUT_RT|IS_FPU),
INVALID,
- INSTR("mtc1", JITFUNC(Comp_mxc1), Dis_mxc1, Int_mxc1, IN_RT|OUT_FS),
+ INSTR("mtc1", JITFUNC(Comp_mxc1), Dis_mxc1, Int_mxc1, IN_RT|OUT_FS|IS_FPU),
INVALID,
- INSTR("ctc1", JITFUNC(Comp_mxc1), Dis_mxc1, Int_mxc1, IN_RT|OUT_FPUFLAG|OUT_OTHER),
+ INSTR("ctc1", JITFUNC(Comp_mxc1), Dis_mxc1, Int_mxc1, IN_RT|OUT_FPUFLAG|OUT_OTHER|IS_FPU),
INVALID,
//8
ENCODING(Cop1BC), INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, INVALID,
@@ -453,10 +453,10 @@ const MIPSInstruction tableCop1[32] = // 010001 xxxxx ..... ..... ...........
const MIPSInstruction tableCop1BC[32] = // 010001 01000 xxxxx ................
{
- INSTR("bc1f", JITFUNC(Comp_FPUBranch), Dis_FPUBranch, Int_FPUBranch, IS_CONDBRANCH|IN_IMM16|IN_FPUFLAG|DELAYSLOT|CONDTYPE_FPUFALSE),
- INSTR("bc1t", JITFUNC(Comp_FPUBranch), Dis_FPUBranch, Int_FPUBranch, IS_CONDBRANCH|IN_IMM16|IN_FPUFLAG|DELAYSLOT|CONDTYPE_FPUTRUE),
- INSTR("bc1fl", JITFUNC(Comp_FPUBranch), Dis_FPUBranch, Int_FPUBranch, IS_CONDBRANCH|IN_IMM16|IN_FPUFLAG|DELAYSLOT|LIKELY|CONDTYPE_FPUFALSE),
- INSTR("bc1tl", JITFUNC(Comp_FPUBranch), Dis_FPUBranch, Int_FPUBranch, IS_CONDBRANCH|IN_IMM16|IN_FPUFLAG|DELAYSLOT|LIKELY|CONDTYPE_FPUTRUE),
+ INSTR("bc1f", JITFUNC(Comp_FPUBranch), Dis_FPUBranch, Int_FPUBranch, IS_CONDBRANCH|IN_IMM16|IN_FPUFLAG|DELAYSLOT|CONDTYPE_FPUFALSE|IS_FPU),
+ INSTR("bc1t", JITFUNC(Comp_FPUBranch), Dis_FPUBranch, Int_FPUBranch, IS_CONDBRANCH|IN_IMM16|IN_FPUFLAG|DELAYSLOT|CONDTYPE_FPUTRUE|IS_FPU),
+ INSTR("bc1fl", JITFUNC(Comp_FPUBranch), Dis_FPUBranch, Int_FPUBranch, IS_CONDBRANCH|IN_IMM16|IN_FPUFLAG|DELAYSLOT|LIKELY|CONDTYPE_FPUFALSE|IS_FPU),
+ INSTR("bc1tl", JITFUNC(Comp_FPUBranch), Dis_FPUBranch, Int_FPUBranch, IS_CONDBRANCH|IN_IMM16|IN_FPUFLAG|DELAYSLOT|LIKELY|CONDTYPE_FPUTRUE|IS_FPU),
INVALID, INVALID, INVALID, INVALID,
//8
INVALID_X_8,
diff --git a/Core/MIPS/MIPSTables.h b/Core/MIPS/MIPSTables.h
index 5b91632408..ac77e34f2b 100644
--- a/Core/MIPS/MIPSTables.h
+++ b/Core/MIPS/MIPSTables.h
@@ -28,7 +28,7 @@ struct MIPSInfo {
explicit MIPSInfo(u64 v) : value(v) {
}
- u64 operator & (const u32 &arg) const {
+ u64 operator & (const u64 &arg) const {
return value & arg;
}
diff --git a/Core/MIPS/x86/Jit.cpp b/Core/MIPS/x86/Jit.cpp
index 886a9e54e0..b4283822dc 100644
--- a/Core/MIPS/x86/Jit.cpp
+++ b/Core/MIPS/x86/Jit.cpp
@@ -114,18 +114,6 @@ static void JitLogMiss(MIPSOpcode op)
func(op);
}
-JitOptions::JitOptions()
-{
- enableBlocklink = true;
- immBranches = false;
- continueBranches = false;
- continueJumps = false;
- continueMaxInstructions = 300;
- enableVFPUSIMD = true;
- // Set by Asm if needed.
- reserveR15ForAsm = false;
-}
-
#ifdef _MSC_VER
// JitBlockCache doesn't use this, just stores it.
#pragma warning(disable:4355)
diff --git a/Core/MIPS/x86/Jit.h b/Core/MIPS/x86/Jit.h
index cbafdb57cf..7d1ed8448a 100644
--- a/Core/MIPS/x86/Jit.h
+++ b/Core/MIPS/x86/Jit.h
@@ -41,19 +41,6 @@ namespace MIPSComp
// This is called when Jit hits a breakpoint. Returns 1 when hit.
u32 JitBreakpoint();
-struct JitOptions
-{
- JitOptions();
-
- bool enableBlocklink;
- bool immBranches;
- bool continueBranches;
- bool continueJumps;
- int continueMaxInstructions;
- bool enableVFPUSIMD;
- bool reserveR15ForAsm;
-};
-
// TODO: Hmm, humongous.
struct RegCacheState {
GPRRegCacheState gpr;
diff --git a/android/jni/Android.mk b/android/jni/Android.mk
index 1be24d8776..c209bba91a 100644
--- a/android/jni/Android.mk
+++ b/android/jni/Android.mk
@@ -314,6 +314,7 @@ EXEC_AND_LIB_FILES := \
$(SRC)/Core/FileSystems/tlzrc.cpp \
$(SRC)/Core/MIPS/JitCommon/JitCommon.cpp \
$(SRC)/Core/MIPS/JitCommon/JitBlockCache.cpp \
+ $(SRC)/Core/MIPS/JitCommon/JitState.cpp \
$(SRC)/Core/Util/AudioFormat.cpp \
$(SRC)/Core/Util/GameManager.cpp \
$(SRC)/Core/Util/BlockAllocator.cpp \
diff --git a/unittest/TestArmEmitter.cpp b/unittest/TestArmEmitter.cpp
index ea8a979e77..27da590dd2 100644
--- a/unittest/TestArmEmitter.cpp
+++ b/unittest/TestArmEmitter.cpp
@@ -199,7 +199,7 @@ bool TestArmEmitter() {
MIPSState mips;
MIPSComp::JitState js;
- MIPSComp::ArmJitOptions jo;
+ MIPSComp::JitOptions jo;
ArmRegCacheFPU fpr(&mips, &js, &jo);
fpr.SetEmitter(&emitter);
int C000 = GetColumnName(0, M_4x4, 0, 0);