X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fglsl%2Fir_hierarchical_visitor.h;h=1988ad0910bf556d124c6d90a190600f04dfe78e;hb=c84e8d039ec9c7532b25757012aa3828f4f8a70d;hp=2c4590d4b10de2f6f02e2d0a9ad5fbf1dde18ea9;hpb=16efab1c4dee6e6a827ba5f1c482378159545ae5;p=mesa.git diff --git a/src/glsl/ir_hierarchical_visitor.h b/src/glsl/ir_hierarchical_visitor.h index 2c4590d4b10..1988ad0910b 100644 --- a/src/glsl/ir_hierarchical_visitor.h +++ b/src/glsl/ir_hierarchical_visitor.h @@ -36,6 +36,7 @@ enum ir_visitor_status { }; +#ifdef __cplusplus /** * Base class of hierarchical visitors of IR instruction trees * @@ -82,6 +83,7 @@ public: * \name Visit methods for leaf-node classes */ /*@{*/ + virtual ir_visitor_status visit(class ir_rvalue *); 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 *); @@ -141,6 +143,16 @@ public: */ void run(struct exec_list *instructions); + /* Some visitors may need to insert new variable declarations and + * assignments for portions of a subtree, which means they need a + * pointer to the current instruction in the stream, not just their + * node in the tree rooted at that instruction. + * + * This is implemented by visit_list_elements -- if the visitor is + * not called by it, nothing good will happen. + */ + class ir_instruction *base_ir; + /** * Callback function that is invoked on entry to each node visited. * @@ -155,10 +167,21 @@ public: * Extra data parameter passed to the per-node callback function */ void *data; + + /** + * Currently in the LHS of an assignment? + * + * This is set and cleared by the \c ir_assignment::accept method. + */ + bool in_assignee; }; void visit_tree(ir_instruction *ir, void (*callback)(class ir_instruction *ir, void *data), void *data); +ir_visitor_status visit_list_elements(ir_hierarchical_visitor *v, exec_list *l, + bool statement_list = true); +#endif /* __cplusplus */ + #endif /* IR_HIERARCHICAL_VISITOR_H */