| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 void Computation::PrintOperandsTo(BufferFormatter* f) const { | 80 void Computation::PrintOperandsTo(BufferFormatter* f) const { |
| 81 for (int i = 0; i < InputCount(); ++i) { | 81 for (int i = 0; i < InputCount(); ++i) { |
| 82 if (i > 0) f->Print(", "); | 82 if (i > 0) f->Print(", "); |
| 83 if (InputAt(i) != NULL) InputAt(i)->PrintTo(f); | 83 if (InputAt(i) != NULL) InputAt(i)->PrintTo(f); |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 | 86 |
| 87 | 87 |
| 88 void UseVal::PrintTo(BufferFormatter* f) const { | 88 void UseVal::PrintTo(BufferFormatter* f) const { |
| 89 if (definition()->ssa_temp_index() != -1) { | 89 if (definition()->ssa_temp_index() != -1) { |
| 90 f->Print("t%d", definition()->ssa_temp_index()); | 90 f->Print("v%d", definition()->ssa_temp_index()); |
| 91 } else { | 91 } else { |
| 92 f->Print("t%d", definition()->temp_index()); | 92 f->Print("t%d", definition()->temp_index()); |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 | 96 |
| 97 void ConstantVal::PrintTo(BufferFormatter* f) const { | 97 void ConstantVal::PrintTo(BufferFormatter* f) const { |
| 98 f->Print("#%s", value().ToCString()); | 98 f->Print("#%s", value().ToCString()); |
| 99 } | 99 } |
| 100 | 100 |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 for (intptr_t i = 0; i < phis_->length(); ++i) { | 351 for (intptr_t i = 0; i < phis_->length(); ++i) { |
| 352 if ((*phis_)[i] == NULL) continue; | 352 if ((*phis_)[i] == NULL) continue; |
| 353 f->Print("\n"); | 353 f->Print("\n"); |
| 354 (*phis_)[i]->PrintTo(f); | 354 (*phis_)[i]->PrintTo(f); |
| 355 } | 355 } |
| 356 } | 356 } |
| 357 } | 357 } |
| 358 | 358 |
| 359 | 359 |
| 360 void PhiInstr::PrintTo(BufferFormatter* f) const { | 360 void PhiInstr::PrintTo(BufferFormatter* f) const { |
| 361 f->Print(" t%d <- phi(", ssa_temp_index()); | 361 f->Print(" v%d <- phi(", ssa_temp_index()); |
| 362 for (intptr_t i = 0; i < inputs_.length(); ++i) { | 362 for (intptr_t i = 0; i < inputs_.length(); ++i) { |
| 363 if (inputs_[i] != NULL) inputs_[i]->PrintTo(f); | 363 if (inputs_[i] != NULL) inputs_[i]->PrintTo(f); |
| 364 if (i < inputs_.length() - 1) f->Print(","); | 364 if (i < inputs_.length() - 1) f->Print(","); |
| 365 } | 365 } |
| 366 f->Print(")"); | 366 f->Print(")"); |
| 367 } | 367 } |
| 368 | 368 |
| 369 | 369 |
| 370 void TargetEntryInstr::PrintTo(BufferFormatter* f) const { | 370 void TargetEntryInstr::PrintTo(BufferFormatter* f) const { |
| 371 f->Print("%2d: [target", block_id()); | 371 f->Print("%2d: [target", block_id()); |
| 372 if (HasTryIndex()) { | 372 if (HasTryIndex()) { |
| 373 f->Print(" catch %d]", try_index()); | 373 f->Print(" catch %d]", try_index()); |
| 374 } else { | 374 } else { |
| 375 f->Print("]"); | 375 f->Print("]"); |
| 376 } | 376 } |
| 377 } | 377 } |
| 378 | 378 |
| 379 | 379 |
| 380 void DoInstr::PrintTo(BufferFormatter* f) const { | 380 void DoInstr::PrintTo(BufferFormatter* f) const { |
| 381 f->Print(" "); | 381 f->Print(" "); |
| 382 computation()->PrintTo(f); | 382 computation()->PrintTo(f); |
| 383 } | 383 } |
| 384 | 384 |
| 385 | 385 |
| 386 void BindInstr::PrintTo(BufferFormatter* f) const { | 386 void BindInstr::PrintTo(BufferFormatter* f) const { |
| 387 if (ssa_temp_index() != -1) { | 387 if (ssa_temp_index() != -1) { |
| 388 f->Print(" t%d <- ", ssa_temp_index()); | 388 f->Print(" v%d <- ", ssa_temp_index()); |
| 389 } else { | 389 } else { |
| 390 f->Print(" t%d <- ", temp_index()); | 390 f->Print(" t%d <- ", temp_index()); |
| 391 } | 391 } |
| 392 computation()->PrintTo(f); | 392 computation()->PrintTo(f); |
| 393 } | 393 } |
| 394 | 394 |
| 395 | 395 |
| 396 void ReturnInstr::PrintTo(BufferFormatter* f) const { | 396 void ReturnInstr::PrintTo(BufferFormatter* f) const { |
| 397 f->Print(" %s ", DebugName()); | 397 f->Print(" %s ", DebugName()); |
| 398 value()->PrintTo(f); | 398 value()->PrintTo(f); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 f->Print("_ [graph]"); | 563 f->Print("_ [graph]"); |
| 564 } | 564 } |
| 565 | 565 |
| 566 | 566 |
| 567 void JoinEntryInstr::PrintToVisualizer(BufferFormatter* f) const { | 567 void JoinEntryInstr::PrintToVisualizer(BufferFormatter* f) const { |
| 568 f->Print("_ [join]"); | 568 f->Print("_ [join]"); |
| 569 } | 569 } |
| 570 | 570 |
| 571 | 571 |
| 572 void PhiInstr::PrintToVisualizer(BufferFormatter* f) const { | 572 void PhiInstr::PrintToVisualizer(BufferFormatter* f) const { |
| 573 f->Print("t%d [", ssa_temp_index()); | 573 f->Print("v%d [", ssa_temp_index()); |
| 574 bool has_constant = false; | 574 bool has_constant = false; |
| 575 for (intptr_t i = 0; i < InputCount(); ++i) { | 575 for (intptr_t i = 0; i < InputCount(); ++i) { |
| 576 if (i > 0) f->Print(" "); | 576 if (i > 0) f->Print(" "); |
| 577 if (InputAt(i)->IsConstant()) { | 577 if (InputAt(i)->IsConstant()) { |
| 578 f->Print("const"); | 578 f->Print("const"); |
| 579 has_constant = true; | 579 has_constant = true; |
| 580 } else { | 580 } else { |
| 581 InputAt(i)->PrintTo(f); | 581 InputAt(i)->PrintTo(f); |
| 582 } | 582 } |
| 583 } | 583 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 608 | 608 |
| 609 | 609 |
| 610 void DoInstr::PrintToVisualizer(BufferFormatter* f) const { | 610 void DoInstr::PrintToVisualizer(BufferFormatter* f) const { |
| 611 f->Print("_ "); | 611 f->Print("_ "); |
| 612 computation()->PrintTo(f); | 612 computation()->PrintTo(f); |
| 613 } | 613 } |
| 614 | 614 |
| 615 | 615 |
| 616 void BindInstr::PrintToVisualizer(BufferFormatter* f) const { | 616 void BindInstr::PrintToVisualizer(BufferFormatter* f) const { |
| 617 if (ssa_temp_index() != -1) { | 617 if (ssa_temp_index() != -1) { |
| 618 f->Print("t%d ", ssa_temp_index()); | 618 f->Print("v%d ", ssa_temp_index()); |
| 619 } else { | 619 } else { |
| 620 f->Print("t%d ", temp_index()); | 620 f->Print("t%d ", temp_index()); |
| 621 } | 621 } |
| 622 computation()->PrintTo(f); | 622 computation()->PrintTo(f); |
| 623 } | 623 } |
| 624 | 624 |
| 625 | 625 |
| 626 void ReturnInstr::PrintToVisualizer(BufferFormatter* f) const { | 626 void ReturnInstr::PrintToVisualizer(BufferFormatter* f) const { |
| 627 f->Print("_ %s ", DebugName()); | 627 f->Print("_ %s ", DebugName()); |
| 628 value()->PrintTo(f); | 628 value()->PrintTo(f); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 647 f->Print("_ %s ", DebugName()); | 647 f->Print("_ %s ", DebugName()); |
| 648 f->Print("if "); | 648 f->Print("if "); |
| 649 value()->PrintTo(f); | 649 value()->PrintTo(f); |
| 650 f->Print(" goto (B%d, B%d)", | 650 f->Print(" goto (B%d, B%d)", |
| 651 true_successor()->block_id(), | 651 true_successor()->block_id(), |
| 652 false_successor()->block_id()); | 652 false_successor()->block_id()); |
| 653 } | 653 } |
| 654 | 654 |
| 655 | 655 |
| 656 } // namespace dart | 656 } // namespace dart |
| OLD | NEW |