nir: Add nir_foreach_function_safe and use it
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23902>
This commit is contained in:
@@ -3735,7 +3735,7 @@ void nir_remove_sysval_output(nir_intrinsic_instr *intr)
|
||||
|
||||
void nir_remove_non_entrypoints(nir_shader *nir)
|
||||
{
|
||||
foreach_list_typed_safe(nir_function, func, node, &nir->functions) {
|
||||
nir_foreach_function_safe(func, nir) {
|
||||
if (!func->is_entrypoint)
|
||||
exec_node_remove(&func->node);
|
||||
}
|
||||
|
@@ -4005,6 +4005,9 @@ typedef struct nir_shader {
|
||||
#define nir_foreach_function(func, shader) \
|
||||
foreach_list_typed(nir_function, func, node, &(shader)->functions)
|
||||
|
||||
#define nir_foreach_function_safe(func, shader) \
|
||||
foreach_list_typed_safe(nir_function, func, node, &(shader)->functions)
|
||||
|
||||
static inline nir_function *
|
||||
nir_foreach_function_with_impl_first(const nir_shader *shader)
|
||||
{
|
||||
|
Reference in New Issue
Block a user