| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 // Handle phis. | 121 // Handle phis. |
| 122 if (block->IsJoinEntry()) { | 122 if (block->IsJoinEntry()) { |
| 123 JoinEntryInstr* join = block->AsJoinEntry(); | 123 JoinEntryInstr* join = block->AsJoinEntry(); |
| 124 if (join->phis() != NULL) { | 124 if (join->phis() != NULL) { |
| 125 for (intptr_t j = 0; j < join->phis()->length(); j++) { | 125 for (intptr_t j = 0; j < join->phis()->length(); j++) { |
| 126 PhiInstr* phi = (*join->phis())[j]; | 126 PhiInstr* phi = (*join->phis())[j]; |
| 127 if (phi == NULL) continue; | 127 if (phi == NULL) continue; |
| 128 kill->Add(phi->ssa_temp_index()); | 128 kill->Add(phi->ssa_temp_index()); |
| 129 live_in->Remove(phi->ssa_temp_index()); | 129 live_in->Remove(phi->ssa_temp_index()); |
| 130 |
| 131 // If phi-operand is not defined by a predecessor it must be marked |
| 132 // live-in for a predecessor. |
| 133 for (intptr_t k = 0; k < phi->InputCount(); k++) { |
| 134 Value* val = phi->InputAt(k); |
| 135 if (val->IsUse()) { |
| 136 BlockEntryInstr* pred = block->PredecessorAt(k); |
| 137 const intptr_t use = val->AsUse()->definition()->ssa_temp_index(); |
| 138 if (!kill_[pred->postorder_number()]->Contains(use)) { |
| 139 live_in_[pred->postorder_number()]->Add(use); |
| 140 } |
| 141 } |
| 142 } |
| 130 } | 143 } |
| 131 } | 144 } |
| 132 } | 145 } |
| 133 } | 146 } |
| 134 | 147 |
| 135 // Process incoming parameters. | 148 // Process incoming parameters. |
| 136 GraphEntryInstr* graph_entry = postorder_[block_count - 1]->AsGraphEntry(); | 149 GraphEntryInstr* graph_entry = postorder_[block_count - 1]->AsGraphEntry(); |
| 137 for (intptr_t i = 0; i < graph_entry->start_env()->values().length(); i++) { | 150 for (intptr_t i = 0; i < graph_entry->start_env()->values().length(); i++) { |
| 138 Value* val = graph_entry->start_env()->values()[i]; | 151 Value* val = graph_entry->start_env()->values()[i]; |
| 139 if (val->IsUse()) { | 152 if (val->IsUse()) { |
| (...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1659 | 1672 |
| 1660 if (FLAG_trace_ssa_allocator) { | 1673 if (FLAG_trace_ssa_allocator) { |
| 1661 OS::Print("-- ir after allocation -------------------------\n"); | 1674 OS::Print("-- ir after allocation -------------------------\n"); |
| 1662 FlowGraphPrinter printer(Function::Handle(), block_order_, true); | 1675 FlowGraphPrinter printer(Function::Handle(), block_order_, true); |
| 1663 printer.PrintBlocks(); | 1676 printer.PrintBlocks(); |
| 1664 } | 1677 } |
| 1665 } | 1678 } |
| 1666 | 1679 |
| 1667 | 1680 |
| 1668 } // namespace dart | 1681 } // namespace dart |
| OLD | NEW |