[Project64] Clean up Interpreter CPU

This commit is contained in:
zilmar 2015-11-15 09:08:30 +11:00
parent 46fea05262
commit 89b197be43
5 changed files with 118 additions and 117 deletions

View File

@ -272,7 +272,7 @@ void CInterpreterCPU::ExecuteCPU()
uint32_t CountPerOp = g_System->CountPerOp();
int32_t & NextTimer = *g_NextTimer;
__try
__try
{
while (!Done)
{
@ -301,24 +301,24 @@ void CInterpreterCPU::ExecuteCPU()
PROGRAM_COUNTER += 4;
break;
case JUMP:
{
bool CheckTimer = (JumpToLocation < PROGRAM_COUNTER || TestTimer);
PROGRAM_COUNTER = JumpToLocation;
R4300iOp::m_NextInstruction = NORMAL;
if (CheckTimer)
{
bool CheckTimer = (JumpToLocation < PROGRAM_COUNTER || TestTimer);
PROGRAM_COUNTER = JumpToLocation;
R4300iOp::m_NextInstruction = NORMAL;
if (CheckTimer)
TestTimer = false;
if (NextTimer < 0)
{
TestTimer = false;
if (NextTimer < 0)
{
g_SystemTimer->TimerDone();
}
if (bDoSomething)
{
g_SystemEvents->ExecuteEvents();
}
g_SystemTimer->TimerDone();
}
if (bDoSomething)
{
g_SystemEvents->ExecuteEvents();
}
}
break;
}
break;
case PERMLOOP_DELAY_DONE:
PROGRAM_COUNTER = JumpToLocation;
R4300iOp::m_NextInstruction = NORMAL;
@ -339,7 +339,8 @@ void CInterpreterCPU::ExecuteCPU()
R4300iOp::m_NextInstruction = NORMAL;
}
}
} __except( g_MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation()) )
}
__except (g_MMU->MemoryFilter(GetExceptionCode(), GetExceptionInformation()))
{
g_Notify->FatalError(GS(MSG_UNKNOWN_MEM_ACTION));
}
@ -355,7 +356,7 @@ void CInterpreterCPU::ExecuteOps(int32_t Cycles)
const int32_t & DoSomething = g_SystemEvents->DoSomething();
uint32_t CountPerOp = g_System->CountPerOp();
__try
__try
{
while (!Done)
{
@ -409,24 +410,24 @@ void CInterpreterCPU::ExecuteOps(int32_t Cycles)
PROGRAM_COUNTER += 4;
break;
case JUMP:
{
bool CheckTimer = (JumpToLocation < PROGRAM_COUNTER || TestTimer);
PROGRAM_COUNTER = JumpToLocation;
R4300iOp::m_NextInstruction = NORMAL;
if (CheckTimer)
{
bool CheckTimer = (JumpToLocation < PROGRAM_COUNTER || TestTimer);
PROGRAM_COUNTER = JumpToLocation;
R4300iOp::m_NextInstruction = NORMAL;
if (CheckTimer)
TestTimer = false;
if (*g_NextTimer < 0)
{
TestTimer = false;
if (*g_NextTimer < 0)
{
g_SystemTimer->TimerDone();
}
if (DoSomething)
{
g_SystemEvents->ExecuteEvents();
}
g_SystemTimer->TimerDone();
}
if (DoSomething)
{
g_SystemEvents->ExecuteEvents();
}
}
break;
}
break;
case PERMLOOP_DELAY_DONE:
PROGRAM_COUNTER = JumpToLocation;
R4300iOp::m_NextInstruction = NORMAL;
@ -448,7 +449,7 @@ void CInterpreterCPU::ExecuteOps(int32_t Cycles)
}
}
}
__except( g_MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation()) )
__except (g_MMU->MemoryFilter(GetExceptionCode(), GetExceptionInformation()))
{
g_Notify->FatalError(GS(MSG_UNKNOWN_MEM_ACTION));
}

View File

@ -11,18 +11,18 @@
#pragma once
class CInterpreterCPU :
private R4300iOp
private R4300iOp
{
public:
static void BuildCPU();
static void ExecuteCPU();
static void ExecuteOps(int Cycles);
static void InPermLoop();
static void BuildCPU();
static void ExecuteCPU();
static void ExecuteOps(int Cycles);
static void InPermLoop();
private:
CInterpreterCPU(); // Disable default constructor
CInterpreterCPU(const CInterpreterCPU&); // Disable copy constructor
CInterpreterCPU& operator=(const CInterpreterCPU&); // Disable assignment
CInterpreterCPU(); // Disable default constructor
CInterpreterCPU(const CInterpreterCPU&); // Disable copy constructor
CInterpreterCPU& operator=(const CInterpreterCPU&); // Disable assignment
static R4300iOp::Func * m_R4300i_Opcode;
static R4300iOp::Func * m_R4300i_Opcode;
};

View File

@ -26,7 +26,7 @@ bool DelaySlotEffectsCompare(uint32_t PC, uint32_t Reg1, uint32_t Reg2);
m_NextInstruction = JUMP;\
m_JumpToLocation = (*_PROGRAM_COUNTER);\
return;\
}
}
#define TLB_READ_EXCEPTION(Address) \
g_Reg->DoTLBReadMiss(m_NextInstruction == JUMP,Address);\

View File

@ -11,74 +11,74 @@
#pragma once
class R4300iOp32 :
public R4300iOp
public R4300iOp
{
public:
/************************* OpCode functions *************************/
static void JAL();
static void BEQ();
static void BNE();
static void BLEZ();
static void BGTZ();
static void ADDI();
static void ADDIU();
static void SLTI();
static void SLTIU();
static void ANDI();
static void ORI();
static void XORI();
static void LUI();
static void BEQL();
static void BNEL();
static void BLEZL();
static void BGTZL();
static void LB();
static void LH();
static void LWL();
static void LW();
static void LBU();
static void LHU();
static void LWR();
static void LWU();
static void LL();
/************************* OpCode functions *************************/
static void JAL();
static void BEQ();
static void BNE();
static void BLEZ();
static void BGTZ();
static void ADDI();
static void ADDIU();
static void SLTI();
static void SLTIU();
static void ANDI();
static void ORI();
static void XORI();
static void LUI();
static void BEQL();
static void BNEL();
static void BLEZL();
static void BGTZL();
static void LB();
static void LH();
static void LWL();
static void LW();
static void LBU();
static void LHU();
static void LWR();
static void LWU();
static void LL();
/********************** R4300i OpCodes: Special **********************/
static void SPECIAL_SLL();
static void SPECIAL_SRL();
static void SPECIAL_SRA();
static void SPECIAL_SLLV();
static void SPECIAL_SRLV();
static void SPECIAL_SRAV();
static void SPECIAL_JALR();
static void SPECIAL_ADD();
static void SPECIAL_ADDU();
static void SPECIAL_SUB();
static void SPECIAL_SUBU();
static void SPECIAL_AND();
static void SPECIAL_OR();
static void SPECIAL_NOR();
static void SPECIAL_SLT();
static void SPECIAL_SLTU();
static void SPECIAL_TEQ();
static void SPECIAL_DSRL32();
static void SPECIAL_DSRA32();
/********************** R4300i OpCodes: Special **********************/
static void SPECIAL_SLL();
static void SPECIAL_SRL();
static void SPECIAL_SRA();
static void SPECIAL_SLLV();
static void SPECIAL_SRLV();
static void SPECIAL_SRAV();
static void SPECIAL_JALR();
static void SPECIAL_ADD();
static void SPECIAL_ADDU();
static void SPECIAL_SUB();
static void SPECIAL_SUBU();
static void SPECIAL_AND();
static void SPECIAL_OR();
static void SPECIAL_NOR();
static void SPECIAL_SLT();
static void SPECIAL_SLTU();
static void SPECIAL_TEQ();
static void SPECIAL_DSRL32();
static void SPECIAL_DSRA32();
/********************** R4300i OpCodes: RegImm **********************/
static void REGIMM_BLTZ();
static void REGIMM_BGEZ();
static void REGIMM_BLTZL();
static void REGIMM_BGEZL();
static void REGIMM_BLTZAL();
static void REGIMM_BGEZAL();
/********************** R4300i OpCodes: RegImm **********************/
static void REGIMM_BLTZ();
static void REGIMM_BGEZ();
static void REGIMM_BLTZL();
static void REGIMM_BGEZL();
static void REGIMM_BLTZAL();
static void REGIMM_BGEZAL();
/************************** COP0 functions **************************/
static void COP0_MF();
static void COP0_MT();
/************************** COP0 functions **************************/
static void COP0_MF();
static void COP0_MT();
/************************** COP1 functions **************************/
static void COP1_MF();
static void COP1_CF();
static void COP1_DMT();
/************************** COP1 functions **************************/
static void COP1_MF();
static void COP1_CF();
static void COP1_DMT();
static Func* BuildInterpreter();
static Func* BuildInterpreter();
};

View File

@ -54,7 +54,7 @@ const int32_t R4300iOp::LWR_SHIFT[4] = { 24, 16, 8, 0 };
m_NextInstruction = JUMP;\
m_JumpToLocation = (*_PROGRAM_COUNTER);\
return;\
}
}
#define TLB_READ_EXCEPTION(Address) \
g_Reg->DoTLBReadMiss(m_NextInstruction == JUMP,Address);\
@ -902,7 +902,7 @@ void R4300iOp::LUI()
if (m_Opcode.rt == 29)
{
StackValue = _GPR[m_Opcode.rt].W[0];
}
}
#endif
}
@ -1866,7 +1866,7 @@ void R4300iOp::SPECIAL_OR()
if (m_Opcode.rd == 29)
{
StackValue = _GPR[m_Opcode.rd].W[0];
}
}
#endif
}
@ -2363,7 +2363,7 @@ __inline void Float_RoundToInteger32(int32_t * Dest, float * Source)
xmm = _mm_load_ss(Source);
*(Dest) = _mm_cvt_ss2si(xmm);
#endif
}
}
__inline void Float_RoundToInteger64(int64_t * Dest, float * Source)
{
@ -2381,7 +2381,7 @@ __inline void Float_RoundToInteger64(int64_t * Dest, float * Source)
xmm = _mm_load_ss(Source);
*(Dest) = _mm_cvtss_si64(xmm);
#endif
}
}
void R4300iOp::COP1_S_ADD()
{
@ -2436,7 +2436,7 @@ void R4300iOp::COP1_S_SQRT()
xmm = _mm_sqrt_ss(xmm);
*(Dest) = _mm_cvtss_f32(xmm);
#endif
}
}
void R4300iOp::COP1_S_ABS()
{
@ -2594,7 +2594,7 @@ __inline void Double_RoundToInteger32(uint32_t * Dest, double * Source)
xmm = _mm_load_sd(Source);
*(Dest) = _mm_cvtsd_si32(xmm);
#endif
}
}
__inline void Double_RoundToInteger64(uint64_t * Dest, double * Source)
{
@ -2612,7 +2612,7 @@ __inline void Double_RoundToInteger64(uint64_t * Dest, double * Source)
xmm = _mm_load_sd(Source);
*(Dest) = _mm_cvtsd_si64(xmm);
#endif
}
}
void R4300iOp::COP1_D_ADD()
{
@ -2825,7 +2825,7 @@ void R4300iOp::UnknownOpcode()
R4300iOpcodeName(m_Opcode.Hex, (*_PROGRAM_COUNTER))).ToUTF16().c_str());
g_System->m_EndEmulation = true;
g_Notify->BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__, __LINE__);
#ifdef tofix
if (HaveDebugger && !inFullScreen)
{
@ -2839,6 +2839,6 @@ void R4300iOp::UnknownOpcode()
Enter_R4300i_Commands_Window ();
}
ExitThread(0);
}
}
#endif
}