OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_COMPILER_MACHINE_OPERATOR_REDUCER_H_ | 5 #ifndef V8_COMPILER_MACHINE_OPERATOR_REDUCER_H_ |
6 #define V8_COMPILER_MACHINE_OPERATOR_REDUCER_H_ | 6 #define V8_COMPILER_MACHINE_OPERATOR_REDUCER_H_ |
7 | 7 |
8 #include "src/compiler/graph-reducer.h" | 8 #include "src/compiler/graph-reducer.h" |
9 #include "src/compiler/machine-operator.h" | 9 #include "src/compiler/machine-operator.h" |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 Reduction Reduce(Node* node) OVERRIDE; | 27 Reduction Reduce(Node* node) OVERRIDE; |
28 | 28 |
29 private: | 29 private: |
30 Node* Float32Constant(volatile float value); | 30 Node* Float32Constant(volatile float value); |
31 Node* Float64Constant(volatile double value); | 31 Node* Float64Constant(volatile double value); |
32 Node* Int32Constant(int32_t value); | 32 Node* Int32Constant(int32_t value); |
33 Node* Int64Constant(int64_t value); | 33 Node* Int64Constant(int64_t value); |
34 Node* Uint32Constant(uint32_t value) { | 34 Node* Uint32Constant(uint32_t value) { |
35 return Int32Constant(bit_cast<uint32_t>(value)); | 35 return Int32Constant(bit_cast<uint32_t>(value)); |
36 } | 36 } |
37 Node* Word32And(Node* lhs, uint32_t rhs); | 37 Node* Word32And(Node* lhs, Node* rhs); |
| 38 Node* Word32And(Node* lhs, uint32_t rhs) { |
| 39 return Word32And(lhs, Uint32Constant(rhs)); |
| 40 } |
38 Node* Word32Sar(Node* lhs, uint32_t rhs); | 41 Node* Word32Sar(Node* lhs, uint32_t rhs); |
39 Node* Word32Shr(Node* lhs, uint32_t rhs); | 42 Node* Word32Shr(Node* lhs, uint32_t rhs); |
40 Node* Word32Equal(Node* lhs, Node* rhs); | 43 Node* Word32Equal(Node* lhs, Node* rhs); |
41 Node* Int32Add(Node* lhs, Node* rhs); | 44 Node* Int32Add(Node* lhs, Node* rhs); |
42 Node* Int32Sub(Node* lhs, Node* rhs); | 45 Node* Int32Sub(Node* lhs, Node* rhs); |
43 Node* Int32Mul(Node* lhs, Node* rhs); | 46 Node* Int32Mul(Node* lhs, Node* rhs); |
44 Node* Int32Div(Node* dividend, int32_t divisor); | 47 Node* Int32Div(Node* dividend, int32_t divisor); |
45 Node* Uint32Div(Node* dividend, uint32_t divisor); | 48 Node* Uint32Div(Node* dividend, uint32_t divisor); |
46 | 49 |
47 Reduction ReplaceBool(bool value) { return ReplaceInt32(value ? 1 : 0); } | 50 Reduction ReplaceBool(bool value) { return ReplaceInt32(value ? 1 : 0); } |
48 Reduction ReplaceFloat32(volatile float value) { | 51 Reduction ReplaceFloat32(volatile float value) { |
49 return Replace(Float32Constant(value)); | 52 return Replace(Float32Constant(value)); |
50 } | 53 } |
51 Reduction ReplaceFloat64(volatile double value) { | 54 Reduction ReplaceFloat64(volatile double value) { |
52 return Replace(Float64Constant(value)); | 55 return Replace(Float64Constant(value)); |
53 } | 56 } |
54 Reduction ReplaceInt32(int32_t value) { | 57 Reduction ReplaceInt32(int32_t value) { |
55 return Replace(Int32Constant(value)); | 58 return Replace(Int32Constant(value)); |
56 } | 59 } |
57 Reduction ReplaceUint32(uint32_t value) { | 60 Reduction ReplaceUint32(uint32_t value) { |
58 return Replace(Uint32Constant(value)); | 61 return Replace(Uint32Constant(value)); |
59 } | 62 } |
60 Reduction ReplaceInt64(int64_t value) { | 63 Reduction ReplaceInt64(int64_t value) { |
61 return Replace(Int64Constant(value)); | 64 return Replace(Int64Constant(value)); |
62 } | 65 } |
63 | 66 |
| 67 Reduction ReduceInt32Add(Node* node); |
64 Reduction ReduceInt32Div(Node* node); | 68 Reduction ReduceInt32Div(Node* node); |
65 Reduction ReduceUint32Div(Node* node); | 69 Reduction ReduceUint32Div(Node* node); |
66 Reduction ReduceInt32Mod(Node* node); | 70 Reduction ReduceInt32Mod(Node* node); |
67 Reduction ReduceUint32Mod(Node* node); | 71 Reduction ReduceUint32Mod(Node* node); |
68 Reduction ReduceTruncateFloat64ToInt32(Node* node); | 72 Reduction ReduceTruncateFloat64ToInt32(Node* node); |
69 Reduction ReduceStore(Node* node); | 73 Reduction ReduceStore(Node* node); |
70 Reduction ReduceProjection(size_t index, Node* node); | 74 Reduction ReduceProjection(size_t index, Node* node); |
71 Reduction ReduceWord32Shifts(Node* node); | 75 Reduction ReduceWord32Shifts(Node* node); |
72 Reduction ReduceWord32Shl(Node* node); | 76 Reduction ReduceWord32Shl(Node* node); |
73 Reduction ReduceWord32And(Node* node); | 77 Reduction ReduceWord32And(Node* node); |
74 Reduction ReduceWord32Or(Node* node); | 78 Reduction ReduceWord32Or(Node* node); |
75 | 79 |
76 Graph* graph() const; | 80 Graph* graph() const; |
77 JSGraph* jsgraph() const { return jsgraph_; } | 81 JSGraph* jsgraph() const { return jsgraph_; } |
78 CommonOperatorBuilder* common() const; | 82 CommonOperatorBuilder* common() const; |
79 MachineOperatorBuilder* machine() const; | 83 MachineOperatorBuilder* machine() const; |
80 | 84 |
81 JSGraph* jsgraph_; | 85 JSGraph* jsgraph_; |
82 }; | 86 }; |
83 | 87 |
84 } // namespace compiler | 88 } // namespace compiler |
85 } // namespace internal | 89 } // namespace internal |
86 } // namespace v8 | 90 } // namespace v8 |
87 | 91 |
88 #endif // V8_COMPILER_MACHINE_OPERATOR_REDUCER_H_ | 92 #endif // V8_COMPILER_MACHINE_OPERATOR_REDUCER_H_ |
OLD | NEW |