summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/ir_rvalue_visitor.cpp127
-rw-r--r--src/glsl/ir_rvalue_visitor.h31
2 files changed, 147 insertions, 11 deletions
diff --git a/src/glsl/ir_rvalue_visitor.cpp b/src/glsl/ir_rvalue_visitor.cpp
index 193bcd2d7bd..b34a419e8e8 100644
--- a/src/glsl/ir_rvalue_visitor.cpp
+++ b/src/glsl/ir_rvalue_visitor.cpp
@@ -36,7 +36,7 @@
#include "glsl_types.h"
ir_visitor_status
-ir_rvalue_visitor::visit_leave(ir_expression *ir)
+ir_rvalue_base_visitor::rvalue_visit(ir_expression *ir)
{
unsigned int operand;
@@ -48,7 +48,7 @@ ir_rvalue_visitor::visit_leave(ir_expression *ir)
}
ir_visitor_status
-ir_rvalue_visitor::visit_leave(ir_texture *ir)
+ir_rvalue_base_visitor::rvalue_visit(ir_texture *ir)
{
handle_rvalue(&ir->coordinate);
handle_rvalue(&ir->projector);
@@ -76,14 +76,14 @@ ir_rvalue_visitor::visit_leave(ir_texture *ir)
}
ir_visitor_status
-ir_rvalue_visitor::visit_leave(ir_swizzle *ir)
+ir_rvalue_base_visitor::rvalue_visit(ir_swizzle *ir)
{
handle_rvalue(&ir->val);
return visit_continue;
}
ir_visitor_status
-ir_rvalue_visitor::visit_leave(ir_dereference_array *ir)
+ir_rvalue_base_visitor::rvalue_visit(ir_dereference_array *ir)
{
/* The array index is not the target of the assignment, so clear the
* 'in_assignee' flag. Restore it after returning from the array index.
@@ -98,14 +98,14 @@ ir_rvalue_visitor::visit_leave(ir_dereference_array *ir)
}
ir_visitor_status
-ir_rvalue_visitor::visit_leave(ir_dereference_record *ir)
+ir_rvalue_base_visitor::rvalue_visit(ir_dereference_record *ir)
{
handle_rvalue(&ir->record);
return visit_continue;
}
ir_visitor_status
-ir_rvalue_visitor::visit_leave(ir_assignment *ir)
+ir_rvalue_base_visitor::rvalue_visit(ir_assignment *ir)
{
handle_rvalue(&ir->rhs);
handle_rvalue(&ir->condition);
@@ -114,7 +114,7 @@ ir_rvalue_visitor::visit_leave(ir_assignment *ir)
}
ir_visitor_status
-ir_rvalue_visitor::visit_leave(ir_call *ir)
+ir_rvalue_base_visitor::rvalue_visit(ir_call *ir)
{
foreach_iter(exec_list_iterator, iter, *ir) {
ir_rvalue *param = (ir_rvalue *)iter.get();
@@ -129,15 +129,124 @@ ir_rvalue_visitor::visit_leave(ir_call *ir)
}
ir_visitor_status
-ir_rvalue_visitor::visit_leave(ir_return *ir)
+ir_rvalue_base_visitor::rvalue_visit(ir_return *ir)
{
handle_rvalue(&ir->value);;
return visit_continue;
}
ir_visitor_status
-ir_rvalue_visitor::visit_leave(ir_if *ir)
+ir_rvalue_base_visitor::rvalue_visit(ir_if *ir)
{
handle_rvalue(&ir->condition);
return visit_continue;
}
+
+
+ir_visitor_status
+ir_rvalue_visitor::visit_leave(ir_expression *ir)
+{
+ return rvalue_visit(ir);
+}
+
+ir_visitor_status
+ir_rvalue_visitor::visit_leave(ir_texture *ir)
+{
+ return rvalue_visit(ir);
+}
+
+ir_visitor_status
+ir_rvalue_visitor::visit_leave(ir_swizzle *ir)
+{
+ return rvalue_visit(ir);
+}
+
+ir_visitor_status
+ir_rvalue_visitor::visit_leave(ir_dereference_array *ir)
+{
+ return rvalue_visit(ir);
+}
+
+ir_visitor_status
+ir_rvalue_visitor::visit_leave(ir_dereference_record *ir)
+{
+ return rvalue_visit(ir);
+}
+
+ir_visitor_status
+ir_rvalue_visitor::visit_leave(ir_assignment *ir)
+{
+ return rvalue_visit(ir);
+}
+
+ir_visitor_status
+ir_rvalue_visitor::visit_leave(ir_call *ir)
+{
+ return rvalue_visit(ir);
+}
+
+ir_visitor_status
+ir_rvalue_visitor::visit_leave(ir_return *ir)
+{
+ return rvalue_visit(ir);
+}
+
+ir_visitor_status
+ir_rvalue_visitor::visit_leave(ir_if *ir)
+{
+ return rvalue_visit(ir);
+}
+
+ir_visitor_status
+ir_rvalue_enter_visitor::visit_enter(ir_expression *ir)
+{
+ return rvalue_visit(ir);
+}
+
+ir_visitor_status
+ir_rvalue_enter_visitor::visit_enter(ir_texture *ir)
+{
+ return rvalue_visit(ir);
+}
+
+ir_visitor_status
+ir_rvalue_enter_visitor::visit_enter(ir_swizzle *ir)
+{
+ return rvalue_visit(ir);
+}
+
+ir_visitor_status
+ir_rvalue_enter_visitor::visit_enter(ir_dereference_array *ir)
+{
+ return rvalue_visit(ir);
+}
+
+ir_visitor_status
+ir_rvalue_enter_visitor::visit_enter(ir_dereference_record *ir)
+{
+ return rvalue_visit(ir);
+}
+
+ir_visitor_status
+ir_rvalue_enter_visitor::visit_enter(ir_assignment *ir)
+{
+ return rvalue_visit(ir);
+}
+
+ir_visitor_status
+ir_rvalue_enter_visitor::visit_enter(ir_call *ir)
+{
+ return rvalue_visit(ir);
+}
+
+ir_visitor_status
+ir_rvalue_enter_visitor::visit_enter(ir_return *ir)
+{
+ return rvalue_visit(ir);
+}
+
+ir_visitor_status
+ir_rvalue_enter_visitor::visit_enter(ir_if *ir)
+{
+ return rvalue_visit(ir);
+}
diff --git a/src/glsl/ir_rvalue_visitor.h b/src/glsl/ir_rvalue_visitor.h
index 31a56beb9b8..2179fa5a8f7 100644
--- a/src/glsl/ir_rvalue_visitor.h
+++ b/src/glsl/ir_rvalue_visitor.h
@@ -30,7 +30,22 @@
* a pointer to each rvalue in the tree.
*/
-class ir_rvalue_visitor : public ir_hierarchical_visitor {
+class ir_rvalue_base_visitor : public ir_hierarchical_visitor {
+public:
+ ir_visitor_status rvalue_visit(ir_assignment *);
+ ir_visitor_status rvalue_visit(ir_call *);
+ ir_visitor_status rvalue_visit(ir_dereference_array *);
+ ir_visitor_status rvalue_visit(ir_dereference_record *);
+ ir_visitor_status rvalue_visit(ir_expression *);
+ ir_visitor_status rvalue_visit(ir_if *);
+ ir_visitor_status rvalue_visit(ir_return *);
+ ir_visitor_status rvalue_visit(ir_swizzle *);
+ ir_visitor_status rvalue_visit(ir_texture *);
+
+ virtual void handle_rvalue(ir_rvalue **rvalue) = 0;
+};
+
+class ir_rvalue_visitor : public ir_rvalue_base_visitor {
public:
virtual ir_visitor_status visit_leave(ir_assignment *);
@@ -42,6 +57,18 @@ public:
virtual ir_visitor_status visit_leave(ir_return *);
virtual ir_visitor_status visit_leave(ir_swizzle *);
virtual ir_visitor_status visit_leave(ir_texture *);
+};
- virtual void handle_rvalue(ir_rvalue **rvalue) = 0;
+class ir_rvalue_enter_visitor : public ir_rvalue_base_visitor {
+public:
+
+ virtual ir_visitor_status visit_enter(ir_assignment *);
+ virtual ir_visitor_status visit_enter(ir_call *);
+ virtual ir_visitor_status visit_enter(ir_dereference_array *);
+ virtual ir_visitor_status visit_enter(ir_dereference_record *);
+ virtual ir_visitor_status visit_enter(ir_expression *);
+ virtual ir_visitor_status visit_enter(ir_if *);
+ virtual ir_visitor_status visit_enter(ir_return *);
+ virtual ir_visitor_status visit_enter(ir_swizzle *);
+ virtual ir_visitor_status visit_enter(ir_texture *);
};