mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 17:48:21 +00:00
ZAM support for two-valued "for" loops over vectors
This commit is contained in:
parent
02cd773c51
commit
5fe4eb27a8
6 changed files with 83 additions and 8 deletions
|
@ -331,9 +331,16 @@ string ZInstI::VName(int n, const FrameMap* frame_ids, const FrameReMap* remappi
|
|||
auto inst_num_u = static_cast<zeek_uint_t>(inst_num);
|
||||
for ( i = 0; i < map.id_start.size(); ++i )
|
||||
{
|
||||
// See discussion for ZInst::VName.
|
||||
if ( (n == 1 && map.id_start[i] > inst_num_u) ||
|
||||
(n > 1 && map.id_start[i] >= inst_num_u) )
|
||||
// See discussion for ZInst::VName, though this is
|
||||
// a tad different since we have the general notion
|
||||
// of AssignsToSlot().
|
||||
if ( AssignsToSlot(n) )
|
||||
{
|
||||
if ( map.id_start[i] > inst_num_u )
|
||||
break;
|
||||
}
|
||||
|
||||
else if ( map.id_start[i] >= inst_num_u )
|
||||
// Went too far.
|
||||
break;
|
||||
}
|
||||
|
@ -441,6 +448,18 @@ bool ZInstI::AssignsToSlot1() const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool ZInstI::AssignsToSlot(int slot) const
|
||||
{
|
||||
switch ( op )
|
||||
{
|
||||
case OP_NEXT_VECTOR_ITER_VAL_VAR_VVVV:
|
||||
return slot == 1 || slot == 2;
|
||||
|
||||
default:
|
||||
return slot == 1 && AssignsToSlot1();
|
||||
}
|
||||
}
|
||||
|
||||
bool ZInstI::UsesSlot(int slot) const
|
||||
{
|
||||
auto fl = op1_flavor[op];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue