From ab8b2f9fe04af657ff9b75e9ab65af5722cd4d37 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Tue, 29 Jun 2021 15:54:50 +0200 Subject: [PATCH] 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. --- Source/Core/Core/PowerPC/PPCAnalyst.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Source/Core/Core/PowerPC/PPCAnalyst.cpp b/Source/Core/Core/PowerPC/PPCAnalyst.cpp index 9b70f5434e..47a7db2638 100644 --- a/Source/Core/Core/PowerPC/PPCAnalyst.cpp +++ b/Source/Core/Core/PowerPC/PPCAnalyst.cpp @@ -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.