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 <robdcl...@gmail.com> wrote:

> Makes it more obvious what sort of deref instruction something is.
>
> Signed-off-by: Rob Clark <robdcl...@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
>
>
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to