mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-25 07:10:00 -06:00
JIT: most mem instructions working
+ branching
This commit is contained in:
@ -6,6 +6,8 @@
|
||||
#include "../ARMJIT.h"
|
||||
#include "../ARMJIT_RegCache.h"
|
||||
|
||||
#include <tuple>
|
||||
|
||||
namespace ARMJIT
|
||||
{
|
||||
|
||||
@ -21,6 +23,19 @@ class Compiler;
|
||||
|
||||
typedef void (Compiler::*CompileFunc)();
|
||||
|
||||
enum DataRegion
|
||||
{
|
||||
dataRegionGeneric, // hey, that's me!
|
||||
dataRegionMainRAM,
|
||||
dataRegionSWRAM,
|
||||
dataRegionVRAM,
|
||||
dataRegionIO,
|
||||
dataRegionExclusive,
|
||||
dataRegionsCount,
|
||||
dataRegionDTCM = dataRegionExclusive,
|
||||
dataRegionWRAM7 = dataRegionExclusive,
|
||||
};
|
||||
|
||||
class Compiler : public Gen::X64CodeBlock
|
||||
{
|
||||
public:
|
||||
@ -34,6 +49,8 @@ public:
|
||||
private:
|
||||
CompileFunc GetCompFunc(int kind);
|
||||
|
||||
void Comp_JumpTo(Gen::X64Reg addr, bool restoreCPSR = false);
|
||||
|
||||
void Comp_AddCycles_C();
|
||||
void Comp_AddCycles_CI(u32 i);
|
||||
|
||||
@ -47,11 +64,14 @@ private:
|
||||
opInvertOp2 = 1 << 5,
|
||||
};
|
||||
|
||||
DataRegion ClassifyAddress(u32 addr);
|
||||
|
||||
void A_Comp_Arith();
|
||||
void A_Comp_MovOp();
|
||||
void A_Comp_CmpOp();
|
||||
|
||||
void A_Comp_MemWB();
|
||||
void A_Comp_MemHalf();
|
||||
|
||||
void T_Comp_ShiftImm();
|
||||
void T_Comp_AddSub_();
|
||||
@ -59,8 +79,15 @@ private:
|
||||
void T_Comp_ALU();
|
||||
void T_Comp_ALU_HiReg();
|
||||
|
||||
void T_Comp_RelAddr();
|
||||
void T_Comp_AddSP();
|
||||
|
||||
void T_Comp_MemReg();
|
||||
void T_Comp_MemImm();
|
||||
void T_Comp_MemRegHalf();
|
||||
void T_Comp_MemImmHalf();
|
||||
|
||||
void Comp_MemAccess(Gen::OpArg rd, bool signExtend, bool store, int size);
|
||||
|
||||
void Comp_ArithTriOp(void (Compiler::*op)(int, const Gen::OpArg&, const Gen::OpArg&),
|
||||
Gen::OpArg rd, Gen::OpArg rn, Gen::OpArg op2, bool carryUsed, int opFlags);
|
||||
@ -70,8 +97,8 @@ private:
|
||||
|
||||
void Comp_RetriveFlags(bool sign, bool retriveCV, bool carryUsed);
|
||||
|
||||
void* Gen_MemoryRoutine9(bool store, int size, u32 region);
|
||||
void* Gen_MemoryRoutine7(bool store, int size, bool mainRAMCode, u32 region);
|
||||
void* Gen_MemoryRoutine9(bool store, int size);
|
||||
void* Gen_MemoryRoutine7(bool store, bool codeMainRAM, int size);
|
||||
|
||||
Gen::OpArg Comp_RegShiftImm(int op, int amount, Gen::OpArg rm, bool S, bool& carryUsed);
|
||||
Gen::OpArg Comp_RegShiftReg(int op, Gen::OpArg rs, Gen::OpArg rm, bool S, bool& carryUsed);
|
||||
@ -92,10 +119,12 @@ private:
|
||||
}
|
||||
|
||||
void* ResetStart;
|
||||
void* MemoryFuncs9[3][2];
|
||||
void* MemoryFuncs7[3][2][2];
|
||||
|
||||
bool CPSRDirty = false;
|
||||
|
||||
FetchedInstr CurrentInstr;
|
||||
FetchedInstr CurInstr;
|
||||
|
||||
RegCache<Compiler, Gen::X64Reg> RegCache;
|
||||
|
||||
@ -105,12 +134,9 @@ private:
|
||||
u32 CodeRegion;
|
||||
|
||||
u32 ConstantCycles;
|
||||
};
|
||||
|
||||
extern void* ReadMemFuncs9[16];
|
||||
extern void* ReadMemFuncs7[2][16];
|
||||
extern void* WriteMemFuncs9[16];
|
||||
extern void* WriteMemFuncs7[2][16];
|
||||
ARM* CurCPU;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user