diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2010-04-30 17:14:36 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-04-30 17:15:16 -0700 |
commit | 97ae21941c3a9c28577c13511ad0a2c674af04c4 (patch) | |
tree | 0677a91c7a37b10015b55090a329c47988c3697c | |
parent | f924180e48329004b232dd4cd9fe0b13acefb42e (diff) |
Use ir_instruction::visit_children to simplify some visitorstexture
-rw-r--r-- | ir_dead_code.cpp | 53 | ||||
-rw-r--r-- | ir_expression_flattening.cpp | 5 | ||||
-rw-r--r-- | ir_function_inlining.cpp | 11 |
3 files changed, 9 insertions, 60 deletions
diff --git a/ir_dead_code.cpp b/ir_dead_code.cpp index 8a83394..3f58642 100644 --- a/ir_dead_code.cpp +++ b/ir_dead_code.cpp @@ -114,13 +114,7 @@ ir_dead_code_visitor::visit(ir_variable *ir) void ir_dead_code_visitor::visit(ir_loop *ir) { - visit_exec_list(&ir->body_instructions, this); - if (ir->from) - ir->from->accept(this); - if (ir->to) - ir->to->accept(this); - if (ir->increment) - ir->increment->accept(this); + ir->visit_children(); } void @@ -133,7 +127,7 @@ ir_dead_code_visitor::visit(ir_loop_jump *ir) void ir_dead_code_visitor::visit(ir_function_signature *ir) { - visit_exec_list(&ir->body, this); + ir->visit_children(this); } void @@ -145,11 +139,7 @@ ir_dead_code_visitor::visit(ir_function *ir) void ir_dead_code_visitor::visit(ir_expression *ir) { - unsigned int operand; - - for (operand = 0; operand < ir->get_num_operands(); operand++) { - ir->operands[operand]->accept(this); - } + ir->visit_children(this); } @@ -242,52 +232,21 @@ ir_dead_code_visitor::visit(ir_call *ir) void ir_dead_code_visitor::visit(ir_return *ir) { - ir_rvalue *val = ir->get_value(); - - if (val) - val->accept(this); + ir->visit_children(this); } void ir_dead_code_visitor::visit(ir_if *ir) { - ir->condition->accept(this); - - visit_exec_list(&ir->then_instructions, this); - visit_exec_list(&ir->else_instructions, this); + ir->visit_children(this); } void ir_dead_code_visitor::visit(ir_texture *ir) { - ir->coordinate->accept(this); - - if (ir->projector != NULL) - ir->projector->accept(this); - - if (ir->shadow_comparitor != NULL) - ir->shadow_comparitor->accept(this); - - switch (ir->op) { - case ir_tex: - break; - - case ir_txb: - case ir_txf: - ir->lod_info.bias->accept(this); - break; - - case ir_txl: - ir->lod_info.lod->accept(this); - break; - - case ir_txd: - ir->lod_info.grad.dPdx->accept(this); - ir->lod_info.grad.dPdy->accept(this); - break; - } + ir->visit_children(this); } diff --git a/ir_expression_flattening.cpp b/ir_expression_flattening.cpp index 6341ccb..217f69e 100644 --- a/ir_expression_flattening.cpp +++ b/ir_expression_flattening.cpp @@ -165,10 +165,7 @@ ir_expression_flattening_visitor::visit(ir_swizzle *ir) void ir_expression_flattening_visitor::visit(ir_dereference *ir) { - if (ir->mode == ir_dereference::ir_reference_array) { - ir->selector.array_index->accept(this); - } - ir->var->accept(this); + ir->visit_children(this); } void diff --git a/ir_function_inlining.cpp b/ir_function_inlining.cpp index e674d16..f47d758 100644 --- a/ir_function_inlining.cpp +++ b/ir_function_inlining.cpp @@ -509,11 +509,7 @@ ir_function_inlining_visitor::visit(ir_function *ir) void ir_function_inlining_visitor::visit(ir_expression *ir) { - unsigned int operand; - - for (operand = 0; operand < ir->get_num_operands(); operand++) { - ir->operands[operand]->accept(this); - } + ir->visit_children(this); } @@ -527,10 +523,7 @@ ir_function_inlining_visitor::visit(ir_swizzle *ir) void ir_function_inlining_visitor::visit(ir_dereference *ir) { - if (ir->mode == ir_dereference::ir_reference_array) { - ir->selector.array_index->accept(this); - } - ir->var->accept(this); + ir->visit_children(this); } void |