summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl
diff options
context:
space:
mode:
authorThomas Helland <thomashelland90@gmail.com>2016-08-16 22:10:34 +0200
committerTimothy Arceri <timothy.arceri@collabora.com>2016-09-12 10:48:35 +1000
commit16fb318d0c42059a9a7a47d00a3cb04d843652c7 (patch)
treebdc3ee80b06b84818daed0ef67f6482628d23e70 /src/compiler/glsl
parentec453979db90e30243851b2dc8024e3d9aeceb62 (diff)
downloadexternal_mesa3d-16fb318d0c42059a9a7a47d00a3cb04d843652c7.tar.gz
external_mesa3d-16fb318d0c42059a9a7a47d00a3cb04d843652c7.tar.bz2
external_mesa3d-16fb318d0c42059a9a7a47d00a3cb04d843652c7.zip
glsl: Convert loop analysis to the util hash table
Signed-off-by: Thomas Helland <thomashelland90@gmail.com> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r--src/compiler/glsl/loop_analysis.cpp25
-rw-r--r--src/compiler/glsl/loop_analysis.h8
2 files changed, 18 insertions, 15 deletions
diff --git a/src/compiler/glsl/loop_analysis.cpp b/src/compiler/glsl/loop_analysis.cpp
index 096a80abb3..b9bae43536 100644
--- a/src/compiler/glsl/loop_analysis.cpp
+++ b/src/compiler/glsl/loop_analysis.cpp
@@ -75,8 +75,8 @@ loop_variable::record_reference(bool in_assignee,
loop_state::loop_state()
{
- this->ht = hash_table_ctor(0, hash_table_pointer_hash,
- hash_table_pointer_compare);
+ this->ht = _mesa_hash_table_create(NULL, _mesa_hash_pointer,
+ _mesa_key_pointer_equal);
this->mem_ctx = ralloc_context(NULL);
this->loop_found = false;
}
@@ -84,7 +84,7 @@ loop_state::loop_state()
loop_state::~loop_state()
{
- hash_table_dtor(this->ht);
+ _mesa_hash_table_destroy(this->ht, NULL);
ralloc_free(this->mem_ctx);
}
@@ -94,7 +94,7 @@ loop_state::insert(ir_loop *ir)
{
loop_variable_state *ls = new(this->mem_ctx) loop_variable_state;
- hash_table_insert(this->ht, ls, ir);
+ _mesa_hash_table_insert(this->ht, ir, ls);
this->loop_found = true;
return ls;
@@ -104,14 +104,16 @@ loop_state::insert(ir_loop *ir)
loop_variable_state *
loop_state::get(const ir_loop *ir)
{
- return (loop_variable_state *) hash_table_find(this->ht, ir);
+ hash_entry *entry = _mesa_hash_table_search(this->ht, ir);
+ return entry ? (loop_variable_state *) entry->data : NULL;
}
loop_variable *
loop_variable_state::get(const ir_variable *ir)
{
- return (loop_variable *) hash_table_find(this->var_hash, ir);
+ hash_entry *entry = _mesa_hash_table_search(this->var_hash, ir);
+ return entry ? (loop_variable *) entry->data : NULL;
}
@@ -123,7 +125,7 @@ loop_variable_state::insert(ir_variable *var)
lv->var = var;
- hash_table_insert(this->var_hash, lv, lv->var);
+ _mesa_hash_table_insert(this->var_hash, lv->var, lv);
this->variables.push_tail(lv);
return lv;
@@ -518,8 +520,9 @@ public:
virtual ir_visitor_status visit(ir_dereference_variable *ir)
{
- loop_variable *lv =
- (loop_variable *) hash_table_find(this->loop_variables, ir->var);
+ hash_entry *entry = _mesa_hash_table_search(this->loop_variables,
+ ir->var);
+ loop_variable *lv = entry ? (loop_variable *) entry->data : NULL;
assert(lv != NULL);
@@ -576,8 +579,8 @@ get_basic_induction_increment(ir_assignment *ir, hash_table *var_hash)
if (inc->as_constant() == NULL) {
ir_variable *const inc_var = inc->variable_referenced();
if (inc_var != NULL) {
- loop_variable *lv =
- (loop_variable *) hash_table_find(var_hash, inc_var);
+ hash_entry *entry = _mesa_hash_table_search(var_hash, inc_var);
+ loop_variable *lv = entry ? (loop_variable *) entry->data : NULL;
if (lv == NULL || !lv->is_loop_constant()) {
assert(lv != NULL);
diff --git a/src/compiler/glsl/loop_analysis.h b/src/compiler/glsl/loop_analysis.h
index 3b1971d7ed..727a91c272 100644
--- a/src/compiler/glsl/loop_analysis.h
+++ b/src/compiler/glsl/loop_analysis.h
@@ -27,7 +27,7 @@
#define LOOP_ANALYSIS_H
#include "ir.h"
-#include "program/hash_table.h"
+#include "util/hash_table.h"
/**
* Analyze and classify all variables used in all loops in the instruction list
@@ -130,14 +130,14 @@ public:
{
this->num_loop_jumps = 0;
this->contains_calls = false;
- this->var_hash = hash_table_ctor(0, hash_table_pointer_hash,
- hash_table_pointer_compare);
+ this->var_hash = _mesa_hash_table_create(NULL, _mesa_hash_pointer,
+ _mesa_key_pointer_equal);
this->limiting_terminator = NULL;
}
~loop_variable_state()
{
- hash_table_dtor(this->var_hash);
+ _mesa_hash_table_destroy(this->var_hash, NULL);
}
DECLARE_RALLOC_CXX_OPERATORS(loop_variable_state)