[Mesa-dev] [PATCH 3/5] nir: constify instruction comparison functions

Pohjolainen, Topi topi.pohjolainen at intel.com
Mon Jun 1 08:40:47 PDT 2015


On Mon, Jun 01, 2015 at 06:50:24AM -0700, Jason Ekstrand wrote:
>    On Jun 1, 2015 3:20 AM, "Pohjolainen, Topi" <topi.pohjolainen at intel.com>
>    wrote:
>    >
>    > On Fri, May 22, 2015 at 02:24:50PM -0400, Connor Abbott wrote:
>    > > Signed-off-by: Connor Abbott <cwabbott0 at gmail.com>
>    > > ---
>    > >  src/glsl/nir/nir.h               | 4 ++--
>    > >  src/glsl/nir/nir_instr_compare.c | 8 ++++----
>    > >  2 files changed, 6 insertions(+), 6 deletions(-)
>    > >
>    > > diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
>    > > index e3b7b17..19b1e18 100644
>    > > --- a/src/glsl/nir/nir.h
>    > > +++ b/src/glsl/nir/nir.h
>    > > @@ -1578,8 +1578,8 @@ bool nir_foreach_dest(nir_instr *instr,
>    nir_foreach_dest_cb cb, void *state);
>    > >  bool nir_foreach_src(nir_instr *instr, nir_foreach_src_cb cb, void
>    *state);
>    > >
>    > >  nir_const_value *nir_src_as_const_value(nir_src src);
>    > > -bool nir_srcs_equal(nir_src src1, nir_src src2);
>    > > -bool nir_instrs_equal(nir_instr *instr1, nir_instr *instr2);
>    > > +bool nir_srcs_equal(const nir_src src1, const nir_src src2);
>    > > +bool nir_instrs_equal(const nir_instr *instr1, const nir_instr
>    *instr2);
>    > >  void nir_instr_rewrite_src(nir_instr *instr, nir_src *src, nir_src
>    new_src);
>    > >  void nir_instr_move_src(nir_instr *dest_instr, nir_src *dest, nir_src
>    *src);
>    > >  void nir_if_rewrite_condition(nir_if *if_stmt, nir_src new_src);
>    > > diff --git a/src/glsl/nir/nir_instr_compare.c
>    b/src/glsl/nir/nir_instr_compare.c
>    > > index 89b576c..07d0031 100644
>    > > --- a/src/glsl/nir/nir_instr_compare.c
>    > > +++ b/src/glsl/nir/nir_instr_compare.c
>    > > @@ -30,7 +30,7 @@
>    > >  #include "nir.h"
>    > >
>    > >  bool
>    > > -nir_srcs_equal(nir_src src1, nir_src src2)
>    > > +nir_srcs_equal(const nir_src src1, const nir_src src2)
>    >
>    > You could even make them constant references and avoid the automatic
>    > copy. With that:
> 
>    This is C not C++.  But, that goes to show that adding comet to these
>    doesn't really help anything.

Right, damn I feel stupid, although I'm laughing the same time :)


More information about the mesa-dev mailing list