diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt
index 003f2122ec..30ae5e0946 100644
--- a/Source/Core/Core/CMakeLists.txt
+++ b/Source/Core/Core/CMakeLists.txt
@@ -236,20 +236,20 @@ if(_M_X86)
DSP/Jit/x64/DSPJitMultiplier.cpp
DSP/Jit/x64/DSPJitTables.cpp
DSP/Jit/x64/DSPJitUtil.cpp
- PowerPC/Jit64/FPURegCache.cpp
- PowerPC/Jit64/GPRRegCache.cpp
- PowerPC/Jit64/Jit64_Tables.cpp
- PowerPC/Jit64/JitAsm.cpp
- PowerPC/Jit64/Jit_Branch.cpp
PowerPC/Jit64/Jit.cpp
+ PowerPC/Jit64/Jit64_Tables.cpp
+ PowerPC/Jit64/Jit_Branch.cpp
PowerPC/Jit64/Jit_FloatingPoint.cpp
PowerPC/Jit64/Jit_Integer.cpp
PowerPC/Jit64/Jit_LoadStore.cpp
PowerPC/Jit64/Jit_LoadStoreFloating.cpp
PowerPC/Jit64/Jit_LoadStorePaired.cpp
PowerPC/Jit64/Jit_Paired.cpp
- PowerPC/Jit64/JitRegCache.cpp
PowerPC/Jit64/Jit_SystemRegisters.cpp
+ PowerPC/Jit64/JitAsm.cpp
+ PowerPC/Jit64/RegCache/FPURegCache.cpp
+ PowerPC/Jit64/RegCache/GPRRegCache.cpp
+ PowerPC/Jit64/RegCache/JitRegCache.cpp
PowerPC/Jit64Common/BlockCache.cpp
PowerPC/Jit64Common/ConstantPool.cpp
PowerPC/Jit64Common/EmuCodeBlock.cpp
diff --git a/Source/Core/Core/Core.vcxproj b/Source/Core/Core/Core.vcxproj
index 44e2327dc2..7c88249fae 100644
--- a/Source/Core/Core/Core.vcxproj
+++ b/Source/Core/Core/Core.vcxproj
@@ -241,8 +241,8 @@
-
+
@@ -260,13 +260,8 @@
-
-
-
-
-
@@ -275,7 +270,12 @@
+
+
+
+
+
@@ -284,10 +284,6 @@
-
-
-
-
@@ -295,6 +291,10 @@
+
+
+
+
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/PowerPC/Jit64/Jit.cpp
index c4cfefd77a..23d214cffa 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit.cpp
@@ -27,7 +27,7 @@
#include "Core/HW/ProcessorInterface.h"
#include "Core/PatchEngine.h"
#include "Core/PowerPC/Jit64/JitAsm.h"
-#include "Core/PowerPC/Jit64/JitRegCache.h"
+#include "Core/PowerPC/Jit64/RegCache/JitRegCache.h"
#include "Core/PowerPC/Jit64Common/FarCodeCache.h"
#include "Core/PowerPC/Jit64Common/Jit64PowerPCState.h"
#include "Core/PowerPC/Jit64Common/TrampolineCache.h"
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.h b/Source/Core/Core/PowerPC/Jit64/Jit.h
index 068d42290c..cfb7ec6944 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit.h
+++ b/Source/Core/Core/PowerPC/Jit64/Jit.h
@@ -21,10 +21,10 @@
#include "Common/CommonTypes.h"
#include "Common/x64ABI.h"
#include "Common/x64Emitter.h"
-#include "Core/PowerPC/Jit64/FPURegCache.h"
-#include "Core/PowerPC/Jit64/GPRRegCache.h"
#include "Core/PowerPC/Jit64/JitAsm.h"
-#include "Core/PowerPC/Jit64/JitRegCache.h"
+#include "Core/PowerPC/Jit64/RegCache/FPURegCache.h"
+#include "Core/PowerPC/Jit64/RegCache/GPRRegCache.h"
+#include "Core/PowerPC/Jit64/RegCache/JitRegCache.h"
#include "Core/PowerPC/Jit64Common/Jit64Base.h"
#include "Core/PowerPC/JitCommon/JitCache.h"
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_Branch.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_Branch.cpp
index 358e16cef9..5e0d4266cd 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit_Branch.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit_Branch.cpp
@@ -8,7 +8,7 @@
#include "Core/CoreTiming.h"
#include "Core/PowerPC/Gekko.h"
#include "Core/PowerPC/Jit64/Jit.h"
-#include "Core/PowerPC/Jit64/JitRegCache.h"
+#include "Core/PowerPC/Jit64/RegCache/JitRegCache.h"
#include "Core/PowerPC/Jit64Common/Jit64PowerPCState.h"
#include "Core/PowerPC/PPCAnalyst.h"
#include "Core/PowerPC/PowerPC.h"
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp
index 15a3588ff7..dc7b851f58 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp
@@ -12,7 +12,7 @@
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/PowerPC/Jit64/Jit.h"
-#include "Core/PowerPC/Jit64/JitRegCache.h"
+#include "Core/PowerPC/Jit64/RegCache/JitRegCache.h"
#include "Core/PowerPC/Jit64Common/Jit64PowerPCState.h"
#include "Core/PowerPC/PPCAnalyst.h"
#include "Core/PowerPC/PowerPC.h"
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp
index f91443996b..1aa5e95209 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp
@@ -13,7 +13,7 @@
#include "Common/MathUtil.h"
#include "Common/x64Emitter.h"
#include "Core/PowerPC/Jit64/Jit.h"
-#include "Core/PowerPC/Jit64/JitRegCache.h"
+#include "Core/PowerPC/Jit64/RegCache/JitRegCache.h"
#include "Core/PowerPC/Jit64Common/Jit64PowerPCState.h"
#include "Core/PowerPC/PPCAnalyst.h"
#include "Core/PowerPC/PowerPC.h"
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp
index bb58075107..9621a727ad 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp
@@ -18,7 +18,7 @@
#include "Core/CoreTiming.h"
#include "Core/HW/CPU.h"
#include "Core/HW/Memmap.h"
-#include "Core/PowerPC/Jit64/JitRegCache.h"
+#include "Core/PowerPC/Jit64/RegCache/JitRegCache.h"
#include "Core/PowerPC/Jit64Common/Jit64PowerPCState.h"
#include "Core/PowerPC/JitInterface.h"
#include "Core/PowerPC/PowerPC.h"
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStoreFloating.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStoreFloating.cpp
index e89bf3f9d6..6cd7f83792 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStoreFloating.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStoreFloating.cpp
@@ -6,7 +6,7 @@
#include "Common/CommonTypes.h"
#include "Common/x64Emitter.h"
#include "Core/PowerPC/Jit64/Jit.h"
-#include "Core/PowerPC/Jit64/JitRegCache.h"
+#include "Core/PowerPC/Jit64/RegCache/JitRegCache.h"
#include "Core/PowerPC/Jit64Common/Jit64PowerPCState.h"
using namespace Gen;
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp
index bf42fa3774..c16c2bb3b3 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp
@@ -9,7 +9,7 @@
#include "Common/CommonTypes.h"
#include "Common/x64Emitter.h"
-#include "Core/PowerPC/Jit64/JitRegCache.h"
+#include "Core/PowerPC/Jit64/RegCache/JitRegCache.h"
#include "Core/PowerPC/Jit64Common/Jit64PowerPCState.h"
#include "Core/PowerPC/JitCommon/JitAsmCommon.h"
#include "Core/PowerPC/PowerPC.h"
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_Paired.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_Paired.cpp
index 45ea288137..df989e05fa 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit_Paired.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit_Paired.cpp
@@ -7,7 +7,7 @@
#include "Common/MsgHandler.h"
#include "Common/x64Emitter.h"
#include "Core/PowerPC/Jit64/Jit.h"
-#include "Core/PowerPC/Jit64/JitRegCache.h"
+#include "Core/PowerPC/Jit64/RegCache/JitRegCache.h"
using namespace Gen;
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp
index 37631239fe..45f318e493 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp
@@ -9,7 +9,7 @@
#include "Core/CoreTiming.h"
#include "Core/HW/ProcessorInterface.h"
#include "Core/PowerPC/Jit64/Jit.h"
-#include "Core/PowerPC/Jit64/JitRegCache.h"
+#include "Core/PowerPC/Jit64/RegCache/JitRegCache.h"
#include "Core/PowerPC/Jit64Common/Jit64PowerPCState.h"
#include "Core/PowerPC/PowerPC.h"
diff --git a/Source/Core/Core/PowerPC/Jit64/RegCache/CachedReg.h b/Source/Core/Core/PowerPC/Jit64/RegCache/CachedReg.h
new file mode 100644
index 0000000000..08f387f0a9
--- /dev/null
+++ b/Source/Core/Core/PowerPC/Jit64/RegCache/CachedReg.h
@@ -0,0 +1,127 @@
+// Copyright 2008 Dolphin Emulator Project
+// Licensed under GPLv2+
+// Refer to the license.txt file included.
+
+#include
+
+#include "Common/Assert.h"
+#include "Common/CommonTypes.h"
+#include "Common/x64Emitter.h"
+
+using preg_t = size_t;
+
+class PPCCachedReg
+{
+public:
+ enum class LocationType
+ {
+ /// Value is currently at its default location
+ Default,
+ /// Value is currently bound to a x64 register
+ Bound,
+ /// Value is known as an immediate and has not been written back to its default location
+ Immediate,
+ /// Value is known as an immediate and is already present at its default location
+ SpeculativeImmediate,
+ };
+
+ PPCCachedReg() = default;
+
+ explicit PPCCachedReg(Gen::OpArg default_location_)
+ : default_location(default_location_), location(default_location_)
+ {
+ }
+
+ const Gen::OpArg& Location() const { return location; }
+
+ LocationType GetLocationType() const
+ {
+ if (!away)
+ {
+ if (location.IsImm())
+ return LocationType::SpeculativeImmediate;
+
+ ASSERT(location == default_location);
+ return LocationType::Default;
+ }
+
+ ASSERT(location.IsImm() || location.IsSimpleReg());
+ return location.IsImm() ? LocationType::Immediate : LocationType::Bound;
+ }
+
+ bool IsAway() const { return away; }
+ bool IsBound() const { return GetLocationType() == LocationType::Bound; }
+
+ void SetBoundTo(Gen::X64Reg xreg)
+ {
+ away = true;
+ location = Gen::R(xreg);
+ }
+
+ void SetFlushed()
+ {
+ away = false;
+ location = default_location;
+ }
+
+ void SetToImm32(u32 imm32, bool dirty = true)
+ {
+ away |= dirty;
+ location = Gen::Imm32(imm32);
+ }
+
+ bool IsLocked() const { return locked > 0; }
+ void Lock() { locked++; }
+ void Unlock()
+ {
+ ASSERT(IsLocked());
+ locked--;
+ }
+ void UnlockAll() { locked = 0; } // TODO: Remove from final version
+
+private:
+ Gen::OpArg default_location{};
+ Gen::OpArg location{};
+ bool away = false; // value not in source register
+ size_t locked = 0;
+};
+
+class X64CachedReg
+{
+public:
+ preg_t Contents() const { return ppcReg; }
+
+ void SetBoundTo(preg_t ppcReg_, bool dirty_)
+ {
+ free = false;
+ ppcReg = ppcReg_;
+ dirty = dirty_;
+ }
+
+ void SetFlushed()
+ {
+ ppcReg = static_cast(Gen::INVALID_REG);
+ free = true;
+ dirty = false;
+ }
+
+ bool IsFree() const { return free && !locked; }
+
+ bool IsDirty() const { return dirty; }
+ void MakeDirty() { dirty = true; }
+
+ bool IsLocked() const { return locked > 0; }
+ void Lock() { locked++; }
+ void Unlock()
+ {
+ ASSERT(IsLocked());
+ locked--;
+ }
+ void UnlockAll() { locked = 0; } // TODO: Remove from final version
+
+private:
+ preg_t ppcReg = static_cast(Gen::INVALID_REG);
+ bool free = true;
+ bool dirty = false;
+ size_t locked = 0;
+};
diff --git a/Source/Core/Core/PowerPC/Jit64/FPURegCache.cpp b/Source/Core/Core/PowerPC/Jit64/RegCache/FPURegCache.cpp
similarity index 96%
rename from Source/Core/Core/PowerPC/Jit64/FPURegCache.cpp
rename to Source/Core/Core/PowerPC/Jit64/RegCache/FPURegCache.cpp
index 9077f388c8..f671afb74c 100644
--- a/Source/Core/Core/PowerPC/Jit64/FPURegCache.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/RegCache/FPURegCache.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
-#include "Core/PowerPC/Jit64/FPURegCache.h"
+#include "Core/PowerPC/Jit64/RegCache/FPURegCache.h"
#include "Core/PowerPC/Jit64/Jit.h"
#include "Core/PowerPC/Jit64Common/Jit64Base.h"
diff --git a/Source/Core/Core/PowerPC/Jit64/FPURegCache.h b/Source/Core/Core/PowerPC/Jit64/RegCache/FPURegCache.h
similarity index 92%
rename from Source/Core/Core/PowerPC/Jit64/FPURegCache.h
rename to Source/Core/Core/PowerPC/Jit64/RegCache/FPURegCache.h
index 1ecbde2bea..cb482911b2 100644
--- a/Source/Core/Core/PowerPC/Jit64/FPURegCache.h
+++ b/Source/Core/Core/PowerPC/Jit64/RegCache/FPURegCache.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Core/PowerPC/Jit64/JitRegCache.h"
+#include "Core/PowerPC/Jit64/RegCache/JitRegCache.h"
class Jit64;
diff --git a/Source/Core/Core/PowerPC/Jit64/GPRRegCache.cpp b/Source/Core/Core/PowerPC/Jit64/RegCache/GPRRegCache.cpp
similarity index 97%
rename from Source/Core/Core/PowerPC/Jit64/GPRRegCache.cpp
rename to Source/Core/Core/PowerPC/Jit64/RegCache/GPRRegCache.cpp
index 18b0e70602..1671d37a51 100644
--- a/Source/Core/Core/PowerPC/Jit64/GPRRegCache.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/RegCache/GPRRegCache.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
-#include "Core/PowerPC/Jit64/GPRRegCache.h"
+#include "Core/PowerPC/Jit64/RegCache/GPRRegCache.h"
#include "Core/PowerPC/Jit64/Jit.h"
#include "Core/PowerPC/Jit64Common/Jit64Base.h"
diff --git a/Source/Core/Core/PowerPC/Jit64/GPRRegCache.h b/Source/Core/Core/PowerPC/Jit64/RegCache/GPRRegCache.h
similarity index 92%
rename from Source/Core/Core/PowerPC/Jit64/GPRRegCache.h
rename to Source/Core/Core/PowerPC/Jit64/RegCache/GPRRegCache.h
index 0b383cf94f..d340d6c6d2 100644
--- a/Source/Core/Core/PowerPC/Jit64/GPRRegCache.h
+++ b/Source/Core/Core/PowerPC/Jit64/RegCache/GPRRegCache.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Core/PowerPC/Jit64/JitRegCache.h"
+#include "Core/PowerPC/Jit64/RegCache/JitRegCache.h"
class Jit64;
diff --git a/Source/Core/Core/PowerPC/Jit64/JitRegCache.cpp b/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp
similarity index 98%
rename from Source/Core/Core/PowerPC/Jit64/JitRegCache.cpp
rename to Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp
index 2307670268..77275b5018 100644
--- a/Source/Core/Core/PowerPC/Jit64/JitRegCache.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
-#include "Core/PowerPC/Jit64/JitRegCache.h"
+#include "Core/PowerPC/Jit64/RegCache/JitRegCache.h"
#include
#include
@@ -15,6 +15,7 @@
#include "Common/MsgHandler.h"
#include "Common/x64Emitter.h"
#include "Core/PowerPC/Jit64/Jit.h"
+#include "Core/PowerPC/Jit64/RegCache/CachedReg.h"
#include "Core/PowerPC/PowerPC.h"
using namespace Gen;
diff --git a/Source/Core/Core/PowerPC/Jit64/JitRegCache.h b/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.h
similarity index 52%
rename from Source/Core/Core/PowerPC/Jit64/JitRegCache.h
rename to Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.h
index ac91409aa1..8c42a6947d 100644
--- a/Source/Core/Core/PowerPC/Jit64/JitRegCache.h
+++ b/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.h
@@ -6,131 +6,16 @@
#include
#include
+#include
-#include "Common/Assert.h"
#include "Common/x64Emitter.h"
#include "Core/PowerPC/PPCAnalyst.h"
+#include "Core/PowerPC/Jit64/RegCache/CachedReg.h"
class Jit64;
using preg_t = size_t;
-class PPCCachedReg
-{
-public:
- enum class LocationType
- {
- /// Value is currently at its default location
- Default,
- /// Value is currently bound to a x64 register
- Bound,
- /// Value is known as an immediate and has not been written back to its default location
- Immediate,
- /// Value is known as an immediate and is already present at its default location
- SpeculativeImmediate,
- };
-
- PPCCachedReg() = default;
-
- explicit PPCCachedReg(Gen::OpArg default_location_)
- : default_location(default_location_), location(default_location_)
- {
- }
-
- const Gen::OpArg& Location() const { return location; }
-
- LocationType GetLocationType() const
- {
- if (!away)
- {
- if (location.IsImm())
- return LocationType::SpeculativeImmediate;
-
- ASSERT(location == default_location);
- return LocationType::Default;
- }
-
- ASSERT(location.IsImm() || location.IsSimpleReg());
- return location.IsImm() ? LocationType::Immediate : LocationType::Bound;
- }
-
- bool IsAway() const { return away; }
- bool IsBound() const { return GetLocationType() == LocationType::Bound; }
-
- void SetBoundTo(Gen::X64Reg xreg)
- {
- away = true;
- location = Gen::R(xreg);
- }
-
- void SetFlushed()
- {
- away = false;
- location = default_location;
- }
-
- void SetToImm32(u32 imm32, bool dirty = true)
- {
- away |= dirty;
- location = Gen::Imm32(imm32);
- }
-
- bool IsLocked() const { return locked > 0; }
- void Lock() { locked++; }
- void Unlock()
- {
- ASSERT(IsLocked());
- locked--;
- }
- void UnlockAll() { locked = 0; } // TODO: Remove from final version
-
-private:
- Gen::OpArg default_location{};
- Gen::OpArg location{};
- bool away = false; // value not in source register
- size_t locked = 0;
-};
-
-class X64CachedReg
-{
-public:
- preg_t Contents() const { return ppcReg; }
-
- void SetBoundTo(preg_t ppcReg_, bool dirty_)
- {
- free = false;
- ppcReg = ppcReg_;
- dirty = dirty_;
- }
-
- void SetFlushed()
- {
- ppcReg = static_cast(Gen::INVALID_REG);
- free = true;
- dirty = false;
- }
-
- bool IsFree() const { return free && !locked; }
-
- bool IsDirty() const { return dirty; }
- void MakeDirty() { dirty = true; }
-
- bool IsLocked() const { return locked > 0; }
- void Lock() { locked++; }
- void Unlock()
- {
- ASSERT(IsLocked());
- locked--;
- }
- void UnlockAll() { locked = 0; } // TODO: Remove from final version
-
-private:
- preg_t ppcReg = static_cast(Gen::INVALID_REG);
- bool free = true;
- bool dirty = false;
- size_t locked = 0;
-};
-
class RegCache
{
public: