From f6d245f3c4a5ce32fc978652ac05578deff3858e Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 9 May 2016 00:13:01 -0700 Subject: [PATCH] jit-ir: Remove redundant simplify pass. This is just doing the same thing as the const folding pass, really. --- Core/MIPS/IR/IRInst.cpp | 4 ---- Core/MIPS/IR/IRInst.h | 2 -- Core/MIPS/IR/IRJit.cpp | 2 -- Core/MIPS/IR/IRPassSimplify.cpp | 19 +------------------ Core/MIPS/IR/IRPassSimplify.h | 3 --- 5 files changed, 1 insertion(+), 29 deletions(-) diff --git a/Core/MIPS/IR/IRInst.cpp b/Core/MIPS/IR/IRInst.cpp index 66ee7561f2..6b3231ce6d 100644 --- a/Core/MIPS/IR/IRInst.cpp +++ b/Core/MIPS/IR/IRInst.cpp @@ -143,10 +143,6 @@ int IRWriter::AddConstantFloat(float value) { return AddConstant(val); } -void IRWriter::Simplify() { - SimplifyInPlace(&insts_[0], (int)insts_.size(), constPool_.data()); -} - const char *GetGPRName(int r) { if (r < 32) { return currentDebugMIPS->GetRegName(0, r); diff --git a/Core/MIPS/IR/IRInst.h b/Core/MIPS/IR/IRInst.h index a3739898b8..77d71ed915 100644 --- a/Core/MIPS/IR/IRInst.h +++ b/Core/MIPS/IR/IRInst.h @@ -270,8 +270,6 @@ public: constPool_.clear(); } - void Simplify(); - const std::vector &GetInstructions() const { return insts_; } const std::vector &GetConstants() const { return constPool_; } diff --git a/Core/MIPS/IR/IRJit.cpp b/Core/MIPS/IR/IRJit.cpp index a7223bcc31..76b58161d3 100644 --- a/Core/MIPS/IR/IRJit.cpp +++ b/Core/MIPS/IR/IRJit.cpp @@ -245,8 +245,6 @@ void IRJit::DoJit(u32 em_address, IRBlock *b) { } } - ir.Simplify(); - IRWriter simplified; IRWriter *code = &ir; if (true) { diff --git a/Core/MIPS/IR/IRPassSimplify.cpp b/Core/MIPS/IR/IRPassSimplify.cpp index 3285ff194d..b296a5b3a3 100644 --- a/Core/MIPS/IR/IRPassSimplify.cpp +++ b/Core/MIPS/IR/IRPassSimplify.cpp @@ -1,24 +1,7 @@ +#include "Common/Log.h" #include "Core/MIPS/IR/IRPassSimplify.h" #include "Core/MIPS/IR/IRRegCache.h" -void SimplifyInPlace(IRInst *inst, int count, const u32 *constPool) { - for (int i = 0; i < count; i++) { - switch (inst[i].op) { - case IROp::AddConst: - if (constPool[inst[i].src2] == 0) - inst[i].op = IROp::Mov; - else if (inst[i].src1 == 0) { - inst[i].op = IROp::SetConst; - inst[i].src1 = inst[i].src2; - } - break; - default: - break; - } - } -} - - u32 Evaluate(u32 a, u32 b, IROp op) { switch (op) { case IROp::Add: case IROp::AddConst: return a + b; diff --git a/Core/MIPS/IR/IRPassSimplify.h b/Core/MIPS/IR/IRPassSimplify.h index efba1749eb..5bf3f53fb9 100644 --- a/Core/MIPS/IR/IRPassSimplify.h +++ b/Core/MIPS/IR/IRPassSimplify.h @@ -2,9 +2,6 @@ #include "Core/MIPS/IR/IRInst.h" -// Dumb example of a simplification pass that can't add or remove instructions. -void SimplifyInPlace(IRInst *inst, int count, const u32 *constPool); - typedef bool (*IRPassFunc)(const IRWriter &in, IRWriter &out); bool IRApplyPasses(const IRPassFunc *passes, size_t c, const IRWriter &in, IRWriter &out);