blob: 979a3d03995ef851f2772db3a8daded8fe48e2d0 [file] [log] [blame]
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001// 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
10namespace v8 {
11namespace internal {
Ben Murdochb8a8cc12014-11-26 15:28:44 +000012namespace compiler {
13
14// Forward declarations.
15class JSGraph;
16class MachineOperatorBuilder;
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000017class SimplifiedOperatorBuilder;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000018
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000019
20class SimplifiedOperatorReducer final : public Reducer {
Ben Murdochb8a8cc12014-11-26 15:28:44 +000021 public:
Emily Bernierd0a1eb72015-03-24 16:35:39 -040022 explicit SimplifiedOperatorReducer(JSGraph* jsgraph);
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000023 ~SimplifiedOperatorReducer() final;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000024
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000025 Reduction Reduce(Node* node) final;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000026
27 private:
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000028 Reduction ReduceReferenceEqual(Node* node);
Emily Bernierd0a1eb72015-03-24 16:35:39 -040029
Ben Murdochb8a8cc12014-11-26 15:28:44 +000030 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 Murdochb8a8cc12014-11-26 15:28:44 +000040 JSGraph* jsgraph() const { return jsgraph_; }
41 MachineOperatorBuilder* machine() const;
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000042 SimplifiedOperatorBuilder* simplified() const;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000043
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000044 JSGraph* const jsgraph_;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000045
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_