[Mesa-dev] [PATCH 1/8] nir: Document a couple instances of parent_instr

Jason Ekstrand jason at jlekstrand.net
Wed Jun 6 22:01:06 UTC 2018


On Wed, Jun 6, 2018 at 2:33 PM, Ian Romanick <idr at freedesktop.org> wrote:

> From: Ian Romanick <ian.d.romanick at intel.com>
>
> nir_ssa_def::parent_instr and nir_src::parent_instr have the same name,
> but they mean really different things.  I choose to save the next person
> the hour+ that I just spent figuring that out.  Even now that I know, I
> doubt I'd notice in code review that someone typed foo->parent_instr
> when they actually meant foo->ssa->parent_instr.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
>  src/compiler/nir/nir.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
> index 5a1f79515ad..ba2a7142aa0 100644
> --- a/src/compiler/nir/nir.h
> +++ b/src/compiler/nir/nir.h
> @@ -490,6 +490,7 @@ typedef struct nir_ssa_def {
>     /** Index into the live_in and live_out bitfields */
>     unsigned live_index;
>
> +   /** Instruction whose result is this SSA value. */
>

Maybe "which produces this SSA value"?  I don't know if that's better.
Either way, documentation is good. :)

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>


>     nir_instr *parent_instr;
>
>     /** set of nir_instrs where this register is used (read from) */
> @@ -529,6 +530,7 @@ struct nir_if;
>
>  typedef struct nir_src {
>     union {
> +      /** Instruction that consumes this value as a source. */
>        nir_instr *parent_instr;
>        struct nir_if *parent_if;
>     };
> --
> 2.14.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180606/ff066827/attachment.html>


More information about the mesa-dev mailing list