From efc8a8e3531f27dd2063e6ab7d726da60d487551 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 13 May 2016 20:17:20 -0700 Subject: [PATCH] Hack to make Symbian build. --- Core/MIPS/IR/IRCompBranch.cpp | 2 -- Core/MIPS/IR/IRFrontend.cpp | 4 ++-- Core/MIPS/IR/IRInst.h | 10 ++++++++++ Core/MIPS/IR/IRJit.h | 26 ++++++++++++++++++++++++++ Core/MIPS/IR/IRPassSimplify.cpp | 4 +--- 5 files changed, 39 insertions(+), 7 deletions(-) diff --git a/Core/MIPS/IR/IRCompBranch.cpp b/Core/MIPS/IR/IRCompBranch.cpp index f7b875100d..609b8f478f 100644 --- a/Core/MIPS/IR/IRCompBranch.cpp +++ b/Core/MIPS/IR/IRCompBranch.cpp @@ -31,8 +31,6 @@ #include "Core/MIPS/IR/IRFrontend.h" #include "Core/MIPS/JitCommon/JitBlockCache.h" -#include "Common/Arm64Emitter.h" - #define _RS MIPS_GET_RS(op) #define _RT MIPS_GET_RT(op) #define _RD MIPS_GET_RD(op) diff --git a/Core/MIPS/IR/IRFrontend.cpp b/Core/MIPS/IR/IRFrontend.cpp index c41c3cac06..6353816407 100644 --- a/Core/MIPS/IR/IRFrontend.cpp +++ b/Core/MIPS/IR/IRFrontend.cpp @@ -261,7 +261,7 @@ void IRFrontend::DoJit(u32 em_address, std::vector &instructions, std::v ILOG("=============== Original IR (%d instructions, %d const) ===============", (int)ir.GetInstructions().size(), (int)ir.GetConstants().size()); for (size_t i = 0; i < ir.GetInstructions().size(); i++) { char buf[256]; - DisassembleIR(buf, sizeof(buf), ir.GetInstructions()[i], ir.GetConstants().data()); + DisassembleIR(buf, sizeof(buf), ir.GetInstructions()[i], &ir.GetConstants()[0]); ILOG("%s", buf); } ILOG("=============== end ================="); @@ -271,7 +271,7 @@ void IRFrontend::DoJit(u32 em_address, std::vector &instructions, std::v ILOG("=============== IR (%d instructions, %d const) ===============", (int)code->GetInstructions().size(), (int)code->GetConstants().size()); for (size_t i = 0; i < code->GetInstructions().size(); i++) { char buf[256]; - DisassembleIR(buf, sizeof(buf), code->GetInstructions()[i], code->GetConstants().data()); + DisassembleIR(buf, sizeof(buf), code->GetInstructions()[i], &code->GetConstants()[0]); ILOG("%s", buf); } ILOG("=============== end ================="); diff --git a/Core/MIPS/IR/IRInst.h b/Core/MIPS/IR/IRInst.h index 86e1e31ae8..b1e17a6c45 100644 --- a/Core/MIPS/IR/IRInst.h +++ b/Core/MIPS/IR/IRInst.h @@ -6,6 +6,16 @@ #include "Common/CommonTypes.h" #include "Core/MIPS/MIPS.h" +#ifdef __SYMBIAN32__ +// Seems std::move() doesn't exist, so assuming it can't do moves at all. +namespace std { + template + const T &move(const T &x) { + return x; + } +}; +#endif + // Basic IR // // This IR refers implicitly to the MIPS register set and is simple to interpret. diff --git a/Core/MIPS/IR/IRJit.h b/Core/MIPS/IR/IRJit.h index 87a8231bff..38f0df6a3e 100644 --- a/Core/MIPS/IR/IRJit.h +++ b/Core/MIPS/IR/IRJit.h @@ -19,6 +19,7 @@ #include +#include "Common/Common.h" #include "Common/CPUDetect.h" #include "Core/MIPS/JitCommon/JitBlockCache.h" #include "Core/MIPS/JitCommon/JitCommon.h" @@ -49,6 +50,31 @@ public: b.const_ = nullptr; } + IRBlock(const IRBlock &b) { + *this = b; + } + + IRBlock &operator=(const IRBlock &b) { + // No std::move on Symbian... But let's try not to use elsewhere. +#ifndef __SYMBIAN32__ + _assert_(false); +#endif + numInstructions_ = b.numInstructions_; + numConstants_ = b.numConstants_; + instr_ = new IRInst[numInstructions_]; + if (numInstructions_) { + memcpy(instr_, b.instr_, sizeof(IRInst) * numInstructions_); + } + const_ = new u32[numConstants_]; + if (numConstants_) { + memcpy(const_, b.const_, sizeof(u32) * numConstants_); + } + origAddr_ = b.origAddr_; + origFirstOpcode_ = b.origFirstOpcode_; + + return *this; + } + ~IRBlock() { delete[] instr_; delete[] const_; diff --git a/Core/MIPS/IR/IRPassSimplify.cpp b/Core/MIPS/IR/IRPassSimplify.cpp index 637e6b22fa..eb0b892b06 100644 --- a/Core/MIPS/IR/IRPassSimplify.cpp +++ b/Core/MIPS/IR/IRPassSimplify.cpp @@ -102,7 +102,6 @@ bool OptimizeFPMoves(const IRWriter &in, IRWriter &out) { //FMovToGPR a0, f12 //FMov f14, f12 - const u32 *constants = in.GetConstants().data(); bool logBlocks = false; IRInst prev; prev.op = IROp::Nop; @@ -134,7 +133,6 @@ bool OptimizeFPMoves(const IRWriter &in, IRWriter &out) { // Might be useful later on x86. bool ThreeOpToTwoOp(const IRWriter &in, IRWriter &out) { - const u32 *constants = in.GetConstants().data(); bool logBlocks = false; for (int i = 0; i < (int)in.GetInstructions().size(); i++) { IRInst inst = in.GetInstructions()[i]; @@ -178,7 +176,7 @@ bool ThreeOpToTwoOp(const IRWriter &in, IRWriter &out) { bool PropagateConstants(const IRWriter &in, IRWriter &out) { IRRegCache gpr(&out); - const u32 *constants = in.GetConstants().data(); + const u32 *constants = &in.GetConstants()[0]; bool logBlocks = false; for (int i = 0; i < (int)in.GetInstructions().size(); i++) { IRInst inst = in.GetInstructions()[i];