nir: Add a nir_instr_free() to replace ralloc_free(instr).
This will gain another step shortly. Reviewed-by: Matt Turner <mattst88@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11776>
This commit is contained in:
@@ -1091,6 +1091,11 @@ void nir_instr_remove_v(nir_instr *instr)
|
||||
}
|
||||
}
|
||||
|
||||
void nir_instr_free(nir_instr *instr)
|
||||
{
|
||||
ralloc_free(instr);
|
||||
}
|
||||
|
||||
static bool nir_instr_free_and_dce_live_cb(nir_ssa_def *def, void *state)
|
||||
{
|
||||
bool *live = state;
|
||||
@@ -1177,7 +1182,7 @@ nir_instr_free_and_dce(nir_instr *instr)
|
||||
struct exec_node *node;
|
||||
while ((node = exec_list_pop_head(&to_free))) {
|
||||
nir_instr *removed_instr = exec_node_data(nir_instr, node, node);
|
||||
ralloc_free(removed_instr);
|
||||
nir_instr_free(removed_instr);
|
||||
}
|
||||
|
||||
nir_instr_worklist_destroy(worklist);
|
||||
|
||||
@@ -4225,6 +4225,7 @@ nir_instr_insert_after_cf_list(struct exec_list *list, nir_instr *after)
|
||||
}
|
||||
|
||||
void nir_instr_remove_v(nir_instr *instr);
|
||||
void nir_instr_free(nir_instr *instr);
|
||||
|
||||
static inline nir_cursor
|
||||
nir_instr_remove(nir_instr *instr)
|
||||
|
||||
@@ -142,7 +142,7 @@ lower_var_copies_impl(nir_function_impl *impl)
|
||||
nir_deref_instr_remove_if_unused(nir_src_as_deref(copy->src[1]));
|
||||
|
||||
progress = true;
|
||||
ralloc_free(copy);
|
||||
nir_instr_free(©->instr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ insert_mov(nir_alu_instr *vec, unsigned start_idx, nir_shader *shader)
|
||||
if (mov->dest.write_mask) {
|
||||
nir_instr_insert_before(&vec->instr, &mov->instr);
|
||||
} else {
|
||||
ralloc_free(mov);
|
||||
nir_instr_free(&mov->instr);
|
||||
}
|
||||
|
||||
return channels_handled;
|
||||
@@ -296,7 +296,7 @@ nir_lower_vec_to_movs_instr(nir_builder *b, nir_instr *instr, void *data)
|
||||
}
|
||||
|
||||
nir_instr_remove(&vec->instr);
|
||||
ralloc_free(vec);
|
||||
nir_instr_free(&vec->instr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -105,8 +105,7 @@ try_fold_alu(nir_builder *b, nir_alu_instr *alu)
|
||||
dest);
|
||||
nir_ssa_def_rewrite_uses(&alu->dest.dest.ssa, imm);
|
||||
nir_instr_remove(&alu->instr);
|
||||
|
||||
ralloc_free(alu);
|
||||
nir_instr_free(&alu->instr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -540,7 +540,7 @@ opt_split_alu_of_phi(nir_builder *b, nir_loop *loop)
|
||||
* remove it.
|
||||
*/
|
||||
nir_instr_remove_v(&alu->instr);
|
||||
ralloc_free(alu);
|
||||
nir_instr_free(&alu->instr);
|
||||
|
||||
progress = true;
|
||||
}
|
||||
@@ -705,7 +705,7 @@ opt_simplify_bcsel_of_phi(nir_builder *b, nir_loop *loop)
|
||||
* just remove it.
|
||||
*/
|
||||
nir_instr_remove_v(&bcsel->instr);
|
||||
ralloc_free(bcsel);
|
||||
nir_instr_free(&bcsel->instr);
|
||||
|
||||
progress = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user