[Mesa-dev] [PATCH v3 019/104] nir: Support deref instructions in lower_var_copies

Jason Ekstrand jason at jlekstrand.net
Thu Apr 5 20:53:46 UTC 2018


On Thu, Apr 5, 2018 at 12:55 PM, Caio Marcelo de Oliveira Filho <
caio.oliveira at intel.com> wrote:

> Hello,
>
> > +static nir_deref_instr *
> > +build_deref_to_next_wildcard(nir_builder *b,
> > +                             nir_deref_instr *parent,
> > +                             nir_deref_instr ***deref_arr)
> > +{
> > +   for (; **deref_arr; (*deref_arr)++) {
> > +      if ((**deref_arr)->deref_type == nir_deref_type_array_wildcard)
> > +         return parent;
> > +
> > +      parent = nir_build_deref_follower(b, parent, **deref_arr);
> > +   }
> > +
> > +   assert(**deref_arr == NULL);
> > +   *deref_arr = NULL;
> > +   return parent;
> > +}
>
> Question: in a scenario where there are no wildcards in the chain,
> could we just return the original deref (i.e. the last element in
> deref_arr)?
>

Yes, and nir_build_deref_follower magically does that. :-)  It's admittedly
a bit sketchy because we don't know if the if the follower actually
dominates the current builder cursor but all of the callers in this series
do have that guarantee.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180405/57bfe6b5/attachment.html>


More information about the mesa-dev mailing list