nir/spirv: Use a C99-style initializer for structure fields
[mesa.git] / src / glsl / ir_variable_refcount.h
index 30dd2bd587ee7d61ec7130124772a715b742f73e..5c74c314781ba2849144d37217cc30f4a6145164 100644 (file)
 #include "ir_visitor.h"
 #include "glsl_types.h"
 
-class variable_entry : public exec_node
+struct assignment_entry {
+   exec_node link;
+   ir_assignment *assign;
+};
+
+class ir_variable_refcount_entry
 {
 public:
-   variable_entry(ir_variable *var)
-   {
-      this->var = var;
-      assign = NULL;
-      referenced_count = 0;
-      assigned_count = 0;
-      declaration = false;
-   }
+   ir_variable_refcount_entry(ir_variable *var);
 
    ir_variable *var; /* The key: the variable's pointer. */
-   ir_assignment *assign; /* An assignment to the variable, if any */
+
+   /**
+    * List of assignments to the variable, if any.
+    * This is intended to be used for dead code optimisation and may
+    * not be a complete list.
+    */
+   exec_list assign_list;
 
    /** Number of times the variable is referenced, including assignments. */
    unsigned referenced_count;
@@ -59,16 +63,8 @@ public:
 
 class ir_variable_refcount_visitor : public ir_hierarchical_visitor {
 public:
-   ir_variable_refcount_visitor(void)
-   {
-      this->mem_ctx = talloc_new(NULL);
-      this->variable_list.make_empty();
-   }
-
-   ~ir_variable_refcount_visitor(void)
-   {
-      this->mem_ctx = talloc_new(NULL);
-   }
+   ir_variable_refcount_visitor(void);
+   ~ir_variable_refcount_visitor(void);
 
    virtual ir_visitor_status visit(ir_variable *);
    virtual ir_visitor_status visit(ir_dereference_variable *);
@@ -76,10 +72,9 @@ public:
    virtual ir_visitor_status visit_enter(ir_function_signature *);
    virtual ir_visitor_status visit_leave(ir_assignment *);
 
-   variable_entry *get_variable_entry(ir_variable *var);
+   ir_variable_refcount_entry *get_variable_entry(ir_variable *var);
 
-   /* List of variable_entry */
-   exec_list variable_list;
+   struct hash_table *ht;
 
    void *mem_ctx;
 };