summaryrefslogtreecommitdiff
path: root/ir.h
diff options
context:
space:
mode:
Diffstat (limited to 'ir.h')
-rw-r--r--ir.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/ir.h b/ir.h
index b728631d78..8d59d21dcb 100644
--- a/ir.h
+++ b/ir.h
@@ -22,6 +22,7 @@
*/
#include "list.h"
+#include "ir_visitor.h"
struct ir_program {
void *bong_hits;
@@ -48,6 +49,8 @@ public:
unsigned mode;
const struct glsl_type *type;
+ virtual void accept(ir_visitor *) = 0;
+
protected:
ir_instruction(int mode);
@@ -81,6 +84,11 @@ class ir_variable : public ir_instruction {
public:
ir_variable(const struct glsl_type *, const char *);
+ virtual void accept(ir_visitor *v)
+ {
+ v->visit(this);
+ }
+
const char *name;
unsigned read_only:1;
@@ -96,6 +104,11 @@ class ir_label : public ir_instruction {
public:
ir_label(const char *label);
+ virtual void accept(ir_visitor *v)
+ {
+ v->visit(this);
+ }
+
const char *label;
};
@@ -105,6 +118,11 @@ class ir_function_signature : public ir_instruction {
public:
ir_function_signature(void);
+ virtual void accept(ir_visitor *v)
+ {
+ v->visit(this);
+ }
+
/**
* Function return type.
*
@@ -131,6 +149,11 @@ class ir_function : public ir_instruction {
public:
ir_function(void);
+ virtual void accept(ir_visitor *v)
+ {
+ v->visit(this);
+ }
+
/**
* Name of the function.
*/
@@ -148,6 +171,11 @@ public:
ir_assignment(ir_instruction *lhs, ir_instruction *rhs,
ir_expression *condition);
+ virtual void accept(ir_visitor *v)
+ {
+ v->visit(this);
+ }
+
/**
* Left-hand side of the assignment.
*/
@@ -234,6 +262,11 @@ public:
ir_expression(int op, const struct glsl_type *type,
ir_instruction *, ir_instruction *);
+ virtual void accept(ir_visitor *v)
+ {
+ v->visit(this);
+ }
+
ir_expression_operation operation;
ir_instruction *operands[2];
};
@@ -262,6 +295,11 @@ class ir_dereference : public ir_instruction {
public:
ir_dereference(struct ir_instruction *);
+ virtual void accept(ir_visitor *v)
+ {
+ v->visit(this);
+ }
+
enum {
ir_reference_variable,
ir_reference_array,
@@ -287,6 +325,11 @@ class ir_constant : public ir_instruction {
public:
ir_constant(const struct glsl_type *type, const void *data);
+ virtual void accept(ir_visitor *v)
+ {
+ v->visit(this);
+ }
+
/**
* Value of the constant.
*