ZAM support for two-valued "for" loops over vectors

This commit is contained in:
Vern Paxson 2022-09-16 09:40:39 -07:00
parent 02cd773c51
commit 5fe4eb27a8
6 changed files with 83 additions and 8 deletions

View file

@ -400,6 +400,16 @@ void ZAMCompiler::ComputeFrameLifetimes()
}
break;
case OP_NEXT_VECTOR_ITER_VAL_VAR_VVVV:
{
CheckSlotAssignment(inst->v2, inst);
auto depth = inst->loop_depth;
ExtendLifetime(inst->v1, EndOfLoop(inst, depth));
ExtendLifetime(inst->v2, EndOfLoop(inst, depth));
}
break;
case OP_NEXT_VECTOR_ITER_VVV:
case OP_NEXT_STRING_ITER_VVV:
// Sometimes loops are written that don't actually
@ -916,6 +926,9 @@ bool ZAMCompiler::VarIsAssigned(int slot, const ZInstI* i) const
// *does* also assign to slot 1.
}
if ( i->op == OP_NEXT_VECTOR_ITER_VAL_VAR_VVVV && i->v2 == slot )
return true;
if ( i->op_type == OP_VV_FRAME )
// We don't want to consider these as assigning to the
// variable, since the point of this method is to figure