summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-03-25 10:43:46 -0700
committerJason Ekstrand <[email protected]>2016-03-28 18:32:48 -0700
commit1be4c61c957d656d0d874b82779b4016a8bb03fd (patch)
tree54663a0b0be75ddd988740130ba8b0ce1b1c0c2f /src
parent6a2479d61804e6cfc7389e1185139d0c8be758e3 (diff)
nir/builder: Add a helper for creating undefs
Reviewed-by: Rob Clark <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/nir/nir_builder.h14
1 files changed, 14 insertions, 0 deletions
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
@@ -75,6 +75,20 @@ nir_builder_cf_insert(nir_builder *build, nir_cf_node *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)
{
nir_load_const_instr *load_const =