summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/nir.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2014-11-04 10:40:48 -0800
committerJason Ekstrand <[email protected]>2015-01-15 07:19:00 -0800
commitfbc443ad564a46e105e0b1d7a12a6f2b07c56b1d (patch)
treef89c9acb0470f734f143a165176396ab039cd9a0 /src/glsl/nir/nir.c
parentf86902e75d989b781be36ced5dc98dfc0cd34b7b (diff)
nir: Add an initialization function for SSA definitions
Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir.c')
-rw-r--r--src/glsl/nir/nir.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c
index adb353b909e..5e5f1aca750 100644
--- a/src/glsl/nir/nir.c
+++ b/src/glsl/nir/nir.c
@@ -1597,6 +1597,20 @@ nir_foreach_src(nir_instr *instr, nir_foreach_src_cb cb, void *state)
return nir_foreach_dest(instr, visit_dest_indirect, &dest_state);
}
+void
+nir_ssa_def_init(nir_function_impl *impl, nir_instr *instr, nir_ssa_def *def,
+ unsigned num_components, const char *name)
+{
+ void *mem_ctx = ralloc_parent(instr);
+
+ def->name = name;
+ def->index = impl->ssa_alloc++;
+ def->parent_instr = instr;
+ def->uses = _mesa_set_create(mem_ctx, _mesa_key_pointer_equal);
+ def->if_uses = _mesa_set_create(mem_ctx, _mesa_key_pointer_equal);
+ def->num_components = num_components;
+}
+
static bool foreach_cf_node(nir_cf_node *node, nir_foreach_block_cb cb,
bool reverse, void *state);