summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2015-10-24 14:54:56 -0400
committerRob Clark <[email protected]>2016-01-03 09:11:27 -0500
commit3684e899ea545c8cc7becc5f39ed69f43d430794 (patch)
treecc6195196c192cfbf8f5395fa01331823ca28b95
parent317628dbb35d03d1e855332c892594ae491c5d24 (diff)
freedreno/ir3: use NIR_PASS helper macros
Signed-off-by: Rob Clark <[email protected]>
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_nir.c47
1 files changed, 28 insertions, 19 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_nir.c
index 4d83ee6a987..565b9c32c1d 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_nir.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_nir.c
@@ -58,6 +58,14 @@ ir3_key_lowers_nir(const struct ir3_shader_key *key)
key->ucp_enables | key->color_two_side;
}
+#define OPT(nir, pass, ...) ({ \
+ bool this_progress = false; \
+ NIR_PASS(this_progress, nir, pass, ##__VA_ARGS__); \
+ this_progress; \
+})
+
+#define OPT_V(nir, pass, ...) NIR_PASS_V(nir, pass, ##__VA_ARGS__)
+
struct nir_shader *
ir3_optimize_nir(struct ir3_shader *shader, nir_shader *s,
const struct ir3_shader_key *key)
@@ -97,40 +105,41 @@ ir3_optimize_nir(struct ir3_shader *shader, nir_shader *s,
debug_printf("----------------------\n");
}
- nir_opt_global_to_local(s);
- nir_convert_to_ssa(s);
+ OPT_V(s, nir_opt_global_to_local);
+ OPT_V(s, nir_convert_to_ssa);
+
if (key) {
if (s->stage == MESA_SHADER_VERTEX) {
- nir_lower_clip_vs(s, key->ucp_enables);
+ OPT_V(s, nir_lower_clip_vs, key->ucp_enables);
} else if (s->stage == MESA_SHADER_FRAGMENT) {
- nir_lower_clip_fs(s, key->ucp_enables);
+ OPT_V(s, nir_lower_clip_fs, key->ucp_enables);
}
if (key->color_two_side) {
- nir_lower_two_sided_color(s);
+ OPT_V(s, nir_lower_two_sided_color);
}
}
- nir_lower_tex(s, &tex_options);
- nir_lower_idiv(s);
- nir_lower_load_const_to_scalar(s);
+
+ OPT_V(s, nir_lower_tex, &tex_options);
+ OPT_V(s, nir_lower_idiv);
+ OPT_V(s, nir_lower_load_const_to_scalar);
do {
progress = false;
- nir_lower_vars_to_ssa(s);
- nir_lower_alu_to_scalar(s);
- nir_lower_phis_to_scalar(s);
+ OPT_V(s, nir_lower_vars_to_ssa);
+ OPT_V(s, nir_lower_alu_to_scalar);
+ OPT_V(s, nir_lower_phis_to_scalar);
- progress |= nir_copy_prop(s);
- progress |= nir_opt_dce(s);
- progress |= nir_opt_cse(s);
- progress |= ir3_nir_lower_if_else(s);
- progress |= nir_opt_algebraic(s);
- progress |= nir_opt_constant_folding(s);
+ progress |= OPT(s, nir_copy_prop);
+ progress |= OPT(s, nir_opt_dce);
+ progress |= OPT(s, nir_opt_cse);
+ progress |= OPT(s, ir3_nir_lower_if_else);
+ progress |= OPT(s, nir_opt_algebraic);
+ progress |= OPT(s, nir_opt_constant_folding);
} while (progress);
- nir_remove_dead_variables(s);
- nir_validate_shader(s);
+ OPT_V(s, nir_remove_dead_variables);
if (fd_mesa_debug & FD_DBG_DISASM) {
debug_printf("----------------------\n");