[Mesa-dev] [PATCH 6/7] nir: Add function to release memory used for liveness tracking
Ian Romanick
idr at freedesktop.org
Wed Nov 21 00:39:48 UTC 2018
From: Ian Romanick <ian.d.romanick at intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/compiler/nir/nir.h | 2 ++
src/compiler/nir/nir_liveness.c | 17 +++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 74c700026ad..ac20864c6ca 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -3105,6 +3105,8 @@ bool nir_normalize_cubemap_coords(nir_shader *shader);
void nir_live_ssa_defs_impl(nir_function_impl *impl);
+void nir_live_ssa_defs_impl_flush(nir_function_impl *impl);
+
void nir_loop_analyze_impl(nir_function_impl *impl,
nir_variable_mode indirect_mask);
diff --git a/src/compiler/nir/nir_liveness.c b/src/compiler/nir/nir_liveness.c
index 03e252fbfd8..52d082e8367 100644
--- a/src/compiler/nir/nir_liveness.c
+++ b/src/compiler/nir/nir_liveness.c
@@ -290,3 +290,20 @@ nir_ssa_defs_interfere(nir_ssa_def *a, nir_ssa_def *b)
return nir_ssa_def_is_live_at(b, a->parent_instr);
}
}
+
+/**
+ * Release memory associated with SSA def liveness tracking.
+ */
+void
+nir_live_ssa_defs_impl_flush(nir_function_impl *impl)
+{
+ nir_metadata_preserve(impl, ~nir_metadata_live_ssa_defs);
+
+ nir_foreach_block(block, impl) {
+ ralloc_free(block->live_in);
+ block->live_in = NULL;
+
+ ralloc_free(block->live_out);
+ block->live_out = NULL;
+ }
+}
--
2.14.4
More information about the mesa-dev
mailing list