[Mesa-dev] [PATCH 05/18] glsl: Move ir_variable_refcount to using the pointer map
Thomas Helland
thomashelland90 at gmail.com
Wed Apr 11 18:48:14 UTC 2018
---
src/compiler/glsl/ir_variable_refcount.cpp | 13 ++++++-------
src/compiler/glsl/ir_variable_refcount.h | 4 ++--
src/compiler/glsl/opt_dead_code.cpp | 6 +++---
3 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/src/compiler/glsl/ir_variable_refcount.cpp b/src/compiler/glsl/ir_variable_refcount.cpp
index 8306be10b9..c5bef9efbf 100644
--- a/src/compiler/glsl/ir_variable_refcount.cpp
+++ b/src/compiler/glsl/ir_variable_refcount.cpp
@@ -33,17 +33,16 @@
#include "ir_visitor.h"
#include "ir_variable_refcount.h"
#include "compiler/glsl_types.h"
-#include "util/hash_table.h"
+#include "util/pointer_map.h"
ir_variable_refcount_visitor::ir_variable_refcount_visitor()
{
this->mem_ctx = ralloc_context(NULL);
- this->ht = _mesa_hash_table_create(NULL, _mesa_hash_pointer,
- _mesa_key_pointer_equal);
+ this->pm = _mesa_pointer_map_create(NULL);
}
static void
-free_entry(struct hash_entry *entry)
+free_entry(struct map_entry *entry)
{
ir_variable_refcount_entry *ivre = (ir_variable_refcount_entry *) entry->data;
@@ -61,7 +60,7 @@ free_entry(struct hash_entry *entry)
ir_variable_refcount_visitor::~ir_variable_refcount_visitor()
{
ralloc_free(this->mem_ctx);
- _mesa_hash_table_destroy(this->ht, free_entry);
+ _mesa_pointer_map_destroy(this->pm, free_entry);
}
// constructor
@@ -79,13 +78,13 @@ ir_variable_refcount_visitor::get_variable_entry(ir_variable *var)
{
assert(var);
- struct hash_entry *e = _mesa_hash_table_search(this->ht, var);
+ struct map_entry *e = _mesa_pointer_map_search(this->pm, var);
if (e)
return (ir_variable_refcount_entry *)e->data;
ir_variable_refcount_entry *entry = new ir_variable_refcount_entry(var);
assert(entry->referenced_count == 0);
- _mesa_hash_table_insert(this->ht, var, entry);
+ _mesa_pointer_map_insert(this->pm, var, entry);
return entry;
}
diff --git a/src/compiler/glsl/ir_variable_refcount.h b/src/compiler/glsl/ir_variable_refcount.h
index 4a90f08c91..270bef7ecd 100644
--- a/src/compiler/glsl/ir_variable_refcount.h
+++ b/src/compiler/glsl/ir_variable_refcount.h
@@ -81,9 +81,9 @@ public:
ir_variable_refcount_entry *get_variable_entry(ir_variable *var);
/**
- * Hash table mapping ir_variable to ir_variable_refcount_entry.
+ * Pointer map mapping ir_variable to ir_variable_refcount_entry.
*/
- struct hash_table *ht;
+ struct pointer_map *pm;
void *mem_ctx;
};
diff --git a/src/compiler/glsl/opt_dead_code.cpp b/src/compiler/glsl/opt_dead_code.cpp
index 75e668ae46..78247d7f4c 100644
--- a/src/compiler/glsl/opt_dead_code.cpp
+++ b/src/compiler/glsl/opt_dead_code.cpp
@@ -31,7 +31,7 @@
#include "ir_visitor.h"
#include "ir_variable_refcount.h"
#include "compiler/glsl_types.h"
-#include "util/hash_table.h"
+#include "util/pointer_map.h"
static bool debug = false;
@@ -50,8 +50,8 @@ do_dead_code(exec_list *instructions, bool uniform_locations_assigned)
v.run(instructions);
- struct hash_entry *e;
- hash_table_foreach(v.ht, e) {
+ struct map_entry *e;
+ _mesa_pointer_map_foreach(v.pm, e) {
ir_variable_refcount_entry *entry = (ir_variable_refcount_entry *)e->data;
/* Since each assignment is a reference, the refereneced count must be
--
2.16.2
More information about the mesa-dev
mailing list