(ir_dereference *) ir->actual_parameters.get_head();
param->accept(this);
instr->variables[0] = this->deref_head;
- instr->dest.is_ssa = true;
- nir_ssa_def_init(&instr->instr, &instr->dest.ssa, 1, NULL);
+ nir_ssa_dest_init(&instr->instr, &instr->dest, 1, NULL);
nir_instr_insert_after_cf_list(this->cf_node_list, &instr->instr);
nir_intrinsic_instr *load =
nir_intrinsic_instr_create(this->shader, nir_intrinsic_load_var);
load->num_components = ir->lhs->type->vector_elements;
- load->dest.is_ssa = true;
- nir_ssa_def_init(&load->instr, &load->dest.ssa,
- num_components, NULL);
+ nir_ssa_dest_init(&load->instr, &load->dest, num_components, NULL);
load->variables[0] = lhs_deref;
nir_instr_insert_after_cf_list(this->cf_node_list, &load->instr);
default: unreachable("Invalid number of components"); break;
}
nir_alu_instr *vec = nir_alu_instr_create(this->shader, vec_op);
- vec->dest.dest.is_ssa = true;
- nir_ssa_def_init(&vec->instr, &vec->dest.dest.ssa,
- num_components, NULL);
+ nir_ssa_dest_init(&vec->instr, &vec->dest.dest, num_components, NULL);
vec->dest.write_mask = (1 << num_components) - 1;
unsigned component = 0;
{
nir_dest *dest = get_instr_dest(instr);
- dest->is_ssa = true;
- nir_ssa_def_init(instr, &dest->ssa, num_components, NULL);
+ nir_ssa_dest_init(instr, dest, num_components, NULL);
nir_instr_insert_after_cf_list(this->cf_node_list, instr);
this->result = instr;
}
}
+void
+nir_ssa_dest_init(nir_instr *instr, nir_dest *dest,
+ unsigned num_components, const char *name)
+{
+ dest->is_ssa = true;
+ nir_ssa_def_init(instr, &dest->ssa, num_components, name);
+}
+
struct ssa_def_rewrite_state {
void *mem_ctx;
nir_ssa_def *old;
bool nir_srcs_equal(nir_src src1, nir_src src2);
void nir_instr_rewrite_src(nir_instr *instr, nir_src *src, nir_src new_src);
+void nir_ssa_dest_init(nir_instr *instr, nir_dest *dest,
+ unsigned num_components, const char *name);
void nir_ssa_def_init(nir_instr *instr, nir_ssa_def *def,
unsigned num_components, const char *name);
void nir_ssa_def_rewrite_uses(nir_ssa_def *def, nir_src new_src, void *mem_ctx);
entry->src = nir_src_copy(src->src, state->dead_ctx);
_mesa_set_add(src->src.ssa->uses, &pcopy->instr);
- entry->dest.is_ssa = true;
- nir_ssa_def_init(&pcopy->instr, &entry->dest.ssa,
- phi->dest.ssa.num_components, src->src.ssa->name);
+ nir_ssa_dest_init(&pcopy->instr, &entry->dest,
+ phi->dest.ssa.num_components, src->src.ssa->name);
struct set_entry *use_entry =
_mesa_set_search(src->src.ssa->uses, instr);
nir_parallel_copy_entry);
exec_list_push_tail(&block_pcopy->entries, &entry->node);
- entry->dest.is_ssa = true;
- nir_ssa_def_init(&block_pcopy->instr, &entry->dest.ssa,
- phi->dest.ssa.num_components, phi->dest.ssa.name);
+ nir_ssa_dest_init(&block_pcopy->instr, &entry->dest,
+ phi->dest.ssa.num_components, phi->dest.ssa.name);
nir_ssa_def_rewrite_uses(&phi->dest.ssa,
nir_src_for_ssa(&entry->dest.ssa),
state->mem_ctx);
nir_instr_insert_before(&instr->instr, &atomic_counter_size->instr);
nir_alu_instr *mul = nir_alu_instr_create(mem_ctx, nir_op_imul);
- mul->dest.dest.is_ssa = true;
- nir_ssa_def_init(&mul->instr, &mul->dest.dest.ssa, 1, NULL);
+ nir_ssa_dest_init(&mul->instr, &mul->dest.dest, 1, NULL);
mul->dest.write_mask = 0x1;
mul->src[0].src = nir_src_copy(deref_array->indirect, mem_ctx);
mul->src[1].src.is_ssa = true;
nir_instr_insert_before(&instr->instr, &mul->instr);
nir_alu_instr *add = nir_alu_instr_create(mem_ctx, nir_op_iadd);
- add->dest.dest.is_ssa = true;
- nir_ssa_def_init(&add->instr, &add->dest.dest.ssa, 1, NULL);
+ nir_ssa_dest_init(&add->instr, &add->dest.dest, 1, NULL);
add->dest.write_mask = 0x1;
add->src[0].src.is_ssa = true;
add->src[0].src.ssa = &mul->dest.dest.ssa;
new_instr->src[0].ssa = offset_def;;
if (instr->dest.is_ssa) {
- new_instr->dest.is_ssa = true;
- nir_ssa_def_init(&new_instr->instr, &new_instr->dest.ssa,
- instr->dest.ssa.num_components, NULL);
+ nir_ssa_dest_init(&new_instr->instr, &new_instr->dest,
+ instr->dest.ssa.num_components, NULL);
nir_ssa_def_rewrite_uses(&instr->dest.ssa,
nir_src_for_ssa(&new_instr->dest.ssa),
mem_ctx);
mul->src[1].src = nir_src_copy(deref_array->indirect,
state->mem_ctx);
mul->dest.write_mask = 1;
- mul->dest.dest.is_ssa = true;
- nir_ssa_def_init(&mul->instr, &mul->dest.dest.ssa, 1, NULL);
+ nir_ssa_dest_init(&mul->instr, &mul->dest.dest, 1, NULL);
nir_instr_insert_before(instr, &mul->instr);
if (found_indirect) {
add->src[1].src.is_ssa = true;
add->src[1].src.ssa = &mul->dest.dest.ssa;
add->dest.write_mask = 1;
- add->dest.dest.is_ssa = true;
- nir_ssa_def_init(&add->instr, &add->dest.dest.ssa, 1, NULL);
+ nir_ssa_dest_init(&add->instr, &add->dest.dest, 1, NULL);
nir_instr_insert_before(instr, &add->instr);
indirect->is_ssa = true;
load->src[0] = indirect;
if (intrin->dest.is_ssa) {
- load->dest.is_ssa = true;
- nir_ssa_def_init(&load->instr, &load->dest.ssa,
- intrin->num_components, NULL);
+ nir_ssa_dest_init(&load->instr, &load->dest,
+ intrin->num_components, NULL);
nir_ssa_def_rewrite_uses(&intrin->dest.ssa,
nir_src_for_ssa(&load->dest.ssa),
state->mem_ctx);
mul->src[1].src.is_ssa = true;
mul->src[1].src.ssa = &load_const->def;
mul->dest.write_mask = 1;
- mul->dest.dest.is_ssa = true;
- nir_ssa_def_init(&mul->instr, &mul->dest.dest.ssa, 1, NULL);
+ nir_ssa_dest_init(&mul->instr, &mul->dest.dest, 1, NULL);
nir_instr_insert_before(instr, &mul->instr);
src.reg.indirect->is_ssa = true;
add->src[1].src = nir_src_copy(deref_array->indirect,
state->mem_ctx);
add->dest.write_mask = 1;
- add->dest.dest.is_ssa = true;
- nir_ssa_def_init(&add->instr, &add->dest.dest.ssa, 1, NULL);
+ nir_ssa_dest_init(&add->instr, &add->dest.dest, 1, NULL);
nir_instr_insert_before(instr, &add->instr);
src.reg.indirect->is_ssa = true;
&intrin->instr, state);
mov->dest.write_mask = (1 << intrin->num_components) - 1;
if (intrin->dest.is_ssa) {
- mov->dest.dest.is_ssa = true;
- nir_ssa_def_init(&mov->instr, &mov->dest.dest.ssa,
- intrin->num_components, NULL);
+ nir_ssa_dest_init(&mov->instr, &mov->dest.dest,
+ intrin->num_components, NULL);
nir_ssa_def_rewrite_uses(&intrin->dest.ssa,
nir_src_for_ssa(&mov->dest.dest.ssa),
state->mem_ctx);
nir_intrinsic_instr *new_instr = nir_intrinsic_instr_create(mem_ctx, op);
if (instr->dest.is_ssa) {
- new_instr->dest.is_ssa = true;
- nir_ssa_def_init(&new_instr->instr, &new_instr->dest.ssa,
- instr->dest.ssa.num_components, NULL);
+ nir_ssa_dest_init(&new_instr->instr, &new_instr->dest,
+ instr->dest.ssa.num_components, NULL);
nir_ssa_def_rewrite_uses(&instr->dest.ssa,
nir_src_for_ssa(&new_instr->dest.ssa),
mem_ctx);
nir_intrinsic_instr_create(mem_ctx, nir_intrinsic_load_var);
load->num_components = num_components;
load->variables[0] = nir_deref_as_var(src_deref);
- load->dest.is_ssa = true;
- nir_ssa_def_init(&load->instr, &load->dest.ssa, num_components, NULL);
+ nir_ssa_dest_init(&load->instr, &load->dest, num_components, NULL);
nir_instr_insert_before(©_instr->instr, &load->instr);
assert(intrin->dest.is_ssa);
mov->dest.write_mask = (1 << intrin->num_components) - 1;
- mov->dest.dest.is_ssa = true;
- nir_ssa_def_init(&mov->instr, &mov->dest.dest.ssa,
- intrin->num_components, NULL);
+ nir_ssa_dest_init(&mov->instr, &mov->dest.dest,
+ intrin->num_components, NULL);
nir_instr_insert_before(&intrin->instr, &mov->instr);
nir_instr_remove(&intrin->instr);
mov->src[0].swizzle[i] = 0;
mov->dest.write_mask = (1 << intrin->num_components) - 1;
- mov->dest.dest.is_ssa = true;
- nir_ssa_def_init(&mov->instr, &mov->dest.dest.ssa,
- intrin->num_components, NULL);
+ nir_ssa_dest_init(&mov->instr, &mov->dest.dest,
+ intrin->num_components, NULL);
nir_instr_insert_before(&intrin->instr, &mov->instr);
if (has_already[next->index] < iter_count) {
nir_phi_instr *phi = nir_phi_instr_create(state->mem_ctx);
- phi->dest.is_ssa = true;
- nir_ssa_def_init(&phi->instr, &phi->dest.ssa,
- glsl_get_vector_elements(node->type), NULL);
+ nir_ssa_dest_init(&phi->instr, &phi->dest,
+ glsl_get_vector_elements(node->type), NULL);
nir_instr_insert_before_block(next, &phi->instr);
_mesa_hash_table_insert(state->phi_table, phi, node);
}
}
- sel->dest.dest.is_ssa = true;
- nir_ssa_def_init(&sel->instr, &sel->dest.dest.ssa,
- phi->dest.ssa.num_components, phi->dest.ssa.name);
+ nir_ssa_dest_init(&sel->instr, &sel->dest.dest,
+ phi->dest.ssa.num_components, phi->dest.ssa.name);
sel->dest.write_mask = (1 << phi->dest.ssa.num_components) - 1;
nir_ssa_def_rewrite_uses(&phi->dest.ssa,
num_components = nir_op_infos[expr->opcode].output_size;
nir_alu_instr *alu = nir_alu_instr_create(mem_ctx, expr->opcode);
- alu->dest.dest.is_ssa = true;
- nir_ssa_def_init(&alu->instr, &alu->dest.dest.ssa, num_components, NULL);
+ nir_ssa_dest_init(&alu->instr, &alu->dest.dest, num_components, NULL);
alu->dest.write_mask = (1 << num_components) - 1;
alu->dest.saturate = false;
*/
nir_alu_instr *mov = nir_alu_instr_create(mem_ctx, nir_op_imov);
mov->dest.write_mask = instr->dest.write_mask;
- mov->dest.dest.is_ssa = true;
- nir_ssa_def_init(&mov->instr, &mov->dest.dest.ssa,
- instr->dest.dest.ssa.num_components, NULL);
+ nir_ssa_dest_init(&mov->instr, &mov->dest.dest,
+ instr->dest.dest.ssa.num_components, NULL);
mov->src[0] = construct_value(replace, nir_op_infos[instr->op].output_type,
instr->dest.dest.ssa.num_components, &state,
if (state->states[index].stack == NULL)
return true;
- dest->is_ssa = true;
-
char *name = NULL;
if (dest->reg.reg->name)
name = ralloc_asprintf(state->mem_ctx, "%s_%u", dest->reg.reg->name,
state->states[index].num_defs);
- nir_ssa_def_init(state->parent_instr, &dest->ssa,
- reg->num_components, name);
+ nir_ssa_dest_init(state->parent_instr, dest, reg->num_components, name);
/* push our SSA destination on the stack */
state->states[index].index++;
reg->name, state->states[index].num_defs);
instr->dest.write_mask = (1 << num_components) - 1;
- instr->dest.dest.is_ssa = true;
- nir_ssa_def_init(&instr->instr, &instr->dest.dest.ssa,
- num_components, name);
+ nir_ssa_dest_init(&instr->instr, &instr->dest.dest, num_components, name);
if (nir_op_infos[instr->op].output_size == 0) {
/*