Module: Mesa
Branch: main
Commit: 21a0ca7ce58e7a71bfa24114a319a7839261f5b7
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=21a0ca7ce58e7a71bfa24114a319a7839261f5b7

Author: Yonggang Luo <[email protected]>
Date:   Fri Jun 30 04:09:33 2023 +0800

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 <[email protected]>
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23960>

---

 src/compiler/nir/nir.h | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 0e30adea2c5..7d8256a9713 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -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
  *

Reply via email to