mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-25 16:00:12 +01:00
Lets DCE pass use the new HasSideEffects IR attribute
This will be less prone to breaking since you should have the sideeffect described in the IR
This commit is contained in:
1 parent
98d6feabae
commit
f41700cd58
1 file changed
+5
-28
@@ -1,6 +1,8 @@
|
||||
#include "Interface/IR/PassManager.h"
|
||||
#include "Interface/Core/OpcodeDispatcher.h"
|
||||
|
||||
#include <FEXCore/IR/IR.h>
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace FEXCore::IR {
|
||||
@@ -42,38 +44,13 @@ bool DeadCodeElimination::Run(IREmitter *IREmit) {
|
||||
OrderedNode *CodeNode = CodeOp->GetNode(ListBegin);
|
||||
auto IROp = CodeNode->Op(DataBegin);
|
||||
|
||||
switch (IROp->Op) {
|
||||
// State/memory storage
|
||||
case OP_STORECONTEXTINDEXED:
|
||||
case OP_STORECONTEXT:
|
||||
case OP_STORECONTEXTPAIR:
|
||||
case OP_STOREFLAG:
|
||||
case OP_STOREMEM:
|
||||
case OP_CAS:
|
||||
case OP_PRINT:
|
||||
// Keep
|
||||
break;
|
||||
// IO
|
||||
case OP_SYSCALL:
|
||||
// Keep
|
||||
break;
|
||||
// Control flow
|
||||
case OP_BREAK:
|
||||
case OP_JUMP:
|
||||
case OP_EXITFUNCTION:
|
||||
case OP_CONDJUMP:
|
||||
// Keep
|
||||
break;
|
||||
case OP_DUMMY:
|
||||
case OP_ENDBLOCK:
|
||||
// Keep, so we don't have to update block first/last
|
||||
break;
|
||||
default:
|
||||
// Skip over anything that has side effects
|
||||
// Use count tracking can't safely remove anything with side effects
|
||||
if (!IR::HasSideEffects(IROp->Op)) {
|
||||
if (CodeNode->GetUses() == 0) {
|
||||
NumRemoved++;
|
||||
IREmit->Remove(CodeNode);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (CodeLast == CodeBegin) {
|
||||
|
||||
Reference in new issue
Block a user