diff options
author | Kenneth Graunke <[email protected]> | 2010-07-15 10:09:09 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2010-07-20 17:10:05 -0700 |
commit | fb2ffd2846b48cb50128fb74df56f2ee63179832 (patch) | |
tree | 5457e6bbaaf1a0472f09108ebae6c09d5880fc1d /src/glsl/ir.h | |
parent | e340854115f2562109c91fa908ffe6628432f989 (diff) |
ir_constant_expression: Convert from a visitor to a virtual function.
The constant_expression_wrapper was already the only external API, and
much of the internal code used it anyway. Also, it wouldn't ever visit
non-rvalue ir_instructions, so using a visitor seemed a bit unnecessary.
This uses "ir_foo *ir = this;" lines to avoid code churn. These should
be removed.
Diffstat (limited to 'src/glsl/ir.h')
-rw-r--r-- | src/glsl/ir.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/glsl/ir.h b/src/glsl/ir.h index b6cd1bae31c..3be096270d8 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -112,10 +112,10 @@ protected: class ir_rvalue : public ir_instruction { public: - class ir_constant *constant_expression_value(); - virtual ir_rvalue *clone(struct hash_table *) const = 0; + virtual ir_constant *constant_expression_value() = 0; + virtual ir_rvalue * as_rvalue() { return this; @@ -511,6 +511,8 @@ public: virtual ir_assignment *clone(struct hash_table *ht) const; + virtual ir_constant *constant_expression_value(); + virtual void accept(ir_visitor *v) { v->visit(this); @@ -651,6 +653,8 @@ public: virtual ir_expression *clone(struct hash_table *ht) const; + virtual ir_constant *constant_expression_value(); + static unsigned int get_num_operands(ir_expression_operation); unsigned int get_num_operands() const { @@ -695,6 +699,8 @@ public: virtual ir_call *clone(struct hash_table *ht) const; + virtual ir_constant *constant_expression_value(); + virtual ir_call *as_call() { return this; @@ -929,6 +935,8 @@ public: virtual ir_texture *clone(struct hash_table *) const; + virtual ir_constant *constant_expression_value(); + virtual void accept(ir_visitor *v) { v->visit(this); @@ -1019,6 +1027,8 @@ public: virtual ir_swizzle *clone(struct hash_table *) const; + virtual ir_constant *constant_expression_value(); + virtual ir_swizzle *as_swizzle() { return this; @@ -1083,6 +1093,8 @@ public: virtual ir_dereference_variable *clone(struct hash_table *) const; + virtual ir_constant *constant_expression_value(); + virtual ir_dereference_variable *as_dereference_variable() { return this; @@ -1129,6 +1141,8 @@ public: virtual ir_dereference_array *clone(struct hash_table *) const; + virtual ir_constant *constant_expression_value(); + virtual ir_dereference_array *as_dereference_array() { return this; @@ -1165,6 +1179,8 @@ public: virtual ir_dereference_record *clone(struct hash_table *) const; + virtual ir_constant *constant_expression_value(); + /** * Get the variable that is ultimately referenced by an r-value */ @@ -1223,6 +1239,8 @@ public: virtual ir_constant *clone(struct hash_table *) const; + virtual ir_constant *constant_expression_value(); + virtual ir_constant *as_constant() { return this; |