mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-13 22:40:29 +02:00
More simplify pass
This commit is contained in:
1 parent
14df39d7c9
commit
98113edbd4
3 files changed
+12
-10
No files matched your search
@@ -256,7 +256,7 @@ void IRJit::DoJit(u32 em_address, IRBlock *b) {
|
||||
js.compilerPC += 4;
|
||||
js.numInstructions++;
|
||||
|
||||
if (ir.GetConstants().size() > 128) {
|
||||
if (ir.GetConstants().size() > 64) {
|
||||
// Need to break the block
|
||||
ir.Write(IROp::ExitToConst, ir.AddConstant(js.compilerPC));
|
||||
js.compiling = false;
|
||||
@@ -272,6 +272,9 @@ void IRJit::DoJit(u32 em_address, IRBlock *b) {
|
||||
if (PropagateConstants(ir, simplified))
|
||||
logBlocks = 1;
|
||||
code = &simplified;
|
||||
// Some blocks in tekken generate curious numbers of constants after propagation.
|
||||
//if (ir.GetConstants().size() >= 64)
|
||||
// logBlocks = 1;
|
||||
}
|
||||
|
||||
b->SetInstructions(code->GetInstructions(), code->GetConstants());
|
||||
@@ -287,7 +290,7 @@ void IRJit::DoJit(u32 em_address, IRBlock *b) {
|
||||
}
|
||||
|
||||
if (logBlocks > 0 && dontLogBlocks == 0) {
|
||||
ILOG("=============== Original IR (%d instructions) ===============", (int)ir.GetInstructions().size());
|
||||
ILOG("=============== Original IR (%d instructions, %d const) ===============", (int)ir.GetInstructions().size(), (int)ir.GetConstants().size());
|
||||
for (int i = 0; i < ir.GetInstructions().size(); i++) {
|
||||
char buf[256];
|
||||
DisassembleIR(buf, sizeof(buf), ir.GetInstructions()[i], ir.GetConstants().data());
|
||||
@@ -297,7 +300,7 @@ void IRJit::DoJit(u32 em_address, IRBlock *b) {
|
||||
}
|
||||
|
||||
if (logBlocks > 0 && dontLogBlocks == 0) {
|
||||
ILOG("=============== IR (%d instructions) ===============", (int)code->GetInstructions().size());
|
||||
ILOG("=============== IR (%d instructions, %d const) ===============", (int)code->GetInstructions().size(), (int)code->GetConstants().size());
|
||||
for (int i = 0; i < code->GetInstructions().size(); i++) {
|
||||
char buf[256];
|
||||
DisassembleIR(buf, sizeof(buf), code->GetInstructions()[i], code->GetConstants().data());
|
||||
|
||||
@@ -62,7 +62,7 @@ bool PropagateConstants(const IRWriter &in, IRWriter &out) {
|
||||
bool symmetric = true;
|
||||
switch (inst.op) {
|
||||
case IROp::SetConst:
|
||||
gpr.SetImm((MIPSGPReg)inst.dest, constants[inst.src1]);
|
||||
gpr.SetImm(inst.dest, constants[inst.src1]);
|
||||
break;
|
||||
|
||||
case IROp::Sub:
|
||||
@@ -83,7 +83,7 @@ bool PropagateConstants(const IRWriter &in, IRWriter &out) {
|
||||
} else {
|
||||
out.Write(ArithToArithConst(inst.op), inst.dest, inst.src1, out.AddConstant(gpr.GetImm(inst.src2)));
|
||||
}
|
||||
} else if (gpr.IsImm(inst.src1) && inst.src1 != inst.src2 && inst.dest != inst.src2 && symmetric) {
|
||||
} else if (symmetric && gpr.IsImm(inst.src1) && inst.src1 != inst.src2 && inst.dest != inst.src2) {
|
||||
gpr.MapDirtyIn(inst.dest, inst.src2);
|
||||
out.Write(ArithToArithConst(inst.op), inst.dest, inst.src2, out.AddConstant(gpr.GetImm(inst.src1)));
|
||||
} else {
|
||||
@@ -91,7 +91,7 @@ bool PropagateConstants(const IRWriter &in, IRWriter &out) {
|
||||
goto doDefault;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case IROp::AddConst:
|
||||
case IROp::SubConst:
|
||||
case IROp::AndConst:
|
||||
@@ -120,7 +120,7 @@ bool PropagateConstants(const IRWriter &in, IRWriter &out) {
|
||||
break;
|
||||
|
||||
case IROp::Mov:
|
||||
if (inst.src1 == inst.src2) {
|
||||
if (inst.dest == inst.src1) {
|
||||
// Nop
|
||||
} else if (gpr.IsImm(inst.src1)) {
|
||||
gpr.SetImm(inst.dest, gpr.GetImm(inst.src1));
|
||||
@@ -148,10 +148,9 @@ bool PropagateConstants(const IRWriter &in, IRWriter &out) {
|
||||
case IROp::Load16:
|
||||
case IROp::Load16Ext:
|
||||
case IROp::Load32:
|
||||
if (gpr.IsImm(inst.src1) && inst.src1 != inst.dest && inst.src2 != inst.dest) {
|
||||
if (gpr.IsImm(inst.src1) && inst.src1 != inst.dest) {
|
||||
gpr.MapDirty(inst.dest);
|
||||
out.Write(inst.op, inst.dest, 0, out.AddConstant(gpr.GetImm(inst.src1) + constants[inst.src2]));
|
||||
logBlocks = true;
|
||||
} else {
|
||||
gpr.MapDirtyIn(inst.dest, inst.src1);
|
||||
goto doDefault;
|
||||
|
||||
@@ -26,7 +26,7 @@ IRRegCache::IRRegCache(IRWriter *ir) : ir_(ir) {
|
||||
|
||||
void IRRegCache::FlushAll() {
|
||||
for (int i = 0; i < TOTAL_MAPPABLE_MIPSREGS; i++) {
|
||||
if (i < IRTEMP_0)
|
||||
//if (i < IRTEMP_0)
|
||||
Flush(i);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user