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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 } | 1143 } |
1144 | 1144 |
1145 const intptr_t pos = current->lifetime_position(); | 1145 const intptr_t pos = current->lifetime_position(); |
1146 ASSERT(IsInstructionStartPosition(pos)); | 1146 ASSERT(IsInstructionStartPosition(pos)); |
1147 | 1147 |
1148 ASSERT(locs->input_count() == current->InputCount()); | 1148 ASSERT(locs->input_count() == current->InputCount()); |
1149 | 1149 |
1150 // Normalize same-as-first-input output if input is specified as | 1150 // Normalize same-as-first-input output if input is specified as |
1151 // fixed register. | 1151 // fixed register. |
1152 if (locs->out(0).IsUnallocated() && | 1152 if (locs->out(0).IsUnallocated() && |
1153 (locs->out(0).policy() == Location::kSameAsFirstInput) && | 1153 (locs->out(0).policy() == Location::kSameAsFirstInput)) { |
1154 (locs->in(0).IsMachineRegister())) { | 1154 if (locs->in(0).IsPairLocation()) { |
1155 locs->set_out(0, locs->in(0)); | 1155 // Pair input, pair output. |
| 1156 PairLocation* in_pair = locs->in(0).AsPairLocation(); |
| 1157 ASSERT(in_pair->At(0).IsMachineRegister() == |
| 1158 in_pair->At(1).IsMachineRegister()); |
| 1159 if (in_pair->At(0).IsMachineRegister() && |
| 1160 in_pair->At(1).IsMachineRegister()) { |
| 1161 locs->set_out(0, Location::Pair(in_pair->At(0), in_pair->At(1))); |
| 1162 } |
| 1163 } else if (locs->in(0).IsMachineRegister()) { |
| 1164 // Single input, single output. |
| 1165 locs->set_out(0, locs->in(0)); |
| 1166 } |
1156 } | 1167 } |
1157 | 1168 |
1158 const bool output_same_as_first_input = | 1169 const bool output_same_as_first_input = |
1159 locs->out(0).IsUnallocated() && | 1170 locs->out(0).IsUnallocated() && |
1160 (locs->out(0).policy() == Location::kSameAsFirstInput); | 1171 (locs->out(0).policy() == Location::kSameAsFirstInput); |
1161 | 1172 |
1162 // Output is same as first input which is a pair. | 1173 // Output is same as first input which is a pair. |
1163 if (output_same_as_first_input && locs->in(0).IsPairLocation()) { | 1174 if (output_same_as_first_input && locs->in(0).IsPairLocation()) { |
1164 // Make out into a PairLocation. | 1175 // Make out into a PairLocation. |
1165 locs->set_out(0, Location::Pair(Location::RequiresRegister(), | 1176 locs->set_out(0, Location::Pair(Location::RequiresRegister(), |
(...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2887 OS::Print("-- [after ssa allocator] ir [%s] -------------\n", | 2898 OS::Print("-- [after ssa allocator] ir [%s] -------------\n", |
2888 function.ToFullyQualifiedCString()); | 2899 function.ToFullyQualifiedCString()); |
2889 FlowGraphPrinter printer(flow_graph_, true); | 2900 FlowGraphPrinter printer(flow_graph_, true); |
2890 printer.PrintBlocks(); | 2901 printer.PrintBlocks(); |
2891 OS::Print("----------------------------------------------\n"); | 2902 OS::Print("----------------------------------------------\n"); |
2892 } | 2903 } |
2893 } | 2904 } |
2894 | 2905 |
2895 | 2906 |
2896 } // namespace dart | 2907 } // namespace dart |
OLD | NEW |