Skip to content

nir: Add nir_foreach_function_impl helper

Alyssa Rosenzweig requested to merge alyssa/mesa:nir/foreach-function-impl into main

Most users of nir_foreach_function actually want the nir_function_impl, not the nir_function, and want to skip empty functions (though some graphics-specific passes sometimes fail to do that part). Add a nir_foreach_function_impl macro to make that case more ergonomic.

   nir_foreach_function_impl(impl, shader) {
      ...
      foo(impl)
   }

is equivalent to:

   nir_foreach_function(func, shader) {
      if (func->impl) {
         ...
         foo(func->impl);
      }
   }
Edited by Alyssa Rosenzweig

Merge request reports