[Mesa-dev] [PATCH 121/133] nir/metadata: Rename metadata_dirty to metadata_preserve

Jason Ekstrand jason at jlekstrand.net
Mon Dec 15 22:13:04 PST 2014


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.
---
 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 8bcc64a..2d49d6a 100644
--- a/src/glsl/nir/nir.c
+++ b/src/glsl/nir/nir.c
@@ -859,7 +859,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) {
@@ -957,7 +957,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);
 }
 
 /**
@@ -1063,7 +1063,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
@@ -1105,7 +1105,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
@@ -1151,7 +1151,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 bc7a226..a31c628 100644
--- a/src/glsl/nir/nir.h
+++ b/src/glsl/nir/nir.h
@@ -1288,7 +1288,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 7718a6d..24deacd 100644
--- a/src/glsl/nir/nir_algebraic.py
+++ b/src/glsl/nir/nir_algebraic.py
@@ -210,8 +210,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 584609c..2ec6219 100644
--- a/src/glsl/nir/nir_from_ssa.c
+++ b/src/glsl/nir/nir_from_ssa.c
@@ -825,8 +825,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 dab3639..9307a67 100644
--- a/src/glsl/nir/nir_lower_variables.c
+++ b/src/glsl/nir/nir_lower_variables.c
@@ -1027,8 +1027,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 a4d618c..a03e124 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 2447fe9..14bd6bf 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 4fc7726..247fe05 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.2.0



More information about the mesa-dev mailing list