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
*
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));
: 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
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()
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);
* 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,
{
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()
: 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);
}
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;
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
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()
* 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) {
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())
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))
{
}
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) {
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;
}
{
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;
}
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()
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()
{
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);
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;
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) {
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) {
/* 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);
}
}
if (!found) {
- entry->dsts = _mesa_set_create(this, _mesa_hash_pointer,
- _mesa_key_pointer_equal);
+ entry->dsts = _mesa_pointer_set_create(this);
}
return entry;
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];
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()
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
* 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);
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);
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);
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) {
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) {
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.
* 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) {
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};
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,
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) {
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;
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);
}
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);
}
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);
}
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 */
{
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;
}
.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);
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,
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 =
{
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;
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) {
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);
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;
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);
{
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);
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);
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 {
©_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 {
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) {
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);
}
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;
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;
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;
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);