aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/nir_lower_io.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2015-01-20 16:23:51 -0800
committerEric Anholt <[email protected]>2015-01-22 13:52:19 -0800
commit534a4ec82f09fa37e2134c994082e71c79b7d5ec (patch)
tree598ab6b45e9a47d997c7d09881a6bad54c805d45 /src/glsl/nir/nir_lower_io.c
parentc5be9c126d6ca9380cd381a5eb22554e4bb71a64 (diff)
nir: Make an easier helper for setting up SSA defs.
Almost all instructions we nir_ssa_def_init() for are nir_dests, and you have to keep from forgetting to set is_ssa when you do. Just provide the simpler helper, instead. Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir_lower_io.c')
-rw-r--r--src/glsl/nir/nir_lower_io.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/glsl/nir/nir_lower_io.c b/src/glsl/nir/nir_lower_io.c
index c35058c14dc..8712869a0f5 100644
--- a/src/glsl/nir/nir_lower_io.c
+++ b/src/glsl/nir/nir_lower_io.c
@@ -151,8 +151,7 @@ get_io_offset(nir_deref_var *deref, nir_instr *instr, nir_src *indirect,
mul->src[1].src = nir_src_copy(deref_array->indirect,
state->mem_ctx);
mul->dest.write_mask = 1;
- mul->dest.dest.is_ssa = true;
- nir_ssa_def_init(&mul->instr, &mul->dest.dest.ssa, 1, NULL);
+ nir_ssa_dest_init(&mul->instr, &mul->dest.dest, 1, NULL);
nir_instr_insert_before(instr, &mul->instr);
if (found_indirect) {
@@ -162,8 +161,7 @@ get_io_offset(nir_deref_var *deref, nir_instr *instr, nir_src *indirect,
add->src[1].src.is_ssa = true;
add->src[1].src.ssa = &mul->dest.dest.ssa;
add->dest.write_mask = 1;
- add->dest.dest.is_ssa = true;
- nir_ssa_def_init(&add->instr, &add->dest.dest.ssa, 1, NULL);
+ nir_ssa_dest_init(&add->instr, &add->dest.dest, 1, NULL);
nir_instr_insert_before(instr, &add->instr);
indirect->is_ssa = true;
@@ -235,9 +233,8 @@ nir_lower_io_block(nir_block *block, void *void_state)
load->src[0] = indirect;
if (intrin->dest.is_ssa) {
- load->dest.is_ssa = true;
- nir_ssa_def_init(&load->instr, &load->dest.ssa,
- intrin->num_components, NULL);
+ nir_ssa_dest_init(&load->instr, &load->dest,
+ intrin->num_components, NULL);
nir_ssa_def_rewrite_uses(&intrin->dest.ssa,
nir_src_for_ssa(&load->dest.ssa),
state->mem_ctx);