From: Jason Ekstrand Date: Fri, 25 Mar 2016 17:43:46 +0000 (-0700) Subject: nir/builder: Add a helper for creating undefs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1be4c61c957d656d0d874b82779b4016a8bb03fd;p=mesa.git nir/builder: Add a helper for creating undefs Reviewed-by: Rob Clark --- diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h index e9c409b8d12..3dc7c25ec28 100644 --- a/src/compiler/nir/nir_builder.h +++ b/src/compiler/nir/nir_builder.h @@ -74,6 +74,20 @@ nir_builder_cf_insert(nir_builder *build, nir_cf_node *cf) nir_cf_node_insert(build->cursor, cf); } +static inline nir_ssa_def * +nir_ssa_undef(nir_builder *build, unsigned num_components, unsigned bit_size) +{ + nir_ssa_undef_instr *undef = + nir_ssa_undef_instr_create(build->shader, num_components); + undef->def.bit_size = bit_size; + if (!undef) + return NULL; + + nir_instr_insert(nir_before_cf_list(&build->impl->body), &undef->instr); + + return &undef->def; +} + static inline nir_ssa_def * nir_build_imm(nir_builder *build, unsigned num_components, nir_const_value value) {