}
nir_ssa_undef_instr *
-nir_ssa_undef_instr_create(void *mem_ctx)
+nir_ssa_undef_instr_create(void *mem_ctx, unsigned num_components)
{
nir_ssa_undef_instr *instr = ralloc(mem_ctx, nir_ssa_undef_instr);
instr_init(&instr->instr, nir_instr_type_ssa_undef);
- instr->def.name = NULL;
- instr->def.parent_instr = &instr->instr;
+ nir_ssa_def_init(&instr->instr, &instr->def, num_components, NULL);
return instr;
}
nir_parallel_copy_instr *nir_parallel_copy_instr_create(void *mem_ctx);
-nir_ssa_undef_instr *nir_ssa_undef_instr_create(void *mem_ctx);
+nir_ssa_undef_instr *nir_ssa_undef_instr_create(void *mem_ctx,
+ unsigned num_components);
nir_deref_var *nir_deref_var_create(void *mem_ctx, nir_variable *var);
nir_deref_array *nir_deref_array_create(void *mem_ctx);
/* If we got here then we don't have a definition that dominates the
* given block. This means that we need to add an undef and use that.
*/
- nir_ssa_undef_instr *undef = nir_ssa_undef_instr_create(state->mem_ctx);
- nir_ssa_def_init(&undef->instr, &undef->def,
- glsl_get_vector_elements(node->type), NULL);
+ nir_ssa_undef_instr *undef =
+ nir_ssa_undef_instr_create(state->mem_ctx,
+ glsl_get_vector_elements(node->type));
nir_instr_insert_before_cf_list(&state->impl->body, &undef->instr);
def_stack_push(node, &undef->def, state);
return &undef->def;
* should result in an undefined value.
*/
nir_ssa_undef_instr *undef =
- nir_ssa_undef_instr_create(state->mem_ctx);
- nir_ssa_def_init(&undef->instr, &undef->def,
- intrin->num_components, NULL);
+ nir_ssa_undef_instr_create(state->mem_ctx,
+ intrin->num_components);
nir_instr_insert_before(&intrin->instr, &undef->instr);
nir_instr_remove(&intrin->instr);
* We're using an undefined register, create a new undefined SSA value
* 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(&instr->instr, &instr->def,
- reg->num_components, NULL);
+ nir_ssa_undef_instr *instr =
+ nir_ssa_undef_instr_create(state->mem_ctx, reg->num_components);
/*
* We could just insert the undefined instruction before the instruction