nir: Strip the const modifier on nir_function * in nir_foreach_function_with_impl
The function iterator should be able to modified in this foreach loop And the latter patches needs this Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23960>
This commit is contained in:
@@ -4005,7 +4005,7 @@ typedef struct nir_shader {
|
||||
foreach_list_typed(nir_function, func, node, &(shader)->functions)
|
||||
|
||||
static inline nir_function *
|
||||
_nir_foreach_function_with_impl_first(const nir_shader *shader)
|
||||
nir_foreach_function_with_impl_first(const nir_shader *shader)
|
||||
{
|
||||
foreach_list_typed(nir_function, func, node, &shader->functions) {
|
||||
if (func->impl != NULL)
|
||||
@@ -4016,7 +4016,7 @@ _nir_foreach_function_with_impl_first(const nir_shader *shader)
|
||||
}
|
||||
|
||||
static inline nir_function_impl *
|
||||
_nir_foreach_function_with_impl_next(const nir_function **it)
|
||||
nir_foreach_function_with_impl_next(nir_function **it)
|
||||
{
|
||||
foreach_list_typed_from(nir_function, func, node, _, (*it)->node.next) {
|
||||
if (func->impl != NULL) {
|
||||
@@ -4028,14 +4028,14 @@ _nir_foreach_function_with_impl_next(const nir_function **it)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#define nir_foreach_function_with_impl(it, impl_it, shader) \
|
||||
for (const nir_function *it =_nir_foreach_function_with_impl_first(shader); \
|
||||
it != NULL; \
|
||||
it = NULL) \
|
||||
\
|
||||
for (nir_function_impl *impl_it = it->impl; \
|
||||
impl_it != NULL; \
|
||||
impl_it = _nir_foreach_function_with_impl_next(&it)) \
|
||||
#define nir_foreach_function_with_impl(it, impl_it, shader) \
|
||||
for (nir_function *it =nir_foreach_function_with_impl_first(shader); \
|
||||
it != NULL; \
|
||||
it = NULL) \
|
||||
\
|
||||
for (nir_function_impl *impl_it = it->impl; \
|
||||
impl_it != NULL; \
|
||||
impl_it = nir_foreach_function_with_impl_next(&it))
|
||||
|
||||
/* Equivalent to
|
||||
*
|
||||
|
Reference in New Issue
Block a user