return should_clone;
}
+
+static inline bool
+should_print_nir(void)
+{
+ static int should_print = -1;
+ if (should_print < 0)
+ should_print = env_var_as_boolean("NIR_PRINT", false);
+
+ return should_print;
+}
#else
static inline void nir_validate_shader(nir_shader *shader) { (void) shader; }
static inline void nir_metadata_set_validation_flag(nir_shader *shader) { (void) shader; }
static inline void nir_metadata_check_validation_flag(nir_shader *shader) { (void) shader; }
static inline bool should_clone_nir(void) { return false; }
+static inline bool should_print_nir(void) { return false; }
#endif /* DEBUG */
#define _PASS(nir, do_pass) do { \
#define NIR_PASS(progress, nir, pass, ...) _PASS(nir, \
nir_metadata_set_validation_flag(nir); \
+ if (should_print_nir()) \
+ printf("%s\n", #pass); \
if (pass(nir, ##__VA_ARGS__)) { \
progress = true; \
+ if (should_print_nir()) \
+ nir_print_shader(nir, stdout); \
nir_metadata_check_validation_flag(nir); \
} \
)
#define NIR_PASS_V(nir, pass, ...) _PASS(nir, \
+ if (should_print_nir()) \
+ printf("%s\n", #pass); \
pass(nir, ##__VA_ARGS__); \
+ if (should_print_nir()) \
+ nir_print_shader(nir, stdout); \
)
void nir_calc_dominance_impl(nir_function_impl *impl);