Merge remote-tracking branch 'mesa-public/master' into vulkan
[mesa.git] / src / glsl / ir_variable_refcount.cpp
index 425ed812dc323f337f445f8206f44073b85b65b2..e4d825c454b4869bc39af540beacdb9e57055d4c 100644 (file)
 #include "ir_visitor.h"
 #include "ir_variable_refcount.h"
 #include "glsl_types.h"
-#include "main/hash_table.h"
+#include "util/hash_table.h"
 
 ir_variable_refcount_visitor::ir_variable_refcount_visitor()
 {
    this->mem_ctx = ralloc_context(NULL);
-   this->ht = _mesa_hash_table_create(NULL, _mesa_key_pointer_equal);
+   this->ht = _mesa_hash_table_create(NULL, _mesa_hash_pointer,
+                                      _mesa_key_pointer_equal);
 }
 
 static void
@@ -70,15 +71,13 @@ ir_variable_refcount_visitor::get_variable_entry(ir_variable *var)
 {
    assert(var);
 
-   struct hash_entry *e = _mesa_hash_table_search(this->ht,
-                                                   _mesa_hash_pointer(var),
-                                                   var);
+   struct hash_entry *e = _mesa_hash_table_search(this->ht, var);
    if (e)
       return (ir_variable_refcount_entry *)e->data;
 
    ir_variable_refcount_entry *entry = new ir_variable_refcount_entry(var);
    assert(entry->referenced_count == 0);
-   _mesa_hash_table_insert(this->ht, _mesa_hash_pointer(var), var, entry);
+   _mesa_hash_table_insert(this->ht, var, entry);
 
    return entry;
 }
@@ -132,24 +131,3 @@ ir_variable_refcount_visitor::visit_leave(ir_assignment *ir)
 
    return visit_continue;
 }
-
-
-ir_visitor_status
-ir_variable_refcount_visitor::visit_leave(ir_loop *ir)
-{
-   /* If the loop has a counter variable, it is implicitly referenced and
-    * assigned to.  Note that since the LHS of an assignment is counted as a
-    * reference, we actually have to increment referenced_count by 2 so that
-    * later code will know that the variable isn't just assigned to.
-    */
-   if (ir->counter != NULL) {
-      ir_variable_refcount_entry *entry =
-         this->get_variable_entry(ir->counter);
-      if (entry) {
-         entry->referenced_count += 2;
-         entry->assigned_count++;
-      }
-   }
-
-   return visit_continue;
-}