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 <jason.ekstrand@intel.com>
This commit is contained in:
Eric Anholt
2015-01-20 16:23:51 -08:00
parent c5be9c126d
commit 534a4ec82f
13 changed files with 46 additions and 66 deletions

View File

@@ -201,8 +201,7 @@ construct_value(const nir_search_value *value, nir_alu_type type,
num_components = nir_op_infos[expr->opcode].output_size;
nir_alu_instr *alu = nir_alu_instr_create(mem_ctx, expr->opcode);
alu->dest.dest.is_ssa = true;
nir_ssa_def_init(&alu->instr, &alu->dest.dest.ssa, num_components, NULL);
nir_ssa_dest_init(&alu->instr, &alu->dest.dest, num_components, NULL);
alu->dest.write_mask = (1 << num_components) - 1;
alu->dest.saturate = false;
@@ -301,9 +300,8 @@ nir_replace_instr(nir_alu_instr *instr, const nir_search_expression *search,
*/
nir_alu_instr *mov = nir_alu_instr_create(mem_ctx, nir_op_imov);
mov->dest.write_mask = instr->dest.write_mask;
mov->dest.dest.is_ssa = true;
nir_ssa_def_init(&mov->instr, &mov->dest.dest.ssa,
instr->dest.dest.ssa.num_components, NULL);
nir_ssa_dest_init(&mov->instr, &mov->dest.dest,
instr->dest.dest.ssa.num_components, NULL);
mov->src[0] = construct_value(replace, nir_op_infos[instr->op].output_type,
instr->dest.dest.ssa.num_components, &state,