Core: Have R4300iInstruction::WritesGPR return the register written to instead of passing a variable by reference
This commit is contained in:
parent
c8e73ba18e
commit
8e3fb3e302
|
@ -97,9 +97,8 @@ bool R4300iInstruction::DelaySlotEffectsCompare(uint32_t DelayInstruction) const
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
uint32_t WriteReg = 0, ReadReg1 = 0, ReadReg2 = 0;
|
uint32_t WriteReg = DelaySlot.WritesGPR(), ReadReg1 = 0, ReadReg2 = 0;
|
||||||
ReadsGPR(ReadReg1, ReadReg2);
|
ReadsGPR(ReadReg1, ReadReg2);
|
||||||
DelaySlot.WritesGPR(WriteReg);
|
|
||||||
if (WriteReg != 0 && (WriteReg == ReadReg1 || WriteReg == ReadReg2))
|
if (WriteReg != 0 && (WriteReg == ReadReg1 || WriteReg == ReadReg2))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -176,7 +175,7 @@ void R4300iInstruction::ReadsGPR(uint32_t & Reg1, uint32_t & Reg2) const
|
||||||
Reg2 = 0;
|
Reg2 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void R4300iInstruction::WritesGPR(uint32_t & nReg) const
|
uint32_t R4300iInstruction::WritesGPR(void) const
|
||||||
{
|
{
|
||||||
uint32_t op = m_Instruction.op;
|
uint32_t op = m_Instruction.op;
|
||||||
if (op == R4300i_SPECIAL)
|
if (op == R4300i_SPECIAL)
|
||||||
|
@ -184,30 +183,26 @@ void R4300iInstruction::WritesGPR(uint32_t & nReg) const
|
||||||
uint32_t fn = m_Instruction.funct;
|
uint32_t fn = m_Instruction.funct;
|
||||||
if (fn >= R4300i_SPECIAL_SLL && fn <= R4300i_SPECIAL_SRAV || fn >= R4300i_SPECIAL_DSLLV && fn <= R4300i_SPECIAL_DSRAV || fn >= R4300i_SPECIAL_DIVU && fn <= R4300i_SPECIAL_DSUBU || fn >= R4300i_SPECIAL_DSLL && fn <= R4300i_SPECIAL_DSRA32 || fn == R4300i_SPECIAL_JALR || fn == R4300i_SPECIAL_MFLO || fn == R4300i_SPECIAL_MFHI)
|
if (fn >= R4300i_SPECIAL_SLL && fn <= R4300i_SPECIAL_SRAV || fn >= R4300i_SPECIAL_DSLLV && fn <= R4300i_SPECIAL_DSRAV || fn >= R4300i_SPECIAL_DIVU && fn <= R4300i_SPECIAL_DSUBU || fn >= R4300i_SPECIAL_DSLL && fn <= R4300i_SPECIAL_DSRA32 || fn == R4300i_SPECIAL_JALR || fn == R4300i_SPECIAL_MFLO || fn == R4300i_SPECIAL_MFHI)
|
||||||
{
|
{
|
||||||
nReg = m_Instruction.rd;
|
return m_Instruction.rd;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (op == R4300i_REGIMM)
|
else if (op == R4300i_REGIMM)
|
||||||
{
|
{
|
||||||
if (op >= R4300i_REGIMM_BLTZAL && op <= R4300i_REGIMM_BGEZALL)
|
if (op >= R4300i_REGIMM_BLTZAL && op <= R4300i_REGIMM_BGEZALL)
|
||||||
{
|
{
|
||||||
nReg = 31; // RA
|
return 31; // RA
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (op >= R4300i_DADDI && op <= R4300i_LWU || op >= R4300i_ADDI && op <= R4300i_LUI || op == R4300i_LL || op == R4300i_LD || (op == R4300i_CP0 && m_Instruction.fmt == R4300i_COP0_MF) || (op == R4300i_CP1 && m_Instruction.fmt == R4300i_COP1_MF) || (op == R4300i_CP1 && m_Instruction.fmt == R4300i_COP1_CF))
|
else if (op >= R4300i_DADDI && op <= R4300i_LWU || op >= R4300i_ADDI && op <= R4300i_LUI || op == R4300i_LL || op == R4300i_LD || (op == R4300i_CP0 && m_Instruction.fmt == R4300i_COP0_MF) || (op == R4300i_CP1 && m_Instruction.fmt == R4300i_COP1_MF) || (op == R4300i_CP1 && m_Instruction.fmt == R4300i_COP1_CF))
|
||||||
{
|
{
|
||||||
nReg = m_Instruction.rt;
|
return m_Instruction.rt;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (op == R4300i_JAL)
|
if (op == R4300i_JAL)
|
||||||
{
|
{
|
||||||
nReg = 31; // RA
|
return 31; // RA
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
nReg = 0;
|
return (uint32_t)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool R4300iInstruction::ReadsHI() const
|
bool R4300iInstruction::ReadsHI() const
|
||||||
|
|
|
@ -14,7 +14,7 @@ public:
|
||||||
bool HasDelaySlot(void) const;
|
bool HasDelaySlot(void) const;
|
||||||
bool DelaySlotEffectsCompare(uint32_t DelayInstruction) const;
|
bool DelaySlotEffectsCompare(uint32_t DelayInstruction) const;
|
||||||
void ReadsGPR(uint32_t & Reg1, uint32_t & Reg2) const;
|
void ReadsGPR(uint32_t & Reg1, uint32_t & Reg2) const;
|
||||||
void WritesGPR(uint32_t & nReg) const;
|
uint32_t WritesGPR(void) const;
|
||||||
bool ReadsHI() const;
|
bool ReadsHI() const;
|
||||||
bool ReadsLO() const;
|
bool ReadsLO() const;
|
||||||
bool WritesHI() const;
|
bool WritesHI() const;
|
||||||
|
|
|
@ -508,10 +508,9 @@ INT_PTR CALLBACK CRegisterTabs::TabProcGPR(HWND hDlg, UINT msg, WPARAM wParam, L
|
||||||
return (LRESULT)GetStockObject(DC_BRUSH);
|
return (LRESULT)GetStockObject(DC_BRUSH);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nRegRead1, nRegRead2, nRegWrite;
|
uint32_t nRegRead1, nRegRead2, nRegWrite = opInfo.WritesGPR();
|
||||||
|
|
||||||
opInfo.ReadsGPR(nRegRead1, nRegRead2);
|
opInfo.ReadsGPR(nRegRead1, nRegRead2);
|
||||||
opInfo.WritesGPR(nRegWrite);
|
|
||||||
|
|
||||||
bOpReads = ((uint32_t)nReg == nRegRead1) || ((uint32_t)nReg == nRegRead2);
|
bOpReads = ((uint32_t)nReg == nRegRead1) || ((uint32_t)nReg == nRegRead2);
|
||||||
bOpWrites = ((uint32_t)nReg == nRegWrite);
|
bOpWrites = ((uint32_t)nReg == nRegWrite);
|
||||||
|
|
|
@ -643,9 +643,7 @@ void CDebuggerUI::CPUStepStarted()
|
||||||
|
|
||||||
if (m_Breakpoints->HaveAnyGPRWriteBP())
|
if (m_Breakpoints->HaveAnyGPRWriteBP())
|
||||||
{
|
{
|
||||||
uint32_t nReg = 0;
|
uint32_t nReg = opInfo.WritesGPR();
|
||||||
opInfo.WritesGPR(nReg);
|
|
||||||
|
|
||||||
if (nReg != 0 && m_Breakpoints->HaveGPRWriteBP(nReg))
|
if (nReg != 0 && m_Breakpoints->HaveGPRWriteBP(nReg))
|
||||||
{
|
{
|
||||||
g_Settings->SaveBool(Debugger_SteppingOps, true);
|
g_Settings->SaveBool(Debugger_SteppingOps, true);
|
||||||
|
|
Loading…
Reference in New Issue