summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/glsl_to_nir.cpp
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/glsl_to_nir.cpp
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/glsl_to_nir.cpp')
-rw-r--r--src/glsl/nir/glsl_to_nir.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp
index 1457c1cac1c..46cfac39918 100644
--- a/src/glsl/nir/glsl_to_nir.cpp
+++ b/src/glsl/nir/glsl_to_nir.cpp
@@ -612,8 +612,7 @@ nir_visitor::visit(ir_call *ir)
(ir_dereference *) ir->actual_parameters.get_head();
param->accept(this);
instr->variables[0] = this->deref_head;
- instr->dest.is_ssa = true;
- nir_ssa_def_init(&instr->instr, &instr->dest.ssa, 1, NULL);
+ nir_ssa_dest_init(&instr->instr, &instr->dest, 1, NULL);
nir_instr_insert_after_cf_list(this->cf_node_list, &instr->instr);
@@ -696,9 +695,7 @@ nir_visitor::visit(ir_assignment *ir)
nir_intrinsic_instr *load =
nir_intrinsic_instr_create(this->shader, nir_intrinsic_load_var);
load->num_components = ir->lhs->type->vector_elements;
- load->dest.is_ssa = true;
- nir_ssa_def_init(&load->instr, &load->dest.ssa,
- num_components, NULL);
+ nir_ssa_dest_init(&load->instr, &load->dest, num_components, NULL);
load->variables[0] = lhs_deref;
nir_instr_insert_after_cf_list(this->cf_node_list, &load->instr);
@@ -711,9 +708,7 @@ nir_visitor::visit(ir_assignment *ir)
default: unreachable("Invalid number of components"); break;
}
nir_alu_instr *vec = nir_alu_instr_create(this->shader, vec_op);
- vec->dest.dest.is_ssa = true;
- nir_ssa_def_init(&vec->instr, &vec->dest.dest.ssa,
- num_components, NULL);
+ nir_ssa_dest_init(&vec->instr, &vec->dest.dest, num_components, NULL);
vec->dest.write_mask = (1 << num_components) - 1;
unsigned component = 0;
@@ -798,8 +793,7 @@ nir_visitor::add_instr(nir_instr *instr, unsigned num_components)
{
nir_dest *dest = get_instr_dest(instr);
- dest->is_ssa = true;
- nir_ssa_def_init(instr, &dest->ssa, num_components, NULL);
+ nir_ssa_dest_init(instr, dest, num_components, NULL);
nir_instr_insert_after_cf_list(this->cf_node_list, instr);
this->result = instr;