X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fcompiler%2Fglsl%2Fir_clone.cpp;h=0e50084d6173cc9bd11410fe38e528db91c4f881;hb=f9ab60202d48c72afa6a6f2a8c27db1e0777ed16;hp=b32ec17f1afab51231ddc55a2ce88257de966088;hpb=f710f3ca377a4583b1fc5081cc28ee1d4aba71cb;p=mesa.git diff --git a/src/compiler/glsl/ir_clone.cpp b/src/compiler/glsl/ir_clone.cpp index b32ec17f1af..0e50084d617 100644 --- a/src/compiler/glsl/ir_clone.cpp +++ b/src/compiler/glsl/ir_clone.cpp @@ -25,7 +25,7 @@ #include "main/compiler.h" #include "ir.h" #include "compiler/glsl_types.h" -#include "program/hash_table.h" +#include "util/hash_table.h" ir_rvalue * ir_rvalue::clone(void *mem_ctx, struct hash_table *) const @@ -46,7 +46,7 @@ ir_variable::clone(void *mem_ctx, struct hash_table *ht) const var->data.max_array_access = this->data.max_array_access; if (this->is_interface_instance()) { var->u.max_ifc_array_access = - rzalloc_array(var, unsigned, this->interface_type->length); + rzalloc_array(var, int, this->interface_type->length); memcpy(var->u.max_ifc_array_access, this->u.max_ifc_array_access, this->interface_type->length * sizeof(unsigned)); } @@ -68,9 +68,8 @@ ir_variable::clone(void *mem_ctx, struct hash_table *ht) const var->interface_type = this->interface_type; - if (ht) { - hash_table_insert(ht, var, (void *)const_cast(this)); - } + if (ht) + _mesa_hash_table_insert(ht, (void *)const_cast(this), var); return var; } @@ -175,9 +174,8 @@ ir_dereference_variable::clone(void *mem_ctx, struct hash_table *ht) const ir_variable *new_var; if (ht) { - new_var = (ir_variable *)hash_table_find(ht, this->var); - if (!new_var) - new_var = this->var; + hash_entry *entry = _mesa_hash_table_search(ht, this->var); + new_var = entry ? (ir_variable *) entry->data : this->var; } else { new_var = this->var; } @@ -280,9 +278,10 @@ ir_function::clone(void *mem_ctx, struct hash_table *ht) const ir_function_signature *sig_copy = sig->clone(mem_ctx, ht); copy->add_signature(sig_copy); - if (ht != NULL) - hash_table_insert(ht, sig_copy, - (void *)const_cast(sig)); + if (ht != NULL) { + _mesa_hash_table_insert(ht, + (void *)const_cast(sig), sig_copy); + } } return copy; @@ -344,7 +343,7 @@ ir_constant::clone(void *mem_ctx, struct hash_table *ht) const ir_constant *c = new(mem_ctx) ir_constant; c->type = this->type; - for (exec_node *node = this->components.head + for (const exec_node *node = this->components.get_head_raw() ; !node->is_tail_sentinel() ; node = node->next) { ir_constant *const orig = (ir_constant *) node; @@ -366,7 +365,6 @@ ir_constant::clone(void *mem_ctx, struct hash_table *ht) const return c; } - case GLSL_TYPE_FUNCTION: case GLSL_TYPE_SAMPLER: case GLSL_TYPE_IMAGE: case GLSL_TYPE_ATOMIC_UINT: @@ -374,6 +372,7 @@ ir_constant::clone(void *mem_ctx, struct hash_table *ht) const case GLSL_TYPE_ERROR: case GLSL_TYPE_SUBROUTINE: case GLSL_TYPE_INTERFACE: + case GLSL_TYPE_FUNCTION: assert(!"Should not get here."); break; } @@ -394,10 +393,13 @@ public: /* Try to find the function signature referenced by the ir_call in the * table. If it is found, replace it with the value from the table. */ - ir_function_signature *sig = - (ir_function_signature *) hash_table_find(this->ht, ir->callee); - if (sig != NULL) - ir->callee = sig; + ir_function_signature *sig; + hash_entry *entry = _mesa_hash_table_search(this->ht, ir->callee); + + if (entry != NULL) { + sig = (ir_function_signature *) entry->data; + ir->callee = sig; + } /* Since this may be used before function call parameters are flattened, * the children also need to be processed. @@ -422,7 +424,7 @@ void clone_ir_list(void *mem_ctx, exec_list *out, const exec_list *in) { struct hash_table *ht = - hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare); + _mesa_hash_table_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal); foreach_in_list(const ir_instruction, original, in) { ir_instruction *copy = original->clone(mem_ctx, ht); @@ -437,5 +439,5 @@ clone_ir_list(void *mem_ctx, exec_list *out, const exec_list *in) */ fixup_function_calls(ht, out); - hash_table_dtor(ht); + _mesa_hash_table_destroy(ht, NULL); }