diff options
Diffstat (limited to 'src')
42 files changed, 72 insertions, 160 deletions
diff --git a/src/compiler/glsl/gl_nir_linker.c b/src/compiler/glsl/gl_nir_linker.c index 547549bc4e0..92e90714e10 100644 --- a/src/compiler/glsl/gl_nir_linker.c +++ b/src/compiler/glsl/gl_nir_linker.c @@ -44,9 +44,7 @@ nir_build_program_resource_list(struct gl_context *ctx, prog->data->NumProgramResourceList = 0; } - struct set *resource_set = _mesa_set_create(NULL, - _mesa_hash_pointer, - _mesa_key_pointer_equal); + struct set *resource_set = _mesa_pointer_set_create(NULL); /* Add uniforms * diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index 424298ad952..8f786575fce 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -176,10 +176,8 @@ nir_visitor::nir_visitor(nir_shader *shader) this->supports_ints = shader->options->native_integers; this->shader = shader; this->is_global = true; - this->var_table = _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); - this->overload_table = _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + this->var_table = _mesa_pointer_hash_table_create(NULL); + this->overload_table = _mesa_pointer_hash_table_create(NULL); this->result = NULL; this->impl = NULL; memset(&this->b, 0, sizeof(this->b)); diff --git a/src/compiler/glsl/ir_array_refcount.cpp b/src/compiler/glsl/ir_array_refcount.cpp index 1a46b2185d4..c2295c96ca9 100644 --- a/src/compiler/glsl/ir_array_refcount.cpp +++ b/src/compiler/glsl/ir_array_refcount.cpp @@ -37,8 +37,7 @@ ir_array_refcount_visitor::ir_array_refcount_visitor() : last_array_deref(0), derefs(0), num_derefs(0), derefs_size(0) { this->mem_ctx = ralloc_context(NULL); - this->ht = _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + this->ht = _mesa_pointer_hash_table_create(NULL); } static void diff --git a/src/compiler/glsl/ir_builder_print_visitor.cpp b/src/compiler/glsl/ir_builder_print_visitor.cpp index da04868652a..57424699d00 100644 --- a/src/compiler/glsl/ir_builder_print_visitor.cpp +++ b/src/compiler/glsl/ir_builder_print_visitor.cpp @@ -141,8 +141,7 @@ _mesa_print_builder_for_ir(FILE *f, exec_list *instructions) ir_builder_print_visitor::ir_builder_print_visitor(FILE *f) : next_ir_index(1), f(f), indentation(0) { - index_map = - _mesa_hash_table_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal); + index_map = _mesa_pointer_hash_table_create(NULL); } ir_builder_print_visitor::~ir_builder_print_visitor() diff --git a/src/compiler/glsl/ir_clone.cpp b/src/compiler/glsl/ir_clone.cpp index e1f4f3b2903..c492fdbb3d0 100644 --- a/src/compiler/glsl/ir_clone.cpp +++ b/src/compiler/glsl/ir_clone.cpp @@ -419,8 +419,7 @@ fixup_function_calls(struct hash_table *ht, exec_list *instructions) void clone_ir_list(void *mem_ctx, exec_list *out, const exec_list *in) { - struct hash_table *ht = - _mesa_hash_table_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal); + struct hash_table *ht = _mesa_pointer_hash_table_create(NULL); foreach_in_list(const ir_instruction, original, in) { ir_instruction *copy = original->clone(mem_ctx, ht); diff --git a/src/compiler/glsl/ir_constant_expression.cpp b/src/compiler/glsl/ir_constant_expression.cpp index bfc22c0011a..cb8558eb00d 100644 --- a/src/compiler/glsl/ir_constant_expression.cpp +++ b/src/compiler/glsl/ir_constant_expression.cpp @@ -1024,8 +1024,7 @@ ir_function_signature::constant_expression_value(void *mem_ctx, * We expect the correctness of the number of parameters to have * been checked earlier. */ - hash_table *deref_hash = _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + hash_table *deref_hash = _mesa_pointer_hash_table_create(NULL); /* If "origin" is non-NULL, then the function body is there. So we * have to use the variable objects from the object with the body, diff --git a/src/compiler/glsl/ir_function_detect_recursion.cpp b/src/compiler/glsl/ir_function_detect_recursion.cpp index 5b05274d001..4a774f666c9 100644 --- a/src/compiler/glsl/ir_function_detect_recursion.cpp +++ b/src/compiler/glsl/ir_function_detect_recursion.cpp @@ -158,8 +158,7 @@ public: { progress = false; this->mem_ctx = ralloc_context(NULL); - this->function_hash = _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + this->function_hash = _mesa_pointer_hash_table_create(NULL); } ~has_recursion_visitor() diff --git a/src/compiler/glsl/ir_print_visitor.cpp b/src/compiler/glsl/ir_print_visitor.cpp index 1626657081e..ef6bca1229e 100644 --- a/src/compiler/glsl/ir_print_visitor.cpp +++ b/src/compiler/glsl/ir_print_visitor.cpp @@ -90,8 +90,7 @@ ir_print_visitor::ir_print_visitor(FILE *f) : f(f) { indentation = 0; - printable_names = - _mesa_hash_table_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal); + printable_names = _mesa_pointer_hash_table_create(NULL); symbols = _mesa_symbol_table_ctor(); mem_ctx = ralloc_context(NULL); } diff --git a/src/compiler/glsl/ir_validate.cpp b/src/compiler/glsl/ir_validate.cpp index aa07f8aea64..819e8aa60dd 100644 --- a/src/compiler/glsl/ir_validate.cpp +++ b/src/compiler/glsl/ir_validate.cpp @@ -46,8 +46,7 @@ class ir_validate : public ir_hierarchical_visitor { public: ir_validate() { - this->ir_set = _mesa_set_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + this->ir_set = _mesa_pointer_set_create(NULL); this->current_function = NULL; diff --git a/src/compiler/glsl/ir_variable_refcount.cpp b/src/compiler/glsl/ir_variable_refcount.cpp index 8306be10b9c..47e9d0c897c 100644 --- a/src/compiler/glsl/ir_variable_refcount.cpp +++ b/src/compiler/glsl/ir_variable_refcount.cpp @@ -38,8 +38,7 @@ 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->ht = _mesa_pointer_hash_table_create(NULL); } static void diff --git a/src/compiler/glsl/link_functions.cpp b/src/compiler/glsl/link_functions.cpp index e73a72c86c9..4998d39dc59 100644 --- a/src/compiler/glsl/link_functions.cpp +++ b/src/compiler/glsl/link_functions.cpp @@ -47,8 +47,7 @@ public: this->success = true; this->linked = linked; - this->locals = _mesa_set_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + this->locals = _mesa_pointer_set_create(NULL); } ~call_link_visitor() @@ -148,8 +147,7 @@ public: * replace signature stored in a function. One could easily be added, * but this avoids the need. */ - struct hash_table *ht = _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + struct hash_table *ht = _mesa_pointer_hash_table_create(NULL); exec_list formal_parameters; foreach_in_list(const ir_instruction, original, &sig->parameters) { diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index d9b9f60067f..2d76e852f47 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -1460,8 +1460,7 @@ move_non_declarations(exec_list *instructions, exec_node *last, hash_table *temps = NULL; if (make_copies) - temps = _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + temps = _mesa_pointer_hash_table_create(NULL); foreach_in_list_safe(ir_instruction, inst, instructions) { if (inst->as_function()) @@ -1507,8 +1506,7 @@ class array_sizing_visitor : public deref_type_updater { public: array_sizing_visitor() : mem_ctx(ralloc_context(NULL)), - unnamed_interfaces(_mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal)) + unnamed_interfaces(_mesa_pointer_hash_table_create(NULL)) { } @@ -4412,9 +4410,7 @@ build_program_resource_list(struct gl_context *ctx, if (input_stage == MESA_SHADER_STAGES && output_stage == 0) return; - struct set *resource_set = _mesa_set_create(NULL, - _mesa_hash_pointer, - _mesa_key_pointer_equal); + struct set *resource_set = _mesa_pointer_set_create(NULL); /* Program interface needs to expose varyings in case of SSO. */ if (shProg->SeparateShader) { diff --git a/src/compiler/glsl/loop_analysis.cpp b/src/compiler/glsl/loop_analysis.cpp index 0fb6e9feb74..e90eb1ccde5 100644 --- a/src/compiler/glsl/loop_analysis.cpp +++ b/src/compiler/glsl/loop_analysis.cpp @@ -252,8 +252,7 @@ loop_variable::record_reference(bool in_assignee, loop_state::loop_state() { - this->ht = _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + this->ht = _mesa_pointer_hash_table_create(NULL); this->mem_ctx = ralloc_context(NULL); this->loop_found = false; } diff --git a/src/compiler/glsl/loop_analysis.h b/src/compiler/glsl/loop_analysis.h index 4e110018461..d6fdb908e0d 100644 --- a/src/compiler/glsl/loop_analysis.h +++ b/src/compiler/glsl/loop_analysis.h @@ -113,8 +113,7 @@ public: { this->num_loop_jumps = 0; this->contains_calls = false; - this->var_hash = _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + this->var_hash = _mesa_pointer_hash_table_create(NULL); this->limiting_terminator = NULL; } diff --git a/src/compiler/glsl/lower_if_to_cond_assign.cpp b/src/compiler/glsl/lower_if_to_cond_assign.cpp index 0d6aa0049d4..ca61f1d5273 100644 --- a/src/compiler/glsl/lower_if_to_cond_assign.cpp +++ b/src/compiler/glsl/lower_if_to_cond_assign.cpp @@ -71,9 +71,7 @@ public: this->min_branch_cost = min_branch_cost; this->depth = 0; - this->condition_variables = - _mesa_set_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + this->condition_variables = _mesa_pointer_set_create(NULL); } ~ir_if_to_cond_assign_visitor() diff --git a/src/compiler/glsl/opt_constant_propagation.cpp b/src/compiler/glsl/opt_constant_propagation.cpp index 642bd641ed6..cc57c48c83a 100644 --- a/src/compiler/glsl/opt_constant_propagation.cpp +++ b/src/compiler/glsl/opt_constant_propagation.cpp @@ -86,8 +86,7 @@ public: mem_ctx = ralloc_context(0); this->lin_ctx = linear_alloc_parent(this->mem_ctx, 0); this->acp = new(mem_ctx) exec_list; - this->kills = _mesa_hash_table_create(mem_ctx, _mesa_hash_pointer, - _mesa_key_pointer_equal); + this->kills = _mesa_pointer_hash_table_create(mem_ctx); } ~ir_constant_propagation_visitor() { @@ -256,8 +255,7 @@ ir_constant_propagation_visitor::visit_enter(ir_function_signature *ir) bool orig_killed_all = this->killed_all; this->acp = new(mem_ctx) exec_list; - this->kills = _mesa_hash_table_create(mem_ctx, _mesa_hash_pointer, - _mesa_key_pointer_equal); + this->kills = _mesa_pointer_hash_table_create(mem_ctx); this->killed_all = false; visit_list_elements(this, &ir->body); @@ -368,8 +366,7 @@ ir_constant_propagation_visitor::visit_enter(ir_if *ir) ir->condition->accept(this); handle_rvalue(&ir->condition); - hash_table *new_kills = _mesa_hash_table_create(mem_ctx, _mesa_hash_pointer, - _mesa_key_pointer_equal); + hash_table *new_kills = _mesa_pointer_hash_table_create(mem_ctx); bool then_killed_all = false; bool else_killed_all = false; @@ -398,8 +395,7 @@ ir_constant_propagation_visitor::handle_loop(ir_loop *ir, bool keep_acp) bool orig_killed_all = this->killed_all; this->acp = new(mem_ctx) exec_list; - this->kills = _mesa_hash_table_create(mem_ctx, _mesa_hash_pointer, - _mesa_key_pointer_equal); + this->kills = _mesa_pointer_hash_table_create(mem_ctx); this->killed_all = false; if (keep_acp) { diff --git a/src/compiler/glsl/opt_constant_variable.cpp b/src/compiler/glsl/opt_constant_variable.cpp index 15d8cf7cdfd..a1fffd4a5f1 100644 --- a/src/compiler/glsl/opt_constant_variable.cpp +++ b/src/compiler/glsl/opt_constant_variable.cpp @@ -186,8 +186,7 @@ do_constant_variable(exec_list *instructions) bool progress = false; ir_constant_variable_visitor v; - v.ht = _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + v.ht = _mesa_pointer_hash_table_create(NULL); v.run(instructions); hash_table_foreach(v.ht, hte) { diff --git a/src/compiler/glsl/opt_copy_propagation_elements.cpp b/src/compiler/glsl/opt_copy_propagation_elements.cpp index 78126ca3870..081909903e5 100644 --- a/src/compiler/glsl/opt_copy_propagation_elements.cpp +++ b/src/compiler/glsl/opt_copy_propagation_elements.cpp @@ -203,8 +203,7 @@ private: /* Use 'this' as context for the table, no explicit destruction * needed later. */ - acp = _mesa_hash_table_create(this, _mesa_hash_pointer, - _mesa_key_pointer_equal); + acp = _mesa_pointer_hash_table_create(this); lin_ctx = linear_alloc_parent(this, 0); } @@ -231,8 +230,7 @@ private: } if (!found) { - entry->dsts = _mesa_set_create(this, _mesa_hash_pointer, - _mesa_key_pointer_equal); + entry->dsts = _mesa_pointer_set_create(this); } return entry; diff --git a/src/compiler/glsl/opt_function_inlining.cpp b/src/compiler/glsl/opt_function_inlining.cpp index 52f57da936d..590bd707bee 100644 --- a/src/compiler/glsl/opt_function_inlining.cpp +++ b/src/compiler/glsl/opt_function_inlining.cpp @@ -152,7 +152,7 @@ ir_call::generate_inline(ir_instruction *next_ir) int i; struct hash_table *ht; - ht = _mesa_hash_table_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal); + ht = _mesa_pointer_hash_table_create(NULL); num_parameters = this->callee->parameters.length(); parameters = new ir_variable *[num_parameters]; diff --git a/src/compiler/glsl/standalone.cpp b/src/compiler/glsl/standalone.cpp index 96ea18f1303..add4e4ea478 100644 --- a/src/compiler/glsl/standalone.cpp +++ b/src/compiler/glsl/standalone.cpp @@ -49,9 +49,7 @@ class dead_variable_visitor : public ir_hierarchical_visitor { public: dead_variable_visitor() { - variables = _mesa_set_create(NULL, - _mesa_hash_pointer, - _mesa_key_pointer_equal); + variables = _mesa_pointer_set_create(NULL); } virtual ~dead_variable_visitor() diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index 3345266fa69..1fc09d9c250 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -330,8 +330,7 @@ nir_block_create(nir_shader *shader) cf_init(&block->cf_node, nir_cf_node_block); block->successors[0] = block->successors[1] = NULL; - block->predecessors = _mesa_set_create(block, _mesa_hash_pointer, - _mesa_key_pointer_equal); + block->predecessors = _mesa_pointer_set_create(block); block->imm_dom = NULL; /* XXX maybe it would be worth it to defer allocation? This * way it doesn't get allocated for shader refs that never run @@ -341,8 +340,7 @@ nir_block_create(nir_shader *shader) * which is later used to do state specific lowering and futher * opt. Do any of the references not need dominance metadata? */ - block->dom_frontier = _mesa_set_create(block, _mesa_hash_pointer, - _mesa_key_pointer_equal); + block->dom_frontier = _mesa_pointer_set_create(block); exec_list_make_empty(&block->instr_list); diff --git a/src/compiler/nir/nir_clone.c b/src/compiler/nir/nir_clone.c index c7c41ef5c6b..557c7d29f53 100644 --- a/src/compiler/nir/nir_clone.c +++ b/src/compiler/nir/nir_clone.c @@ -62,8 +62,7 @@ init_clone_state(clone_state *state, struct hash_table *remap_table, if (remap_table) { state->remap_table = remap_table; } else { - state->remap_table = _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + state->remap_table = _mesa_pointer_hash_table_create(NULL); } list_inithead(&state->phi_srcs); diff --git a/src/compiler/nir/nir_deref.c b/src/compiler/nir/nir_deref.c index 26de64c5140..513e8242d7c 100644 --- a/src/compiler/nir/nir_deref.c +++ b/src/compiler/nir/nir_deref.c @@ -474,8 +474,7 @@ rematerialize_deref_in_block(nir_deref_instr *deref, return deref; if (!state->cache) { - state->cache = _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + state->cache = _mesa_pointer_hash_table_create(NULL); } struct hash_entry *cached = _mesa_hash_table_search(state->cache, deref); diff --git a/src/compiler/nir/nir_from_ssa.c b/src/compiler/nir/nir_from_ssa.c index 8419b28576b..99cfe757477 100644 --- a/src/compiler/nir/nir_from_ssa.c +++ b/src/compiler/nir/nir_from_ssa.c @@ -768,8 +768,7 @@ nir_convert_from_ssa_impl(nir_function_impl *impl, bool phi_webs_only) nir_builder_init(&state.builder, impl); state.dead_ctx = ralloc_context(NULL); state.phi_webs_only = phi_webs_only; - state.merge_node_table = _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + state.merge_node_table = _mesa_pointer_hash_table_create(NULL); state.progress = false; nir_foreach_block(block, impl) { diff --git a/src/compiler/nir/nir_inline_functions.c b/src/compiler/nir/nir_inline_functions.c index 74d39db7ab2..4e0bb8fcba1 100644 --- a/src/compiler/nir/nir_inline_functions.c +++ b/src/compiler/nir/nir_inline_functions.c @@ -209,8 +209,7 @@ inline_function_impl(nir_function_impl *impl, struct set *inlined) bool nir_inline_functions(nir_shader *shader) { - struct set *inlined = _mesa_set_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + struct set *inlined = _mesa_pointer_set_create(NULL); bool progress = false; nir_foreach_function(function, shader) { diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c index 2e89aa7dd19..b85e1295da3 100644 --- a/src/compiler/nir/nir_linking_helpers.c +++ b/src/compiler/nir/nir_linking_helpers.c @@ -712,9 +712,7 @@ nir_link_opt_varyings(nir_shader *producer, nir_shader *consumer) nir_function_impl *impl = nir_shader_get_entrypoint(producer); - struct hash_table *varying_values = - _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + struct hash_table *varying_values = _mesa_pointer_hash_table_create(NULL); /* If we find a store in the last block of the producer we can be sure this * is the only possible value for this output. diff --git a/src/compiler/nir/nir_lower_global_vars_to_local.c b/src/compiler/nir/nir_lower_global_vars_to_local.c index 1ca7c1996a3..9eb76c7ed6c 100644 --- a/src/compiler/nir/nir_lower_global_vars_to_local.c +++ b/src/compiler/nir/nir_lower_global_vars_to_local.c @@ -74,9 +74,7 @@ nir_lower_global_vars_to_local(nir_shader *shader) * nir_function_impl that uses the given variable. If a variable is * used in multiple functions, the data for the given key will be NULL. */ - struct hash_table *var_func_table = - _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + struct hash_table *var_func_table = _mesa_pointer_hash_table_create(NULL); nir_foreach_function(function, shader) { if (function->impl) { diff --git a/src/compiler/nir/nir_lower_io_arrays_to_elements.c b/src/compiler/nir/nir_lower_io_arrays_to_elements.c index 34020249199..9051d397fbc 100644 --- a/src/compiler/nir/nir_lower_io_arrays_to_elements.c +++ b/src/compiler/nir/nir_lower_io_arrays_to_elements.c @@ -343,12 +343,8 @@ void nir_lower_io_arrays_to_elements_no_indirects(nir_shader *shader, bool outputs_only) { - struct hash_table *split_inputs = - _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); - struct hash_table *split_outputs = - _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + struct hash_table *split_inputs = _mesa_pointer_hash_table_create(NULL); + struct hash_table *split_outputs = _mesa_pointer_hash_table_create(NULL); uint64_t indirects[4] = {0}, patch_indirects[4] = {0}; @@ -385,12 +381,8 @@ nir_lower_io_arrays_to_elements_no_indirects(nir_shader *shader, void nir_lower_io_arrays_to_elements(nir_shader *producer, nir_shader *consumer) { - struct hash_table *split_inputs = - _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); - struct hash_table *split_outputs = - _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + struct hash_table *split_inputs = _mesa_pointer_hash_table_create(NULL); + struct hash_table *split_outputs = _mesa_pointer_hash_table_create(NULL); uint64_t indirects[4] = {0}, patch_indirects[4] = {0}; create_indirects_mask(producer, indirects, patch_indirects, diff --git a/src/compiler/nir/nir_lower_io_to_scalar.c b/src/compiler/nir/nir_lower_io_to_scalar.c index d58805294b5..e9135b56ffd 100644 --- a/src/compiler/nir/nir_lower_io_to_scalar.c +++ b/src/compiler/nir/nir_lower_io_to_scalar.c @@ -279,12 +279,8 @@ lower_store_output_to_scalar_early(nir_builder *b, nir_intrinsic_instr *intr, void nir_lower_io_to_scalar_early(nir_shader *shader, nir_variable_mode mask) { - struct hash_table *split_inputs = - _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); - struct hash_table *split_outputs = - _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + struct hash_table *split_inputs = _mesa_pointer_hash_table_create(NULL); + struct hash_table *split_outputs = _mesa_pointer_hash_table_create(NULL); nir_foreach_function(function, shader) { if (function->impl) { diff --git a/src/compiler/nir/nir_lower_phis_to_scalar.c b/src/compiler/nir/nir_lower_phis_to_scalar.c index 904eff0d828..3d7155c04f6 100644 --- a/src/compiler/nir/nir_lower_phis_to_scalar.c +++ b/src/compiler/nir/nir_lower_phis_to_scalar.c @@ -275,8 +275,7 @@ lower_phis_to_scalar_impl(nir_function_impl *impl) state.mem_ctx = ralloc_parent(impl); state.dead_ctx = ralloc_context(NULL); - state.phi_table = _mesa_hash_table_create(state.dead_ctx, _mesa_hash_pointer, - _mesa_key_pointer_equal); + state.phi_table = _mesa_pointer_hash_table_create(state.dead_ctx); nir_foreach_block(block, impl) { progress = lower_phis_to_scalar_block(block, &state) || progress; diff --git a/src/compiler/nir/nir_lower_vars_to_ssa.c b/src/compiler/nir/nir_lower_vars_to_ssa.c index 9c8f75f1083..62f9ad8bcca 100644 --- a/src/compiler/nir/nir_lower_vars_to_ssa.c +++ b/src/compiler/nir/nir_lower_vars_to_ssa.c @@ -376,8 +376,7 @@ register_load_instr(nir_intrinsic_instr *load_instr, return; if (node->loads == NULL) - node->loads = _mesa_set_create(state->dead_ctx, _mesa_hash_pointer, - _mesa_key_pointer_equal); + node->loads = _mesa_pointer_set_create(state->dead_ctx); _mesa_set_add(node->loads, load_instr); } @@ -392,8 +391,7 @@ register_store_instr(nir_intrinsic_instr *store_instr, return; if (node->stores == NULL) - node->stores = _mesa_set_create(state->dead_ctx, _mesa_hash_pointer, - _mesa_key_pointer_equal); + node->stores = _mesa_pointer_set_create(state->dead_ctx); _mesa_set_add(node->stores, store_instr); } @@ -409,8 +407,7 @@ register_copy_instr(nir_intrinsic_instr *copy_instr, continue; if (node->copies == NULL) - node->copies = _mesa_set_create(state->dead_ctx, _mesa_hash_pointer, - _mesa_key_pointer_equal); + node->copies = _mesa_pointer_set_create(state->dead_ctx); _mesa_set_add(node->copies, copy_instr); } @@ -661,9 +658,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_hash_table_create(state.dead_ctx); exec_list_make_empty(&state.direct_deref_nodes); /* Build the initial deref structures and direct_deref_nodes table */ diff --git a/src/compiler/nir/nir_opt_copy_prop_vars.c b/src/compiler/nir/nir_opt_copy_prop_vars.c index 069fcad7199..3dc0ad80573 100644 --- a/src/compiler/nir/nir_opt_copy_prop_vars.c +++ b/src/compiler/nir/nir_opt_copy_prop_vars.c @@ -106,8 +106,7 @@ create_vars_written(struct copy_prop_var_state *state) { struct vars_written *written = linear_zalloc_child(state->lin_ctx, sizeof(struct vars_written)); - written->derefs = _mesa_hash_table_create(state->mem_ctx, _mesa_hash_pointer, - _mesa_key_pointer_equal); + written->derefs = _mesa_pointer_hash_table_create(state->mem_ctx); return written; } @@ -865,8 +864,7 @@ nir_copy_prop_vars_impl(nir_function_impl *impl) .mem_ctx = mem_ctx, .lin_ctx = linear_zalloc_parent(mem_ctx, 0), - .vars_written_map = _mesa_hash_table_create(mem_ctx, _mesa_hash_pointer, - _mesa_key_pointer_equal), + .vars_written_map = _mesa_pointer_hash_table_create(mem_ctx), }; gather_vars_written(&state, NULL, &impl->cf_node); diff --git a/src/compiler/nir/nir_opt_loop_unroll.c b/src/compiler/nir/nir_opt_loop_unroll.c index 8406880204a..e599005083b 100644 --- a/src/compiler/nir/nir_opt_loop_unroll.c +++ b/src/compiler/nir/nir_opt_loop_unroll.c @@ -165,9 +165,7 @@ simple_unroll(nir_loop *loop) nir_cf_extract(&loop_body, nir_after_cf_node(&limiting_term->nif->cf_node), nir_after_block(nir_loop_last_block(loop))); - struct hash_table *remap_table = - _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + struct hash_table *remap_table = _mesa_pointer_hash_table_create(NULL); /* Clone the loop header and insert before the loop */ nir_cf_list_clone_and_reinsert(&lp_header, loop->cf_node.parent, @@ -417,9 +415,7 @@ complex_unroll(nir_loop *loop, nir_loop_terminator *unlimit_term, num_times_to_clone = loop->info->max_trip_count; } - struct hash_table *remap_table = - _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + struct hash_table *remap_table = _mesa_pointer_hash_table_create(NULL); nir_cf_list lp_body; nir_cf_node *unroll_loc = diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index cfbc8be7a2c..88a82b1ef17 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -1318,8 +1318,7 @@ init_print_state(print_state *state, nir_shader *shader, FILE *fp) { state->fp = fp; state->shader = shader; - state->ht = _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + state->ht = _mesa_pointer_hash_table_create(NULL); state->syms = _mesa_set_create(NULL, _mesa_key_hash_string, _mesa_key_string_equal); state->index = 0; diff --git a/src/compiler/nir/nir_propagate_invariant.c b/src/compiler/nir/nir_propagate_invariant.c index 7e253492ba8..103b2422b83 100644 --- a/src/compiler/nir/nir_propagate_invariant.c +++ b/src/compiler/nir/nir_propagate_invariant.c @@ -182,8 +182,7 @@ bool nir_propagate_invariant(nir_shader *shader) { /* Hash set of invariant things */ - struct set *invariants = _mesa_set_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + struct set *invariants = _mesa_pointer_set_create(NULL); bool progress = false; nir_foreach_function(function, shader) { diff --git a/src/compiler/nir/nir_remove_dead_variables.c b/src/compiler/nir/nir_remove_dead_variables.c index a8a347b6a67..5c345bdb854 100644 --- a/src/compiler/nir/nir_remove_dead_variables.c +++ b/src/compiler/nir/nir_remove_dead_variables.c @@ -164,8 +164,7 @@ bool nir_remove_dead_variables(nir_shader *shader, nir_variable_mode modes) { bool progress = false; - struct set *live = - _mesa_set_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal); + struct set *live = _mesa_pointer_set_create(NULL); add_var_use_shader(shader, live, modes); diff --git a/src/compiler/nir/nir_serialize.c b/src/compiler/nir/nir_serialize.c index 808df193754..743eeaed3d5 100644 --- a/src/compiler/nir/nir_serialize.c +++ b/src/compiler/nir/nir_serialize.c @@ -1082,8 +1082,7 @@ void nir_serialize(struct blob *blob, const nir_shader *nir) { write_ctx ctx; - ctx.remap_table = _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + ctx.remap_table = _mesa_pointer_hash_table_create(NULL); ctx.next_idx = 0; ctx.blob = blob; ctx.nir = nir; diff --git a/src/compiler/nir/nir_split_per_member_structs.c b/src/compiler/nir/nir_split_per_member_structs.c index c1234c2e92a..1c148d3d63e 100644 --- a/src/compiler/nir/nir_split_per_member_structs.c +++ b/src/compiler/nir/nir_split_per_member_structs.c @@ -175,8 +175,7 @@ nir_split_per_member_structs(nir_shader *shader) bool progress = false; void *dead_ctx = ralloc_context(NULL); struct hash_table *var_to_member_map = - _mesa_hash_table_create(dead_ctx, _mesa_hash_pointer, - _mesa_key_pointer_equal); + _mesa_pointer_hash_table_create(dead_ctx); progress |= split_variables_in_list(&shader->inputs, shader, var_to_member_map, dead_ctx); diff --git a/src/compiler/nir/nir_split_vars.c b/src/compiler/nir/nir_split_vars.c index 5044d29f146..0cf3e517f85 100644 --- a/src/compiler/nir/nir_split_vars.c +++ b/src/compiler/nir/nir_split_vars.c @@ -257,8 +257,7 @@ nir_split_struct_vars(nir_shader *shader, nir_variable_mode modes) { void *mem_ctx = ralloc_context(NULL); struct hash_table *var_field_map = - _mesa_hash_table_create(mem_ctx, _mesa_hash_pointer, - _mesa_key_pointer_equal); + _mesa_pointer_hash_table_create(mem_ctx); assert((modes & (nir_var_private | nir_var_function)) == modes); @@ -793,9 +792,7 @@ bool nir_split_array_vars(nir_shader *shader, nir_variable_mode modes) { void *mem_ctx = ralloc_context(NULL); - struct hash_table *var_info_map = - _mesa_hash_table_create(mem_ctx, _mesa_hash_pointer, - _mesa_key_pointer_equal); + struct hash_table *var_info_map = _mesa_pointer_hash_table_create(mem_ctx); assert((modes & (nir_var_private | nir_var_function)) == modes); @@ -973,8 +970,7 @@ mark_deref_used(nir_deref_instr *deref, true, mem_ctx); if (copy_usage) { if (usage->vars_copied == NULL) { - usage->vars_copied = _mesa_set_create(mem_ctx, _mesa_hash_pointer, - _mesa_key_pointer_equal); + usage->vars_copied = _mesa_pointer_set_create(mem_ctx); } _mesa_set_add(usage->vars_copied, copy_usage); } else { @@ -1016,9 +1012,7 @@ mark_deref_used(nir_deref_instr *deref, ©_usage->levels[copy_i++]; if (level->levels_copied == NULL) { - level->levels_copied = - _mesa_set_create(mem_ctx, _mesa_hash_pointer, - _mesa_key_pointer_equal); + level->levels_copied = _mesa_pointer_set_create(mem_ctx); } _mesa_set_add(level->levels_copied, copy_level); } else { @@ -1523,8 +1517,7 @@ nir_shrink_vec_array_vars(nir_shader *shader, nir_variable_mode modes) void *mem_ctx = ralloc_context(NULL); struct hash_table *var_usage_map = - _mesa_hash_table_create(mem_ctx, _mesa_hash_pointer, - _mesa_key_pointer_equal); + _mesa_pointer_hash_table_create(mem_ctx); bool has_vars_to_shrink = false; nir_foreach_function(function, shader) { diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c index f506b54d3b5..c9732edda14 100644 --- a/src/compiler/nir/nir_validate.c +++ b/src/compiler/nir/nir_validate.c @@ -300,10 +300,8 @@ validate_ssa_def(nir_ssa_def *def, validate_state *state) ssa_def_validate_state *def_state = ralloc(state->ssa_defs, ssa_def_validate_state); def_state->where_defined = state->impl; - def_state->uses = _mesa_set_create(def_state, _mesa_hash_pointer, - _mesa_key_pointer_equal); - def_state->if_uses = _mesa_set_create(def_state, _mesa_hash_pointer, - _mesa_key_pointer_equal); + def_state->uses = _mesa_pointer_set_create(def_state); + def_state->if_uses = _mesa_pointer_set_create(def_state); _mesa_hash_table_insert(state->ssa_defs, def, def_state); } @@ -927,12 +925,9 @@ prevalidate_reg_decl(nir_register *reg, bool is_global, validate_state *state) list_validate(®->if_uses); reg_validate_state *reg_state = ralloc(state->regs, reg_validate_state); - reg_state->uses = _mesa_set_create(reg_state, _mesa_hash_pointer, - _mesa_key_pointer_equal); - reg_state->if_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->uses = _mesa_pointer_set_create(reg_state); + reg_state->if_uses = _mesa_pointer_set_create(reg_state); + reg_state->defs = _mesa_pointer_set_create(reg_state); reg_state->where_defined = is_global ? NULL : state->impl; @@ -1132,16 +1127,12 @@ validate_function(nir_function *func, validate_state *state) static void init_validate_state(validate_state *state) { - state->regs = _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); - state->ssa_defs = _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + state->regs = _mesa_pointer_hash_table_create(NULL); + state->ssa_defs = _mesa_pointer_hash_table_create(NULL); state->ssa_defs_found = NULL; state->regs_found = NULL; - state->var_defs = _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); - state->errors = _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + state->var_defs = _mesa_pointer_hash_table_create(NULL); + state->errors = _mesa_pointer_hash_table_create(NULL); state->loop = NULL; state->instr = NULL; diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 76a997ee341..0ca1ee48b5e 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -4406,8 +4406,7 @@ spirv_to_nir(const uint32_t *words, size_t word_count, progress = false; foreach_list_typed(struct vtn_function, func, node, &b->functions) { if (func->referenced && !func->emitted) { - b->const_table = _mesa_hash_table_create(b, _mesa_hash_pointer, - _mesa_key_pointer_equal); + b->const_table = _mesa_pointer_hash_table_create(b); vtn_function_emit(b, func, vtn_handle_body_instruction); progress = true; diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c index dc57e41feb0..dde5b972a29 100644 --- a/src/compiler/spirv/vtn_cfg.c +++ b/src/compiler/spirv/vtn_cfg.c @@ -1039,8 +1039,7 @@ vtn_function_emit(struct vtn_builder *b, struct vtn_function *func, b->func = func; b->nb.cursor = nir_after_cf_list(&func->impl->body); b->has_loop_continue = false; - b->phi_table = _mesa_hash_table_create(b, _mesa_hash_pointer, - _mesa_key_pointer_equal); + b->phi_table = _mesa_pointer_hash_table_create(b); vtn_emit_cf_list(b, &func->body, NULL, NULL, instruction_handler); |