From b6c81b3ff453d51898f86a819f80ea1128aea0fe Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 12 Dec 2014 16:22:46 -0800 Subject: [PATCH] nir/metadata: Rename metadata_dirty to metadata_preserve nir_metadata_dirty was a terrible name because the parameter it takes is the metadata to be preserved. This is really confusing because it looks like it's doing the opposite of what it is actually doing. Now it's named sensibly. Reviewed-by: Connor Abbott --- src/glsl/nir/nir.c | 10 +++++----- src/glsl/nir/nir.h | 2 +- src/glsl/nir/nir_algebraic.py | 4 ++-- src/glsl/nir/nir_from_ssa.c | 6 ++++-- src/glsl/nir/nir_lower_variables.c | 4 ++-- src/glsl/nir/nir_metadata.c | 2 +- src/glsl/nir/nir_opt_cse.c | 4 ++-- src/glsl/nir/nir_opt_peephole_select.c | 2 +- 8 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c index 3a64135d94e..cb788d47259 100644 --- a/src/glsl/nir/nir.c +++ b/src/glsl/nir/nir.c @@ -862,7 +862,7 @@ handle_jump(nir_block *block) unlink_block_successors(block); nir_function_impl *impl = nir_cf_node_get_function(&block->cf_node); - nir_metadata_dirty(impl, nir_metadata_none); + nir_metadata_preserve(impl, nir_metadata_none); if (jump_instr->type == nir_jump_break || jump_instr->type == nir_jump_continue) { @@ -960,7 +960,7 @@ handle_remove_jump(nir_block *block, nir_jump_type type) } nir_function_impl *impl = nir_cf_node_get_function(&block->cf_node); - nir_metadata_dirty(impl, nir_metadata_none); + nir_metadata_preserve(impl, nir_metadata_none); } /** @@ -1066,7 +1066,7 @@ nir_cf_node_insert_after(nir_cf_node *node, nir_cf_node *after) } nir_function_impl *impl = nir_cf_node_get_function(node); - nir_metadata_dirty(impl, nir_metadata_none); + nir_metadata_preserve(impl, nir_metadata_none); } void @@ -1108,7 +1108,7 @@ nir_cf_node_insert_before(nir_cf_node *node, nir_cf_node *before) } nir_function_impl *impl = nir_cf_node_get_function(node); - nir_metadata_dirty(impl, nir_metadata_none); + nir_metadata_preserve(impl, nir_metadata_none); } void @@ -1154,7 +1154,7 @@ void nir_cf_node_remove(nir_cf_node *node) { nir_function_impl *impl = nir_cf_node_get_function(node); - nir_metadata_dirty(impl, nir_metadata_none); + nir_metadata_preserve(impl, nir_metadata_none); if (node->type == nir_cf_node_block) { /* diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index fe1f9a8682e..822e2ae414c 100644 --- a/src/glsl/nir/nir.h +++ b/src/glsl/nir/nir.h @@ -1287,7 +1287,7 @@ void nir_cf_node_remove(nir_cf_node *node); /** requests that the given pieces of metadata be generated */ void nir_metadata_require(nir_function_impl *impl, nir_metadata required); /** dirties all but the preserved metadata */ -void nir_metadata_dirty(nir_function_impl *impl, nir_metadata preserved); +void nir_metadata_preserve(nir_function_impl *impl, nir_metadata preserved); /** creates an instruction with default swizzle/writemask/etc. with NULL registers */ nir_alu_instr *nir_alu_instr_create(void *mem_ctx, nir_op op); diff --git a/src/glsl/nir/nir_algebraic.py b/src/glsl/nir/nir_algebraic.py index 703102fc5ca..72703beea8a 100644 --- a/src/glsl/nir/nir_algebraic.py +++ b/src/glsl/nir/nir_algebraic.py @@ -216,8 +216,8 @@ ${pass_name}_impl(nir_function_impl *impl) nir_foreach_block(impl, ${pass_name}_block, &state); if (state.progress) - nir_metadata_dirty(impl, nir_metadata_block_index | - nir_metadata_dominance); + nir_metadata_preserve(impl, nir_metadata_block_index | + nir_metadata_dominance); return state.progress; } diff --git a/src/glsl/nir/nir_from_ssa.c b/src/glsl/nir/nir_from_ssa.c index 9b7c931c072..f99ba9b7828 100644 --- a/src/glsl/nir/nir_from_ssa.c +++ b/src/glsl/nir/nir_from_ssa.c @@ -827,8 +827,10 @@ nir_convert_from_ssa_impl(nir_function_impl *impl) nir_foreach_block(impl, isolate_phi_nodes_block, &state); - nir_metadata_dirty(impl, nir_metadata_block_index | - nir_metadata_dominance); + /* Mark metadata as dirty before we ask for liveness analysis */ + nir_metadata_preserve(impl, nir_metadata_block_index | + nir_metadata_dominance); + nir_metadata_require(impl, nir_metadata_live_variables | nir_metadata_dominance); diff --git a/src/glsl/nir/nir_lower_variables.c b/src/glsl/nir/nir_lower_variables.c index 8c231240183..b8961f85ce8 100644 --- a/src/glsl/nir/nir_lower_variables.c +++ b/src/glsl/nir/nir_lower_variables.c @@ -1022,8 +1022,8 @@ nir_lower_variables_impl(nir_function_impl *impl) insert_phi_nodes(&state); nir_foreach_block(impl, lower_deref_to_ssa_block, &state); - nir_metadata_dirty(impl, nir_metadata_block_index | - nir_metadata_dominance); + nir_metadata_preserve(impl, nir_metadata_block_index | + nir_metadata_dominance); ralloc_free(state.dead_ctx); diff --git a/src/glsl/nir/nir_metadata.c b/src/glsl/nir/nir_metadata.c index a4d618ccc05..a03e12456a1 100644 --- a/src/glsl/nir/nir_metadata.c +++ b/src/glsl/nir/nir_metadata.c @@ -48,7 +48,7 @@ nir_metadata_require(nir_function_impl *impl, nir_metadata required) } void -nir_metadata_dirty(nir_function_impl *impl, nir_metadata preserved) +nir_metadata_preserve(nir_function_impl *impl, nir_metadata preserved) { impl->valid_metadata &= preserved; } diff --git a/src/glsl/nir/nir_opt_cse.c b/src/glsl/nir/nir_opt_cse.c index 2447fe9cfc0..14bd6bf50e6 100644 --- a/src/glsl/nir/nir_opt_cse.c +++ b/src/glsl/nir/nir_opt_cse.c @@ -249,8 +249,8 @@ nir_opt_cse_impl(nir_function_impl *impl) nir_foreach_block(impl, nir_opt_cse_block, &state); if (state.progress) - nir_metadata_dirty(impl, nir_metadata_block_index | - nir_metadata_dominance); + nir_metadata_preserve(impl, nir_metadata_block_index | + nir_metadata_dominance); return state.progress; } diff --git a/src/glsl/nir/nir_opt_peephole_select.c b/src/glsl/nir/nir_opt_peephole_select.c index 4fc7726a85a..247fe050a70 100644 --- a/src/glsl/nir/nir_opt_peephole_select.c +++ b/src/glsl/nir/nir_opt_peephole_select.c @@ -193,7 +193,7 @@ nir_opt_peephole_select_impl(nir_function_impl *impl) nir_foreach_block(impl, nir_opt_peephole_select_block, &state); if (state.progress) - nir_metadata_dirty(impl, nir_metadata_none); + nir_metadata_preserve(impl, nir_metadata_none); return state.progress; } -- 2.30.2