OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/il_printer.h" | 5 #include "vm/il_printer.h" |
6 | 6 |
7 #include "vm/intermediate_language.h" | 7 #include "vm/intermediate_language.h" |
8 #include "vm/os.h" | 8 #include "vm/os.h" |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 } | 57 } |
58 | 58 |
59 | 59 |
60 void FlowGraphPrinter::PrintInstruction(Instruction* instr) { | 60 void FlowGraphPrinter::PrintInstruction(Instruction* instr) { |
61 char str[1000]; | 61 char str[1000]; |
62 BufferFormatter f(str, sizeof(str)); | 62 BufferFormatter f(str, sizeof(str)); |
63 instr->PrintTo(&f); | 63 instr->PrintTo(&f); |
64 if (FLAG_print_environments && (instr->env() != NULL)) { | 64 if (FLAG_print_environments && (instr->env() != NULL)) { |
65 instr->env()->PrintTo(&f); | 65 instr->env()->PrintTo(&f); |
66 } | 66 } |
67 if (print_locations_ && instr->locs() != NULL) { | |
srdjan
2012/07/10 23:27:54
Add parenthesis.
Vyacheslav Egorov (Google)
2012/07/11 13:27:58
Done.
| |
68 instr->locs()->PrintTo(&f); | |
69 } | |
70 if (instr->pos() != -1) OS::Print("%3d: ", instr->pos()); | |
67 OS::Print("%s", str); | 71 OS::Print("%s", str); |
68 } | 72 } |
69 | 73 |
70 | 74 |
71 void FlowGraphPrinter::PrintComputation(Computation* comp) { | 75 void FlowGraphPrinter::PrintComputation(Computation* comp) { |
72 char str[1000]; | 76 char str[1000]; |
73 BufferFormatter f(str, sizeof(str)); | 77 BufferFormatter f(str, sizeof(str)); |
74 comp->PrintTo(&f); | 78 comp->PrintTo(&f); |
75 OS::Print("%s", str); | 79 OS::Print("%s", str); |
76 } | 80 } |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
410 if (is_negated()) { | 414 if (is_negated()) { |
411 f->Print(" (negated)"); | 415 f->Print(" (negated)"); |
412 } | 416 } |
413 f->Print(" goto (%d, %d)", | 417 f->Print(" goto (%d, %d)", |
414 true_successor()->block_id(), | 418 true_successor()->block_id(), |
415 false_successor()->block_id()); | 419 false_successor()->block_id()); |
416 } | 420 } |
417 | 421 |
418 | 422 |
419 void ParallelMoveInstr::PrintTo(BufferFormatter* f) const { | 423 void ParallelMoveInstr::PrintTo(BufferFormatter* f) const { |
420 UNIMPLEMENTED(); | 424 f->Print(" %s ", DebugName()); |
425 for (intptr_t i = 0; i < moves_.length(); i++) { | |
426 if (i != 0) f->Print(", "); | |
427 f->Print("%s = %s", moves_[i].dest().Name(), moves_[i].src().Name()); | |
428 } | |
421 } | 429 } |
422 | 430 |
423 | 431 |
424 void FlowGraphVisualizer::Print(const char* format, ...) { | 432 void FlowGraphVisualizer::Print(const char* format, ...) { |
425 char str[1000]; | 433 char str[1000]; |
426 BufferFormatter f(str, sizeof(str)); | 434 BufferFormatter f(str, sizeof(str)); |
427 f.Print("%*s", 2 * indent_, ""); | 435 f.Print("%*s", 2 * indent_, ""); |
428 va_list args; | 436 va_list args; |
429 va_start(args, format); | 437 va_start(args, format); |
430 f.VPrint(format, args); | 438 f.VPrint(format, args); |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
660 void ParallelMoveInstr::PrintToVisualizer(BufferFormatter* f) const { | 668 void ParallelMoveInstr::PrintToVisualizer(BufferFormatter* f) const { |
661 UNIMPLEMENTED(); | 669 UNIMPLEMENTED(); |
662 } | 670 } |
663 | 671 |
664 | 672 |
665 void Environment::PrintTo(BufferFormatter* f) const { | 673 void Environment::PrintTo(BufferFormatter* f) const { |
666 f->Print(" env={ "); | 674 f->Print(" env={ "); |
667 for (intptr_t i = 0; i < values_.length(); ++i) { | 675 for (intptr_t i = 0; i < values_.length(); ++i) { |
668 if (i > 0) f->Print(", "); | 676 if (i > 0) f->Print(", "); |
669 values_[i]->PrintTo(f); | 677 values_[i]->PrintTo(f); |
678 if (i < locations_.length() && !locations_[i].IsInvalid()) { | |
679 f->Print(" [%s]", locations_[i].Name()); | |
srdjan
2012/07/10 23:27:54
Add parenthesis, fix indent.
Vyacheslav Egorov (Google)
2012/07/11 13:27:58
Done.
| |
680 } | |
670 } | 681 } |
671 f->Print(" }"); | 682 f->Print(" }"); |
672 } | 683 } |
673 | 684 |
674 } // namespace dart | 685 } // namespace dart |
OLD | NEW |