| 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 // Note that Float*Max behaves like `(b < a) ? a : b`, not like Math.max(). | |
| 108 // Note that Float*Min behaves like `(a < b) ? a : b`, not like Math.min(). | |
| 109 kFloat32Max = 1u << 0, | 107 kFloat32Max = 1u << 0, |
| 110 kFloat32Min = 1u << 1, | 108 kFloat32Min = 1u << 1, |
| 111 kFloat64Max = 1u << 2, | 109 kFloat32RoundDown = 1u << 2, |
| 112 kFloat64Min = 1u << 3, | 110 kFloat64RoundDown = 1u << 3, |
| 113 kFloat32RoundDown = 1u << 4, | 111 kFloat32RoundUp = 1u << 4, |
| 114 kFloat64RoundDown = 1u << 5, | 112 kFloat64RoundUp = 1u << 5, |
| 115 kFloat32RoundUp = 1u << 6, | 113 kFloat32RoundTruncate = 1u << 6, |
| 116 kFloat64RoundUp = 1u << 7, | 114 kFloat64RoundTruncate = 1u << 7, |
| 117 kFloat32RoundTruncate = 1u << 8, | 115 kFloat32RoundTiesEven = 1u << 8, |
| 118 kFloat64RoundTruncate = 1u << 9, | 116 kFloat64RoundTiesEven = 1u << 9, |
| 119 kFloat32RoundTiesEven = 1u << 10, | 117 kFloat64RoundTiesAway = 1u << 10, |
| 120 kFloat64RoundTiesEven = 1u << 11, | 118 kInt32DivIsSafe = 1u << 11, |
| 121 kFloat64RoundTiesAway = 1u << 12, | 119 kUint32DivIsSafe = 1u << 12, |
| 122 kInt32DivIsSafe = 1u << 13, | 120 kWord32ShiftIsSafe = 1u << 13, |
| 123 kUint32DivIsSafe = 1u << 14, | 121 kWord32Ctz = 1u << 14, |
| 124 kWord32ShiftIsSafe = 1u << 15, | 122 kWord64Ctz = 1u << 15, |
| 125 kWord32Ctz = 1u << 16, | 123 kWord32Popcnt = 1u << 16, |
| 126 kWord64Ctz = 1u << 17, | 124 kWord64Popcnt = 1u << 17, |
| 127 kWord32Popcnt = 1u << 18, | 125 kWord32ReverseBits = 1u << 18, |
| 128 kWord64Popcnt = 1u << 19, | 126 kWord64ReverseBits = 1u << 19, |
| 129 kWord32ReverseBits = 1u << 20, | 127 kWord32ReverseBytes = 1u << 20, |
| 130 kWord64ReverseBits = 1u << 21, | 128 kWord64ReverseBytes = 1u << 21, |
| 131 kWord32ReverseBytes = 1u << 22, | 129 kAllOptionalOps = |
| 132 kWord64ReverseBytes = 1u << 23, | 130 kFloat32Max | kFloat32Min | kFloat32RoundDown | kFloat64RoundDown | |
| 133 kAllOptionalOps = kFloat32Max | kFloat32Min | kFloat64Max | kFloat64Min | | 131 kFloat32RoundUp | kFloat64RoundUp | kFloat32RoundTruncate | |
| 134 kFloat32RoundDown | kFloat64RoundDown | kFloat32RoundUp | | 132 kFloat64RoundTruncate | kFloat64RoundTiesAway | kFloat32RoundTiesEven | |
| 135 kFloat64RoundUp | kFloat32RoundTruncate | | 133 kFloat64RoundTiesEven | kWord32Ctz | kWord64Ctz | kWord32Popcnt | |
| 136 kFloat64RoundTruncate | kFloat64RoundTiesAway | | 134 kWord64Popcnt | kWord32ReverseBits | kWord64ReverseBits | |
| 137 kFloat32RoundTiesEven | kFloat64RoundTiesEven | | 135 kWord32ReverseBytes | kWord64ReverseBytes |
| 138 kWord32Ctz | kWord64Ctz | kWord32Popcnt | kWord64Popcnt | | |
| 139 kWord32ReverseBits | kWord64ReverseBits | | |
| 140 kWord32ReverseBytes | kWord64ReverseBytes | |
| 141 }; | 136 }; |
| 142 typedef base::Flags<Flag, unsigned> Flags; | 137 typedef base::Flags<Flag, unsigned> Flags; |
| 143 | 138 |
| 144 class AlignmentRequirements { | 139 class AlignmentRequirements { |
| 145 public: | 140 public: |
| 146 enum UnalignedAccessSupport { kNoSupport, kSomeSupport, kFullSupport }; | 141 enum UnalignedAccessSupport { kNoSupport, kSomeSupport, kFullSupport }; |
| 147 | 142 |
| 148 bool IsUnalignedLoadSupported(const MachineType& machineType, | 143 bool IsUnalignedLoadSupported(const MachineType& machineType, |
| 149 uint8_t alignment) const { | 144 uint8_t alignment) const { |
| 150 return IsUnalignedSupported(unalignedLoadUnsupportedTypes_, machineType, | 145 return IsUnalignedSupported(unalignedLoadUnsupportedTypes_, machineType, |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 }; | 695 }; |
| 701 | 696 |
| 702 | 697 |
| 703 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) | 698 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) |
| 704 | 699 |
| 705 } // namespace compiler | 700 } // namespace compiler |
| 706 } // namespace internal | 701 } // namespace internal |
| 707 } // namespace v8 | 702 } // namespace v8 |
| 708 | 703 |
| 709 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ | 704 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ |
| OLD | NEW |