OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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.h" | 10 #include "vm/flow_graph.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 live_in->Add(defn->ssa_temp_index()); | 211 live_in->Add(defn->ssa_temp_index()); |
212 if (defn->HasPairRepresentation()) { | 212 if (defn->HasPairRepresentation()) { |
213 live_in->Add(ToSecondPairVreg(defn->ssa_temp_index())); | 213 live_in->Add(ToSecondPairVreg(defn->ssa_temp_index())); |
214 } | 214 } |
215 } | 215 } |
216 } | 216 } |
217 } | 217 } |
218 } | 218 } |
219 | 219 |
220 // Handle phis. | 220 // Handle phis. |
221 if (block->IsJoinEntry()) { | 221 if (block->IsJoinEntry() || block->IsIndirectEntry()) { |
222 JoinEntryInstr* join = block->AsJoinEntry(); | 222 JoinEntryInstr* join = block->AsJoinEntry(); |
223 for (PhiIterator it(join); !it.Done(); it.Advance()) { | 223 for (PhiIterator it(join); !it.Done(); it.Advance()) { |
224 // TODO(johnmccutchan): Fix handling of PhiInstr with PairLocation. | 224 // TODO(johnmccutchan): Fix handling of PhiInstr with PairLocation. |
225 PhiInstr* phi = it.Current(); | 225 PhiInstr* phi = it.Current(); |
226 ASSERT(phi != NULL); | 226 ASSERT(phi != NULL); |
227 kill->Add(phi->ssa_temp_index()); | 227 kill->Add(phi->ssa_temp_index()); |
228 live_in->Remove(phi->ssa_temp_index()); | 228 live_in->Remove(phi->ssa_temp_index()); |
229 | 229 |
230 // If a phi input is not defined by the corresponding predecessor it | 230 // If a phi input is not defined by the corresponding predecessor it |
231 // must be marked live-in for that predecessor. | 231 // must be marked live-in for that predecessor. |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 for (BitVector::Iterator it(liveness_.GetLiveInSetAt(i)); | 568 for (BitVector::Iterator it(liveness_.GetLiveInSetAt(i)); |
569 !it.Done(); | 569 !it.Done(); |
570 it.Advance()) { | 570 it.Advance()) { |
571 LiveRange* range = GetLiveRange(it.Current()); | 571 LiveRange* range = GetLiveRange(it.Current()); |
572 if (HasOnlyUnconstrainedUsesInLoop(range, block_info)) { | 572 if (HasOnlyUnconstrainedUsesInLoop(range, block_info)) { |
573 range->MarkHasOnlyUnconstrainedUsesInLoop(block_info->loop_id()); | 573 range->MarkHasOnlyUnconstrainedUsesInLoop(block_info->loop_id()); |
574 } | 574 } |
575 } | 575 } |
576 } | 576 } |
577 | 577 |
578 if (block->IsJoinEntry()) { | 578 if (block->IsJoinEntry() || block->IsIndirectEntry()) { |
579 ConnectIncomingPhiMoves(block->AsJoinEntry()); | 579 ConnectIncomingPhiMoves(block->AsJoinEntry()); |
580 } else if (block->IsCatchBlockEntry()) { | 580 } else if (block->IsCatchBlockEntry()) { |
581 // Process initial definitions. | 581 // Process initial definitions. |
582 CatchBlockEntryInstr* catch_entry = block->AsCatchBlockEntry(); | 582 CatchBlockEntryInstr* catch_entry = block->AsCatchBlockEntry(); |
583 for (intptr_t i = 0; | 583 for (intptr_t i = 0; |
584 i < catch_entry->initial_definitions()->length(); | 584 i < catch_entry->initial_definitions()->length(); |
585 i++) { | 585 i++) { |
586 Definition* defn = (*catch_entry->initial_definitions())[i]; | 586 Definition* defn = (*catch_entry->initial_definitions())[i]; |
587 LiveRange* range = GetLiveRange(defn->ssa_temp_index()); | 587 LiveRange* range = GetLiveRange(defn->ssa_temp_index()); |
588 range->DefineAt(catch_entry->start_pos()); // Defined at block entry. | 588 range->DefineAt(catch_entry->start_pos()); // Defined at block entry. |
(...skipping 2251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2840 for (intptr_t i = 0; | 2840 for (intptr_t i = 0; |
2841 i < catch_entry->initial_definitions()->length(); | 2841 i < catch_entry->initial_definitions()->length(); |
2842 ++i) { | 2842 ++i) { |
2843 Definition* def = (*catch_entry->initial_definitions())[i]; | 2843 Definition* def = (*catch_entry->initial_definitions())[i]; |
2844 ASSERT(!def->HasPairRepresentation()); | 2844 ASSERT(!def->HasPairRepresentation()); |
2845 value_representations_[def->ssa_temp_index()] = | 2845 value_representations_[def->ssa_temp_index()] = |
2846 RepresentationForRange(def->representation()); | 2846 RepresentationForRange(def->representation()); |
2847 } | 2847 } |
2848 } | 2848 } |
2849 // Phis. | 2849 // Phis. |
2850 if (block->IsJoinEntry()) { | 2850 if (block->IsJoinEntry() || block->IsIndirectEntry()) { |
2851 JoinEntryInstr* join = block->AsJoinEntry(); | 2851 JoinEntryInstr* join = block->AsJoinEntry(); |
2852 for (PhiIterator it(join); !it.Done(); it.Advance()) { | 2852 for (PhiIterator it(join); !it.Done(); it.Advance()) { |
2853 // TODO(johnmccutchan): Fix handling of PhiInstr with PairLocation. | 2853 // TODO(johnmccutchan): Fix handling of PhiInstr with PairLocation. |
2854 PhiInstr* phi = it.Current(); | 2854 PhiInstr* phi = it.Current(); |
2855 if ((phi != NULL) && (phi->ssa_temp_index() >= 0)) { | 2855 if ((phi != NULL) && (phi->ssa_temp_index() >= 0)) { |
2856 ASSERT(!phi->HasPairRepresentation()); | 2856 ASSERT(!phi->HasPairRepresentation()); |
2857 value_representations_[phi->ssa_temp_index()] = | 2857 value_representations_[phi->ssa_temp_index()] = |
2858 RepresentationForRange(phi->representation()); | 2858 RepresentationForRange(phi->representation()); |
2859 } | 2859 } |
2860 } | 2860 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2945 OS::Print("-- [after ssa allocator] ir [%s] -------------\n", | 2945 OS::Print("-- [after ssa allocator] ir [%s] -------------\n", |
2946 function.ToFullyQualifiedCString()); | 2946 function.ToFullyQualifiedCString()); |
2947 FlowGraphPrinter printer(flow_graph_, true); | 2947 FlowGraphPrinter printer(flow_graph_, true); |
2948 printer.PrintBlocks(); | 2948 printer.PrintBlocks(); |
2949 OS::Print("----------------------------------------------\n"); | 2949 OS::Print("----------------------------------------------\n"); |
2950 } | 2950 } |
2951 } | 2951 } |
2952 | 2952 |
2953 | 2953 |
2954 } // namespace dart | 2954 } // namespace dart |
OLD | NEW |