Merge remote-tracking branch 'mesa-public/master' into vulkan
[mesa.git] / src / glsl / ir_hierarchical_visitor.h
index bc89a04d8c95079e64a49fe96feb50febdab58dc..28517b6e4f47c7527d79aaced98c0441a71b4847 100644 (file)
@@ -59,7 +59,7 @@ enum ir_visitor_status {
  * in the composite's \c accept method.  The \c accept method for a leaf-node
  * class will simply call the \c visit method, as usual, and pass its return
  * value on.  The \c accept method for internal-node classes will call the \c
- * visit_enter method, call the \c accpet method of each child node, and,
+ * visit_enter method, call the \c accept method of each child node, and,
  * finally, call the \c visit_leave method.  If any of these return a value
  * other that \c visit_continue, the correct action must be taken.
  *
@@ -87,6 +87,7 @@ public:
    virtual ir_visitor_status visit(class ir_variable *);
    virtual ir_visitor_status visit(class ir_constant *);
    virtual ir_visitor_status visit(class ir_loop_jump *);
+   virtual ir_visitor_status visit(class ir_barrier *);
 
    /**
     * ir_dereference_variable isn't technically a leaf, but it is treated as a
@@ -163,14 +164,29 @@ public:
     * \warning
     * Visitor classes derived from \c ir_hierarchical_visitor \b may \b not
     * invoke this function.  This can be used, for example, to cause the
-    * callback to be invoked on every node type execpt one.
+    * callback to be invoked on every node type except one.
     */
-   void (*callback)(class ir_instruction *ir, void *data);
+   void (*callback_enter)(class ir_instruction *ir, void *data);
 
    /**
-    * Extra data parameter passed to the per-node callback function
+    * Callback function that is invoked on exit of each node visited.
+    *
+    * \warning
+    * Visitor classes derived from \c ir_hierarchical_visitor \b may \b not
+    * invoke this function.  This can be used, for example, to cause the
+    * callback to be invoked on every node type except one.
+    */
+   void (*callback_leave)(class ir_instruction *ir, void *data);
+
+   /**
+    * Extra data parameter passed to the per-node callback_enter function
+    */
+   void *data_enter;
+
+   /**
+    * Extra data parameter passed to the per-node callback_leave function
     */
-   void *data;
+   void *data_leave;
 
    /**
     * Currently in the LHS of an assignment?
@@ -181,8 +197,10 @@ public:
 };
 
 void visit_tree(ir_instruction *ir,
-               void (*callback)(class ir_instruction *ir, void *data),
-               void *data);
+               void (*callback_enter)(class ir_instruction *ir, void *data),
+               void *data_enter,
+               void (*callback_leave)(class ir_instruction *ir, void *data) = NULL,
+               void *data_leave = NULL);
 
 ir_visitor_status visit_list_elements(ir_hierarchical_visitor *v, exec_list *l,
                                       bool statement_list = true);