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