nir: Rework nir_src_as_alu_instr to not take a pointer

Other nir_src_as_* functions just take a nir_src.  It's not that much
more memory copying and the constness preserving really isn't worth the
cognitive dissonance.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
This commit is contained in:
Jason Ekstrand
2019-04-17 17:10:18 -05:00
parent eee994e769
commit 85c35885b3
4 changed files with 18 additions and 26 deletions

View File

@@ -2756,16 +2756,10 @@ nir_src_instr(const struct nir_src *src)
#define NIR_SRC_AS_(name, c_type, type_enum, cast_macro) \
static inline c_type * \
nir_src_as_ ## name (nir_src *src) \
nir_src_as_ ## name (nir_src src) \
{ \
return src->is_ssa && src->ssa->parent_instr->type == type_enum \
? cast_macro(src->ssa->parent_instr) : NULL; \
} \
static inline const c_type * \
nir_src_as_ ## name ## _const(const nir_src *src) \
{ \
return src->is_ssa && src->ssa->parent_instr->type == type_enum \
? cast_macro(src->ssa->parent_instr) : NULL; \
return src.is_ssa && src.ssa->parent_instr->type == type_enum \
? cast_macro(src.ssa->parent_instr) : NULL; \
}
NIR_SRC_AS_(alu_instr, nir_alu_instr, nir_instr_type_alu, nir_instr_as_alu)