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_SELECT_LOWERING_H_ | 5 #ifndef V8_COMPILER_SELECT_LOWERING_H_ |
6 #define V8_COMPILER_SELECT_LOWERING_H_ | 6 #define V8_COMPILER_SELECT_LOWERING_H_ |
7 | 7 |
8 #include <map> | |
9 | |
10 #include "src/compiler/graph-reducer.h" | 8 #include "src/compiler/graph-reducer.h" |
11 #include "src/zone-allocator.h" | |
12 | 9 |
13 namespace v8 { | 10 namespace v8 { |
14 namespace internal { | 11 namespace internal { |
15 namespace compiler { | 12 namespace compiler { |
16 | 13 |
17 // Forward declarations. | 14 // Forward declarations. |
18 class CommonOperatorBuilder; | 15 class CommonOperatorBuilder; |
19 class Graph; | 16 class Graph; |
20 | 17 |
21 | 18 |
22 // Lowers Select nodes to diamonds. | 19 // Lowers Select nodes to diamonds. |
23 class SelectLowering final : public Reducer { | 20 class SelectLowering final : public Reducer { |
24 public: | 21 public: |
25 SelectLowering(Graph* graph, CommonOperatorBuilder* common); | 22 SelectLowering(Graph* graph, CommonOperatorBuilder* common); |
26 ~SelectLowering(); | 23 ~SelectLowering(); |
27 | 24 |
28 Reduction Reduce(Node* node) override; | 25 Reduction Reduce(Node* node) override; |
29 | 26 |
30 private: | 27 private: |
31 typedef std::multimap<Node*, Node*, std::less<Node*>, | |
32 zone_allocator<std::pair<Node* const, Node*>>> Merges; | |
33 | |
34 bool ReachableFrom(Node* const sink, Node* const source); | |
35 | |
36 CommonOperatorBuilder* common() const { return common_; } | 28 CommonOperatorBuilder* common() const { return common_; } |
37 Graph* graph() const { return graph_; } | 29 Graph* graph() const { return graph_; } |
38 | 30 |
39 CommonOperatorBuilder* common_; | 31 CommonOperatorBuilder* common_; |
40 Graph* graph_; | 32 Graph* graph_; |
41 Merges merges_; | |
42 }; | 33 }; |
43 | 34 |
44 } // namespace compiler | 35 } // namespace compiler |
45 } // namespace internal | 36 } // namespace internal |
46 } // namespace v8 | 37 } // namespace v8 |
47 | 38 |
48 #endif // V8_COMPILER_SELECT_LOWERING_H_ | 39 #endif // V8_COMPILER_SELECT_LOWERING_H_ |
OLD | NEW |