nir: add nir_foreach_entrypoint macros

for compiling libraries full of kernels.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32382>
This commit is contained in:
Alyssa Rosenzweig 2024-11-17 19:42:02 -04:00 committed by Marge Bot
parent 83581b3f1f
commit ba30eb9f40
2 changed files with 11 additions and 0 deletions

View file

@ -153,6 +153,9 @@ ForEachMacros:
- nir_foreach_function_impl
- nir_foreach_entrypoint
- nir_foreach_entrypoint_safe
- nir_foreach_block_unstructured
- nir_foreach_block_unstructured_safe

View file

@ -4479,6 +4479,14 @@ typedef struct nir_shader {
#define nir_foreach_function_safe(func, shader) \
foreach_list_typed_safe(nir_function, func, node, &(shader)->functions)
#define nir_foreach_entrypoint(func, lib) \
nir_foreach_function(func, lib) \
if (func->is_entrypoint)
#define nir_foreach_entrypoint_safe(func, lib) \
nir_foreach_function_safe(func, lib) \
if (func->is_entrypoint)
static inline nir_function *
nir_foreach_function_with_impl_first(const nir_shader *shader)
{