{
nir_instr *instr = (nir_instr *) state;
- if (src->is_ssa)
- return true;
-
- nir_register *reg = src->reg.reg;
+ struct set *uses_set = src->is_ssa ? src->ssa->uses : src->reg.reg->uses;
- _mesa_set_add(reg->uses, _mesa_hash_pointer(instr), instr);
+ _mesa_set_add(uses_set, _mesa_hash_pointer(instr), instr);
return true;
}
{
nir_instr *instr = (nir_instr *) state;
- if (src->is_ssa)
- return true;
-
- nir_register *reg = src->reg.reg;
+ struct set *uses_set = src->is_ssa ? src->ssa->uses : src->reg.reg->uses;
- struct set_entry *entry = _mesa_set_search(reg->uses,
+ struct set_entry *entry = _mesa_set_search(uses_set,
_mesa_hash_pointer(instr),
instr);
if (entry)
- _mesa_set_remove(reg->uses, entry);
+ _mesa_set_remove(uses_set, entry);
return true;
}
csel->dest.dest.reg.reg = dest->reg.reg;
csel->dest.write_mask = (1 << dest->reg.reg->num_components) - 1;
csel->src[0].src = nir_src_copy(*state->predicate, state->mem_ctx);
- if (csel->src[0].src.is_ssa)
- _mesa_set_add(csel->src[0].src.ssa->uses,
- _mesa_hash_pointer(&csel->instr), &csel->instr);
csel->src[2].src.is_ssa = true;
csel->src[2].src.ssa = get_ssa_src(dest->reg.reg, state);
- _mesa_set_add(csel->src[2].src.ssa->uses,
- _mesa_hash_pointer(&csel->instr), &csel->instr);
}
dest->is_ssa = true;
if (state->predicate) {
csel->src[1].src.is_ssa = true;
csel->src[1].src.ssa = &dest->ssa;
- _mesa_set_add(dest->ssa.uses, _mesa_hash_pointer(&csel->instr),
- &csel->instr);
nir_instr *old_parent_instr = state->parent_instr;
nir_src *old_predicate = state->predicate;
vec->src[i].src.ssa = old_src;
vec->src[i].swizzle[0] = i;
}
-
- _mesa_set_add(vec->src[i].src.ssa->uses,
- _mesa_hash_pointer(&vec->instr), &vec->instr);
}
vec->has_predicate = instr->has_predicate;
- if (instr->has_predicate) {
+ if (instr->has_predicate)
vec->predicate = nir_src_copy(instr->predicate, state->mem_ctx);
- if (vec->predicate.is_ssa)
- _mesa_set_add(vec->predicate.ssa->uses,
- _mesa_hash_pointer(&vec->instr), &vec->instr);
- }
nir_instr_insert_after(&instr->instr, &vec->instr);