diff options
author | Ian Romanick <[email protected]> | 2010-04-05 16:16:07 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2010-04-07 11:41:50 -0700 |
commit | fad607a9be59056aecda50176b4d20a8b5319747 (patch) | |
tree | 1d2bd8f2e5137b54c64a6d8eab04cfe02369fcd4 /ir_print_visitor.cpp | |
parent | b94e402cffc1c1606d8d7375f38ab573877e1c6a (diff) |
Add ir_loop to represent loops
This touches a lot of files because everything derived from ir_visitor
has to be updated. This is the primary disadvantage of the visitor pattern.
Diffstat (limited to 'ir_print_visitor.cpp')
-rw-r--r-- | ir_print_visitor.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ir_print_visitor.cpp b/ir_print_visitor.cpp index 375659d5cff..76524261ecd 100644 --- a/ir_print_visitor.cpp +++ b/ir_print_visitor.cpp @@ -294,3 +294,28 @@ ir_print_visitor::visit(ir_if *ir) } printf("))\n"); } + + +void +ir_print_visitor::visit(ir_loop *ir) +{ + printf("(loop ("); + if (ir->counter != NULL) + ir->counter->accept(this); + printf(") ("); + if (ir->from != NULL) + ir->from->accept(this); + printf(") ("); + if (ir->to != NULL) + ir->to->accept(this); + printf(") ("); + if (ir->increment != NULL) + ir->increment->accept(this); + printf(") ("); + foreach_iter(exec_list_iterator, iter, ir->body_instructions) { + ir_instruction *const inst = (ir_instruction *) iter.get(); + + inst->accept(this); + } + printf("))\n"); +} |