OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_COMPILER_COMMON_OPERATOR_REDUCER_H_ | 5 #ifndef V8_COMPILER_COMMON_OPERATOR_REDUCER_H_ |
6 #define V8_COMPILER_COMMON_OPERATOR_REDUCER_H_ | 6 #define V8_COMPILER_COMMON_OPERATOR_REDUCER_H_ |
7 | 7 |
8 #include "src/compiler/graph-reducer.h" | 8 #include "src/compiler/graph-reducer.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
11 namespace internal { | 11 namespace internal { |
12 namespace compiler { | 12 namespace compiler { |
13 | 13 |
14 // Forward declarations. | 14 // Forward declarations. |
15 class CommonOperatorBuilder; | 15 class CommonOperatorBuilder; |
16 class Graph; | 16 class Graph; |
17 class MachineOperatorBuilder; | 17 class MachineOperatorBuilder; |
18 class Operator; | 18 class Operator; |
19 | 19 |
20 | 20 |
21 // Performs strength reduction on nodes that have common operators. | 21 // Performs strength reduction on nodes that have common operators. |
22 class CommonOperatorReducer final : public AdvancedReducer { | 22 class CommonOperatorReducer final : public AdvancedReducer { |
23 public: | 23 public: |
24 CommonOperatorReducer(Editor* editor, Graph* graph, | 24 CommonOperatorReducer(Editor* editor, Graph* graph, |
25 CommonOperatorBuilder* common, | 25 CommonOperatorBuilder* common, |
26 MachineOperatorBuilder* machine) | 26 MachineOperatorBuilder* machine); |
27 : AdvancedReducer(editor), | |
28 graph_(graph), | |
29 common_(common), | |
30 machine_(machine) {} | |
31 ~CommonOperatorReducer() final {} | 27 ~CommonOperatorReducer() final {} |
32 | 28 |
33 Reduction Reduce(Node* node) final; | 29 Reduction Reduce(Node* node) final; |
34 | 30 |
35 private: | 31 private: |
36 Reduction ReduceBranch(Node* node); | 32 Reduction ReduceBranch(Node* node); |
37 Reduction ReduceMerge(Node* node); | 33 Reduction ReduceMerge(Node* node); |
38 Reduction ReduceEffectPhi(Node* node); | 34 Reduction ReduceEffectPhi(Node* node); |
39 Reduction ReducePhi(Node* node); | 35 Reduction ReducePhi(Node* node); |
| 36 Reduction ReduceReturn(Node* node); |
40 Reduction ReduceSelect(Node* node); | 37 Reduction ReduceSelect(Node* node); |
41 | 38 |
42 Reduction Change(Node* node, Operator const* op, Node* a); | 39 Reduction Change(Node* node, Operator const* op, Node* a); |
43 Reduction Change(Node* node, Operator const* op, Node* a, Node* b); | 40 Reduction Change(Node* node, Operator const* op, Node* a, Node* b); |
44 | 41 |
45 Graph* graph() const { return graph_; } | 42 Graph* graph() const { return graph_; } |
46 CommonOperatorBuilder* common() const { return common_; } | 43 CommonOperatorBuilder* common() const { return common_; } |
47 MachineOperatorBuilder* machine() const { return machine_; } | 44 MachineOperatorBuilder* machine() const { return machine_; } |
| 45 Node* dead() const { return dead_; } |
48 | 46 |
49 Graph* const graph_; | 47 Graph* const graph_; |
50 CommonOperatorBuilder* const common_; | 48 CommonOperatorBuilder* const common_; |
51 MachineOperatorBuilder* const machine_; | 49 MachineOperatorBuilder* const machine_; |
52 SetOncePointer<Node> dead_; | 50 Node* const dead_; |
53 }; | 51 }; |
54 | 52 |
55 } // namespace compiler | 53 } // namespace compiler |
56 } // namespace internal | 54 } // namespace internal |
57 } // namespace v8 | 55 } // namespace v8 |
58 | 56 |
59 #endif // V8_COMPILER_COMMON_OPERATOR_REDUCER_H_ | 57 #endif // V8_COMPILER_COMMON_OPERATOR_REDUCER_H_ |
OLD | NEW |