nir: Add nir_remove_non_exported

For libraries.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25498>
This commit is contained in:
Alyssa Rosenzweig 2023-10-12 12:03:42 -04:00 committed by Marge Bot
parent 6014f745d5
commit 23bea25207
2 changed files with 14 additions and 0 deletions

View file

@ -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);
}
}

View file

@ -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,