mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-12-04 03:32:29 +00:00
irjit: Reserve some arrays that churn.
Improves IR compile time by around 20-30%.
This commit is contained in:
parent
cd1c5beb60
commit
57123e8f9e
@ -375,6 +375,9 @@ public:
|
|||||||
int AddConstant(u32 value);
|
int AddConstant(u32 value);
|
||||||
int AddConstantFloat(float value);
|
int AddConstantFloat(float value);
|
||||||
|
|
||||||
|
void Reserve(size_t s) {
|
||||||
|
insts_.reserve(s);
|
||||||
|
}
|
||||||
void Clear() {
|
void Clear() {
|
||||||
insts_.clear();
|
insts_.clear();
|
||||||
}
|
}
|
||||||
|
@ -168,6 +168,7 @@ void IRJit::CompileFunction(u32 start_address, u32 length) {
|
|||||||
// We may go up and down from branches, so track all block starts done here.
|
// We may go up and down from branches, so track all block starts done here.
|
||||||
std::set<u32> doneAddresses;
|
std::set<u32> doneAddresses;
|
||||||
std::vector<u32> pendingAddresses;
|
std::vector<u32> pendingAddresses;
|
||||||
|
pendingAddresses.reserve(16);
|
||||||
pendingAddresses.push_back(start_address);
|
pendingAddresses.push_back(start_address);
|
||||||
while (!pendingAddresses.empty()) {
|
while (!pendingAddresses.empty()) {
|
||||||
u32 em_address = pendingAddresses.back();
|
u32 em_address = pendingAddresses.back();
|
||||||
|
@ -86,6 +86,8 @@ IROp ShiftToShiftImm(IROp op) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool IRApplyPasses(const IRPassFunc *passes, size_t c, const IRWriter &in, IRWriter &out, const IROptions &opts) {
|
bool IRApplyPasses(const IRPassFunc *passes, size_t c, const IRWriter &in, IRWriter &out, const IROptions &opts) {
|
||||||
|
out.Reserve(in.GetInstructions().size());
|
||||||
|
|
||||||
if (c == 1) {
|
if (c == 1) {
|
||||||
return passes[0](in, out, opts);
|
return passes[0](in, out, opts);
|
||||||
}
|
}
|
||||||
@ -95,6 +97,7 @@ bool IRApplyPasses(const IRPassFunc *passes, size_t c, const IRWriter &in, IRWri
|
|||||||
IRWriter temp[2];
|
IRWriter temp[2];
|
||||||
const IRWriter *nextIn = ∈
|
const IRWriter *nextIn = ∈
|
||||||
IRWriter *nextOut = &temp[1];
|
IRWriter *nextOut = &temp[1];
|
||||||
|
temp[1].Reserve(nextIn->GetInstructions().size());
|
||||||
for (size_t i = 0; i < c - 1; ++i) {
|
for (size_t i = 0; i < c - 1; ++i) {
|
||||||
if (passes[i](*nextIn, *nextOut, opts)) {
|
if (passes[i](*nextIn, *nextOut, opts)) {
|
||||||
logBlocks = true;
|
logBlocks = true;
|
||||||
@ -102,8 +105,12 @@ bool IRApplyPasses(const IRPassFunc *passes, size_t c, const IRWriter &in, IRWri
|
|||||||
|
|
||||||
temp[0] = std::move(temp[1]);
|
temp[0] = std::move(temp[1]);
|
||||||
nextIn = &temp[0];
|
nextIn = &temp[0];
|
||||||
|
|
||||||
|
temp[1].Clear();
|
||||||
|
temp[1].Reserve(nextIn->GetInstructions().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out.Reserve(nextIn->GetInstructions().size());
|
||||||
if (passes[c - 1](*nextIn, out, opts)) {
|
if (passes[c - 1](*nextIn, out, opts)) {
|
||||||
logBlocks = true;
|
logBlocks = true;
|
||||||
}
|
}
|
||||||
@ -947,6 +954,8 @@ bool PurgeTemps(const IRWriter &in, IRWriter &out, const IROptions &opts) {
|
|||||||
int8_t fplen = 0;
|
int8_t fplen = 0;
|
||||||
};
|
};
|
||||||
std::vector<Check> checks;
|
std::vector<Check> checks;
|
||||||
|
checks.reserve(insts.size() / 2);
|
||||||
|
|
||||||
// This tracks the last index at which each reg was modified.
|
// This tracks the last index at which each reg was modified.
|
||||||
int lastWrittenTo[256];
|
int lastWrittenTo[256];
|
||||||
int lastReadFrom[256];
|
int lastReadFrom[256];
|
||||||
|
Loading…
Reference in New Issue
Block a user