src_add_all_uses(dest->reg.indirect, instr, NULL);
}
+/* note: does *not* take ownership of 'name' */
void
nir_ssa_def_init(nir_instr *instr, nir_ssa_def *def,
unsigned num_components,
unsigned bit_size, const char *name)
{
- def->name = name;
+ def->name = ralloc_strdup(instr, name);
def->parent_instr = instr;
list_inithead(&def->uses);
list_inithead(&def->if_uses);
}
}
+/* note: does *not* take ownership of 'name' */
void
nir_ssa_dest_init(nir_instr *instr, nir_dest *dest,
unsigned num_components, unsigned bit_size,
switch (c->type) {
case nir_type_float:
- load->def.name = ralloc_asprintf(mem_ctx, "%f", c->data.d);
+ load->def.name = ralloc_asprintf(load, "%f", c->data.d);
switch (bitsize->dest_size) {
case 32:
load->value.f32[0] = c->data.d;
break;
case nir_type_int:
- load->def.name = ralloc_asprintf(mem_ctx, "%ld", c->data.i);
+ load->def.name = ralloc_asprintf(load, "%ld", c->data.i);
switch (bitsize->dest_size) {
case 32:
load->value.i32[0] = c->data.i;
break;
case nir_type_uint:
- load->def.name = ralloc_asprintf(mem_ctx, "%lu", c->data.u);
+ load->def.name = ralloc_asprintf(load, "%lu", c->data.u);
switch (bitsize->dest_size) {
case 32:
load->value.u32[0] = c->data.u;
list_del(&dest->reg.def_link);
nir_ssa_dest_init(state->parent_instr, dest, reg->num_components,
reg->bit_size, name);
+ ralloc_free(name);
/* push our SSA destination on the stack */
state->states[index].index++;
list_del(&instr->dest.dest.reg.def_link);
nir_ssa_dest_init(&instr->instr, &instr->dest.dest, num_components,
reg->bit_size, name);
+ ralloc_free(name);
if (nir_op_infos[instr->op].output_size == 0) {
/*