Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JitIL] No more terrible usage of vectors.
This is possible because of C++11.
  • Loading branch information
Parlane committed Nov 6, 2013
1 parent 274f6dd commit 897bec1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions Source/Core/Core/Src/PowerPC/JitILCommon/IR.cpp
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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];
}

Expand Down
6 changes: 3 additions & 3 deletions Source/Core/Core/Src/PowerPC/JitILCommon/IR.h
Expand Up @@ -529,11 +529,11 @@ class IRBuilder {
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;
Expand Down

0 comments on commit 897bec1

Please sign in to comment.