Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef V8_COMPILER_COMMON_OPERATOR_REDUCER_H_ |
| 6 | #define V8_COMPILER_COMMON_OPERATOR_REDUCER_H_ |
| 7 | |
| 8 | #include "src/compiler/graph-reducer.h" |
| 9 | |
| 10 | namespace v8 { |
| 11 | namespace internal { |
| 12 | namespace compiler { |
| 13 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 14 | // Forward declarations. |
| 15 | class CommonOperatorBuilder; |
| 16 | class Graph; |
| 17 | class MachineOperatorBuilder; |
| 18 | class Operator; |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 19 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 20 | |
| 21 | // Performs strength reduction on nodes that have common operators. |
| 22 | class CommonOperatorReducer final : public AdvancedReducer { |
| 23 | public: |
| 24 | CommonOperatorReducer(Editor* editor, Graph* graph, |
| 25 | CommonOperatorBuilder* common, |
| 26 | MachineOperatorBuilder* machine); |
| 27 | ~CommonOperatorReducer() final {} |
| 28 | |
| 29 | Reduction Reduce(Node* node) final; |
| 30 | |
| 31 | private: |
| 32 | Reduction ReduceBranch(Node* node); |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 33 | Reduction ReduceDeoptimizeConditional(Node* node); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 34 | Reduction ReduceMerge(Node* node); |
| 35 | Reduction ReduceEffectPhi(Node* node); |
| 36 | Reduction ReducePhi(Node* node); |
| 37 | Reduction ReduceReturn(Node* node); |
| 38 | Reduction ReduceSelect(Node* node); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 39 | |
| 40 | Reduction Change(Node* node, Operator const* op, Node* a); |
| 41 | Reduction Change(Node* node, Operator const* op, Node* a, Node* b); |
| 42 | |
| 43 | Graph* graph() const { return graph_; } |
| 44 | CommonOperatorBuilder* common() const { return common_; } |
| 45 | MachineOperatorBuilder* machine() const { return machine_; } |
| 46 | Node* dead() const { return dead_; } |
| 47 | |
| 48 | Graph* const graph_; |
| 49 | CommonOperatorBuilder* const common_; |
| 50 | MachineOperatorBuilder* const machine_; |
| 51 | Node* const dead_; |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | } // namespace compiler |
| 55 | } // namespace internal |
| 56 | } // namespace v8 |
| 57 | |
| 58 | #endif // V8_COMPILER_COMMON_OPERATOR_REDUCER_H_ |