mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-28 16:00:58 +00:00
More constant propagation
This commit is contained in:
parent
d4480d50fd
commit
c7e4658b6d
@ -157,6 +157,15 @@ bool PropagateConstants(const IRWriter &in, IRWriter &out) {
|
||||
gpr.MapDirtyIn(inst.dest, inst.src1);
|
||||
goto doDefault;
|
||||
|
||||
case IROp::FMovFromGPR:
|
||||
if (gpr.IsImm(inst.src1)) {
|
||||
out.Write(IROp::SetConstF, inst.dest, out.AddConstant(gpr.GetImm(inst.src1)));
|
||||
} else {
|
||||
gpr.MapIn(inst.src1);
|
||||
goto doDefault;
|
||||
}
|
||||
break;
|
||||
|
||||
case IROp::MfHi:
|
||||
case IROp::MfLo:
|
||||
gpr.MapDirty(inst.dest);
|
||||
@ -174,11 +183,18 @@ bool PropagateConstants(const IRWriter &in, IRWriter &out) {
|
||||
gpr.MapIn(inst.dest);
|
||||
out.Write(inst.op, inst.dest, 0, out.AddConstant(gpr.GetImm(inst.src1) + constants[inst.src2]));
|
||||
} else {
|
||||
// Just pass through, no excessive flushing
|
||||
gpr.MapInIn(inst.dest, inst.src1);
|
||||
goto doDefault;
|
||||
}
|
||||
break;
|
||||
case IROp::StoreFloat:
|
||||
if (gpr.IsImm(inst.src1)) {
|
||||
out.Write(inst.op, inst.dest, 0, out.AddConstant(gpr.GetImm(inst.src1) + constants[inst.src2]));
|
||||
} else {
|
||||
gpr.MapIn(inst.src1);
|
||||
goto doDefault;
|
||||
}
|
||||
break;
|
||||
|
||||
case IROp::Load8:
|
||||
case IROp::Load8Ext:
|
||||
@ -193,6 +209,26 @@ bool PropagateConstants(const IRWriter &in, IRWriter &out) {
|
||||
goto doDefault;
|
||||
}
|
||||
break;
|
||||
case IROp::LoadFloat:
|
||||
if (gpr.IsImm(inst.src1)) {
|
||||
out.Write(inst.op, inst.dest, 0, out.AddConstant(gpr.GetImm(inst.src1) + constants[inst.src2]));
|
||||
} else {
|
||||
gpr.MapIn(inst.src1);
|
||||
goto doDefault;
|
||||
}
|
||||
break;
|
||||
|
||||
// FP-only instructions don't need to flush immediates.
|
||||
case IROp::FAdd:
|
||||
case IROp::FMul:
|
||||
case IROp::FDiv:
|
||||
case IROp::FSub:
|
||||
case IROp::FNeg:
|
||||
case IROp::FAbs:
|
||||
case IROp::FSqrt:
|
||||
case IROp::FMov:
|
||||
out.Write(inst);
|
||||
break;
|
||||
|
||||
case IROp::Syscall:
|
||||
case IROp::Interpret:
|
||||
|
Loading…
Reference in New Issue
Block a user