1 | // Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file |
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. |
4 | // Class for intrinsifying functions. |
5 | |
6 | #ifndef RUNTIME_VM_COMPILER_GRAPH_INTRINSIFIER_H_ |
7 | #define RUNTIME_VM_COMPILER_GRAPH_INTRINSIFIER_H_ |
8 | |
9 | #if defined(DART_PRECOMPILED_RUNTIME) |
10 | #error "AOT runtime should not use compiler sources (including header files)" |
11 | #endif // defined(DART_PRECOMPILED_RUNTIME) |
12 | |
13 | #include "vm/allocation.h" |
14 | #include "vm/compiler/recognized_methods_list.h" |
15 | |
16 | namespace dart { |
17 | |
18 | // Forward declarations. |
19 | class FlowGraphCompiler; |
20 | class ParsedFunction; |
21 | class FlowGraph; |
22 | |
23 | namespace compiler { |
24 | class Assembler; |
25 | class Label; |
26 | |
27 | class GraphIntrinsifier : public AllStatic { |
28 | public: |
29 | static intptr_t ParameterSlotFromSp(); |
30 | |
31 | static bool GraphIntrinsify(const ParsedFunction& parsed_function, |
32 | FlowGraphCompiler* compiler); |
33 | |
34 | static void IntrinsicCallPrologue(Assembler* assembler); |
35 | static void IntrinsicCallEpilogue(Assembler* assembler); |
36 | |
37 | private: |
38 | #define DECLARE_FUNCTION(class_name, function_name, enum_name, fp) \ |
39 | static void enum_name(Assembler* assembler, Label* normal_ir_body); |
40 | |
41 | GRAPH_INTRINSICS_LIST(DECLARE_FUNCTION) |
42 | |
43 | #undef DECLARE_FUNCTION |
44 | |
45 | #define DECLARE_FUNCTION(class_name, function_name, enum_name, fp) \ |
46 | static bool Build_##enum_name(FlowGraph* flow_graph); |
47 | |
48 | GRAPH_INTRINSICS_LIST(DECLARE_FUNCTION) |
49 | |
50 | #undef DECLARE_FUNCTION |
51 | |
52 | static bool Build_ImplicitGetter(FlowGraph* flow_graph); |
53 | static bool Build_ImplicitSetter(FlowGraph* flow_graph); |
54 | }; |
55 | |
56 | } // namespace compiler |
57 | } // namespace dart |
58 | |
59 | #endif // RUNTIME_VM_COMPILER_GRAPH_INTRINSIFIER_H_ |
60 | |