From 8c2a9838355cfd02356bf7b22eead408d909fe25 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 20 Jul 2012 14:10:44 -0700 Subject: glsl: Add a variant of the rvalue visitor for handle_rvalue() on the way down. For the UBO lowering pass, I want to see the whole dereference chain for replacing, not the innermost ir_dereference_variable. Reviewed-by: Kenneth Graunke --- src/glsl/ir_rvalue_visitor.h | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'src/glsl/ir_rvalue_visitor.h') 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 *); }; -- cgit v1.2.3