nir: Don't require a function in ssa_def_init

Instead, we give SSA definitions a temporary index of 0xFFFFFFFF if the
instruction does not have a block and a proper index when it actually gets
added to the list.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
This commit is contained in:
Jason Ekstrand
2014-11-19 16:06:32 -08:00
parent 829aa98320
commit 6a52d2af2f
6 changed files with 41 additions and 24 deletions

View File

@@ -163,7 +163,7 @@ static nir_ssa_def *get_ssa_src(nir_register *reg, rewrite_state *state)
* to preserve the information that this source is undefined
*/
nir_ssa_undef_instr *instr = nir_ssa_undef_instr_create(state->mem_ctx);
nir_ssa_def_init(state->impl, &instr->instr, &instr->def,
nir_ssa_def_init(&instr->instr, &instr->def,
reg->num_components, NULL);
/*
@@ -246,7 +246,7 @@ rewrite_def_forwards(nir_dest *dest, void *_state)
name = ralloc_asprintf(state->mem_ctx, "%s_%u", dest->reg.reg->name,
state->states[index].num_defs);
nir_ssa_def_init(state->impl, state->parent_instr, &dest->ssa,
nir_ssa_def_init(state->parent_instr, &dest->ssa,
reg->num_components, name);
/* push our SSA destination on the stack */
@@ -312,7 +312,7 @@ rewrite_alu_instr_forward(nir_alu_instr *instr, rewrite_state *state)
instr->dest.write_mask = (1 << num_components) - 1;
instr->dest.dest.is_ssa = true;
nir_ssa_def_init(state->impl, &instr->instr, &instr->dest.dest.ssa,
nir_ssa_def_init(&instr->instr, &instr->dest.dest.ssa,
num_components, name);
if (nir_op_infos[instr->op].output_size == 0) {