@anholt needed it for nir_to_tgsi, and the desire comes up frequently.
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6567>
void nir_print_instr(const nir_instr *instr, FILE *fp);
void nir_print_deref(const nir_deref_instr *deref, FILE *fp);
+/** Shallow clone of a single instruction. */
+nir_instr *nir_instr_clone(nir_shader *s, const nir_instr *orig);
+
/** Shallow clone of a single ALU instruction. */
nir_alu_instr *nir_alu_instr_clone(nir_shader *s, const nir_alu_instr *orig);
}
}
+nir_instr *
+nir_instr_clone(nir_shader *shader, const nir_instr *orig)
+{
+ clone_state state = {
+ .allow_remap_fallback = true,
+ .ns = shader,
+ };
+ return clone_instr(&state, orig);
+}
+
static nir_block *
clone_block(clone_state *state, struct exec_list *cf_list, const nir_block *blk)
{