Index: src/compiler/machine-operator-reducer.h |
diff --git a/src/compiler/machine-operator-reducer.h b/src/compiler/machine-operator-reducer.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..46d2931e9949a9b674c1e8baca5382b8f6253e9f |
--- /dev/null |
+++ b/src/compiler/machine-operator-reducer.h |
@@ -0,0 +1,52 @@ |
+// Copyright 2014 the V8 project authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef V8_COMPILER_MACHINE_OPERATOR_REDUCER_H_ |
+#define V8_COMPILER_MACHINE_OPERATOR_REDUCER_H_ |
+ |
+#include "src/compiler/common-operator.h" |
+#include "src/compiler/graph-reducer.h" |
+#include "src/compiler/machine-operator.h" |
+ |
+namespace v8 { |
+namespace internal { |
+namespace compiler { |
+ |
+// Forward declarations. |
+class CommonNodeCache; |
+ |
+// Performs constant folding and strength reduction on nodes that have |
+// machine operators. |
+class MachineOperatorReducer : public Reducer { |
+ public: |
+ explicit MachineOperatorReducer(Graph* graph); |
+ |
+ MachineOperatorReducer(Graph* graph, CommonNodeCache* cache); |
+ |
+ virtual Reduction Reduce(Node* node); |
+ |
+ private: |
+ Graph* graph_; |
+ CommonNodeCache* cache_; |
+ CommonOperatorBuilder common_; |
+ MachineOperatorBuilder machine_; |
+ |
+ Node* Int32Constant(int32_t value); |
+ Node* Float64Constant(volatile double value); |
+ |
+ Reduction ReplaceBool(bool value) { return ReplaceInt32(value ? 1 : 0); } |
+ |
+ Reduction ReplaceInt32(int32_t value) { |
+ return Replace(Int32Constant(value)); |
+ } |
+ |
+ Reduction ReplaceFloat64(volatile double value) { |
+ return Replace(Float64Constant(value)); |
+ } |
+}; |
+} |
+} |
+} // namespace v8::internal::compiler |
+ |
+#endif // V8_COMPILER_MACHINE_OPERATOR_REDUCER_H_ |