[Mesa-dev] [PATCH 7/7] nir: add helper macros for running NIR passes

Erik Faye-Lund kusmabite at gmail.com
Sun Oct 25 05:05:02 PDT 2015


On Sat, Oct 24, 2015 at 7:08 PM, Rob Clark <robdclark at gmail.com> wrote:
> From: Rob Clark <robclark at freedesktop.org>
>
> +#define NIR_PASS_PROGRESS(pass, nir, ...) ({               \
> +      assert(nir_shader_is_mutable(nir));                  \
> +      bool __ret = pass(nir, ##__VA_ARGS__);               \
> +      nir_validate_shader(nir);                            \
> +      if (__nir_test_clone()) {                            \
> +         nir = nir_shader_clone(ralloc_parent(nir), nir);  \
> +         nir_validate_shader(nir);                         \
> +      }                                                    \
> +      __ret;                                               \
> +   })
> +
<snip>0
> +      progress |= NIR_PASS_PROGRESS(nir_copy_prop, nir);

This does not generate valid C code, but rather what looks like a GCC
extension. Is that really a good move?


More information about the mesa-dev mailing list