nir_foreach_src(instr, remove_use_cb, instr);
}
-void nir_instr_remove(nir_instr *instr)
+void nir_instr_remove_v(nir_instr *instr)
{
remove_defs_uses(instr);
exec_node_remove(&instr->node);
nir_instr_insert(nir_after_cf_list(list), after);
}
-void nir_instr_remove(nir_instr *instr);
+void nir_instr_remove_v(nir_instr *instr);
+
+static inline nir_cursor
+nir_instr_remove(nir_instr *instr)
+{
+ nir_cursor cursor;
+ nir_instr *prev = nir_instr_prev(instr);
+ if (prev) {
+ cursor = nir_after_instr(prev);
+ } else {
+ cursor = nir_before_block(instr->block);
+ }
+ nir_instr_remove_v(instr);
+ return cursor;
+}
/** @} */
}
}
-/* Remove an instruction and return a cursor pointing to where it was */
-static nir_cursor
-instr_remove_cursor(nir_instr *instr)
-{
- nir_cursor cursor;
- nir_instr *prev = nir_instr_prev(instr);
- if (prev) {
- cursor = nir_after_instr(prev);
- } else {
- cursor = nir_before_block(instr->block);
- }
- nir_instr_remove(instr);
- return cursor;
-}
-
/* Do a "load" from an SSA-based entry return it in "value" as a value with a
* single SSA def. Because an entry could reference up to 4 different SSA
* defs, a vecN operation may be inserted to combine them into a single SSA
if (all_same) {
/* Our work here is done */
- b->cursor = instr_remove_cursor(&intrin->instr);
+ b->cursor = nir_instr_remove(&intrin->instr);
intrin->instr.block = NULL;
return true;
}
value_tail->child = nir_deref_clone(src_tail->child, value_tail);
}
- b->cursor = instr_remove_cursor(&intrin->instr);
+ b->cursor = nir_instr_remove(&intrin->instr);
return true;
}