diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2010-05-19 13:20:12 +0200 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-05-26 15:23:25 -0700 |
commit | c7b1046a9fa6da916f11fb9e43d61fd772470183 (patch) | |
tree | ccc8b84f24edbfa38b5eb2fe3c8610274a48b52c /ir_copy_propagation.cpp | |
parent | f3a002b503542fe2544025c6a42d552fdc4907c2 (diff) |
Refactor ir_dereference support for ir_visitor
Move the accept method for visitors from ir_dereference to the derived
classes.
Diffstat (limited to 'ir_copy_propagation.cpp')
-rw-r--r-- | ir_copy_propagation.cpp | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/ir_copy_propagation.cpp b/ir_copy_propagation.cpp index aac12b3da3..47f9390710 100644 --- a/ir_copy_propagation.cpp +++ b/ir_copy_propagation.cpp @@ -78,7 +78,9 @@ public: virtual void visit(ir_function *); virtual void visit(ir_expression *); virtual void visit(ir_swizzle *); - virtual void visit(ir_dereference *); + virtual void visit(ir_dereference_variable *); + virtual void visit(ir_dereference_array *); + virtual void visit(ir_dereference_record *); virtual void visit(ir_assignment *); virtual void visit(ir_constant *); virtual void visit(ir_call *); @@ -149,31 +151,35 @@ ir_copy_propagation_visitor::visit(ir_swizzle *ir) * must not be shared by multiple IR operations! */ void -ir_copy_propagation_visitor::visit(ir_dereference *ir) +ir_copy_propagation_visitor::visit(ir_dereference_variable *ir) { - ir_variable *var; + ir_variable *var = ir->variable_referenced(); - if (ir->mode == ir_dereference::ir_reference_array) { - ir->selector.array_index->accept(this); - } - - var = ir->var->as_variable(); - if (var) { - foreach_iter(exec_list_iterator, iter, *this->acp) { - acp_entry *entry = (acp_entry *)iter.get(); + foreach_iter(exec_list_iterator, iter, *this->acp) { + acp_entry *entry = (acp_entry *)iter.get(); - if (var == entry->lhs) { - ir->var = entry->rhs; - this->progress = true; - break; - } + if (var == entry->lhs) { + ir->var = entry->rhs; + this->progress = true; + break; } - } else { - ir->var->accept(this); } } void +ir_copy_propagation_visitor::visit(ir_dereference_array *ir) +{ + ir->var->accept(this); + ir->selector.array_index->accept(this); +} + +void +ir_copy_propagation_visitor::visit(ir_dereference_record *ir) +{ + ir->var->accept(this); +} + +void ir_copy_propagation_visitor::visit(ir_assignment *ir) { if (ir->condition) |