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 kFloat64RoundDown = 1u << 0, | 77 kFloat64Max = 1u << 0, |
78 kFloat64RoundTruncate = 1u << 1, | 78 kFloat64Min = 1u << 1, |
79 kFloat64RoundTiesAway = 1u << 2, | 79 kFloat64RoundDown = 1u << 2, |
80 kInt32DivIsSafe = 1u << 3, | 80 kFloat64RoundTruncate = 1u << 3, |
81 kUint32DivIsSafe = 1u << 4, | 81 kFloat64RoundTiesAway = 1u << 4, |
82 kWord32ShiftIsSafe = 1u << 5 | 82 kInt32DivIsSafe = 1u << 5, |
| 83 kUint32DivIsSafe = 1u << 6, |
| 84 kWord32ShiftIsSafe = 1u << 7 |
83 }; | 85 }; |
84 typedef base::Flags<Flag, unsigned> Flags; | 86 typedef base::Flags<Flag, unsigned> Flags; |
85 | 87 |
86 explicit MachineOperatorBuilder(Zone* zone, MachineType word = kMachPtr, | 88 explicit MachineOperatorBuilder(Zone* zone, MachineType word = kMachPtr, |
87 Flags supportedOperators = kNoFlags); | 89 Flags supportedOperators = kNoFlags); |
88 | 90 |
89 const Operator* Word32And(); | 91 const Operator* Word32And(); |
90 const Operator* Word32Or(); | 92 const Operator* Word32Or(); |
91 const Operator* Word32Xor(); | 93 const Operator* Word32Xor(); |
92 const Operator* Word32Shl(); | 94 const Operator* Word32Shl(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 const Operator* Float64Mul(); | 161 const Operator* Float64Mul(); |
160 const Operator* Float64Div(); | 162 const Operator* Float64Div(); |
161 const Operator* Float64Mod(); | 163 const Operator* Float64Mod(); |
162 const Operator* Float64Sqrt(); | 164 const Operator* Float64Sqrt(); |
163 | 165 |
164 // Floating point comparisons complying to IEEE 754. | 166 // Floating point comparisons complying to IEEE 754. |
165 const Operator* Float64Equal(); | 167 const Operator* Float64Equal(); |
166 const Operator* Float64LessThan(); | 168 const Operator* Float64LessThan(); |
167 const Operator* Float64LessThanOrEqual(); | 169 const Operator* Float64LessThanOrEqual(); |
168 | 170 |
| 171 // Floating point min/max complying to IEEE 754. |
| 172 const Operator* Float64Max(); |
| 173 const Operator* Float64Min(); |
| 174 bool HasFloat64Max() { return flags_ & kFloat64Max; } |
| 175 bool HasFloat64Min() { return flags_ & kFloat64Min; } |
| 176 |
169 // Floating point rounding. | 177 // Floating point rounding. |
170 const Operator* Float64RoundDown(); | 178 const Operator* Float64RoundDown(); |
171 const Operator* Float64RoundTruncate(); | 179 const Operator* Float64RoundTruncate(); |
172 const Operator* Float64RoundTiesAway(); | 180 const Operator* Float64RoundTiesAway(); |
173 bool HasFloat64RoundDown() { return flags_ & kFloat64RoundDown; } | 181 bool HasFloat64RoundDown() { return flags_ & kFloat64RoundDown; } |
174 bool HasFloat64RoundTruncate() { return flags_ & kFloat64RoundTruncate; } | 182 bool HasFloat64RoundTruncate() { return flags_ & kFloat64RoundTruncate; } |
175 bool HasFloat64RoundTiesAway() { return flags_ & kFloat64RoundTiesAway; } | 183 bool HasFloat64RoundTiesAway() { return flags_ & kFloat64RoundTiesAway; } |
176 | 184 |
177 // Floating point bit representation. | 185 // Floating point bit representation. |
178 const Operator* Float64ExtractLowWord32(); | 186 const Operator* Float64ExtractLowWord32(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 }; | 246 }; |
239 | 247 |
240 | 248 |
241 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) | 249 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) |
242 | 250 |
243 } // namespace compiler | 251 } // namespace compiler |
244 } // namespace internal | 252 } // namespace internal |
245 } // namespace v8 | 253 } // namespace v8 |
246 | 254 |
247 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ | 255 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ |
OLD | NEW |