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.
5 #ifndef V8_COMPILER_SIMPLIFIED_OPERATOR_REDUCER_H_
6 #define V8_COMPILER_SIMPLIFIED_OPERATOR_REDUCER_H_
8 #include "src/compiler/graph-reducer.h"
9 #include "src/compiler/simplified-operator.h"
14 // Forward declarations.
20 // Forward declarations.
21 class CommonOperatorBuilder;
23 class MachineOperatorBuilder;
25 class SimplifiedOperatorReducer FINAL : public Reducer {
27 explicit SimplifiedOperatorReducer(JSGraph* jsgraph);
28 ~SimplifiedOperatorReducer() FINAL;
30 Reduction Reduce(Node* node) FINAL;
33 Reduction ReduceAnyToBoolean(Node* node);
35 Reduction Change(Node* node, const Operator* op, Node* a);
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));
41 Reduction ReplaceNumber(double value);
42 Reduction ReplaceNumber(int32_t value);
45 Factory* factory() const;
46 JSGraph* jsgraph() const { return jsgraph_; }
47 CommonOperatorBuilder* common() const;
48 MachineOperatorBuilder* machine() const;
49 SimplifiedOperatorBuilder* simplified() { return &simplified_; }
52 SimplifiedOperatorBuilder simplified_;
54 DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorReducer);
57 } // namespace compiler
58 } // namespace internal
61 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_REDUCER_H_