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/machine-type.h" | 9 #include "src/machine-type.h" |
10 | 10 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 MachineRepresentation AtomicStoreRepresentationOf(Operator const* op); | 87 MachineRepresentation AtomicStoreRepresentationOf(Operator const* op); |
88 | 88 |
89 // Interface for building machine-level operators. These operators are | 89 // Interface for building machine-level operators. These operators are |
90 // machine-level but machine-independent and thus define a language suitable | 90 // machine-level but machine-independent and thus define a language suitable |
91 // for generating code to run on architectures such as ia32, x64, arm, etc. | 91 // for generating code to run on architectures such as ia32, x64, arm, etc. |
92 class MachineOperatorBuilder final : public ZoneObject { | 92 class MachineOperatorBuilder final : public ZoneObject { |
93 public: | 93 public: |
94 // Flags that specify which operations are available. This is useful | 94 // Flags that specify which operations are available. This is useful |
95 // for operations that are unsupported by some back-ends. | 95 // for operations that are unsupported by some back-ends. |
96 enum Flag { | 96 enum Flag : unsigned { |
97 kNoFlags = 0u, | 97 kNoFlags = 0u, |
98 // Note that Float*Max behaves like `(b < a) ? a : b`, not like Math.max(). | 98 kFloat32RoundDown = 1u << 0, |
99 // Note that Float*Min behaves like `(a < b) ? a : b`, not like Math.min(). | 99 kFloat64RoundDown = 1u << 1, |
100 kFloat32Max = 1u << 0, | 100 kFloat32RoundUp = 1u << 2, |
101 kFloat32Min = 1u << 1, | 101 kFloat64RoundUp = 1u << 3, |
102 kFloat64Max = 1u << 2, | 102 kFloat32RoundTruncate = 1u << 4, |
103 kFloat64Min = 1u << 3, | 103 kFloat64RoundTruncate = 1u << 5, |
104 kFloat32RoundDown = 1u << 4, | 104 kFloat32RoundTiesEven = 1u << 6, |
105 kFloat64RoundDown = 1u << 5, | 105 kFloat64RoundTiesEven = 1u << 7, |
106 kFloat32RoundUp = 1u << 6, | 106 kFloat64RoundTiesAway = 1u << 8, |
107 kFloat64RoundUp = 1u << 7, | 107 kInt32DivIsSafe = 1u << 9, |
108 kFloat32RoundTruncate = 1u << 8, | 108 kUint32DivIsSafe = 1u << 10, |
109 kFloat64RoundTruncate = 1u << 9, | 109 kWord32ShiftIsSafe = 1u << 11, |
110 kFloat32RoundTiesEven = 1u << 10, | 110 kWord32Ctz = 1u << 12, |
111 kFloat64RoundTiesEven = 1u << 11, | 111 kWord64Ctz = 1u << 13, |
112 kFloat64RoundTiesAway = 1u << 12, | 112 kWord32Popcnt = 1u << 14, |
113 kInt32DivIsSafe = 1u << 13, | 113 kWord64Popcnt = 1u << 15, |
114 kUint32DivIsSafe = 1u << 14, | 114 kWord32ReverseBits = 1u << 16, |
115 kWord32ShiftIsSafe = 1u << 15, | 115 kWord64ReverseBits = 1u << 17, |
116 kWord32Ctz = 1u << 16, | 116 kFloat32Neg = 1u << 18, |
117 kWord64Ctz = 1u << 17, | 117 kFloat64Neg = 1u << 19, |
118 kWord32Popcnt = 1u << 18, | |
119 kWord64Popcnt = 1u << 19, | |
120 kWord32ReverseBits = 1u << 20, | |
121 kWord64ReverseBits = 1u << 21, | |
122 kFloat32Neg = 1u << 22, | |
123 kFloat64Neg = 1u << 23, | |
124 kAllOptionalOps = | 118 kAllOptionalOps = |
125 kFloat32Max | kFloat32Min | kFloat64Max | kFloat64Min | | |
126 kFloat32RoundDown | kFloat64RoundDown | kFloat32RoundUp | | 119 kFloat32RoundDown | kFloat64RoundDown | kFloat32RoundUp | |
127 kFloat64RoundUp | kFloat32RoundTruncate | kFloat64RoundTruncate | | 120 kFloat64RoundUp | kFloat32RoundTruncate | kFloat64RoundTruncate | |
128 kFloat64RoundTiesAway | kFloat32RoundTiesEven | kFloat64RoundTiesEven | | 121 kFloat64RoundTiesAway | kFloat32RoundTiesEven | kFloat64RoundTiesEven | |
129 kWord32Ctz | kWord64Ctz | kWord32Popcnt | kWord64Popcnt | | 122 kWord32Ctz | kWord64Ctz | kWord32Popcnt | kWord64Popcnt | |
130 kWord32ReverseBits | kWord64ReverseBits | kFloat32Neg | kFloat64Neg | 123 kWord32ReverseBits | kWord64ReverseBits | kFloat32Neg | kFloat64Neg |
131 }; | 124 }; |
132 typedef base::Flags<Flag, unsigned> Flags; | 125 typedef base::Flags<Flag, unsigned> Flags; |
133 | 126 |
134 class AlignmentRequirements { | 127 class AlignmentRequirements { |
135 public: | 128 public: |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 // Floating point comparisons complying to IEEE 754 (single-precision). | 330 // Floating point comparisons complying to IEEE 754 (single-precision). |
338 const Operator* Float32Equal(); | 331 const Operator* Float32Equal(); |
339 const Operator* Float32LessThan(); | 332 const Operator* Float32LessThan(); |
340 const Operator* Float32LessThanOrEqual(); | 333 const Operator* Float32LessThanOrEqual(); |
341 | 334 |
342 // Floating point comparisons complying to IEEE 754 (double-precision). | 335 // Floating point comparisons complying to IEEE 754 (double-precision). |
343 const Operator* Float64Equal(); | 336 const Operator* Float64Equal(); |
344 const Operator* Float64LessThan(); | 337 const Operator* Float64LessThan(); |
345 const Operator* Float64LessThanOrEqual(); | 338 const Operator* Float64LessThanOrEqual(); |
346 | 339 |
347 // Floating point min/max complying to IEEE 754 (single-precision). | 340 // Floating point min/max complying to EcmaScript 6 (double-precision). |
348 const OptionalOperator Float32Max(); | 341 const Operator* Float64Max(); |
349 const OptionalOperator Float32Min(); | 342 const Operator* Float64Min(); |
350 | |
351 // Floating point min/max complying to IEEE 754 (double-precision). | |
352 const OptionalOperator Float64Max(); | |
353 const OptionalOperator Float64Min(); | |
354 | 343 |
355 // Floating point abs complying to IEEE 754 (single-precision). | 344 // Floating point abs complying to IEEE 754 (single-precision). |
356 const Operator* Float32Abs(); | 345 const Operator* Float32Abs(); |
357 | 346 |
358 // Floating point abs complying to IEEE 754 (double-precision). | 347 // Floating point abs complying to IEEE 754 (double-precision). |
359 const Operator* Float64Abs(); | 348 const Operator* Float64Abs(); |
360 | 349 |
361 // Floating point rounding. | 350 // Floating point rounding. |
362 const OptionalOperator Float32RoundDown(); | 351 const OptionalOperator Float32RoundDown(); |
363 const OptionalOperator Float64RoundDown(); | 352 const OptionalOperator Float64RoundDown(); |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 }; | 666 }; |
678 | 667 |
679 | 668 |
680 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) | 669 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) |
681 | 670 |
682 } // namespace compiler | 671 } // namespace compiler |
683 } // namespace internal | 672 } // namespace internal |
684 } // namespace v8 | 673 } // namespace v8 |
685 | 674 |
686 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ | 675 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ |
OLD | NEW |