summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2015-09-17 12:33:36 -0700
committerKenneth Graunke <[email protected]>2015-09-21 13:46:59 -0700
commitdc18b9357b553a972ea439facfbc55e376f1179f (patch)
treefabe45e0c108097680150345f4433d71fa79efd0 /src/glsl
parentcfae0f8a3ae98ae10bcf9e4f1429f66165a17d95 (diff)
nir: Report progress from nir_split_var_copies().
Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/nir/nir.h2
-rw-r--r--src/glsl/nir/nir_split_var_copies.c15
2 files changed, 13 insertions, 4 deletions
diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
index 26b3c75c140..bccaf58c03c 100644
--- a/src/glsl/nir/nir.h
+++ b/src/glsl/nir/nir.h
@@ -1804,7 +1804,7 @@ void nir_dump_dom_frontier(nir_shader *shader, FILE *fp);
void nir_dump_cfg_impl(nir_function_impl *impl, FILE *fp);
void nir_dump_cfg(nir_shader *shader, FILE *fp);
-void nir_split_var_copies(nir_shader *shader);
+bool nir_split_var_copies(nir_shader *shader);
void nir_lower_var_copy_instr(nir_intrinsic_instr *copy, void *mem_ctx);
void nir_lower_var_copies(nir_shader *shader);
diff --git a/src/glsl/nir/nir_split_var_copies.c b/src/glsl/nir/nir_split_var_copies.c
index fc72c078c77..d2ea58a8b7c 100644
--- a/src/glsl/nir/nir_split_var_copies.c
+++ b/src/glsl/nir/nir_split_var_copies.c
@@ -64,6 +64,7 @@
struct split_var_copies_state {
void *mem_ctx;
void *dead_ctx;
+ bool progress;
};
static nir_deref *
@@ -198,6 +199,7 @@ split_var_copy_instr(nir_intrinsic_instr *old_copy,
* remove the old one later.
*/
nir_instr_insert_after(&old_copy->instr, &new_copy->instr);
+ state->progress = true;
}
break;
@@ -256,24 +258,31 @@ split_var_copies_block(nir_block *block, void *void_state)
return true;
}
-static void
+static bool
split_var_copies_impl(nir_function_impl *impl)
{
struct split_var_copies_state state;
state.mem_ctx = ralloc_parent(impl);
state.dead_ctx = ralloc_context(NULL);
+ state.progress = false;
nir_foreach_block(impl, split_var_copies_block, &state);
ralloc_free(state.dead_ctx);
+
+ return state.progress;
}
-void
+bool
nir_split_var_copies(nir_shader *shader)
{
+ bool progress = false;
+
nir_foreach_overload(shader, overload) {
if (overload->impl)
- split_var_copies_impl(overload->impl);
+ progress = split_var_copies_impl(overload->impl) || progress;
}
+
+ return progress;
}