| 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/flow_graph_allocator.h" | 5 #include "vm/flow_graph_allocator.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 #include "vm/il_printer.h" | 9 #include "vm/il_printer.h" |
| 10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 | 360 |
| 361 | 361 |
| 362 void FlowGraphAllocator::BuildLiveRanges() { | 362 void FlowGraphAllocator::BuildLiveRanges() { |
| 363 NumberInstructions(); | 363 NumberInstructions(); |
| 364 | 364 |
| 365 const intptr_t block_count = postorder_.length(); | 365 const intptr_t block_count = postorder_.length(); |
| 366 ASSERT(postorder_[block_count - 1]->IsGraphEntry()); | 366 ASSERT(postorder_[block_count - 1]->IsGraphEntry()); |
| 367 for (intptr_t i = 0; i < (block_count - 1); i++) { | 367 for (intptr_t i = 0; i < (block_count - 1); i++) { |
| 368 BlockEntryInstr* block = postorder_[i]; | 368 BlockEntryInstr* block = postorder_[i]; |
| 369 | 369 |
| 370 // For every SSA value that is live out of this block create an interval | 370 // For every SSA value that is live out of this block, create an interval |
| 371 // that covers the hole block. It will be shortened if we encounter a | 371 // that covers the whole block. It will be shortened if we encounter a |
| 372 // definition of this value in this block. | 372 // definition of this value in this block. |
| 373 for (BitVector::Iterator it(live_out_[i]); !it.Done(); it.Advance()) { | 373 for (BitVector::Iterator it(live_out_[i]); !it.Done(); it.Advance()) { |
| 374 LiveRange* range = GetLiveRange(it.Current()); | 374 LiveRange* range = GetLiveRange(it.Current()); |
| 375 range->AddUseInterval(block->start_pos(), block->end_pos()); | 375 range->AddUseInterval(block->start_pos(), block->end_pos()); |
| 376 } | 376 } |
| 377 | 377 |
| 378 // Connect outgoing phi-moves that were created in NumberInstructions | 378 // Connect outgoing phi-moves that were created in NumberInstructions |
| 379 // and find last instruction that contributes to liveness. | 379 // and find last instruction that contributes to liveness. |
| 380 Instruction* current = ConnectOutgoingPhiMoves(block); | 380 Instruction* current = ConnectOutgoingPhiMoves(block); |
| 381 | 381 |
| (...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1595 | 1595 |
| 1596 if (FLAG_trace_ssa_allocator) { | 1596 if (FLAG_trace_ssa_allocator) { |
| 1597 OS::Print("-- ir after allocation -------------------------\n"); | 1597 OS::Print("-- ir after allocation -------------------------\n"); |
| 1598 FlowGraphPrinter printer(Function::Handle(), block_order_, true); | 1598 FlowGraphPrinter printer(Function::Handle(), block_order_, true); |
| 1599 printer.PrintBlocks(); | 1599 printer.PrintBlocks(); |
| 1600 } | 1600 } |
| 1601 } | 1601 } |
| 1602 | 1602 |
| 1603 | 1603 |
| 1604 } // namespace dart | 1604 } // namespace dart |
| OLD | NEW |