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;
}
loop_state::~loop_state()
{
- hash_table_dtor(this->ht);
+ _mesa_hash_table_destroy(this->ht, NULL);
ralloc_free(this->mem_ctx);
}
{
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;
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;
}
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;
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);
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);
#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
{
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)