| 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 for (intptr_t k = 0; k < phi->InputCount(); k++) { | |
| 132 Value* val = phi->InputAt(k); | |
| 133 if (val->IsUse()) { | |
| 134 BlockEntryInstr* pred = block->PredecessorAt(k); | |
| 135 const intptr_t use = val->AsUse()->definition()->ssa_temp_index(); | |
| 136 live_out_[pred->postorder_number()]->Add(use); | |
| 137 } | |
| 138 } | |
| 139 } | 130 } |
| 140 } | 131 } |
| 141 } | 132 } |
| 142 } | 133 } |
| 143 | 134 |
| 144 // Process incoming parameters. | 135 // Process incoming parameters. |
| 145 GraphEntryInstr* graph_entry = postorder_[block_count - 1]->AsGraphEntry(); | 136 GraphEntryInstr* graph_entry = postorder_[block_count - 1]->AsGraphEntry(); |
| 146 for (intptr_t i = 0; i < graph_entry->start_env()->values().length(); i++) { | 137 for (intptr_t i = 0; i < graph_entry->start_env()->values().length(); i++) { |
| 147 Value* val = graph_entry->start_env()->values()[i]; | 138 Value* val = graph_entry->start_env()->values()[i]; |
| 148 if (val->IsUse()) { | 139 if (val->IsUse()) { |
| (...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1664 | 1655 |
| 1665 if (FLAG_trace_ssa_allocator) { | 1656 if (FLAG_trace_ssa_allocator) { |
| 1666 OS::Print("-- ir after allocation -------------------------\n"); | 1657 OS::Print("-- ir after allocation -------------------------\n"); |
| 1667 FlowGraphPrinter printer(Function::Handle(), block_order_, true); | 1658 FlowGraphPrinter printer(Function::Handle(), block_order_, true); |
| 1668 printer.PrintBlocks(); | 1659 printer.PrintBlocks(); |
| 1669 } | 1660 } |
| 1670 } | 1661 } |
| 1671 | 1662 |
| 1672 | 1663 |
| 1673 } // namespace dart | 1664 } // namespace dart |
| OLD | NEW |