Mesa (master): glsl: add ir_control_flow_visitor

Ian Romanick idr at kemper.freedesktop.org
Mon Sep 13 20:09:14 UTC 2010


Module: Mesa
Branch: master
Commit: 55adbebc62a6a819a005adf48f367e7f378c7349
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=55adbebc62a6a819a005adf48f367e7f378c7349

Author: Luca Barbieri <luca at luca-barbieri.com>
Date:   Tue Sep  7 00:22:34 2010 +0200

glsl: add ir_control_flow_visitor

This is just a subclass of ir_visitor with empty implementations of all
the visit methods for non-control flow nodes.

Used to avoid duplicating that in ir_visitor subclasses.

ir_hierarchical_visitor is another way to solve this, but is less natural
for some applications.

---

 src/glsl/ir_visitor.h |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/glsl/ir_visitor.h b/src/glsl/ir_visitor.h
index b87d737..7dd35fe 100644
--- a/src/glsl/ir_visitor.h
+++ b/src/glsl/ir_visitor.h
@@ -64,4 +64,21 @@ public:
    /*@}*/
 };
 
+/* NOTE: function calls may never return due to discards inside them
+ * This is usually not an issue, but if it is, keep it in mind
+ */
+class ir_control_flow_visitor : public ir_visitor {
+public:
+   virtual void visit(class ir_variable *) {}
+   virtual void visit(class ir_expression *) {}
+   virtual void visit(class ir_texture *) {}
+   virtual void visit(class ir_swizzle *) {}
+   virtual void visit(class ir_dereference_variable *) {}
+   virtual void visit(class ir_dereference_array *) {}
+   virtual void visit(class ir_dereference_record *) {}
+   virtual void visit(class ir_assignment *) {}
+   virtual void visit(class ir_constant *) {}
+   virtual void visit(class ir_call *) {}
+};
+
 #endif /* IR_VISITOR_H */




More information about the mesa-commit mailing list