[Mesa-dev] [PATCH] nir: Mark nir_print_instr's instr pointer as const.

Jason Ekstrand jason at jlekstrand.net
Mon Feb 9 13:43:53 PST 2015


Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>

On Mon, Feb 9, 2015 at 4:42 PM, Kenneth Graunke <kenneth at whitecape.org>
wrote:

> Printing instructions doesn't modify them, so we can mark the parameter
> const.
> ---
>  src/glsl/nir/nir.h       | 2 +-
>  src/glsl/nir/nir_print.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
> index 4cb2e92..ceda977 100644
> --- a/src/glsl/nir/nir.h
> +++ b/src/glsl/nir/nir.h
> @@ -1489,7 +1489,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);
> +void nir_print_instr(const 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 9c07950..6a3c6a0 100644
> --- a/src/glsl/nir/nir_print.c
> +++ b/src/glsl/nir/nir_print.c
> @@ -576,7 +576,7 @@ print_parallel_copy_instr(nir_parallel_copy_instr
> *instr, FILE *fp)
>  }
>
>  static void
> -print_instr(nir_instr *instr, print_var_state *state, unsigned tabs, FILE
> *fp)
> +print_instr(const nir_instr *instr, print_var_state *state, unsigned
> tabs, FILE *fp)
>  {
>     print_tabs(tabs, fp);
>
> @@ -882,7 +882,7 @@ nir_print_shader(nir_shader *shader, FILE *fp)
>  }
>
>  void
> -nir_print_instr(nir_instr *instr, FILE *fp)
> +nir_print_instr(const nir_instr *instr, FILE *fp)
>  {
>     print_instr(instr, NULL, 0, fp);
>  }
> --
> 2.2.2
>
> _______________________________________________
> 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/20150209/a2b31380/attachment.html>


More information about the mesa-dev mailing list