aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/ir_hierarchical_visitor.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-07-19 15:12:53 +0200
committermarha <marha@users.sourceforge.net>2014-07-19 15:12:53 +0200
commit61c36feba19d918885022042ea62d068a698c83d (patch)
treefd351953eb2193fe548e7d0e2dca06b34b7c4f4d /mesalib/src/glsl/ir_hierarchical_visitor.cpp
parent3865d60ef607cbb00c819e905e40d3628b8eca29 (diff)
parentd0c30e7945e76ac119f6d867e27137c8a76f7e15 (diff)
downloadvcxsrv-61c36feba19d918885022042ea62d068a698c83d.tar.gz
vcxsrv-61c36feba19d918885022042ea62d068a698c83d.tar.bz2
vcxsrv-61c36feba19d918885022042ea62d068a698c83d.zip
Merge remote-tracking branch 'origin/released'
Conflicts: mesalib/src/glsl/ir.cpp xorg-server/config/config.c xorg-server/include/callback.h xorg-server/include/colormap.h xorg-server/include/cursor.h xorg-server/include/dix.h xorg-server/include/dixfont.h xorg-server/include/dixgrabs.h xorg-server/include/gc.h xorg-server/include/gcstruct.h xorg-server/include/input.h xorg-server/include/os.h xorg-server/include/pixmap.h xorg-server/include/property.h xorg-server/include/resource.h xorg-server/include/scrnintstr.h xorg-server/include/window.h xorg-server/include/xkbsrv.h xorg-server/mi/mi.h
Diffstat (limited to 'mesalib/src/glsl/ir_hierarchical_visitor.cpp')
-rw-r--r--mesalib/src/glsl/ir_hierarchical_visitor.cpp158
1 files changed, 97 insertions, 61 deletions
diff --git a/mesalib/src/glsl/ir_hierarchical_visitor.cpp b/mesalib/src/glsl/ir_hierarchical_visitor.cpp
index d3c00ecdb..adb629414 100644
--- a/mesalib/src/glsl/ir_hierarchical_visitor.cpp
+++ b/mesalib/src/glsl/ir_hierarchical_visitor.cpp
@@ -27,16 +27,18 @@
ir_hierarchical_visitor::ir_hierarchical_visitor()
{
this->base_ir = NULL;
- this->callback = NULL;
- this->data = NULL;
+ this->callback_enter = NULL;
+ this->callback_leave = NULL;
+ this->data_enter = NULL;
+ this->data_leave = NULL;
this->in_assignee = false;
}
ir_visitor_status
ir_hierarchical_visitor::visit(ir_rvalue *ir)
{
- if (this->callback != NULL)
- this->callback(ir, this->data);
+ if (this->callback_enter != NULL)
+ this->callback_enter(ir, this->data_enter);
return visit_continue;
}
@@ -44,8 +46,8 @@ ir_hierarchical_visitor::visit(ir_rvalue *ir)
ir_visitor_status
ir_hierarchical_visitor::visit(ir_variable *ir)
{
- if (this->callback != NULL)
- this->callback(ir, this->data);
+ if (this->callback_enter != NULL)
+ this->callback_enter(ir, this->data_enter);
return visit_continue;
}
@@ -53,8 +55,8 @@ ir_hierarchical_visitor::visit(ir_variable *ir)
ir_visitor_status
ir_hierarchical_visitor::visit(ir_constant *ir)
{
- if (this->callback != NULL)
- this->callback(ir, this->data);
+ if (this->callback_enter != NULL)
+ this->callback_enter(ir, this->data_enter);
return visit_continue;
}
@@ -62,8 +64,8 @@ ir_hierarchical_visitor::visit(ir_constant *ir)
ir_visitor_status
ir_hierarchical_visitor::visit(ir_loop_jump *ir)
{
- if (this->callback != NULL)
- this->callback(ir, this->data);
+ if (this->callback_enter != NULL)
+ this->callback_enter(ir, this->data_enter);
return visit_continue;
}
@@ -71,8 +73,8 @@ ir_hierarchical_visitor::visit(ir_loop_jump *ir)
ir_visitor_status
ir_hierarchical_visitor::visit(ir_dereference_variable *ir)
{
- if (this->callback != NULL)
- this->callback(ir, this->data);
+ if (this->callback_enter != NULL)
+ this->callback_enter(ir, this->data_enter);
return visit_continue;
}
@@ -80,8 +82,8 @@ ir_hierarchical_visitor::visit(ir_dereference_variable *ir)
ir_visitor_status
ir_hierarchical_visitor::visit_enter(ir_loop *ir)
{
- if (this->callback != NULL)
- this->callback(ir, this->data);
+ if (this->callback_enter != NULL)
+ this->callback_enter(ir, this->data_enter);
return visit_continue;
}
@@ -89,15 +91,17 @@ ir_hierarchical_visitor::visit_enter(ir_loop *ir)
ir_visitor_status
ir_hierarchical_visitor::visit_leave(ir_loop *ir)
{
- (void) ir;
+ if (this->callback_leave != NULL)
+ this->callback_leave(ir, this->data_leave);
+
return visit_continue;
}
ir_visitor_status
ir_hierarchical_visitor::visit_enter(ir_function_signature *ir)
{
- if (this->callback != NULL)
- this->callback(ir, this->data);
+ if (this->callback_enter != NULL)
+ this->callback_enter(ir, this->data_enter);
return visit_continue;
}
@@ -105,15 +109,17 @@ ir_hierarchical_visitor::visit_enter(ir_function_signature *ir)
ir_visitor_status
ir_hierarchical_visitor::visit_leave(ir_function_signature *ir)
{
- (void) ir;
+ if (this->callback_leave != NULL)
+ this->callback_leave(ir, this->data_leave);
+
return visit_continue;
}
ir_visitor_status
ir_hierarchical_visitor::visit_enter(ir_function *ir)
{
- if (this->callback != NULL)
- this->callback(ir, this->data);
+ if (this->callback_enter != NULL)
+ this->callback_enter(ir, this->data_enter);
return visit_continue;
}
@@ -121,15 +127,17 @@ ir_hierarchical_visitor::visit_enter(ir_function *ir)
ir_visitor_status
ir_hierarchical_visitor::visit_leave(ir_function *ir)
{
- (void) ir;
+ if (this->callback_leave != NULL)
+ this->callback_leave(ir, this->data_leave);
+
return visit_continue;
}
ir_visitor_status
ir_hierarchical_visitor::visit_enter(ir_expression *ir)
{
- if (this->callback != NULL)
- this->callback(ir, this->data);
+ if (this->callback_enter != NULL)
+ this->callback_enter(ir, this->data_enter);
return visit_continue;
}
@@ -137,15 +145,17 @@ ir_hierarchical_visitor::visit_enter(ir_expression *ir)
ir_visitor_status
ir_hierarchical_visitor::visit_leave(ir_expression *ir)
{
- (void) ir;
+ if (this->callback_leave != NULL)
+ this->callback_leave(ir, this->data_leave);
+
return visit_continue;
}
ir_visitor_status
ir_hierarchical_visitor::visit_enter(ir_texture *ir)
{
- if (this->callback != NULL)
- this->callback(ir, this->data);
+ if (this->callback_enter != NULL)
+ this->callback_enter(ir, this->data_enter);
return visit_continue;
}
@@ -153,15 +163,17 @@ ir_hierarchical_visitor::visit_enter(ir_texture *ir)
ir_visitor_status
ir_hierarchical_visitor::visit_leave(ir_texture *ir)
{
- (void) ir;
+ if (this->callback_leave != NULL)
+ this->callback_leave(ir, this->data_leave);
+
return visit_continue;
}
ir_visitor_status
ir_hierarchical_visitor::visit_enter(ir_swizzle *ir)
{
- if (this->callback != NULL)
- this->callback(ir, this->data);
+ if (this->callback_enter != NULL)
+ this->callback_enter(ir, this->data_enter);
return visit_continue;
}
@@ -169,15 +181,17 @@ ir_hierarchical_visitor::visit_enter(ir_swizzle *ir)
ir_visitor_status
ir_hierarchical_visitor::visit_leave(ir_swizzle *ir)
{
- (void) ir;
+ if (this->callback_leave != NULL)
+ this->callback_leave(ir, this->data_leave);
+
return visit_continue;
}
ir_visitor_status
ir_hierarchical_visitor::visit_enter(ir_dereference_array *ir)
{
- if (this->callback != NULL)
- this->callback(ir, this->data);
+ if (this->callback_enter != NULL)
+ this->callback_enter(ir, this->data_enter);
return visit_continue;
}
@@ -185,15 +199,17 @@ ir_hierarchical_visitor::visit_enter(ir_dereference_array *ir)
ir_visitor_status
ir_hierarchical_visitor::visit_leave(ir_dereference_array *ir)
{
- (void) ir;
+ if (this->callback_leave != NULL)
+ this->callback_leave(ir, this->data_leave);
+
return visit_continue;
}
ir_visitor_status
ir_hierarchical_visitor::visit_enter(ir_dereference_record *ir)
{
- if (this->callback != NULL)
- this->callback(ir, this->data);
+ if (this->callback_enter != NULL)
+ this->callback_enter(ir, this->data_enter);
return visit_continue;
}
@@ -201,15 +217,17 @@ ir_hierarchical_visitor::visit_enter(ir_dereference_record *ir)
ir_visitor_status
ir_hierarchical_visitor::visit_leave(ir_dereference_record *ir)
{
- (void) ir;
+ if (this->callback_leave != NULL)
+ this->callback_leave(ir, this->data_leave);
+
return visit_continue;
}
ir_visitor_status
ir_hierarchical_visitor::visit_enter(ir_assignment *ir)
{
- if (this->callback != NULL)
- this->callback(ir, this->data);
+ if (this->callback_enter != NULL)
+ this->callback_enter(ir, this->data_enter);
return visit_continue;
}
@@ -217,15 +235,17 @@ ir_hierarchical_visitor::visit_enter(ir_assignment *ir)
ir_visitor_status
ir_hierarchical_visitor::visit_leave(ir_assignment *ir)
{
- (void) ir;
+ if (this->callback_leave != NULL)
+ this->callback_leave(ir, this->data_leave);
+
return visit_continue;
}
ir_visitor_status
ir_hierarchical_visitor::visit_enter(ir_call *ir)
{
- if (this->callback != NULL)
- this->callback(ir, this->data);
+ if (this->callback_enter != NULL)
+ this->callback_enter(ir, this->data_enter);
return visit_continue;
}
@@ -233,15 +253,17 @@ ir_hierarchical_visitor::visit_enter(ir_call *ir)
ir_visitor_status
ir_hierarchical_visitor::visit_leave(ir_call *ir)
{
- (void) ir;
+ if (this->callback_leave != NULL)
+ this->callback_leave(ir, this->data_leave);
+
return visit_continue;
}
ir_visitor_status
ir_hierarchical_visitor::visit_enter(ir_return *ir)
{
- if (this->callback != NULL)
- this->callback(ir, this->data);
+ if (this->callback_enter != NULL)
+ this->callback_enter(ir, this->data_enter);
return visit_continue;
}
@@ -249,15 +271,17 @@ ir_hierarchical_visitor::visit_enter(ir_return *ir)
ir_visitor_status
ir_hierarchical_visitor::visit_leave(ir_return *ir)
{
- (void) ir;
+ if (this->callback_leave != NULL)
+ this->callback_leave(ir, this->data_leave);
+
return visit_continue;
}
ir_visitor_status
ir_hierarchical_visitor::visit_enter(ir_discard *ir)
{
- if (this->callback != NULL)
- this->callback(ir, this->data);
+ if (this->callback_enter != NULL)
+ this->callback_enter(ir, this->data_enter);
return visit_continue;
}
@@ -265,15 +289,17 @@ ir_hierarchical_visitor::visit_enter(ir_discard *ir)
ir_visitor_status
ir_hierarchical_visitor::visit_leave(ir_discard *ir)
{
- (void) ir;
+ if (this->callback_leave != NULL)
+ this->callback_leave(ir, this->data_leave);
+
return visit_continue;
}
ir_visitor_status
ir_hierarchical_visitor::visit_enter(ir_if *ir)
{
- if (this->callback != NULL)
- this->callback(ir, this->data);
+ if (this->callback_enter != NULL)
+ this->callback_enter(ir, this->data_enter);
return visit_continue;
}
@@ -281,15 +307,17 @@ ir_hierarchical_visitor::visit_enter(ir_if *ir)
ir_visitor_status
ir_hierarchical_visitor::visit_leave(ir_if *ir)
{
- (void) ir;
+ if (this->callback_leave != NULL)
+ this->callback_leave(ir, this->data_leave);
+
return visit_continue;
}
ir_visitor_status
ir_hierarchical_visitor::visit_enter(ir_emit_vertex *ir)
{
- if (this->callback != NULL)
- this->callback(ir, this->data);
+ if (this->callback_enter != NULL)
+ this->callback_enter(ir, this->data_enter);
return visit_continue;
}
@@ -297,15 +325,17 @@ ir_hierarchical_visitor::visit_enter(ir_emit_vertex *ir)
ir_visitor_status
ir_hierarchical_visitor::visit_leave(ir_emit_vertex *ir)
{
- (void) ir;
+ if (this->callback_leave != NULL)
+ this->callback_leave(ir, this->data_leave);
+
return visit_continue;
}
ir_visitor_status
ir_hierarchical_visitor::visit_enter(ir_end_primitive *ir)
{
- if (this->callback != NULL)
- this->callback(ir, this->data);
+ if (this->callback_enter != NULL)
+ this->callback_enter(ir, this->data_enter);
return visit_continue;
}
@@ -313,7 +343,9 @@ ir_hierarchical_visitor::visit_enter(ir_end_primitive *ir)
ir_visitor_status
ir_hierarchical_visitor::visit_leave(ir_end_primitive *ir)
{
- (void) ir;
+ if (this->callback_leave != NULL)
+ this->callback_leave(ir, this->data_leave);
+
return visit_continue;
}
@@ -326,13 +358,17 @@ ir_hierarchical_visitor::run(exec_list *instructions)
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),
+ void *data_leave)
{
ir_hierarchical_visitor v;
- v.callback = callback;
- v.data = data;
+ v.callback_enter = callback_enter;
+ v.callback_leave = callback_leave;
+ v.data_enter = data_enter;
+ v.data_leave = data_leave;
ir->accept(&v);
}