From 897bec1add3cc7650d979cf40c54508dafbddfc0 Mon Sep 17 00:00:00 2001 From: Matthew Parlane Date: Wed, 6 Nov 2013 22:18:08 +1300 Subject: [PATCH] [JitIL] No more terrible usage of vectors. This is possible because of C++11. --- Source/Core/Core/Src/PowerPC/JitILCommon/IR.cpp | 14 +++++++------- Source/Core/Core/Src/PowerPC/JitILCommon/IR.h | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/Core/Core/Src/PowerPC/JitILCommon/IR.cpp b/Source/Core/Core/Src/PowerPC/JitILCommon/IR.cpp index 0e73b211c1..ffc5f94b62 100644 --- a/Source/Core/Core/Src/PowerPC/JitILCommon/IR.cpp +++ b/Source/Core/Core/Src/PowerPC/JitILCommon/IR.cpp @@ -131,14 +131,14 @@ using namespace Gen; namespace IREmitter { InstLoc IRBuilder::EmitZeroOp(unsigned Opcode, unsigned extra = 0) { - InstLoc curIndex = &InstList[InstList.size()]; + InstLoc curIndex = InstList.data() + InstList.size(); InstList.push_back(Opcode | (extra << 8)); MarkUsed.push_back(false); return curIndex; } InstLoc IRBuilder::EmitUOp(unsigned Opcode, InstLoc Op1, unsigned extra) { - InstLoc curIndex = &InstList[InstList.size()]; + InstLoc curIndex = InstList.data() + InstList.size(); unsigned backOp1 = (s32)(curIndex - 1 - Op1); if (backOp1 >= 256) { InstList.push_back(Tramp | backOp1 << 8); @@ -152,7 +152,7 @@ InstLoc IRBuilder::EmitUOp(unsigned Opcode, InstLoc Op1, unsigned extra) { } InstLoc IRBuilder::EmitBiOp(unsigned Opcode, InstLoc Op1, InstLoc Op2, unsigned extra) { - InstLoc curIndex = &InstList[InstList.size()]; + InstLoc curIndex = InstList.data() + InstList.size(); unsigned backOp1 = (s32)(curIndex - 1 - Op1); if (backOp1 >= 255) { InstList.push_back(Tramp | backOp1 << 8); @@ -175,7 +175,7 @@ InstLoc IRBuilder::EmitBiOp(unsigned Opcode, InstLoc Op1, InstLoc Op2, unsigned #if 0 InstLoc IRBuilder::EmitTriOp(unsigned Opcode, InstLoc Op1, InstLoc Op2, InstLoc Op3) { - InstLoc curIndex = &InstList[InstList.size()]; + InstLoc curIndex = InstList.data() + InstList.size(); unsigned backOp1 = curIndex - 1 - Op1; if (backOp1 >= 254) { InstList.push_back(Tramp | backOp1 << 8); @@ -1049,7 +1049,7 @@ InstLoc IRBuilder::FoldBiOp(unsigned Opcode, InstLoc Op1, InstLoc Op2, unsigned } InstLoc IRBuilder::EmitIntConst(unsigned value) { - InstLoc curIndex = &InstList[InstList.size()]; + InstLoc curIndex = InstList.data() + InstList.size(); InstList.push_back(CInt32 | ((unsigned int)ConstList.size() << 8)); MarkUsed.push_back(false); ConstList.push_back(value); @@ -1061,12 +1061,12 @@ unsigned IRBuilder::GetImmValue(InstLoc I) const { } void IRBuilder::SetMarkUsed(InstLoc I) { - const unsigned i = (unsigned)(I - &InstList[0]); + const unsigned i = (unsigned)(I - InstList.data()); MarkUsed[i] = true; } bool IRBuilder::IsMarkUsed(InstLoc I) const { - const unsigned i = (unsigned)(I - &InstList[0]); + const unsigned i = (unsigned)(I - InstList.data()); return MarkUsed[i]; } diff --git a/Source/Core/Core/Src/PowerPC/JitILCommon/IR.h b/Source/Core/Core/Src/PowerPC/JitILCommon/IR.h index 991f1524c8..f3246e77b0 100644 --- a/Source/Core/Core/Src/PowerPC/JitILCommon/IR.h +++ b/Source/Core/Core/Src/PowerPC/JitILCommon/IR.h @@ -529,11 +529,11 @@ public: return FoldZeroOp(Int3, 0); } - void StartBackPass() { curReadPtr = &InstList[InstList.size()]; } - void StartForwardPass() { curReadPtr = &InstList[0]; } + void StartBackPass() { curReadPtr = InstList.data() + InstList.size(); } + void StartForwardPass() { curReadPtr = InstList.data(); } InstLoc ReadForward() { return curReadPtr++; } InstLoc ReadBackward() { return --curReadPtr; } - InstLoc getFirstInst() { return &InstList[0]; } + InstLoc getFirstInst() { return InstList.data(); } unsigned int getNumInsts() { return (unsigned int)InstList.size(); } unsigned int ReadInst(InstLoc I) { return *I; } unsigned int GetImmValue(InstLoc I) const;