[Mesa-dev] [PATCH 2/2] nir: Expose nir_print_instr() for debug prints
Jason Ekstrand
jason at jlekstrand.net
Fri Jan 23 16:45:24 PST 2015
Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>
On Fri, Jan 23, 2015 at 4:35 PM, Eric Anholt <eric at anholt.net> wrote:
> It's nice to have this present in your default cases so you can see what
> instruction is triggering an abort.
>
> v2: Just pass a NULL state, now that it won't crash when you do.
> ---
> src/glsl/nir/nir.h | 1 +
> src/glsl/nir/nir_print.c | 9 +++++++--
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
> index 58a8efe..0912837 100644
> --- a/src/glsl/nir/nir.h
> +++ b/src/glsl/nir/nir.h
> @@ -1484,6 +1484,7 @@ void nir_index_ssa_defs(nir_function_impl *impl);
> void nir_index_blocks(nir_function_impl *impl);
>
> void nir_print_shader(nir_shader *shader, FILE *fp);
> +void nir_print_instr(nir_instr *instr, FILE *fp);
>
> #ifdef DEBUG
> void nir_validate_shader(nir_shader *shader);
> diff --git a/src/glsl/nir/nir_print.c b/src/glsl/nir/nir_print.c
> index 2ef55ed..9c07950 100644
> --- a/src/glsl/nir/nir_print.c
> +++ b/src/glsl/nir/nir_print.c
> @@ -621,8 +621,6 @@ print_instr(nir_instr *instr, print_var_state *state,
> unsigned tabs, FILE *fp)
> unreachable("Invalid instruction type");
> break;
> }
> -
> - fprintf(fp, "\n");
> }
>
> static int
> @@ -668,6 +666,7 @@ print_block(nir_block *block, print_var_state *state,
> unsigned tabs, FILE *fp)
>
> nir_foreach_instr(block, instr) {
> print_instr(instr, state, tabs, fp);
> + fprintf(fp, "\n");
> }
>
> print_tabs(tabs, fp);
> @@ -881,3 +880,9 @@ nir_print_shader(nir_shader *shader, FILE *fp)
>
> destroy_print_state(&state);
> }
> +
> +void
> +nir_print_instr(nir_instr *instr, FILE *fp)
> +{
> + print_instr(instr, NULL, 0, fp);
> +}
> --
> 2.1.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150123/dc0918d5/attachment.html>
More information about the mesa-dev
mailing list