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 kFloat32Abs = 1u << 0, | 77 kFloat32Max = 1u << 0, |
78 kFloat32Max = 1u << 1, | 78 kFloat32Min = 1u << 1, |
79 kFloat32Min = 1u << 2, | 79 kFloat64Max = 1u << 2, |
80 kFloat64Abs = 1u << 3, | 80 kFloat64Min = 1u << 3, |
81 kFloat64Max = 1u << 4, | 81 kFloat64RoundDown = 1u << 4, |
82 kFloat64Min = 1u << 5, | 82 kFloat64RoundTruncate = 1u << 5, |
83 kFloat64RoundDown = 1u << 6, | 83 kFloat64RoundTiesAway = 1u << 6, |
84 kFloat64RoundTruncate = 1u << 7, | 84 kInt32DivIsSafe = 1u << 7, |
85 kFloat64RoundTiesAway = 1u << 8, | 85 kUint32DivIsSafe = 1u << 8, |
86 kInt32DivIsSafe = 1u << 9, | 86 kWord32ShiftIsSafe = 1u << 9 |
87 kUint32DivIsSafe = 1u << 10, | |
88 kWord32ShiftIsSafe = 1u << 11 | |
89 }; | 87 }; |
90 typedef base::Flags<Flag, unsigned> Flags; | 88 typedef base::Flags<Flag, unsigned> Flags; |
91 | 89 |
92 explicit MachineOperatorBuilder(Zone* zone, MachineType word = kMachPtr, | 90 explicit MachineOperatorBuilder(Zone* zone, MachineType word = kMachPtr, |
93 Flags supportedOperators = kNoFlags); | 91 Flags supportedOperators = kNoFlags); |
94 | 92 |
95 const Operator* Word32And(); | 93 const Operator* Word32And(); |
96 const Operator* Word32Or(); | 94 const Operator* Word32Or(); |
97 const Operator* Word32Xor(); | 95 const Operator* Word32Xor(); |
98 const Operator* Word32Shl(); | 96 const Operator* Word32Shl(); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 bool HasFloat32Min() { return flags_ & kFloat32Min; } | 192 bool HasFloat32Min() { return flags_ & kFloat32Min; } |
195 | 193 |
196 // Floating point min/max complying to IEEE 754 (double-precision). | 194 // Floating point min/max complying to IEEE 754 (double-precision). |
197 const Operator* Float64Max(); | 195 const Operator* Float64Max(); |
198 const Operator* Float64Min(); | 196 const Operator* Float64Min(); |
199 bool HasFloat64Max() { return flags_ & kFloat64Max; } | 197 bool HasFloat64Max() { return flags_ & kFloat64Max; } |
200 bool HasFloat64Min() { return flags_ & kFloat64Min; } | 198 bool HasFloat64Min() { return flags_ & kFloat64Min; } |
201 | 199 |
202 // Floating point abs complying to IEEE 754 (single-precision). | 200 // Floating point abs complying to IEEE 754 (single-precision). |
203 const Operator* Float32Abs(); | 201 const Operator* Float32Abs(); |
204 bool HasFloat32Abs() const { return flags_ & kFloat32Abs; } | |
205 | 202 |
206 // Floating point abs complying to IEEE 754 (double-precision). | 203 // Floating point abs complying to IEEE 754 (double-precision). |
207 const Operator* Float64Abs(); | 204 const Operator* Float64Abs(); |
208 bool HasFloat64Abs() const { return flags_ & kFloat64Abs; } | |
209 | 205 |
210 // Floating point rounding. | 206 // Floating point rounding. |
211 const Operator* Float64RoundDown(); | 207 const Operator* Float64RoundDown(); |
212 const Operator* Float64RoundTruncate(); | 208 const Operator* Float64RoundTruncate(); |
213 const Operator* Float64RoundTiesAway(); | 209 const Operator* Float64RoundTiesAway(); |
214 bool HasFloat64RoundDown() { return flags_ & kFloat64RoundDown; } | 210 bool HasFloat64RoundDown() { return flags_ & kFloat64RoundDown; } |
215 bool HasFloat64RoundTruncate() { return flags_ & kFloat64RoundTruncate; } | 211 bool HasFloat64RoundTruncate() { return flags_ & kFloat64RoundTruncate; } |
216 bool HasFloat64RoundTiesAway() { return flags_ & kFloat64RoundTiesAway; } | 212 bool HasFloat64RoundTiesAway() { return flags_ & kFloat64RoundTiesAway; } |
217 | 213 |
218 // Floating point bit representation. | 214 // Floating point bit representation. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 }; | 275 }; |
280 | 276 |
281 | 277 |
282 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) | 278 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) |
283 | 279 |
284 } // namespace compiler | 280 } // namespace compiler |
285 } // namespace internal | 281 } // namespace internal |
286 } // namespace v8 | 282 } // namespace v8 |
287 | 283 |
288 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ | 284 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ |
OLD | NEW |