Refactor code

This commit is contained in:
SSimco
2024-09-01 07:25:49 +03:00
parent 972e655a9b
commit 3e8d56c022
6 changed files with 193 additions and 214 deletions
+1 -1
View File
@@ -20,4 +20,4 @@
shallow = true
[submodule "dependencies/xbyak_aarch64"]
path = dependencies/xbyak_aarch64
url = https://github.com/SSimco/xbyak_aarch64
url = https://github.com/fujitsu/xbyak_aarch64
File diff suppressed because it is too large Load Diff
@@ -1,5 +1,12 @@
#pragma once
bool PPCRecompiler_generateAArch64Code(struct PPCRecFunction_t* PPCRecFunction, struct ppcImlGenContext_t* ppcImlGenContext);
#include "HW/Espresso/Recompiler/IML/IMLInstruction.h"
#include "../PPCRecompiler.h"
struct CodeContext
{
virtual ~CodeContext() = default;
};
std::unique_ptr<CodeContext> PPCRecompiler_generateAArch64Code(struct PPCRecFunction_t* PPCRecFunction, struct ppcImlGenContext_t* ppcImlGenContext);
void PPCRecompilerAArch64Gen_generateRecompilerInterfaceFunctions();
@@ -44,6 +44,10 @@ void ATTR_MS_ABI (*PPCRecompiler_leaveRecompilerCode_unvisited)();
PPCRecompilerInstanceData_t* ppcRecompilerInstanceData;
#if defined(__aarch64__)
std::list<std::unique_ptr<CodeContext>> s_aarch64CodeCtxs;
#endif
bool ppcRecompilerEnabled = false;
// this function does never block and can fail if the recompiler lock cannot be acquired immediately
void PPCRecompiler_visitAddressNoBlock(uint32 enterAddress)
@@ -230,11 +234,12 @@ PPCRecFunction_t* PPCRecompiler_recompileFunction(PPCFunctionBoundaryTracker::PP
return nullptr;
}
#elif defined(__aarch64__)
bool aarch64GenerationSuccess = PPCRecompiler_generateAArch64Code(ppcRecFunc, &ppcImlGenContext);
if (aarch64GenerationSuccess == false)
auto aarch64CodeCtx = PPCRecompiler_generateAArch64Code(ppcRecFunc, &ppcImlGenContext);
if (aarch64CodeCtx == nullptr)
{
return nullptr;
}
s_aarch64CodeCtxs.push_back(std::move(aarch64CodeCtx));
#endif
// collect list of PPC-->x64 entry points
@@ -680,7 +685,7 @@ void PPCRecompiler_init()
#if defined(ARCH_X86_64)
PPCRecompilerX64Gen_generateRecompilerInterfaceFunctions();
#else
PPCRecompilerAArch64Gen_generateRecompilerInterfaceFunctions();
PPCRecompilerAArch64Gen_generateRecompilerInterfaceFunctions();
#endif
PPCRecompiler_allocateRange(0, 0x1000); // the first entry is used for fallback to interpreter
PPCRecompiler_allocateRange(mmuRange_TRAMPOLINE_AREA.getBase(), mmuRange_TRAMPOLINE_AREA.getSize());
@@ -761,4 +766,7 @@ void PPCRecompiler_Shutdown()
// mark as unmapped
ppcRecompiler_reservedBlockMask[i] = false;
}
#if defined(__aarch64__)
s_aarch64CodeCtxs.clear();
#endif
}
@@ -3080,7 +3080,8 @@ void runRecompilerTests()
#if defined(ARCH_X86_64)
bool successful = PPCRecompiler_generateX64Code(&ppcRecFunc, &ppcImlGenContext);
#elif defined(__aarch64__)
bool successful = PPCRecompiler_generateAArch64Code(&ppcRecFunc, &ppcImlGenContext);
auto aarch64CodeCtx = PPCRecompiler_generateAArch64Code(&ppcRecFunc, &ppcImlGenContext);
bool successful = aarch64CodeCtx != nullptr;
#endif
cemu_assert_debug(successful);
if (!successful)
+1 -1
View File
@@ -62,7 +62,7 @@ fres_nan_or_inf:
add sp, sp, #48
ret
fres_lookup :
fres_lookup:
stp x2, x3, [sp, #16]
stp x4, x5, [sp, #32]
ubfx x2, x0, #47, #5