[Mesa-dev] [PATCH 06/16] nir/print: show deref instruction type

Jason Ekstrand jason at jlekstrand.net
Sat Apr 7 16:56:04 UTC 2018


I thought that was fairly obvious from "<var_name>", "(type *)thing",
"thing->thing", and "thing[thing]"

I guess it's probably ok but it didn't seem necessary to me.  One thing I
did sort-of want to do was to make it print the full deref back to the
variable if possible.  I'll give a go at that and send out a fixup.

On Sat, Apr 7, 2018 at 9:13 AM, Rob Clark <robdclark at gmail.com> wrote:

> Makes it more obvious what sort of deref instruction something is.
>
> Signed-off-by: Rob Clark <robdclark at gmail.com>
> ---
>  src/compiler/nir/nir_print.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
> index 6e6fd421c60..7d7542a4113 100644
> --- a/src/compiler/nir/nir_print.c
> +++ b/src/compiler/nir/nir_print.c
> @@ -494,17 +494,19 @@ print_deref_instr(nir_deref_instr *instr,
> print_state *state)
>     print_dest(&instr->dest, state);
>
>     if (instr->deref_type == nir_deref_type_var) {
> -      fprintf(fp, " = deref %s", get_var_name(instr->var, state));
> +      fprintf(fp, " = deref_var %s", get_var_name(instr->var, state));
>        return;
>     } else if (instr->deref_type == nir_deref_type_cast) {
> -      fprintf(fp, " = deref (%s) (%s *)&",
> +      fprintf(fp, " = deref_cast (%s) (%s *)&",
>                get_variable_mode_str(instr->mode),
>                glsl_get_type_name(instr->type));
>        print_src(&instr->parent, state);
>        return;
>     }
>
> -   fprintf(fp, " = deref (%s) &", get_variable_mode_str(instr->mode));
> +   fprintf(fp, " = deref_%s (%s) &",
> +          (instr->deref_type == nir_deref_type_struct) ? "struct" :
> "array",
> +          get_variable_mode_str(instr->mode));
>     print_src(&instr->parent, state);
>
>     assert(instr->parent.is_ssa);
> --
> 2.14.3
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180407/daf5dc0b/attachment-0001.html>


More information about the mesa-dev mailing list