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.h" | 10 #include "vm/flow_graph.h" |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 // j' i i' | 839 // j' i i' |
840 // value --* | 840 // value --* |
841 // register [-----) | 841 // register [-----) |
842 // | 842 // |
843 MoveOperands* move = | 843 MoveOperands* move = |
844 AddMoveAt(pos - 1, *in_ref, Location::Any()); | 844 AddMoveAt(pos - 1, *in_ref, Location::Any()); |
845 BlockLocation(*in_ref, pos - 1, pos + 1); | 845 BlockLocation(*in_ref, pos - 1, pos + 1); |
846 range->AddUseInterval(block->start_pos(), pos - 1); | 846 range->AddUseInterval(block->start_pos(), pos - 1); |
847 range->AddHintedUse(pos - 1, move->src_slot(), in_ref); | 847 range->AddHintedUse(pos - 1, move->src_slot(), in_ref); |
848 } else if (in_ref->IsUnallocated()) { | 848 } else if (in_ref->IsUnallocated()) { |
849 // Normal unallocated input. Expected shape of | 849 if (in_ref->policy() == Location::kWritableRegister) { |
850 // live ranges: | 850 // Writable unallocated input. Expected shape of |
851 // | 851 // live ranges: |
852 // i i' | 852 // |
853 // value -----* | 853 // i i' |
854 // | 854 // value --* |
855 ASSERT(in_ref->IsUnallocated()); | 855 // temp [--) |
856 range->AddUseInterval(block->start_pos(), pos + 1); | 856 MoveOperands* move = AddMoveAt(pos, |
857 range->AddUse(pos + 1, in_ref); | 857 Location::RequiresRegister(), |
| 858 Location::PrefersRegister()); |
| 859 |
| 860 // Add uses to the live range of the input. |
| 861 range->AddUseInterval(block->start_pos(), pos); |
| 862 range->AddUse(pos, move->src_slot()); |
| 863 |
| 864 // Create live range for the temporary. |
| 865 LiveRange* temp = MakeLiveRangeForTemporary(); |
| 866 temp->AddUseInterval(pos, pos + 1); |
| 867 temp->AddHintedUse(pos, in_ref, move->src_slot()); |
| 868 temp->AddUse(pos, move->dest_slot()); |
| 869 *in_ref = Location::RequiresRegister(); |
| 870 CompleteRange(temp, RegisterKindFromPolicy(*in_ref)); |
| 871 } else { |
| 872 // Normal unallocated input. Expected shape of |
| 873 // live ranges: |
| 874 // |
| 875 // i i' |
| 876 // value -----* |
| 877 // |
| 878 range->AddUseInterval(block->start_pos(), pos + 1); |
| 879 range->AddUse(pos + 1, in_ref); |
| 880 } |
858 } else { | 881 } else { |
859 ASSERT(in_ref->IsConstant()); | 882 ASSERT(in_ref->IsConstant()); |
860 } | 883 } |
861 } | 884 } |
862 | 885 |
863 // Process temps. | 886 // Process temps. |
864 for (intptr_t j = 0; j < locs->temp_count(); j++) { | 887 for (intptr_t j = 0; j < locs->temp_count(); j++) { |
865 // Expected shape of live range: | 888 // Expected shape of live range: |
866 // | 889 // |
867 // i i' | 890 // i i' |
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2183 OS::Print("-- [after ssa allocator] ir [%s] -------------\n", | 2206 OS::Print("-- [after ssa allocator] ir [%s] -------------\n", |
2184 function.ToFullyQualifiedCString()); | 2207 function.ToFullyQualifiedCString()); |
2185 FlowGraphPrinter printer(flow_graph_, true); | 2208 FlowGraphPrinter printer(flow_graph_, true); |
2186 printer.PrintBlocks(); | 2209 printer.PrintBlocks(); |
2187 OS::Print("----------------------------------------------\n"); | 2210 OS::Print("----------------------------------------------\n"); |
2188 } | 2211 } |
2189 } | 2212 } |
2190 | 2213 |
2191 | 2214 |
2192 } // namespace dart | 2215 } // namespace dart |
OLD | NEW |