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 // Class for intrinsifying functions. | 4 // Class for intrinsifying functions. |
5 | 5 |
6 #include "vm/assembler.h" | 6 #include "vm/assembler.h" |
7 #include "vm/compiler.h" | 7 #include "vm/compiler.h" |
8 #include "vm/cpu.h" | 8 #include "vm/cpu.h" |
9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
10 #include "vm/flow_graph.h" | 10 #include "vm/flow_graph.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 printer.PrintBlocks(); | 208 printer.PrintBlocks(); |
209 } | 209 } |
210 EmitCodeFor(compiler, graph); | 210 EmitCodeFor(compiler, graph); |
211 return true; | 211 return true; |
212 #else | 212 #else |
213 return false; | 213 return false; |
214 #endif // !defined(TARGET_ARCH_DBC) | 214 #endif // !defined(TARGET_ARCH_DBC) |
215 } | 215 } |
216 | 216 |
217 | 217 |
218 void Intrinsifier::Intrinsify(const ParsedFunction& parsed_function, | 218 // Returns true if fall-through code can be omitted. |
| 219 bool Intrinsifier::Intrinsify(const ParsedFunction& parsed_function, |
219 FlowGraphCompiler* compiler) { | 220 FlowGraphCompiler* compiler) { |
220 const Function& function = parsed_function.function(); | 221 const Function& function = parsed_function.function(); |
221 if (!CanIntrinsify(function)) { | 222 if (!CanIntrinsify(function)) { |
222 return; | 223 return false; |
223 } | 224 } |
224 | 225 |
225 ASSERT(!compiler->flow_graph().IsCompiledForOsr()); | 226 ASSERT(!compiler->flow_graph().IsCompiledForOsr()); |
226 if (GraphIntrinsify(parsed_function, compiler)) { | 227 if (GraphIntrinsify(parsed_function, compiler)) { |
227 return; | 228 return compiler->intrinsic_slow_path_label()->IsUnused(); |
228 } | 229 } |
229 | 230 |
230 #define EMIT_CASE(class_name, function_name, enum_name, type, fp) \ | 231 #define EMIT_CASE(class_name, function_name, enum_name, type, fp) \ |
231 case MethodRecognizer::k##enum_name: \ | 232 case MethodRecognizer::k##enum_name: \ |
232 compiler->assembler()->Comment("Intrinsic"); \ | 233 compiler->assembler()->Comment("Intrinsic"); \ |
233 enum_name(compiler->assembler()); \ | 234 enum_name(compiler->assembler()); \ |
234 break; | 235 break; |
235 | 236 |
236 switch (function.recognized_kind()) { | 237 switch (function.recognized_kind()) { |
237 ALL_INTRINSICS_NO_INTEGER_LIB_LIST(EMIT_CASE); | 238 ALL_INTRINSICS_NO_INTEGER_LIB_LIST(EMIT_CASE); |
(...skipping 10 matching lines...) Expand all Loading... |
248 // intrinsics. | 249 // intrinsics. |
249 #if defined(TARGET_ARCH_DBC) | 250 #if defined(TARGET_ARCH_DBC) |
250 switch (function.recognized_kind()) { | 251 switch (function.recognized_kind()) { |
251 GRAPH_INTRINSICS_LIST(EMIT_CASE) | 252 GRAPH_INTRINSICS_LIST(EMIT_CASE) |
252 default: | 253 default: |
253 break; | 254 break; |
254 } | 255 } |
255 #endif | 256 #endif |
256 | 257 |
257 #undef EMIT_INTRINSIC | 258 #undef EMIT_INTRINSIC |
| 259 return false; |
258 } | 260 } |
259 | 261 |
260 | 262 |
261 #if !defined(TARGET_ARCH_DBC) | 263 #if !defined(TARGET_ARCH_DBC) |
262 static intptr_t CidForRepresentation(Representation rep) { | 264 static intptr_t CidForRepresentation(Representation rep) { |
263 switch (rep) { | 265 switch (rep) { |
264 case kUnboxedDouble: | 266 case kUnboxedDouble: |
265 return kDoubleCid; | 267 return kDoubleCid; |
266 case kUnboxedFloat32x4: | 268 case kUnboxedFloat32x4: |
267 return kFloat32x4Cid; | 269 return kFloat32x4Cid; |
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1267 TargetEntryInstr* normal_entry = graph_entry->normal_entry(); | 1269 TargetEntryInstr* normal_entry = graph_entry->normal_entry(); |
1268 BlockBuilder builder(flow_graph, normal_entry); | 1270 BlockBuilder builder(flow_graph, normal_entry); |
1269 | 1271 |
1270 return BuildInvokeMathCFunction(&builder, | 1272 return BuildInvokeMathCFunction(&builder, |
1271 MethodRecognizer::kDoubleRound); | 1273 MethodRecognizer::kDoubleRound); |
1272 } | 1274 } |
1273 #endif // !defined(TARGET_ARCH_DBC) | 1275 #endif // !defined(TARGET_ARCH_DBC) |
1274 | 1276 |
1275 | 1277 |
1276 } // namespace dart | 1278 } // namespace dart |
OLD | NEW |