diff options
author | Jason Ekstrand <[email protected]> | 2015-09-09 17:50:09 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2015-09-21 13:46:54 -0700 |
commit | 9f5e7ae9d83ce6de761936b95cd0b7ba4c1219c4 (patch) | |
tree | 264a44c8f25cd82b40839315295d47cd0e48585f | |
parent | 967a5ddb88d248aa317964c9b0951332b2494aab (diff) |
nir: Report progress from lower_vec_to_movs().
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
-rw-r--r-- | src/glsl/nir/nir.h | 2 | ||||
-rw-r--r-- | src/glsl/nir/nir_lower_vec_to_movs.c | 27 |
2 files changed, 22 insertions, 7 deletions
diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index 3d071b17ce3..4b05807e1d0 100644 --- a/src/glsl/nir/nir.h +++ b/src/glsl/nir/nir.h @@ -1826,7 +1826,7 @@ void nir_lower_vars_to_ssa(nir_shader *shader); void nir_remove_dead_variables(nir_shader *shader); void nir_move_vec_src_uses_to_dest(nir_shader *shader); -void nir_lower_vec_to_movs(nir_shader *shader); +bool nir_lower_vec_to_movs(nir_shader *shader); void nir_lower_alu_to_scalar(nir_shader *shader); void nir_lower_load_const_to_scalar(nir_shader *shader); diff --git a/src/glsl/nir/nir_lower_vec_to_movs.c b/src/glsl/nir/nir_lower_vec_to_movs.c index 2cb0457f9ba..b7ee4e8d33c 100644 --- a/src/glsl/nir/nir_lower_vec_to_movs.c +++ b/src/glsl/nir/nir_lower_vec_to_movs.c @@ -32,6 +32,11 @@ * moves with partial writes. */ +struct vec_to_movs_state { + nir_function_impl *impl; + bool progress; +}; + static bool src_matches_dest_reg(nir_dest *dest, nir_src *src) { @@ -185,9 +190,10 @@ try_coalesce(nir_alu_instr *vec, unsigned start_idx, nir_shader *shader) } static bool -lower_vec_to_movs_block(nir_block *block, void *void_impl) +lower_vec_to_movs_block(nir_block *block, void *void_state) { - nir_function_impl *impl = void_impl; + struct vec_to_movs_state *state = void_state; + nir_function_impl *impl = state->impl; nir_shader *shader = impl->overload->function->shader; nir_foreach_instr_safe(block, instr) { @@ -246,22 +252,31 @@ lower_vec_to_movs_block(nir_block *block, void *void_impl) nir_instr_remove(&vec->instr); ralloc_free(vec); + state->progress = true; } return true; } -static void +static bool nir_lower_vec_to_movs_impl(nir_function_impl *impl) { - nir_foreach_block(impl, lower_vec_to_movs_block, impl); + struct vec_to_movs_state state = { impl, false }; + + nir_foreach_block(impl, lower_vec_to_movs_block, &state); + + return state.progress; } -void +bool nir_lower_vec_to_movs(nir_shader *shader) { + bool progress = false; + nir_foreach_overload(shader, overload) { if (overload->impl) - nir_lower_vec_to_movs_impl(overload->impl); + progress = nir_lower_vec_to_movs_impl(overload->impl) || progress; } + + return progress; } |