nir: Return progress from nir_lower_regs_to_ssa().
authorMatt Turner <mattst88@gmail.com>
Thu, 9 Mar 2017 18:56:20 +0000 (10:56 -0800)
committerMatt Turner <mattst88@gmail.com>
Thu, 23 Mar 2017 21:34:44 +0000 (14:34 -0700)
And from nir_lower_regs_to_ssa_impl() as well.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir.h
src/compiler/nir/nir_lower_regs_to_ssa.c

index 8bf517c33356c02116adbbc7ef339f66bacbb360..8e1721a92dc039b003e7ee661c3a1a2f3536f5ca 100644 (file)
@@ -2389,8 +2389,8 @@ nir_src *nir_get_io_vertex_index_src(nir_intrinsic_instr *instr);
 bool nir_is_per_vertex_io(nir_variable *var, gl_shader_stage stage);
 
 void nir_lower_io_types(nir_shader *shader);
-void nir_lower_regs_to_ssa_impl(nir_function_impl *impl);
-void nir_lower_regs_to_ssa(nir_shader *shader);
+bool nir_lower_regs_to_ssa_impl(nir_function_impl *impl);
+bool nir_lower_regs_to_ssa(nir_shader *shader);
 bool nir_lower_vars_to_ssa(nir_shader *shader);
 
 bool nir_remove_dead_variables(nir_shader *shader, nir_variable_mode modes);
index 095bae66927eb59fafff253507603075ac858962..d70e70260be410ba2ea5c2ebeec192eafbcf0d97 100644 (file)
@@ -210,11 +210,11 @@ rewrite_alu_instr(nir_alu_instr *alu, struct regs_to_ssa_state *state)
                                        &vec->dest.dest.ssa);
 }
 
-void
+bool
 nir_lower_regs_to_ssa_impl(nir_function_impl *impl)
 {
    if (exec_list_is_empty(&impl->registers))
-      return;
+      return false;
 
    nir_metadata_require(impl, nir_metadata_block_index |
                               nir_metadata_dominance);
@@ -279,15 +279,19 @@ nir_lower_regs_to_ssa_impl(nir_function_impl *impl)
 
    nir_metadata_preserve(impl, nir_metadata_block_index |
                                nir_metadata_dominance);
+   return true;
 }
 
-void
+bool
 nir_lower_regs_to_ssa(nir_shader *shader)
 {
    assert(exec_list_is_empty(&shader->registers));
+   bool progress = false;
 
    nir_foreach_function(function, shader) {
       if (function->impl)
-         nir_lower_regs_to_ssa_impl(function->impl);
+         progress |= nir_lower_regs_to_ssa_impl(function->impl);
    }
+
+   return progress;
 }