nir: Make load_const SSA-only

As it was, we weren't ever using load_const in a non-SSA way.  This allows
us to substantially simplify the load_const instruction.  If we ever need a
non-SSA constant load, we can do a load_const and an imov.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
This commit is contained in:
Jason Ekstrand
2014-12-15 17:32:56 -08:00
parent 675ffdef30
commit 2c7da78805
16 changed files with 54 additions and 162 deletions

View File

@@ -140,18 +140,14 @@ get_io_offset(nir_deref_var *deref, nir_instr *instr, nir_src *indirect,
if (deref_array->deref_array_type == nir_deref_array_type_indirect) {
nir_load_const_instr *load_const =
nir_load_const_instr_create(state->mem_ctx);
load_const->num_components = 1;
nir_load_const_instr_create(state->mem_ctx, 1);
load_const->value.u[0] = size;
load_const->dest.is_ssa = true;
nir_ssa_def_init(&load_const->instr, &load_const->dest.ssa,
1, NULL);
nir_instr_insert_before(instr, &load_const->instr);
nir_alu_instr *mul = nir_alu_instr_create(state->mem_ctx,
nir_op_imul);
mul->src[0].src.is_ssa = true;
mul->src[0].src.ssa = &load_const->dest.ssa;
mul->src[0].src.ssa = &load_const->def;
mul->src[1].src = nir_src_copy(deref_array->indirect,
state->mem_ctx);
mul->dest.write_mask = 1;