diff options
author | Thomas Helland <[email protected]> | 2016-08-16 22:10:20 +0200 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2016-09-12 10:48:35 +1000 |
commit | 9ac6d617514ce7fe339e18f1c072f07feecf8c1a (patch) | |
tree | 20dea98f0affa8d8c854d9a09e049b5ec519fa75 /src/compiler/glsl | |
parent | 5b5d4ea4a098c94442666402dccfc0a35333dced (diff) |
glsl: Convert ir_clone to the util hash table
V2: add braces to multiline if (Timothy Arceri)
Signed-off-by: Thomas Helland <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r-- | src/compiler/glsl/ir_clone.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/src/compiler/glsl/ir_clone.cpp b/src/compiler/glsl/ir_clone.cpp index ef2c4c3db2c..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 @@ -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<ir_variable *>(this)); - } + if (ht) + _mesa_hash_table_insert(ht, (void *)const_cast<ir_variable *>(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<ir_function_signature *>(sig)); + if (ht != NULL) { + _mesa_hash_table_insert(ht, + (void *)const_cast<ir_function_signature *>(sig), sig_copy); + } } return copy; @@ -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); } |