PPCAnalyst: Less strict interrupt checks in CanSwapAdjacentOps

When these checks were originally added, we didn't have the nice
canCauseException attribute. Now we do, so let's use it.
This commit is contained in:
JosJuice 2021-06-29 15:54:50 +02:00
parent 85d2ea0dd2
commit ab8b2f9fe0
1 changed files with 9 additions and 9 deletions

View File

@ -205,6 +205,14 @@ bool PPCAnalyzer::CanSwapAdjacentOps(const CodeOp& a, const CodeOp& b) const
{
return false;
}
// Any instruction which can raise an interrupt is *not* a possible swap candidate:
// see [1] for an example of a crash caused by this error.
//
// [1] https://bugs.dolphin-emu.org/issues/5864#note-7
if (a.canCauseException || b.canCauseException)
return false;
if (a_flags & FL_ENDBLOCK)
return false;
if (b_flags & (FL_SET_CRx | FL_ENDBLOCK | FL_TIMER | FL_EVIL | FL_SET_OE))
return false;
if ((b_flags & (FL_RC_BIT | FL_RC_BIT_F)) && (b.inst.Rc))
@ -223,18 +231,10 @@ bool PPCAnalyzer::CanSwapAdjacentOps(const CodeOp& a, const CodeOp& b) const
return false;
}
// For now, only integer ops acceptable. Any instruction which can raise an
// interrupt is *not* a possible swap candidate: see [1] for an example of
// a crash caused by this error.
//
// [1] https://bugs.dolphin-emu.org/issues/5864#note-7
// For now, only integer ops are acceptable.
if (b_info->type != OpType::Integer)
return false;
// And it's possible a might raise an interrupt too (fcmpo/fcmpu)
if (a_info->type != OpType::Integer)
return false;
// Check that we have no register collisions.
// That is, check that none of b's outputs matches any of a's inputs,
// and that none of a's outputs matches any of b's inputs.