diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index 0de2138ca0c..3143fc8201f 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -3401,3 +3401,12 @@ nir_remove_non_entrypoints(nir_shader *nir) } assert(exec_list_length(&nir->functions) == 1); } + +void +nir_remove_non_exported(nir_shader *nir) +{ + nir_foreach_function_safe(func, nir) { + if (!func->is_exported) + exec_node_remove(&func->node); + } +} diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 74985f9f336..69e6912004a 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -4150,7 +4150,12 @@ nir_shader_get_function_for_name(const nir_shader *shader, const char *name) return NULL; } +/* + * After all functions are forcibly inlined, these passes remove redundant + * functions from a shader and library respectively. + */ void nir_remove_non_entrypoints(nir_shader *shader); +void nir_remove_non_exported(nir_shader *shader); nir_shader *nir_shader_create(void *mem_ctx, gl_shader_stage stage,