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/flow_graph_compiler.h" | 9 #include "vm/flow_graph_compiler.h" |
10 | 10 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 const intptr_t use = ToVirtualRegister(val->AsUse()->definition()); | 59 const intptr_t use = ToVirtualRegister(val->AsUse()->definition()); |
60 if (use >= 0) { | 60 if (use >= 0) { |
61 BlockEntryInstr* pred = block->PredecessorAt(k); | 61 BlockEntryInstr* pred = block->PredecessorAt(k); |
62 live_out_[pred->postorder_number()]->Add(use); | 62 live_out_[pred->postorder_number()]->Add(use); |
63 } | 63 } |
64 } | 64 } |
65 } | 65 } |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 Instruction* current = block->StraightLineSuccessor(); | 69 Instruction* current = block->successor(); |
70 // TODO(vegorov): iterate backwards. | 70 // TODO(vegorov): iterate backwards. |
71 while ((current != NULL) && !current->IsBlockEntry()) { | 71 while ((current != NULL) && !current->IsBlockEntry()) { |
72 for (intptr_t j = 0; j < current->InputCount(); j++) { | 72 for (intptr_t j = 0; j < current->InputCount(); j++) { |
73 Value* input = current->InputAt(j); | 73 Value* input = current->InputAt(j); |
74 if (!input->IsUse()) continue; | 74 if (!input->IsUse()) continue; |
75 const intptr_t use = ToVirtualRegister(input->AsUse()->definition()); | 75 const intptr_t use = ToVirtualRegister(input->AsUse()->definition()); |
76 if ((use >= 0) && !kill->Contains(use)) live_in->Add(use); | 76 if ((use >= 0) && !kill->Contains(use)) live_in->Add(use); |
77 } | 77 } |
78 | 78 |
79 const intptr_t def = ToVirtualRegister(current); | 79 const intptr_t def = ToVirtualRegister(current); |
80 if (def >= 0) kill->Add(def); | 80 if (def >= 0) kill->Add(def); |
81 | 81 |
82 current = current->StraightLineSuccessor(); | 82 current = current->successor(); |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 // Update initial live_in sets to match live_out sets. Has to be | 86 // Update initial live_in sets to match live_out sets. Has to be |
87 // done in a separate path because of backwards branches. | 87 // done in a separate path because of backwards branches. |
88 for (intptr_t i = 0; i < block_count; i++) { | 88 for (intptr_t i = 0; i < block_count; i++) { |
89 UpdateLiveIn(postorder_[i]); | 89 UpdateLiveIn(postorder_[i]); |
90 } | 90 } |
91 } | 91 } |
92 | 92 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 OS::Print("\n"); | 176 OS::Print("\n"); |
177 | 177 |
178 PrintBitVector(" live out", live_out_[i]); | 178 PrintBitVector(" live out", live_out_[i]); |
179 PrintBitVector(" kill", kill_[i]); | 179 PrintBitVector(" kill", kill_[i]); |
180 PrintBitVector(" live in", live_in_[i]); | 180 PrintBitVector(" live in", live_in_[i]); |
181 } | 181 } |
182 } | 182 } |
183 | 183 |
184 | 184 |
185 } // namespace dart | 185 } // namespace dart |
OLD | NEW |