Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [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_SIMPLIFIED_OPERATOR_REDUCER_H_ |
| 6 | #define V8_COMPILER_SIMPLIFIED_OPERATOR_REDUCER_H_ |
| 7 | |
| 8 | #include "src/compiler/graph-reducer.h" |
| 9 | |
| 10 | namespace v8 { |
| 11 | namespace internal { |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 12 | namespace compiler { |
| 13 | |
| 14 | // Forward declarations. |
| 15 | class JSGraph; |
| 16 | class MachineOperatorBuilder; |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame^] | 17 | class SimplifiedOperatorBuilder; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 18 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame^] | 19 | |
| 20 | class SimplifiedOperatorReducer final : public Reducer { |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 21 | public: |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 22 | explicit SimplifiedOperatorReducer(JSGraph* jsgraph); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame^] | 23 | ~SimplifiedOperatorReducer() final; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 24 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame^] | 25 | Reduction Reduce(Node* node) final; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 26 | |
| 27 | private: |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame^] | 28 | Reduction ReduceReferenceEqual(Node* node); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 29 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 30 | Reduction Change(Node* node, const Operator* op, Node* a); |
| 31 | Reduction ReplaceFloat64(double value); |
| 32 | Reduction ReplaceInt32(int32_t value); |
| 33 | Reduction ReplaceUint32(uint32_t value) { |
| 34 | return ReplaceInt32(bit_cast<int32_t>(value)); |
| 35 | } |
| 36 | Reduction ReplaceNumber(double value); |
| 37 | Reduction ReplaceNumber(int32_t value); |
| 38 | |
| 39 | Graph* graph() const; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 40 | JSGraph* jsgraph() const { return jsgraph_; } |
| 41 | MachineOperatorBuilder* machine() const; |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame^] | 42 | SimplifiedOperatorBuilder* simplified() const; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 43 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame^] | 44 | JSGraph* const jsgraph_; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 45 | |
| 46 | DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorReducer); |
| 47 | }; |
| 48 | |
| 49 | } // namespace compiler |
| 50 | } // namespace internal |
| 51 | } // namespace v8 |
| 52 | |
| 53 | #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_REDUCER_H_ |