[Mesa-dev] [PATCH 06/18] nir: Change lower_vars_to_ssa to use pointer map
Thomas Helland
thomashelland90 at gmail.com
Wed Apr 11 18:48:15 UTC 2018
---
src/compiler/nir/nir_lower_vars_to_ssa.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/compiler/nir/nir_lower_vars_to_ssa.c b/src/compiler/nir/nir_lower_vars_to_ssa.c
index e8cfe308d2..3dfe48d6d3 100644
--- a/src/compiler/nir/nir_lower_vars_to_ssa.c
+++ b/src/compiler/nir/nir_lower_vars_to_ssa.c
@@ -29,6 +29,7 @@
#include "nir_builder.h"
#include "nir_phi_builder.h"
#include "nir_vla.h"
+#include "util/pointer_map.h"
struct deref_node {
@@ -61,7 +62,7 @@ struct lower_variables_state {
nir_function_impl *impl;
/* A hash table mapping variables to deref_node data */
- struct hash_table *deref_var_nodes;
+ struct pointer_map *deref_var_nodes;
/* A hash table mapping fully-qualified direct dereferences, i.e.
* dereferences with no indirect or wildcard array dereferences, to
@@ -114,14 +115,14 @@ get_deref_node_for_var(nir_variable *var, struct lower_variables_state *state)
{
struct deref_node *node;
- struct hash_entry *var_entry =
- _mesa_hash_table_search(state->deref_var_nodes, var);
+ struct map_entry *var_entry =
+ _mesa_pointer_map_search(state->deref_var_nodes, var);
if (var_entry) {
return var_entry->data;
} else {
node = deref_node_create(NULL, var->type, state->dead_ctx);
- _mesa_hash_table_insert(state->deref_var_nodes, var, node);
+ _mesa_pointer_map_insert(state->deref_var_nodes, var, node);
return node;
}
}
@@ -646,9 +647,7 @@ nir_lower_vars_to_ssa_impl(nir_function_impl *impl)
state.dead_ctx = ralloc_context(state.shader);
state.impl = impl;
- state.deref_var_nodes = _mesa_hash_table_create(state.dead_ctx,
- _mesa_hash_pointer,
- _mesa_key_pointer_equal);
+ state.deref_var_nodes = _mesa_pointer_map_create(state.dead_ctx);
exec_list_make_empty(&state.direct_deref_nodes);
/* Build the initial deref structures and direct_deref_nodes table */
--
2.16.2
More information about the mesa-dev
mailing list