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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 | 67 |
68 // Interface for building machine-level operators. These operators are | 68 // Interface for building machine-level operators. These operators are |
69 // machine-level but machine-independent and thus define a language suitable | 69 // machine-level but machine-independent and thus define a language suitable |
70 // for generating code to run on architectures such as ia32, x64, arm, etc. | 70 // for generating code to run on architectures such as ia32, x64, arm, etc. |
71 class MachineOperatorBuilder FINAL : public ZoneObject { | 71 class MachineOperatorBuilder FINAL : public ZoneObject { |
72 public: | 72 public: |
73 // Flags that specify which operations are available. This is useful | 73 // Flags that specify which operations are available. This is useful |
74 // for operations that are unsupported by some back-ends. | 74 // for operations that are unsupported by some back-ends. |
75 enum Flag { | 75 enum Flag { |
76 kNoFlags = 0u, | 76 kNoFlags = 0u, |
77 kFloat32Max = 1u << 0, | 77 kFloat32Abs = 1u << 0, |
78 kFloat32Min = 1u << 1, | 78 kFloat32Max = 1u << 1, |
79 kFloat64Max = 1u << 2, | 79 kFloat32Min = 1u << 2, |
80 kFloat64Min = 1u << 3, | 80 kFloat64Abs = 1u << 3, |
81 kFloat64RoundDown = 1u << 4, | 81 kFloat64Max = 1u << 4, |
82 kFloat64RoundTruncate = 1u << 5, | 82 kFloat64Min = 1u << 5, |
83 kFloat64RoundTiesAway = 1u << 6, | 83 kFloat64RoundDown = 1u << 6, |
84 kInt32DivIsSafe = 1u << 7, | 84 kFloat64RoundTruncate = 1u << 7, |
85 kUint32DivIsSafe = 1u << 8, | 85 kFloat64RoundTiesAway = 1u << 8, |
86 kWord32ShiftIsSafe = 1u << 9 | 86 kInt32DivIsSafe = 1u << 9, |
87 kUint32DivIsSafe = 1u << 10, | |
88 kWord32ShiftIsSafe = 1u << 11 | |
87 }; | 89 }; |
88 typedef base::Flags<Flag, unsigned> Flags; | 90 typedef base::Flags<Flag, unsigned> Flags; |
89 | 91 |
90 explicit MachineOperatorBuilder(Zone* zone, MachineType word = kMachPtr, | 92 explicit MachineOperatorBuilder(Zone* zone, MachineType word = kMachPtr, |
91 Flags supportedOperators = kNoFlags); | 93 Flags supportedOperators = kNoFlags); |
92 | 94 |
93 const Operator* Word32And(); | 95 const Operator* Word32And(); |
94 const Operator* Word32Or(); | 96 const Operator* Word32Or(); |
95 const Operator* Word32Xor(); | 97 const Operator* Word32Xor(); |
96 const Operator* Word32Shl(); | 98 const Operator* Word32Shl(); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 const Operator* Float32Min(); | 192 const Operator* Float32Min(); |
191 bool HasFloat32Max() { return flags_ & kFloat32Max; } | 193 bool HasFloat32Max() { return flags_ & kFloat32Max; } |
192 bool HasFloat32Min() { return flags_ & kFloat32Min; } | 194 bool HasFloat32Min() { return flags_ & kFloat32Min; } |
193 | 195 |
194 // Floating point min/max complying to IEEE 754 (double-precision). | 196 // Floating point min/max complying to IEEE 754 (double-precision). |
195 const Operator* Float64Max(); | 197 const Operator* Float64Max(); |
196 const Operator* Float64Min(); | 198 const Operator* Float64Min(); |
197 bool HasFloat64Max() { return flags_ & kFloat64Max; } | 199 bool HasFloat64Max() { return flags_ & kFloat64Max; } |
198 bool HasFloat64Min() { return flags_ & kFloat64Min; } | 200 bool HasFloat64Min() { return flags_ & kFloat64Min; } |
199 | 201 |
202 // Floating point abs complying to IEEE 753 (single-precision). | |
Sven Panne
2015/04/08 11:52:03
+1 ^^
Benedikt Meurer
2015/04/08 11:54:42
Done.
| |
203 const Operator* Float32Abs(); | |
204 bool HasFloat32Abs() const { return flags_ & kFloat32Abs; } | |
205 | |
206 // Floating point abs complying to IEEE 753 (double-precision). | |
207 const Operator* Float64Abs(); | |
208 bool HasFloat64Abs() const { return flags_ & kFloat64Abs; } | |
209 | |
200 // Floating point rounding. | 210 // Floating point rounding. |
201 const Operator* Float64RoundDown(); | 211 const Operator* Float64RoundDown(); |
202 const Operator* Float64RoundTruncate(); | 212 const Operator* Float64RoundTruncate(); |
203 const Operator* Float64RoundTiesAway(); | 213 const Operator* Float64RoundTiesAway(); |
204 bool HasFloat64RoundDown() { return flags_ & kFloat64RoundDown; } | 214 bool HasFloat64RoundDown() { return flags_ & kFloat64RoundDown; } |
205 bool HasFloat64RoundTruncate() { return flags_ & kFloat64RoundTruncate; } | 215 bool HasFloat64RoundTruncate() { return flags_ & kFloat64RoundTruncate; } |
206 bool HasFloat64RoundTiesAway() { return flags_ & kFloat64RoundTiesAway; } | 216 bool HasFloat64RoundTiesAway() { return flags_ & kFloat64RoundTiesAway; } |
207 | 217 |
208 // Floating point bit representation. | 218 // Floating point bit representation. |
209 const Operator* Float64ExtractLowWord32(); | 219 const Operator* Float64ExtractLowWord32(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
269 }; | 279 }; |
270 | 280 |
271 | 281 |
272 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) | 282 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) |
273 | 283 |
274 } // namespace compiler | 284 } // namespace compiler |
275 } // namespace internal | 285 } // namespace internal |
276 } // namespace v8 | 286 } // namespace v8 |
277 | 287 |
278 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ | 288 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ |
OLD | NEW |