summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/nir/nir.c56
-rw-r--r--src/glsl/nir/nir_dominance.c3
-rw-r--r--src/glsl/nir/nir_from_ssa.c19
-rw-r--r--src/glsl/nir/nir_lower_vars_to_ssa.c21
-rw-r--r--src/glsl/nir/nir_opt_copy_propagate.c12
-rw-r--r--src/glsl/nir/nir_print.c8
-rw-r--r--src/glsl/nir/nir_remove_dead_variables.c16
-rw-r--r--src/glsl/nir/nir_to_ssa.c6
-rw-r--r--src/glsl/nir/nir_validate.c38
9 files changed, 76 insertions, 103 deletions
diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c
index da9b7a1d3b6..f112db8dd56 100644
--- a/src/glsl/nir/nir.c
+++ b/src/glsl/nir/nir.c
@@ -61,9 +61,12 @@ reg_create(void *mem_ctx, struct exec_list *list)
{
nir_register *reg = ralloc(mem_ctx, nir_register);
- reg->uses = _mesa_set_create(mem_ctx, _mesa_key_pointer_equal);
- reg->defs = _mesa_set_create(mem_ctx, _mesa_key_pointer_equal);
- reg->if_uses = _mesa_set_create(mem_ctx, _mesa_key_pointer_equal);
+ reg->uses = _mesa_set_create(mem_ctx, _mesa_hash_pointer,
+ _mesa_key_pointer_equal);
+ reg->defs = _mesa_set_create(mem_ctx, _mesa_hash_pointer,
+ _mesa_key_pointer_equal);
+ reg->if_uses = _mesa_set_create(mem_ctx, _mesa_hash_pointer,
+ _mesa_key_pointer_equal);
reg->num_components = 0;
reg->num_array_elems = 0;
@@ -175,7 +178,7 @@ nir_dest nir_dest_copy(nir_dest dest, void *mem_ctx)
static inline void
block_add_pred(nir_block *block, nir_block *pred)
{
- _mesa_set_add(block->predecessors, _mesa_hash_pointer(pred), pred);
+ _mesa_set_add(block->predecessors, pred);
}
static void
@@ -208,8 +211,7 @@ unlink_blocks(nir_block *pred, nir_block *succ)
pred->successors[1] = NULL;
}
- struct set_entry *entry = _mesa_set_search(succ->predecessors,
- _mesa_hash_pointer(pred), pred);
+ struct set_entry *entry = _mesa_set_search(succ->predecessors, pred);
assert(entry);
@@ -274,9 +276,11 @@ nir_block_create(void *mem_ctx)
cf_init(&block->cf_node, nir_cf_node_block);
block->successors[0] = block->successors[1] = NULL;
- block->predecessors = _mesa_set_create(mem_ctx, _mesa_key_pointer_equal);
+ block->predecessors = _mesa_set_create(mem_ctx, _mesa_hash_pointer,
+ _mesa_key_pointer_equal);
block->imm_dom = NULL;
- block->dom_frontier = _mesa_set_create(mem_ctx, _mesa_key_pointer_equal);
+ block->dom_frontier = _mesa_set_create(mem_ctx, _mesa_hash_pointer,
+ _mesa_key_pointer_equal);
exec_list_make_empty(&block->instr_list);
@@ -1001,7 +1005,7 @@ update_if_uses(nir_cf_node *node)
if_stmt->condition.ssa->if_uses :
if_stmt->condition.reg.reg->uses;
- _mesa_set_add(if_uses_set, _mesa_hash_pointer(if_stmt), if_stmt);
+ _mesa_set_add(if_uses_set, if_stmt);
}
void
@@ -1168,7 +1172,7 @@ add_use_cb(nir_src *src, void *state)
struct set *uses_set = src->is_ssa ? src->ssa->uses : src->reg.reg->uses;
- _mesa_set_add(uses_set, _mesa_hash_pointer(instr), instr);
+ _mesa_set_add(uses_set, instr);
return true;
}
@@ -1194,7 +1198,7 @@ add_reg_def_cb(nir_dest *dest, void *state)
nir_instr *instr = (nir_instr *) state;
if (!dest->is_ssa)
- _mesa_set_add(dest->reg.reg->defs, _mesa_hash_pointer(instr), instr);
+ _mesa_set_add(dest->reg.reg->defs, instr);
return true;
}
@@ -1313,9 +1317,7 @@ remove_use_cb(nir_src *src, void *state)
struct set *uses_set = src->is_ssa ? src->ssa->uses : src->reg.reg->uses;
- struct set_entry *entry = _mesa_set_search(uses_set,
- _mesa_hash_pointer(instr),
- instr);
+ struct set_entry *entry = _mesa_set_search(uses_set, instr);
if (entry)
_mesa_set_remove(uses_set, entry);
@@ -1332,9 +1334,7 @@ remove_def_cb(nir_dest *dest, void *state)
nir_register *reg = dest->reg.reg;
- struct set_entry *entry = _mesa_set_search(reg->defs,
- _mesa_hash_pointer(instr),
- instr);
+ struct set_entry *entry = _mesa_set_search(reg->defs, instr);
if (entry)
_mesa_set_remove(reg->defs, entry);
@@ -1741,9 +1741,7 @@ nir_instr_rewrite_src(nir_instr *instr, nir_src *src, nir_src new_src)
nir_ssa_def *old_ssa = src->ssa;
*src = new_src;
if (old_ssa && nir_foreach_src(instr, src_does_not_use_def, old_ssa)) {
- struct set_entry *entry = _mesa_set_search(old_ssa->uses,
- _mesa_hash_pointer(instr),
- instr);
+ struct set_entry *entry = _mesa_set_search(old_ssa->uses, instr);
assert(entry);
_mesa_set_remove(old_ssa->uses, entry);
}
@@ -1754,9 +1752,7 @@ nir_instr_rewrite_src(nir_instr *instr, nir_src *src, nir_src new_src)
nir_register *old_reg = src->reg.reg;
*src = new_src;
if (old_reg && nir_foreach_src(instr, src_does_not_use_reg, old_reg)) {
- struct set_entry *entry = _mesa_set_search(old_reg->uses,
- _mesa_hash_pointer(instr),
- instr);
+ struct set_entry *entry = _mesa_set_search(old_reg->uses, instr);
assert(entry);
_mesa_set_remove(old_reg->uses, entry);
}
@@ -1764,10 +1760,10 @@ nir_instr_rewrite_src(nir_instr *instr, nir_src *src, nir_src new_src)
if (new_src.is_ssa) {
if (new_src.ssa)
- _mesa_set_add(new_src.ssa->uses, _mesa_hash_pointer(instr), instr);
+ _mesa_set_add(new_src.ssa->uses, instr);
} else {
if (new_src.reg.reg)
- _mesa_set_add(new_src.reg.reg->uses, _mesa_hash_pointer(instr), instr);
+ _mesa_set_add(new_src.reg.reg->uses, instr);
}
}
@@ -1779,8 +1775,10 @@ nir_ssa_def_init(nir_instr *instr, nir_ssa_def *def,
def->name = name;
def->parent_instr = instr;
- def->uses = _mesa_set_create(mem_ctx, _mesa_key_pointer_equal);
- def->if_uses = _mesa_set_create(mem_ctx, _mesa_key_pointer_equal);
+ def->uses = _mesa_set_create(mem_ctx, _mesa_hash_pointer,
+ _mesa_key_pointer_equal);
+ def->if_uses = _mesa_set_create(mem_ctx, _mesa_hash_pointer,
+ _mesa_key_pointer_equal);
def->num_components = num_components;
if (instr->block) {
@@ -1835,7 +1833,7 @@ nir_ssa_def_rewrite_uses(nir_ssa_def *def, nir_src new_src, void *mem_ctx)
_mesa_set_remove(def->uses, entry);
nir_foreach_src(instr, ssa_def_rewrite_uses_src, &state);
- _mesa_set_add(new_uses, _mesa_hash_pointer(instr), instr);
+ _mesa_set_add(new_uses, instr);
}
set_foreach(def->if_uses, entry) {
@@ -1843,7 +1841,7 @@ nir_ssa_def_rewrite_uses(nir_ssa_def *def, nir_src new_src, void *mem_ctx)
_mesa_set_remove(def->if_uses, entry);
if_use->condition = nir_src_copy(new_src, mem_ctx);
- _mesa_set_add(new_if_uses, _mesa_hash_pointer(if_use), if_use);
+ _mesa_set_add(new_if_uses, if_use);
}
}
diff --git a/src/glsl/nir/nir_dominance.c b/src/glsl/nir/nir_dominance.c
index 76847847d64..67fdcc69725 100644
--- a/src/glsl/nir/nir_dominance.c
+++ b/src/glsl/nir/nir_dominance.c
@@ -113,8 +113,7 @@ calc_dom_frontier_cb(nir_block *block, void *state)
set_foreach(block->predecessors, entry) {
nir_block *runner = (nir_block *) entry->key;
while (runner != block->imm_dom) {
- _mesa_set_add(runner->dom_frontier, _mesa_hash_pointer(block),
- block);
+ _mesa_set_add(runner->dom_frontier, block);
runner = runner->imm_dom;
}
}
diff --git a/src/glsl/nir/nir_from_ssa.c b/src/glsl/nir/nir_from_ssa.c
index 97c09b3b880..025869921f7 100644
--- a/src/glsl/nir/nir_from_ssa.c
+++ b/src/glsl/nir/nir_from_ssa.c
@@ -353,16 +353,14 @@ isolate_phi_nodes_block(nir_block *block, void *void_state)
exec_list_push_tail(&pcopy->entries, &entry->node);
entry->src = nir_src_copy(src->src, state->dead_ctx);
- _mesa_set_add(src->src.ssa->uses,
- _mesa_hash_pointer(&pcopy->instr), &pcopy->instr);
+ _mesa_set_add(src->src.ssa->uses, &pcopy->instr);
entry->dest.is_ssa = true;
nir_ssa_def_init(&pcopy->instr, &entry->dest.ssa,
phi->dest.ssa.num_components, src->src.ssa->name);
struct set_entry *use_entry =
- _mesa_set_search(src->src.ssa->uses,
- _mesa_hash_pointer(instr), instr);
+ _mesa_set_search(src->src.ssa->uses, instr);
if (use_entry)
/* It is possible that a phi node can use the same source twice
* but for different basic blocks. If that happens, entry will
@@ -374,7 +372,7 @@ isolate_phi_nodes_block(nir_block *block, void *void_state)
_mesa_set_remove(src->src.ssa->uses, use_entry);
src->src.ssa = &entry->dest.ssa;
- _mesa_set_add(entry->dest.ssa.uses, _mesa_hash_pointer(instr), instr);
+ _mesa_set_add(entry->dest.ssa.uses, instr);
}
nir_parallel_copy_entry *entry = ralloc(state->dead_ctx,
@@ -393,9 +391,7 @@ isolate_phi_nodes_block(nir_block *block, void *void_state)
entry->src.is_ssa = true;
entry->src.ssa = &phi->dest.ssa;
- _mesa_set_add(phi->dest.ssa.uses,
- _mesa_hash_pointer(&block_pcopy->instr),
- &block_pcopy->instr);
+ _mesa_set_add(phi->dest.ssa.uses, &block_pcopy->instr);
}
return true;
@@ -545,7 +541,7 @@ rewrite_ssa_src(nir_src *src, void *void_state)
/* We don't need to remove it from the uses set because that is going
* away. We just need to add it to the one for the register. */
- _mesa_set_add(reg->uses, _mesa_hash_pointer(state->instr), state->instr);
+ _mesa_set_add(reg->uses, state->instr);
}
return true;
@@ -570,7 +566,7 @@ rewrite_ssa_dest(nir_dest *dest, void *void_state)
memset(dest, 0, sizeof *dest);
dest->reg.reg = reg;
- _mesa_set_add(reg->defs, _mesa_hash_pointer(state->instr), state->instr);
+ _mesa_set_add(reg->defs, state->instr);
}
return true;
@@ -605,8 +601,7 @@ resolve_registers_block(nir_block *block, void *void_state)
memset(&following_if->condition, 0, sizeof following_if->condition);
following_if->condition.reg.reg = reg;
- _mesa_set_add(reg->if_uses, _mesa_hash_pointer(following_if),
- following_if);
+ _mesa_set_add(reg->if_uses, following_if);
} else {
/* FIXME: We really shouldn't hit this. We should be doing
* constant control flow propagation.
diff --git a/src/glsl/nir/nir_lower_vars_to_ssa.c b/src/glsl/nir/nir_lower_vars_to_ssa.c
index e331bcdabc3..4df9bdd8897 100644
--- a/src/glsl/nir/nir_lower_vars_to_ssa.c
+++ b/src/glsl/nir/nir_lower_vars_to_ssa.c
@@ -443,10 +443,10 @@ register_load_instr(nir_intrinsic_instr *load_instr,
return;
if (node->loads == NULL)
- node->loads = _mesa_set_create(state->dead_ctx,
+ node->loads = _mesa_set_create(state->dead_ctx, _mesa_hash_pointer,
_mesa_key_pointer_equal);
- _mesa_set_add(node->loads, _mesa_hash_pointer(load_instr), load_instr);
+ _mesa_set_add(node->loads, load_instr);
}
static void
@@ -458,10 +458,10 @@ register_store_instr(nir_intrinsic_instr *store_instr,
return;
if (node->stores == NULL)
- node->stores = _mesa_set_create(state->dead_ctx,
+ node->stores = _mesa_set_create(state->dead_ctx, _mesa_hash_pointer,
_mesa_key_pointer_equal);
- _mesa_set_add(node->stores, _mesa_hash_pointer(store_instr), store_instr);
+ _mesa_set_add(node->stores, store_instr);
}
static void
@@ -476,10 +476,10 @@ register_copy_instr(nir_intrinsic_instr *copy_instr,
continue;
if (node->copies == NULL)
- node->copies = _mesa_set_create(state->dead_ctx,
+ node->copies = _mesa_set_create(state->dead_ctx, _mesa_hash_pointer,
_mesa_key_pointer_equal);
- _mesa_set_add(node->copies, _mesa_hash_pointer(copy_instr), copy_instr);
+ _mesa_set_add(node->copies, copy_instr);
}
}
@@ -539,9 +539,7 @@ lower_copies_to_load_store(struct deref_node *node,
if (arg_node == NULL)
continue;
- struct set_entry *arg_entry = _mesa_set_search(arg_node->copies,
- copy_entry->hash,
- copy);
+ struct set_entry *arg_entry = _mesa_set_search(arg_node->copies, copy);
assert(arg_entry);
_mesa_set_remove(node->copies, arg_entry);
}
@@ -714,7 +712,7 @@ add_phi_sources(nir_block *block, nir_block *pred,
src->src.is_ssa = true;
src->src.ssa = get_ssa_def_for_block(node, pred, state);
- _mesa_set_add(src->src.ssa->uses, _mesa_hash_pointer(instr), instr);
+ _mesa_set_add(src->src.ssa->uses, instr);
exec_list_push_tail(&phi->srcs, &src->node);
}
@@ -1039,6 +1037,7 @@ nir_lower_vars_to_ssa_impl(nir_function_impl *impl)
nir_foreach_block(impl, register_variable_uses_block, &state);
struct set *outputs = _mesa_set_create(state.dead_ctx,
+ _mesa_hash_pointer,
_mesa_key_pointer_equal);
bool progress = false;
@@ -1075,7 +1074,7 @@ nir_lower_vars_to_ssa_impl(nir_function_impl *impl)
}
if (deref->var->data.mode == nir_var_shader_out)
- _mesa_set_add(outputs, _mesa_hash_pointer(node), node);
+ _mesa_set_add(outputs, node);
foreach_deref_node_match(deref, lower_copies_to_load_store, &state);
}
diff --git a/src/glsl/nir/nir_opt_copy_propagate.c b/src/glsl/nir/nir_opt_copy_propagate.c
index aa2df1be857..dd0ec01efd6 100644
--- a/src/glsl/nir/nir_opt_copy_propagate.c
+++ b/src/glsl/nir/nir_opt_copy_propagate.c
@@ -114,15 +114,12 @@ rewrite_src_instr(nir_src *src, nir_ssa_def *new_def, nir_instr *parent_instr)
search_state.found = false;
nir_foreach_src(parent_instr, search_def, &search_state);
if (!search_state.found) {
- struct set_entry *entry =
- _mesa_set_search(old_def->uses, _mesa_hash_pointer(parent_instr),
- parent_instr);
+ struct set_entry *entry = _mesa_set_search(old_def->uses, parent_instr);
assert(entry);
_mesa_set_remove(old_def->uses, entry);
}
- _mesa_set_add(new_def->uses, _mesa_hash_pointer(parent_instr),
- parent_instr);
+ _mesa_set_add(new_def->uses, parent_instr);
}
static void
@@ -132,12 +129,11 @@ rewrite_src_if(nir_if *if_stmt, nir_ssa_def *new_def)
if_stmt->condition.ssa = new_def;
- struct set_entry *entry =
- _mesa_set_search(old_def->if_uses, _mesa_hash_pointer(if_stmt), if_stmt);
+ struct set_entry *entry = _mesa_set_search(old_def->if_uses, if_stmt);
assert(entry);
_mesa_set_remove(old_def->if_uses, entry);
- _mesa_set_add(new_def->if_uses, _mesa_hash_pointer(if_stmt), if_stmt);
+ _mesa_set_add(new_def->if_uses, if_stmt);
}
static bool
diff --git a/src/glsl/nir/nir_print.c b/src/glsl/nir/nir_print.c
index fe5ceeaf035..84bb97957ba 100644
--- a/src/glsl/nir/nir_print.c
+++ b/src/glsl/nir/nir_print.c
@@ -210,8 +210,7 @@ print_var_decl(nir_variable *var, print_var_state *state, FILE *fp)
glsl_print_type(var->type, fp);
- struct set_entry *entry =
- _mesa_set_search(state->syms, _mesa_hash_string(var->name), var->name);
+ struct set_entry *entry = _mesa_set_search(state->syms, var->name);
char *name;
@@ -232,7 +231,7 @@ print_var_decl(nir_variable *var, print_var_state *state, FILE *fp)
fprintf(fp, "\n");
- _mesa_set_add(state->syms, _mesa_hash_string(name), name);
+ _mesa_set_add(state->syms, name);
_mesa_hash_table_insert(state->ht, var, name);
}
@@ -818,7 +817,8 @@ init_print_state(print_var_state *state)
{
state->ht = _mesa_hash_table_create(NULL, _mesa_hash_pointer,
_mesa_key_pointer_equal);
- state->syms = _mesa_set_create(NULL, _mesa_key_string_equal);
+ state->syms = _mesa_set_create(NULL, _mesa_key_hash_string,
+ _mesa_key_string_equal);
state->index = 0;
}
diff --git a/src/glsl/nir/nir_remove_dead_variables.c b/src/glsl/nir/nir_remove_dead_variables.c
index 38b291ca04b..e37535f7988 100644
--- a/src/glsl/nir/nir_remove_dead_variables.c
+++ b/src/glsl/nir/nir_remove_dead_variables.c
@@ -33,7 +33,7 @@ add_var_use_intrinsic(nir_intrinsic_instr *instr, struct set *live)
unsigned num_vars = nir_intrinsic_infos[instr->intrinsic].num_variables;
for (unsigned i = 0; i < num_vars; i++) {
nir_variable *var = instr->variables[i]->var;
- _mesa_set_add(live, _mesa_hash_pointer(var), var);
+ _mesa_set_add(live, var);
}
}
@@ -42,12 +42,12 @@ add_var_use_call(nir_call_instr *instr, struct set *live)
{
if (instr->return_deref != NULL) {
nir_variable *var = instr->return_deref->var;
- _mesa_set_add(live, _mesa_hash_pointer(var), var);
+ _mesa_set_add(live, var);
}
for (unsigned i = 0; i < instr->num_params; i++) {
nir_variable *var = instr->params[i]->var;
- _mesa_set_add(live, _mesa_hash_pointer(var), var);
+ _mesa_set_add(live, var);
}
}
@@ -56,7 +56,7 @@ add_var_use_tex(nir_tex_instr *instr, struct set *live)
{
if (instr->sampler != NULL) {
nir_variable *var = instr->sampler->var;
- _mesa_set_add(live, _mesa_hash_pointer(var), var);
+ _mesa_set_add(live, var);
}
}
@@ -101,8 +101,7 @@ static void
remove_dead_local_vars(nir_function_impl *impl, struct set *live)
{
foreach_list_typed_safe(nir_variable, var, node, &impl->locals) {
- struct set_entry *entry =
- _mesa_set_search(live, _mesa_hash_pointer(var), var);
+ struct set_entry *entry = _mesa_set_search(live, var);
if (entry == NULL)
exec_node_remove(&var->node);
}
@@ -112,8 +111,7 @@ static void
remove_dead_global_vars(nir_shader *shader, struct set *live)
{
foreach_list_typed_safe(nir_variable, var, node, &shader->globals) {
- struct set_entry *entry =
- _mesa_set_search(live, _mesa_hash_pointer(var), var);
+ struct set_entry *entry = _mesa_set_search(live, var);
if (entry == NULL)
exec_node_remove(&var->node);
}
@@ -123,7 +121,7 @@ void
nir_remove_dead_variables(nir_shader *shader)
{
struct set *live =
- _mesa_set_create(NULL, _mesa_key_pointer_equal);
+ _mesa_set_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal);
add_var_use_shader(shader, live);
diff --git a/src/glsl/nir/nir_to_ssa.c b/src/glsl/nir/nir_to_ssa.c
index 58e8829e1c4..03cce9266ff 100644
--- a/src/glsl/nir/nir_to_ssa.c
+++ b/src/glsl/nir/nir_to_ssa.c
@@ -194,11 +194,9 @@ rewrite_use(nir_src *src, void *_state)
src->ssa = get_ssa_src(src->reg.reg, state);
if (state->parent_instr)
- _mesa_set_add(src->ssa->uses, _mesa_hash_pointer(state->parent_instr),
- state->parent_instr);
+ _mesa_set_add(src->ssa->uses, state->parent_instr);
else
- _mesa_set_add(src->ssa->if_uses, _mesa_hash_pointer(state->parent_if),
- state->parent_if);
+ _mesa_set_add(src->ssa->if_uses, state->parent_if);
return true;
}
diff --git a/src/glsl/nir/nir_validate.c b/src/glsl/nir/nir_validate.c
index 0d267baa21f..77bc5afa38e 100644
--- a/src/glsl/nir/nir_validate.c
+++ b/src/glsl/nir/nir_validate.c
@@ -92,9 +92,7 @@ validate_reg_src(nir_reg_src *src, validate_state *state)
{
assert(src->reg != NULL);
- struct set_entry *entry =
- _mesa_set_search(src->reg->uses, _mesa_hash_pointer(state->instr),
- state->instr);
+ struct set_entry *entry = _mesa_set_search(src->reg->uses, state->instr);
assert(entry && "use not in nir_register.uses");
struct hash_entry *entry2;
@@ -103,8 +101,7 @@ validate_reg_src(nir_reg_src *src, validate_state *state)
assert(entry2);
reg_validate_state *reg_state = (reg_validate_state *) entry2->data;
- _mesa_set_add(reg_state->uses, _mesa_hash_pointer(state->instr),
- state->instr);
+ _mesa_set_add(reg_state->uses, state->instr);
if (!src->reg->is_global) {
assert(reg_state->where_defined == state->impl &&
@@ -137,8 +134,7 @@ validate_ssa_src(nir_ssa_def *def, validate_state *state)
struct set_entry *entry2;
- entry2 = _mesa_set_search(def->uses, _mesa_hash_pointer(state->instr),
- state->instr);
+ entry2 = _mesa_set_search(def->uses, state->instr);
assert(entry2 && "SSA use missing");
@@ -183,9 +179,7 @@ validate_reg_dest(nir_reg_dest *dest, validate_state *state)
{
assert(dest->reg != NULL);
- struct set_entry *entry =
- _mesa_set_search(dest->reg->defs, _mesa_hash_pointer(state->instr),
- state->instr);
+ struct set_entry *entry = _mesa_set_search(dest->reg->defs, state->instr);
assert(entry && "definition not in nir_register.defs");
struct hash_entry *entry2;
@@ -194,8 +188,7 @@ validate_reg_dest(nir_reg_dest *dest, validate_state *state)
assert(entry2);
reg_validate_state *reg_state = (reg_validate_state *) entry2->data;
- _mesa_set_add(reg_state->defs, _mesa_hash_pointer(state->instr),
- state->instr);
+ _mesa_set_add(reg_state->defs, state->instr);
if (!dest->reg->is_global) {
assert(reg_state->where_defined == state->impl &&
@@ -553,8 +546,7 @@ validate_block(nir_block *block, validate_state *state)
for (unsigned i = 0; i < 2; i++) {
if (block->successors[i] != NULL) {
struct set_entry *entry =
- _mesa_set_search(block->successors[i]->predecessors,
- _mesa_hash_pointer(block), block);
+ _mesa_set_search(block->successors[i]->predecessors, block);
assert(entry);
validate_phi_srcs(block, block->successors[i], state);
@@ -585,13 +577,11 @@ validate_if(nir_if *if_stmt, validate_state *state)
if (!if_stmt->condition.is_ssa) {
nir_register *reg = if_stmt->condition.reg.reg;
- struct set_entry *entry =
- _mesa_set_search(reg->if_uses, _mesa_hash_pointer(if_stmt), if_stmt);
+ struct set_entry *entry = _mesa_set_search(reg->if_uses, if_stmt);
assert(entry);
} else {
nir_ssa_def *def = if_stmt->condition.ssa;
- struct set_entry *entry =
- _mesa_set_search(def->if_uses, _mesa_hash_pointer(if_stmt), if_stmt);
+ struct set_entry *entry = _mesa_set_search(def->if_uses, if_stmt);
assert(entry);
}
@@ -679,8 +669,10 @@ prevalidate_reg_decl(nir_register *reg, bool is_global, validate_state *state)
BITSET_SET(state->regs_found, reg->index);
reg_validate_state *reg_state = ralloc(state->regs, reg_validate_state);
- reg_state->uses = _mesa_set_create(reg_state, _mesa_key_pointer_equal);
- reg_state->defs = _mesa_set_create(reg_state, _mesa_key_pointer_equal);
+ reg_state->uses = _mesa_set_create(reg_state, _mesa_hash_pointer,
+ _mesa_key_pointer_equal);
+ reg_state->defs = _mesa_set_create(reg_state, _mesa_hash_pointer,
+ _mesa_key_pointer_equal);
reg_state->where_defined = is_global ? NULL : state->impl;
@@ -699,8 +691,7 @@ postvalidate_reg_decl(nir_register *reg, validate_state *state)
struct set_entry *entry;
set_foreach(reg->uses, entry) {
struct set_entry *entry2 =
- _mesa_set_search(reg_state->uses, _mesa_hash_pointer(entry->key),
- entry->key);
+ _mesa_set_search(reg_state->uses, entry->key);
if (entry2 == NULL) {
printf("%p\n", entry->key);
@@ -715,8 +706,7 @@ postvalidate_reg_decl(nir_register *reg, validate_state *state)
struct set_entry *entry;
set_foreach(reg->defs, entry) {
struct set_entry *entry2 =
- _mesa_set_search(reg_state->defs, _mesa_hash_pointer(entry->key),
- entry->key);
+ _mesa_set_search(reg_state->defs, entry->key);
if (entry2 == NULL) {
printf("%p\n", entry->key);