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 | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 12 | |
| 13 | // Forward declarations. |
| 14 | class TypeCache; |
| 15 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 16 | namespace compiler { |
| 17 | |
| 18 | // Forward declarations. |
| 19 | class JSGraph; |
| 20 | class MachineOperatorBuilder; |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 21 | class SimplifiedOperatorBuilder; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 22 | |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame^] | 23 | class SimplifiedOperatorReducer final : public AdvancedReducer { |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 24 | public: |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame^] | 25 | SimplifiedOperatorReducer(Editor* editor, JSGraph* jsgraph); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 26 | ~SimplifiedOperatorReducer() final; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 27 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 28 | Reduction Reduce(Node* node) final; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 29 | |
| 30 | private: |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 31 | Reduction ReduceReferenceEqual(Node* node); |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame] | 32 | Reduction ReduceTypeGuard(Node* node); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 33 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 34 | Reduction Change(Node* node, const Operator* op, Node* a); |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame^] | 35 | Reduction ReplaceBoolean(bool value); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 36 | Reduction ReplaceFloat64(double value); |
| 37 | Reduction ReplaceInt32(int32_t value); |
| 38 | Reduction ReplaceUint32(uint32_t value) { |
| 39 | return ReplaceInt32(bit_cast<int32_t>(value)); |
| 40 | } |
| 41 | Reduction ReplaceNumber(double value); |
| 42 | Reduction ReplaceNumber(int32_t value); |
| 43 | |
| 44 | Graph* graph() const; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 45 | JSGraph* jsgraph() const { return jsgraph_; } |
| 46 | MachineOperatorBuilder* machine() const; |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 47 | SimplifiedOperatorBuilder* simplified() const; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 48 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 49 | JSGraph* const jsgraph_; |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 50 | TypeCache const& type_cache_; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 51 | |
| 52 | DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorReducer); |
| 53 | }; |
| 54 | |
| 55 | } // namespace compiler |
| 56 | } // namespace internal |
| 57 | } // namespace v8 |
| 58 | |
| 59 | #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_REDUCER_H_ |