src_copy(dest, src, instr ? gc_get_context(instr) : NULL);
}
-void nir_dest_copy(nir_dest *dest, const nir_dest *src, nir_instr *instr)
-{
- /* Copying an SSA definition makes no sense whatsoever. */
- assert(!src->is_ssa);
-
- dest->is_ssa = false;
-
- dest->reg.reg = src->reg.reg;
-}
-
void
nir_alu_src_copy(nir_alu_src *dest, const nir_alu_src *src,
nir_alu_instr *instr)
dest->swizzle[i] = src->swizzle[i];
}
-void
-nir_alu_dest_copy(nir_alu_dest *dest, const nir_alu_dest *src,
- nir_alu_instr *instr)
-{
- nir_dest_copy(&dest->dest, &src->dest, &instr->instr);
- dest->write_mask = src->write_mask;
-}
-
bool
nir_alu_src_is_trivial_ssa(const nir_alu_instr *alu, unsigned srcn)
{
}
void
-nir_instr_rewrite_dest(nir_instr *instr, nir_dest *dest, nir_dest new_dest)
-{
- if (dest->is_ssa) {
- /* We can only overwrite an SSA destination if it has no uses. */
- assert(nir_ssa_def_is_unused(&dest->ssa));
- } else {
- list_del(&dest->reg.def_link);
- }
-
- /* We can't re-write with an SSA def */
- assert(!new_dest.is_ssa);
-
- nir_dest_copy(dest, &new_dest, instr);
-
- dest->reg.parent_instr = instr;
- list_addtail(&dest->reg.def_link, &new_dest.reg.reg->defs);
-}
-
-void
nir_ssa_def_init(nir_instr *instr, nir_ssa_def *def,
unsigned num_components,
unsigned bit_size)
}
void nir_src_copy(nir_src *dest, const nir_src *src, nir_instr *instr);
-void nir_dest_copy(nir_dest *dest, const nir_dest *src, nir_instr *instr);
typedef struct {
/** Base source */
void nir_alu_src_copy(nir_alu_src *dest, const nir_alu_src *src,
nir_alu_instr *instr);
-void nir_alu_dest_copy(nir_alu_dest *dest, const nir_alu_dest *src,
- nir_alu_instr *instr);
bool nir_alu_instr_is_copy(nir_alu_instr *instr);
void nir_instr_move_src(nir_instr *dest_instr, nir_src *dest, nir_src *src);
void nir_if_rewrite_condition(nir_if *if_stmt, nir_src new_src);
-void nir_instr_rewrite_dest(nir_instr *instr, nir_dest *dest,
- nir_dest new_dest);
void nir_ssa_dest_init(nir_instr *instr, nir_dest *dest,
unsigned num_components, unsigned bit_size);