| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 // Interface for building machine-level operators. These operators are | 98 // Interface for building machine-level operators. These operators are |
| 99 // machine-level but machine-independent and thus define a language suitable | 99 // machine-level but machine-independent and thus define a language suitable |
| 100 // for generating code to run on architectures such as ia32, x64, arm, etc. | 100 // for generating code to run on architectures such as ia32, x64, arm, etc. |
| 101 class MachineOperatorBuilder final : public ZoneObject { | 101 class MachineOperatorBuilder final : public ZoneObject { |
| 102 public: | 102 public: |
| 103 // Flags that specify which operations are available. This is useful | 103 // Flags that specify which operations are available. This is useful |
| 104 // for operations that are unsupported by some back-ends. | 104 // for operations that are unsupported by some back-ends. |
| 105 enum Flag : unsigned { | 105 enum Flag : unsigned { |
| 106 kNoFlags = 0u, | 106 kNoFlags = 0u, |
| 107 kFloat32Max = 1u << 0, | 107 kFloat32RoundDown = 1u << 0, |
| 108 kFloat32Min = 1u << 1, | 108 kFloat64RoundDown = 1u << 1, |
| 109 kFloat32RoundDown = 1u << 2, | 109 kFloat32RoundUp = 1u << 2, |
| 110 kFloat64RoundDown = 1u << 3, | 110 kFloat64RoundUp = 1u << 3, |
| 111 kFloat32RoundUp = 1u << 4, | 111 kFloat32RoundTruncate = 1u << 4, |
| 112 kFloat64RoundUp = 1u << 5, | 112 kFloat64RoundTruncate = 1u << 5, |
| 113 kFloat32RoundTruncate = 1u << 6, | 113 kFloat32RoundTiesEven = 1u << 6, |
| 114 kFloat64RoundTruncate = 1u << 7, | 114 kFloat64RoundTiesEven = 1u << 7, |
| 115 kFloat32RoundTiesEven = 1u << 8, | 115 kFloat64RoundTiesAway = 1u << 8, |
| 116 kFloat64RoundTiesEven = 1u << 9, | 116 kInt32DivIsSafe = 1u << 9, |
| 117 kFloat64RoundTiesAway = 1u << 10, | 117 kUint32DivIsSafe = 1u << 10, |
| 118 kInt32DivIsSafe = 1u << 11, | 118 kWord32ShiftIsSafe = 1u << 11, |
| 119 kUint32DivIsSafe = 1u << 12, | 119 kWord32Ctz = 1u << 12, |
| 120 kWord32ShiftIsSafe = 1u << 13, | 120 kWord64Ctz = 1u << 13, |
| 121 kWord32Ctz = 1u << 14, | 121 kWord32Popcnt = 1u << 14, |
| 122 kWord64Ctz = 1u << 15, | 122 kWord64Popcnt = 1u << 15, |
| 123 kWord32Popcnt = 1u << 16, | 123 kWord32ReverseBits = 1u << 16, |
| 124 kWord64Popcnt = 1u << 17, | 124 kWord64ReverseBits = 1u << 17, |
| 125 kWord32ReverseBits = 1u << 18, | 125 kWord32ReverseBytes = 1u << 18, |
| 126 kWord64ReverseBits = 1u << 19, | 126 kWord64ReverseBytes = 1u << 19, |
| 127 kWord32ReverseBytes = 1u << 20, | 127 kAllOptionalOps = kFloat32RoundDown | kFloat64RoundDown | kFloat32RoundUp | |
| 128 kWord64ReverseBytes = 1u << 21, | 128 kFloat64RoundUp | kFloat32RoundTruncate | |
| 129 kAllOptionalOps = | 129 kFloat64RoundTruncate | kFloat64RoundTiesAway | |
| 130 kFloat32Max | kFloat32Min | kFloat32RoundDown | kFloat64RoundDown | | 130 kFloat32RoundTiesEven | kFloat64RoundTiesEven | |
| 131 kFloat32RoundUp | kFloat64RoundUp | kFloat32RoundTruncate | | 131 kWord32Ctz | kWord64Ctz | kWord32Popcnt | kWord64Popcnt | |
| 132 kFloat64RoundTruncate | kFloat64RoundTiesAway | kFloat32RoundTiesEven | | 132 kWord32ReverseBits | kWord64ReverseBits | |
| 133 kFloat64RoundTiesEven | kWord32Ctz | kWord64Ctz | kWord32Popcnt | | 133 kWord32ReverseBytes | kWord64ReverseBytes |
| 134 kWord64Popcnt | kWord32ReverseBits | kWord64ReverseBits | | |
| 135 kWord32ReverseBytes | kWord64ReverseBytes | |
| 136 }; | 134 }; |
| 137 typedef base::Flags<Flag, unsigned> Flags; | 135 typedef base::Flags<Flag, unsigned> Flags; |
| 138 | 136 |
| 139 class AlignmentRequirements { | 137 class AlignmentRequirements { |
| 140 public: | 138 public: |
| 141 enum UnalignedAccessSupport { kNoSupport, kSomeSupport, kFullSupport }; | 139 enum UnalignedAccessSupport { kNoSupport, kSomeSupport, kFullSupport }; |
| 142 | 140 |
| 143 bool IsUnalignedLoadSupported(const MachineType& machineType, | 141 bool IsUnalignedLoadSupported(const MachineType& machineType, |
| 144 uint8_t alignment) const { | 142 uint8_t alignment) const { |
| 145 return IsUnalignedSupported(unalignedLoadUnsupportedTypes_, machineType, | 143 return IsUnalignedSupported(unalignedLoadUnsupportedTypes_, machineType, |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 const Operator* Float32LessThanOrEqual(); | 354 const Operator* Float32LessThanOrEqual(); |
| 357 | 355 |
| 358 // Floating point comparisons complying to IEEE 754 (double-precision). | 356 // Floating point comparisons complying to IEEE 754 (double-precision). |
| 359 const Operator* Float64Equal(); | 357 const Operator* Float64Equal(); |
| 360 const Operator* Float64LessThan(); | 358 const Operator* Float64LessThan(); |
| 361 const Operator* Float64LessThanOrEqual(); | 359 const Operator* Float64LessThanOrEqual(); |
| 362 | 360 |
| 363 // Floating point min/max complying to EcmaScript 6 (double-precision). | 361 // Floating point min/max complying to EcmaScript 6 (double-precision). |
| 364 const Operator* Float64Max(); | 362 const Operator* Float64Max(); |
| 365 const Operator* Float64Min(); | 363 const Operator* Float64Min(); |
| 364 // Floating point min/max complying to WebAssembly (single-precision). |
| 365 const Operator* Float32Max(); |
| 366 const Operator* Float32Min(); |
| 366 | 367 |
| 367 // Floating point abs complying to IEEE 754 (single-precision). | 368 // Floating point abs complying to IEEE 754 (single-precision). |
| 368 const Operator* Float32Abs(); | 369 const Operator* Float32Abs(); |
| 369 | 370 |
| 370 // Floating point abs complying to IEEE 754 (double-precision). | 371 // Floating point abs complying to IEEE 754 (double-precision). |
| 371 const Operator* Float64Abs(); | 372 const Operator* Float64Abs(); |
| 372 | 373 |
| 373 // Floating point rounding. | 374 // Floating point rounding. |
| 374 const OptionalOperator Float32RoundDown(); | 375 const OptionalOperator Float32RoundDown(); |
| 375 const OptionalOperator Float64RoundDown(); | 376 const OptionalOperator Float64RoundDown(); |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 }; | 696 }; |
| 696 | 697 |
| 697 | 698 |
| 698 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) | 699 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) |
| 699 | 700 |
| 700 } // namespace compiler | 701 } // namespace compiler |
| 701 } // namespace internal | 702 } // namespace internal |
| 702 } // namespace v8 | 703 } // namespace v8 |
| 703 | 704 |
| 704 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ | 705 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ |
| OLD | NEW |