Line data Source code
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/base/compiler-specific.h"
9 : #include "src/compiler/graph-reducer.h"
10 : #include "src/globals.h"
11 :
12 : namespace v8 {
13 : namespace internal {
14 : namespace compiler {
15 :
16 : // Forward declarations.
17 : class CommonOperatorBuilder;
18 : class Graph;
19 : class MachineOperatorBuilder;
20 : class Operator;
21 :
22 :
23 : // Performs strength reduction on nodes that have common operators.
24 : class V8_EXPORT_PRIVATE CommonOperatorReducer final
25 : : public NON_EXPORTED_BASE(AdvancedReducer) {
26 : public:
27 : CommonOperatorReducer(Editor* editor, Graph* graph,
28 : CommonOperatorBuilder* common,
29 : MachineOperatorBuilder* machine);
30 2446128 : ~CommonOperatorReducer() final {}
31 :
32 : Reduction Reduce(Node* node) final;
33 :
34 : private:
35 : Reduction ReduceBranch(Node* node);
36 : Reduction ReduceDeoptimizeConditional(Node* node);
37 : Reduction ReduceMerge(Node* node);
38 : Reduction ReduceEffectPhi(Node* node);
39 : Reduction ReducePhi(Node* node);
40 : Reduction ReduceReturn(Node* node);
41 : Reduction ReduceSelect(Node* node);
42 :
43 : Reduction Change(Node* node, Operator const* op, Node* a);
44 : Reduction Change(Node* node, Operator const* op, Node* a, Node* b);
45 :
46 : Graph* graph() const { return graph_; }
47 : CommonOperatorBuilder* common() const { return common_; }
48 : MachineOperatorBuilder* machine() const { return machine_; }
49 : Node* dead() const { return dead_; }
50 :
51 : Graph* const graph_;
52 : CommonOperatorBuilder* const common_;
53 : MachineOperatorBuilder* const machine_;
54 : Node* const dead_;
55 : };
56 :
57 : } // namespace compiler
58 : } // namespace internal
59 : } // namespace v8
60 :
61 : #endif // V8_COMPILER_COMMON_OPERATOR_REDUCER_H_
|