OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_H_ | 5 #ifndef V8_COMPILER_MACHINE_OPERATOR_H_ |
6 #define V8_COMPILER_MACHINE_OPERATOR_H_ | 6 #define V8_COMPILER_MACHINE_OPERATOR_H_ |
7 | 7 |
8 #include "src/base/flags.h" | 8 #include "src/base/flags.h" |
9 #include "src/compiler/machine-type.h" | 9 #include "src/compiler/machine-type.h" |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 public: | 60 public: |
61 // Flags that specify which operations are available. This is useful | 61 // Flags that specify which operations are available. This is useful |
62 // for operations that are unsupported by some back-ends. | 62 // for operations that are unsupported by some back-ends. |
63 enum Flag { | 63 enum Flag { |
64 kNoFlags = 0u, | 64 kNoFlags = 0u, |
65 kFloat64Floor = 1u << 0, | 65 kFloat64Floor = 1u << 0, |
66 kFloat64Ceil = 1u << 1, | 66 kFloat64Ceil = 1u << 1, |
67 kFloat64RoundTruncate = 1u << 2, | 67 kFloat64RoundTruncate = 1u << 2, |
68 kFloat64RoundTiesAway = 1u << 3, | 68 kFloat64RoundTiesAway = 1u << 3, |
69 kInt32DivIsSafe = 1u << 4, | 69 kInt32DivIsSafe = 1u << 4, |
70 kUint32DivIsSafe = 1u << 5 | 70 kUint32DivIsSafe = 1u << 5, |
| 71 kWord32ShiftIsSafe = 1u << 6 |
71 }; | 72 }; |
72 typedef base::Flags<Flag, unsigned> Flags; | 73 typedef base::Flags<Flag, unsigned> Flags; |
73 | 74 |
74 explicit MachineOperatorBuilder(Zone* zone, MachineType word = kMachPtr, | 75 explicit MachineOperatorBuilder(Zone* zone, MachineType word = kMachPtr, |
75 Flags supportedOperators = kNoFlags); | 76 Flags supportedOperators = kNoFlags); |
76 | 77 |
77 const Operator* Word32And(); | 78 const Operator* Word32And(); |
78 const Operator* Word32Or(); | 79 const Operator* Word32Or(); |
79 const Operator* Word32Xor(); | 80 const Operator* Word32Xor(); |
80 const Operator* Word32Shl(); | 81 const Operator* Word32Shl(); |
81 const Operator* Word32Shr(); | 82 const Operator* Word32Shr(); |
82 const Operator* Word32Sar(); | 83 const Operator* Word32Sar(); |
83 const Operator* Word32Ror(); | 84 const Operator* Word32Ror(); |
84 const Operator* Word32Equal(); | 85 const Operator* Word32Equal(); |
| 86 bool Word32ShiftIsSafe() const { return flags_ & kWord32ShiftIsSafe; } |
85 | 87 |
86 const Operator* Word64And(); | 88 const Operator* Word64And(); |
87 const Operator* Word64Or(); | 89 const Operator* Word64Or(); |
88 const Operator* Word64Xor(); | 90 const Operator* Word64Xor(); |
89 const Operator* Word64Shl(); | 91 const Operator* Word64Shl(); |
90 const Operator* Word64Shr(); | 92 const Operator* Word64Shr(); |
91 const Operator* Word64Sar(); | 93 const Operator* Word64Sar(); |
92 const Operator* Word64Ror(); | 94 const Operator* Word64Ror(); |
93 const Operator* Word64Equal(); | 95 const Operator* Word64Equal(); |
94 | 96 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 DISALLOW_COPY_AND_ASSIGN(MachineOperatorBuilder); | 216 DISALLOW_COPY_AND_ASSIGN(MachineOperatorBuilder); |
215 }; | 217 }; |
216 | 218 |
217 | 219 |
218 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) | 220 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) |
219 } // namespace compiler | 221 } // namespace compiler |
220 } // namespace internal | 222 } // namespace internal |
221 } // namespace v8 | 223 } // namespace v8 |
222 | 224 |
223 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ | 225 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ |
OLD | NEW |