diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index 502846c3886..8b099b80cf3 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -3550,6 +3550,19 @@ nir_remove_non_exported(nir_shader *nir) } } +/* + * After precompiling entrypoints from a kernel library, we want to garbage + * collect the NIR entrypoints but leave the exported library functions. This + * helper does that. + */ +void +nir_remove_entrypoints(nir_shader *nir) +{ + nir_foreach_entrypoint_safe(func, nir) { + exec_node_remove(&func->node); + } +} + unsigned nir_static_workgroup_size(const nir_shader *s) { diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 0d775271323..f3ec0c896b5 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -4582,6 +4582,7 @@ nir_shader_get_function_for_name(const nir_shader *shader, const char *name) */ void nir_remove_non_entrypoints(nir_shader *shader); void nir_remove_non_exported(nir_shader *shader); +void nir_remove_entrypoints(nir_shader *shader); void nir_fixup_is_exported(nir_shader *shader); nir_shader *nir_shader_create(void *mem_ctx,