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, JSHeapBroker* broker,
28 : CommonOperatorBuilder* common,
29 : MachineOperatorBuilder* machine, Zone* temp_zone);
30 5722238 : ~CommonOperatorReducer() final = default;
31 :
32 177 : const char* reducer_name() const override { return "CommonOperatorReducer"; }
33 :
34 : Reduction Reduce(Node* node) final;
35 :
36 : private:
37 : Reduction ReduceBranch(Node* node);
38 : Reduction ReduceDeoptimizeConditional(Node* node);
39 : Reduction ReduceMerge(Node* node);
40 : Reduction ReduceEffectPhi(Node* node);
41 : Reduction ReducePhi(Node* node);
42 : Reduction ReduceReturn(Node* node);
43 : Reduction ReduceSelect(Node* node);
44 : Reduction ReduceSwitch(Node* node);
45 :
46 : Reduction Change(Node* node, Operator const* op, Node* a);
47 : Reduction Change(Node* node, Operator const* op, Node* a, Node* b);
48 :
49 : Graph* graph() const { return graph_; }
50 : JSHeapBroker* broker() const { return broker_; }
51 : CommonOperatorBuilder* common() const { return common_; }
52 : MachineOperatorBuilder* machine() const { return machine_; }
53 : Node* dead() const { return dead_; }
54 :
55 : Graph* const graph_;
56 : JSHeapBroker* const broker_;
57 : CommonOperatorBuilder* const common_;
58 : MachineOperatorBuilder* const machine_;
59 : Node* const dead_;
60 : Zone* zone_;
61 : };
62 :
63 : } // namespace compiler
64 : } // namespace internal
65 : } // namespace v8
66 :
67 : #endif // V8_COMPILER_COMMON_OPERATOR_REDUCER_H_
|