Line data Source code
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
3 : // found in the LICENSE file.
4 :
5 : #ifndef V8_COMPILER_OPCODES_H_
6 : #define V8_COMPILER_OPCODES_H_
7 :
8 : #include <iosfwd>
9 :
10 : #include "src/globals.h"
11 :
12 : // Opcodes for control operators.
13 : #define CONTROL_OP_LIST(V) \
14 : V(Start) \
15 : V(Loop) \
16 : V(Branch) \
17 : V(Switch) \
18 : V(IfTrue) \
19 : V(IfFalse) \
20 : V(IfSuccess) \
21 : V(IfException) \
22 : V(IfValue) \
23 : V(IfDefault) \
24 : V(Merge) \
25 : V(Deoptimize) \
26 : V(DeoptimizeIf) \
27 : V(DeoptimizeUnless) \
28 : V(TrapIf) \
29 : V(TrapUnless) \
30 : V(Return) \
31 : V(TailCall) \
32 : V(Terminate) \
33 : V(OsrNormalEntry) \
34 : V(OsrLoopEntry) \
35 : V(Throw) \
36 : V(End)
37 :
38 : // Opcodes for constant operators.
39 : #define CONSTANT_OP_LIST(V) \
40 : V(Int32Constant) \
41 : V(Int64Constant) \
42 : V(Float32Constant) \
43 : V(Float64Constant) \
44 : V(ExternalConstant) \
45 : V(NumberConstant) \
46 : V(PointerConstant) \
47 : V(HeapConstant) \
48 : V(RelocatableInt32Constant) \
49 : V(RelocatableInt64Constant)
50 :
51 : #define INNER_OP_LIST(V) \
52 : V(Select) \
53 : V(Phi) \
54 : V(EffectPhi) \
55 : V(InductionVariablePhi) \
56 : V(Checkpoint) \
57 : V(BeginRegion) \
58 : V(FinishRegion) \
59 : V(FrameState) \
60 : V(StateValues) \
61 : V(TypedStateValues) \
62 : V(ArgumentsElementsState) \
63 : V(ArgumentsLengthState) \
64 : V(ObjectState) \
65 : V(ObjectId) \
66 : V(TypedObjectState) \
67 : V(Call) \
68 : V(CallWithCallerSavedRegisters) \
69 : V(Parameter) \
70 : V(OsrValue) \
71 : V(LoopExit) \
72 : V(LoopExitValue) \
73 : V(LoopExitEffect) \
74 : V(Projection) \
75 : V(Retain) \
76 : V(MapGuard) \
77 : V(TypeGuard)
78 :
79 : #define COMMON_OP_LIST(V) \
80 : CONSTANT_OP_LIST(V) \
81 : INNER_OP_LIST(V) \
82 : V(Dead)
83 :
84 : // Opcodes for JavaScript operators.
85 : #define JS_COMPARE_BINOP_LIST(V) \
86 : V(JSEqual) \
87 : V(JSStrictEqual) \
88 : V(JSLessThan) \
89 : V(JSGreaterThan) \
90 : V(JSLessThanOrEqual) \
91 : V(JSGreaterThanOrEqual)
92 :
93 : #define JS_BITWISE_BINOP_LIST(V) \
94 : V(JSBitwiseOr) \
95 : V(JSBitwiseXor) \
96 : V(JSBitwiseAnd) \
97 : V(JSShiftLeft) \
98 : V(JSShiftRight) \
99 : V(JSShiftRightLogical)
100 :
101 : #define JS_ARITH_BINOP_LIST(V) \
102 : V(JSAdd) \
103 : V(JSSubtract) \
104 : V(JSMultiply) \
105 : V(JSDivide) \
106 : V(JSModulus)
107 :
108 : #define JS_SIMPLE_BINOP_LIST(V) \
109 : JS_COMPARE_BINOP_LIST(V) \
110 : JS_BITWISE_BINOP_LIST(V) \
111 : JS_ARITH_BINOP_LIST(V) \
112 : V(JSHasInPrototypeChain) \
113 : V(JSInstanceOf) \
114 : V(JSOrdinaryHasInstance)
115 :
116 : #define JS_CONVERSION_UNOP_LIST(V) \
117 : V(JSToInteger) \
118 : V(JSToLength) \
119 : V(JSToName) \
120 : V(JSToNumber) \
121 : V(JSToObject) \
122 : V(JSToString)
123 :
124 : #define JS_SIMPLE_UNOP_LIST(V) JS_CONVERSION_UNOP_LIST(V)
125 :
126 : #define JS_OBJECT_OP_LIST(V) \
127 : V(JSCreate) \
128 : V(JSCreateArguments) \
129 : V(JSCreateArray) \
130 : V(JSCreateBoundFunction) \
131 : V(JSCreateClosure) \
132 : V(JSCreateIterResultObject) \
133 : V(JSCreateKeyValueArray) \
134 : V(JSCreateLiteralArray) \
135 : V(JSCreateEmptyLiteralArray) \
136 : V(JSCreateLiteralObject) \
137 : V(JSCreateEmptyLiteralObject) \
138 : V(JSCreateLiteralRegExp) \
139 : V(JSLoadProperty) \
140 : V(JSLoadNamed) \
141 : V(JSLoadGlobal) \
142 : V(JSStoreProperty) \
143 : V(JSStoreNamed) \
144 : V(JSStoreNamedOwn) \
145 : V(JSStoreGlobal) \
146 : V(JSStoreDataPropertyInLiteral) \
147 : V(JSDeleteProperty) \
148 : V(JSHasProperty) \
149 : V(JSCreateGeneratorObject) \
150 : V(JSGetSuperConstructor)
151 :
152 : #define JS_CONTEXT_OP_LIST(V) \
153 : V(JSLoadContext) \
154 : V(JSStoreContext) \
155 : V(JSCreateFunctionContext) \
156 : V(JSCreateCatchContext) \
157 : V(JSCreateWithContext) \
158 : V(JSCreateBlockContext) \
159 : V(JSCreateScriptContext)
160 :
161 : #define JS_OTHER_OP_LIST(V) \
162 : V(JSConstructForwardVarargs) \
163 : V(JSConstruct) \
164 : V(JSConstructWithArrayLike) \
165 : V(JSConstructWithSpread) \
166 : V(JSCallForwardVarargs) \
167 : V(JSCall) \
168 : V(JSCallWithArrayLike) \
169 : V(JSCallWithSpread) \
170 : V(JSCallRuntime) \
171 : V(JSConvertReceiver) \
172 : V(JSForInEnumerate) \
173 : V(JSForInNext) \
174 : V(JSForInPrepare) \
175 : V(JSLoadMessage) \
176 : V(JSStoreMessage) \
177 : V(JSLoadModule) \
178 : V(JSStoreModule) \
179 : V(JSGeneratorStore) \
180 : V(JSGeneratorRestoreContinuation) \
181 : V(JSGeneratorRestoreRegister) \
182 : V(JSStackCheck) \
183 : V(JSDebugger)
184 :
185 : #define JS_OP_LIST(V) \
186 : JS_SIMPLE_BINOP_LIST(V) \
187 : JS_SIMPLE_UNOP_LIST(V) \
188 : JS_OBJECT_OP_LIST(V) \
189 : JS_CONTEXT_OP_LIST(V) \
190 : JS_OTHER_OP_LIST(V)
191 :
192 : // Opcodes for VirtuaMachine-level operators.
193 : #define SIMPLIFIED_CHANGE_OP_LIST(V) \
194 : V(ChangeTaggedSignedToInt32) \
195 : V(ChangeTaggedToInt32) \
196 : V(ChangeTaggedToUint32) \
197 : V(ChangeTaggedToFloat64) \
198 : V(ChangeTaggedToTaggedSigned) \
199 : V(ChangeInt31ToTaggedSigned) \
200 : V(ChangeInt32ToTagged) \
201 : V(ChangeUint32ToTagged) \
202 : V(ChangeFloat64ToTagged) \
203 : V(ChangeFloat64ToTaggedPointer) \
204 : V(ChangeTaggedToBit) \
205 : V(ChangeBitToTagged) \
206 : V(TruncateTaggedToWord32) \
207 : V(TruncateTaggedToFloat64) \
208 : V(TruncateTaggedToBit) \
209 : V(TruncateTaggedPointerToBit)
210 :
211 : #define SIMPLIFIED_CHECKED_OP_LIST(V) \
212 : V(CheckedInt32Add) \
213 : V(CheckedInt32Sub) \
214 : V(CheckedInt32Div) \
215 : V(CheckedInt32Mod) \
216 : V(CheckedUint32Div) \
217 : V(CheckedUint32Mod) \
218 : V(CheckedInt32Mul) \
219 : V(CheckedInt32ToTaggedSigned) \
220 : V(CheckedUint32ToInt32) \
221 : V(CheckedUint32ToTaggedSigned) \
222 : V(CheckedFloat64ToInt32) \
223 : V(CheckedTaggedSignedToInt32) \
224 : V(CheckedTaggedToInt32) \
225 : V(CheckedTruncateTaggedToWord32) \
226 : V(CheckedTaggedToFloat64) \
227 : V(CheckedTaggedToTaggedSigned) \
228 : V(CheckedTaggedToTaggedPointer)
229 :
230 : #define SIMPLIFIED_COMPARE_BINOP_LIST(V) \
231 : V(NumberEqual) \
232 : V(NumberLessThan) \
233 : V(NumberLessThanOrEqual) \
234 : V(SpeculativeNumberEqual) \
235 : V(SpeculativeNumberLessThan) \
236 : V(SpeculativeNumberLessThanOrEqual) \
237 : V(ReferenceEqual) \
238 : V(StringEqual) \
239 : V(StringLessThan) \
240 : V(StringLessThanOrEqual)
241 :
242 : #define SIMPLIFIED_NUMBER_BINOP_LIST(V) \
243 : V(NumberAdd) \
244 : V(NumberSubtract) \
245 : V(NumberMultiply) \
246 : V(NumberDivide) \
247 : V(NumberModulus) \
248 : V(NumberBitwiseOr) \
249 : V(NumberBitwiseXor) \
250 : V(NumberBitwiseAnd) \
251 : V(NumberShiftLeft) \
252 : V(NumberShiftRight) \
253 : V(NumberShiftRightLogical) \
254 : V(NumberAtan2) \
255 : V(NumberImul) \
256 : V(NumberMax) \
257 : V(NumberMin) \
258 : V(NumberPow)
259 :
260 : #define SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(V) \
261 : V(SpeculativeNumberAdd) \
262 : V(SpeculativeNumberSubtract) \
263 : V(SpeculativeNumberMultiply) \
264 : V(SpeculativeNumberDivide) \
265 : V(SpeculativeNumberModulus) \
266 : V(SpeculativeNumberBitwiseAnd) \
267 : V(SpeculativeNumberBitwiseOr) \
268 : V(SpeculativeNumberBitwiseXor) \
269 : V(SpeculativeNumberShiftLeft) \
270 : V(SpeculativeNumberShiftRight) \
271 : V(SpeculativeNumberShiftRightLogical) \
272 : V(SpeculativeSafeIntegerAdd) \
273 : V(SpeculativeSafeIntegerSubtract)
274 :
275 : #define SIMPLIFIED_NUMBER_UNOP_LIST(V) \
276 : V(NumberAbs) \
277 : V(NumberAcos) \
278 : V(NumberAcosh) \
279 : V(NumberAsin) \
280 : V(NumberAsinh) \
281 : V(NumberAtan) \
282 : V(NumberAtanh) \
283 : V(NumberCbrt) \
284 : V(NumberCeil) \
285 : V(NumberClz32) \
286 : V(NumberCos) \
287 : V(NumberCosh) \
288 : V(NumberExp) \
289 : V(NumberExpm1) \
290 : V(NumberFloor) \
291 : V(NumberFround) \
292 : V(NumberLog) \
293 : V(NumberLog1p) \
294 : V(NumberLog2) \
295 : V(NumberLog10) \
296 : V(NumberRound) \
297 : V(NumberSign) \
298 : V(NumberSin) \
299 : V(NumberSinh) \
300 : V(NumberSqrt) \
301 : V(NumberTan) \
302 : V(NumberTanh) \
303 : V(NumberTrunc) \
304 : V(NumberToBoolean) \
305 : V(NumberToInt32) \
306 : V(NumberToUint32) \
307 : V(NumberToUint8Clamped) \
308 : V(NumberSilenceNaN)
309 :
310 : #define SIMPLIFIED_SPECULATIVE_NUMBER_UNOP_LIST(V) V(SpeculativeToNumber)
311 :
312 : #define SIMPLIFIED_OTHER_OP_LIST(V) \
313 : V(PlainPrimitiveToNumber) \
314 : V(PlainPrimitiveToWord32) \
315 : V(PlainPrimitiveToFloat64) \
316 : V(BooleanNot) \
317 : V(StringToNumber) \
318 : V(StringCharAt) \
319 : V(StringCharCodeAt) \
320 : V(SeqStringCharCodeAt) \
321 : V(StringFromCharCode) \
322 : V(StringFromCodePoint) \
323 : V(StringIndexOf) \
324 : V(StringToLowerCaseIntl) \
325 : V(StringToUpperCaseIntl) \
326 : V(CheckBounds) \
327 : V(CheckIf) \
328 : V(CheckMaps) \
329 : V(CheckNumber) \
330 : V(CheckInternalizedString) \
331 : V(CheckReceiver) \
332 : V(CheckString) \
333 : V(CheckSeqString) \
334 : V(CheckSymbol) \
335 : V(CheckSmi) \
336 : V(CheckHeapObject) \
337 : V(CheckFloat64Hole) \
338 : V(CheckNotTaggedHole) \
339 : V(CheckEqualsInternalizedString) \
340 : V(CheckEqualsSymbol) \
341 : V(CompareMaps) \
342 : V(ConvertTaggedHoleToUndefined) \
343 : V(TypeOf) \
344 : V(ClassOf) \
345 : V(Allocate) \
346 : V(LoadFieldByIndex) \
347 : V(LoadField) \
348 : V(LoadElement) \
349 : V(LoadTypedElement) \
350 : V(StoreField) \
351 : V(StoreElement) \
352 : V(StoreTypedElement) \
353 : V(StoreSignedSmallElement) \
354 : V(TransitionAndStoreElement) \
355 : V(TransitionAndStoreNumberElement) \
356 : V(TransitionAndStoreNonNumberElement) \
357 : V(ToBoolean) \
358 : V(ObjectIsArrayBufferView) \
359 : V(ObjectIsCallable) \
360 : V(ObjectIsConstructor) \
361 : V(ObjectIsDetectableCallable) \
362 : V(ObjectIsMinusZero) \
363 : V(ObjectIsNaN) \
364 : V(ObjectIsNonCallable) \
365 : V(ObjectIsNumber) \
366 : V(ObjectIsReceiver) \
367 : V(ObjectIsSmi) \
368 : V(ObjectIsString) \
369 : V(ObjectIsSymbol) \
370 : V(ObjectIsUndetectable) \
371 : V(ArgumentsFrame) \
372 : V(ArgumentsLength) \
373 : V(NewDoubleElements) \
374 : V(NewSmiOrObjectElements) \
375 : V(NewArgumentsElements) \
376 : V(ArrayBufferWasNeutered) \
377 : V(EnsureWritableFastElements) \
378 : V(MaybeGrowFastElements) \
379 : V(TransitionElementsKind) \
380 : V(FindOrderedHashMapEntry) \
381 : V(FindOrderedHashMapEntryForInt32Key) \
382 : V(RuntimeAbort)
383 :
384 : #define SIMPLIFIED_OP_LIST(V) \
385 : SIMPLIFIED_CHANGE_OP_LIST(V) \
386 : SIMPLIFIED_CHECKED_OP_LIST(V) \
387 : SIMPLIFIED_COMPARE_BINOP_LIST(V) \
388 : SIMPLIFIED_NUMBER_BINOP_LIST(V) \
389 : SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(V) \
390 : SIMPLIFIED_NUMBER_UNOP_LIST(V) \
391 : SIMPLIFIED_SPECULATIVE_NUMBER_UNOP_LIST(V) \
392 : SIMPLIFIED_OTHER_OP_LIST(V)
393 :
394 : // Opcodes for Machine-level operators.
395 : #define MACHINE_COMPARE_BINOP_LIST(V) \
396 : V(Word32Equal) \
397 : V(Word64Equal) \
398 : V(Int32LessThan) \
399 : V(Int32LessThanOrEqual) \
400 : V(Uint32LessThan) \
401 : V(Uint32LessThanOrEqual) \
402 : V(Int64LessThan) \
403 : V(Int64LessThanOrEqual) \
404 : V(Uint64LessThan) \
405 : V(Uint64LessThanOrEqual) \
406 : V(Float32Equal) \
407 : V(Float32LessThan) \
408 : V(Float32LessThanOrEqual) \
409 : V(Float64Equal) \
410 : V(Float64LessThan) \
411 : V(Float64LessThanOrEqual)
412 :
413 : #define MACHINE_UNOP_32_LIST(V) \
414 : V(Word32Clz) \
415 : V(Word32Ctz) \
416 : V(Int32AbsWithOverflow) \
417 : V(Word32ReverseBits) \
418 : V(Word32ReverseBytes)
419 :
420 : #define MACHINE_BINOP_32_LIST(V) \
421 : V(Word32And) \
422 : V(Word32Or) \
423 : V(Word32Xor) \
424 : V(Word32Shl) \
425 : V(Word32Shr) \
426 : V(Word32Sar) \
427 : V(Word32Ror) \
428 : V(Int32Add) \
429 : V(Int32AddWithOverflow) \
430 : V(Int32Sub) \
431 : V(Int32SubWithOverflow) \
432 : V(Int32Mul) \
433 : V(Int32MulWithOverflow) \
434 : V(Int32MulHigh) \
435 : V(Int32Div) \
436 : V(Int32Mod) \
437 : V(Uint32Div) \
438 : V(Uint32Mod) \
439 : V(Uint32MulHigh)
440 :
441 : #define MACHINE_BINOP_64_LIST(V) \
442 : V(Word64And) \
443 : V(Word64Or) \
444 : V(Word64Xor) \
445 : V(Word64Shl) \
446 : V(Word64Shr) \
447 : V(Word64Sar) \
448 : V(Word64Ror) \
449 : V(Int64Add) \
450 : V(Int64AddWithOverflow) \
451 : V(Int64Sub) \
452 : V(Int64SubWithOverflow) \
453 : V(Int64Mul) \
454 : V(Int64Div) \
455 : V(Int64Mod) \
456 : V(Uint64Div) \
457 : V(Uint64Mod)
458 :
459 : #define MACHINE_FLOAT32_UNOP_LIST(V) \
460 : V(Float32Abs) \
461 : V(Float32Neg) \
462 : V(Float32RoundDown) \
463 : V(Float32RoundTiesEven) \
464 : V(Float32RoundTruncate) \
465 : V(Float32RoundUp) \
466 : V(Float32Sqrt)
467 :
468 : #define MACHINE_FLOAT32_BINOP_LIST(V) \
469 : V(Float32Add) \
470 : V(Float32Sub) \
471 : V(Float32Mul) \
472 : V(Float32Div) \
473 : V(Float32Max) \
474 : V(Float32Min)
475 :
476 : #define MACHINE_FLOAT64_UNOP_LIST(V) \
477 : V(Float64Abs) \
478 : V(Float64Acos) \
479 : V(Float64Acosh) \
480 : V(Float64Asin) \
481 : V(Float64Asinh) \
482 : V(Float64Atan) \
483 : V(Float64Atanh) \
484 : V(Float64Cbrt) \
485 : V(Float64Cos) \
486 : V(Float64Cosh) \
487 : V(Float64Exp) \
488 : V(Float64Expm1) \
489 : V(Float64Log) \
490 : V(Float64Log1p) \
491 : V(Float64Log10) \
492 : V(Float64Log2) \
493 : V(Float64Neg) \
494 : V(Float64RoundDown) \
495 : V(Float64RoundTiesAway) \
496 : V(Float64RoundTiesEven) \
497 : V(Float64RoundTruncate) \
498 : V(Float64RoundUp) \
499 : V(Float64Sin) \
500 : V(Float64Sinh) \
501 : V(Float64Sqrt) \
502 : V(Float64Tan) \
503 : V(Float64Tanh)
504 :
505 : #define MACHINE_FLOAT64_BINOP_LIST(V) \
506 : V(Float64Atan2) \
507 : V(Float64Max) \
508 : V(Float64Min) \
509 : V(Float64Add) \
510 : V(Float64Sub) \
511 : V(Float64Mul) \
512 : V(Float64Div) \
513 : V(Float64Mod) \
514 : V(Float64Pow)
515 :
516 : #define MACHINE_OP_LIST(V) \
517 : MACHINE_UNOP_32_LIST(V) \
518 : MACHINE_BINOP_32_LIST(V) \
519 : MACHINE_BINOP_64_LIST(V) \
520 : MACHINE_COMPARE_BINOP_LIST(V) \
521 : MACHINE_FLOAT32_BINOP_LIST(V) \
522 : MACHINE_FLOAT32_UNOP_LIST(V) \
523 : MACHINE_FLOAT64_BINOP_LIST(V) \
524 : MACHINE_FLOAT64_UNOP_LIST(V) \
525 : V(DebugAbort) \
526 : V(DebugBreak) \
527 : V(Comment) \
528 : V(Load) \
529 : V(Store) \
530 : V(StackSlot) \
531 : V(Word32Popcnt) \
532 : V(Word64Popcnt) \
533 : V(Word64Clz) \
534 : V(Word64Ctz) \
535 : V(Word64ReverseBits) \
536 : V(Word64ReverseBytes) \
537 : V(Int64AbsWithOverflow) \
538 : V(BitcastTaggedToWord) \
539 : V(BitcastWordToTagged) \
540 : V(BitcastWordToTaggedSigned) \
541 : V(TruncateFloat64ToWord32) \
542 : V(ChangeFloat32ToFloat64) \
543 : V(ChangeFloat64ToInt32) \
544 : V(ChangeFloat64ToUint32) \
545 : V(ChangeFloat64ToUint64) \
546 : V(Float64SilenceNaN) \
547 : V(TruncateFloat64ToUint32) \
548 : V(TruncateFloat32ToInt32) \
549 : V(TruncateFloat32ToUint32) \
550 : V(TryTruncateFloat32ToInt64) \
551 : V(TryTruncateFloat64ToInt64) \
552 : V(TryTruncateFloat32ToUint64) \
553 : V(TryTruncateFloat64ToUint64) \
554 : V(ChangeInt32ToFloat64) \
555 : V(ChangeInt32ToInt64) \
556 : V(ChangeUint32ToFloat64) \
557 : V(ChangeUint32ToUint64) \
558 : V(TruncateFloat64ToFloat32) \
559 : V(TruncateInt64ToInt32) \
560 : V(RoundFloat64ToInt32) \
561 : V(RoundInt32ToFloat32) \
562 : V(RoundInt64ToFloat32) \
563 : V(RoundInt64ToFloat64) \
564 : V(RoundUint32ToFloat32) \
565 : V(RoundUint64ToFloat32) \
566 : V(RoundUint64ToFloat64) \
567 : V(BitcastFloat32ToInt32) \
568 : V(BitcastFloat64ToInt64) \
569 : V(BitcastInt32ToFloat32) \
570 : V(BitcastInt64ToFloat64) \
571 : V(Float64ExtractLowWord32) \
572 : V(Float64ExtractHighWord32) \
573 : V(Float64InsertLowWord32) \
574 : V(Float64InsertHighWord32) \
575 : V(LoadStackPointer) \
576 : V(LoadFramePointer) \
577 : V(LoadParentFramePointer) \
578 : V(CheckedLoad) \
579 : V(CheckedStore) \
580 : V(UnalignedLoad) \
581 : V(UnalignedStore) \
582 : V(Int32PairAdd) \
583 : V(Int32PairSub) \
584 : V(Int32PairMul) \
585 : V(Word32PairShl) \
586 : V(Word32PairShr) \
587 : V(Word32PairSar) \
588 : V(ProtectedLoad) \
589 : V(ProtectedStore) \
590 : V(AtomicLoad) \
591 : V(AtomicStore) \
592 : V(AtomicExchange) \
593 : V(AtomicCompareExchange) \
594 : V(AtomicAdd) \
595 : V(AtomicSub) \
596 : V(AtomicAnd) \
597 : V(AtomicOr) \
598 : V(AtomicXor) \
599 : V(UnsafePointerAdd)
600 :
601 : #define MACHINE_SIMD_OP_LIST(V) \
602 : V(F32x4Splat) \
603 : V(F32x4ExtractLane) \
604 : V(F32x4ReplaceLane) \
605 : V(F32x4SConvertI32x4) \
606 : V(F32x4UConvertI32x4) \
607 : V(F32x4Abs) \
608 : V(F32x4Neg) \
609 : V(F32x4RecipApprox) \
610 : V(F32x4RecipSqrtApprox) \
611 : V(F32x4Add) \
612 : V(F32x4AddHoriz) \
613 : V(F32x4Sub) \
614 : V(F32x4Mul) \
615 : V(F32x4Min) \
616 : V(F32x4Max) \
617 : V(F32x4Eq) \
618 : V(F32x4Ne) \
619 : V(F32x4Lt) \
620 : V(F32x4Le) \
621 : V(F32x4Gt) \
622 : V(F32x4Ge) \
623 : V(I32x4Splat) \
624 : V(I32x4ExtractLane) \
625 : V(I32x4ReplaceLane) \
626 : V(I32x4SConvertF32x4) \
627 : V(I32x4SConvertI16x8Low) \
628 : V(I32x4SConvertI16x8High) \
629 : V(I32x4Neg) \
630 : V(I32x4Shl) \
631 : V(I32x4ShrS) \
632 : V(I32x4Add) \
633 : V(I32x4AddHoriz) \
634 : V(I32x4Sub) \
635 : V(I32x4Mul) \
636 : V(I32x4MinS) \
637 : V(I32x4MaxS) \
638 : V(I32x4Eq) \
639 : V(I32x4Ne) \
640 : V(I32x4LtS) \
641 : V(I32x4LeS) \
642 : V(I32x4GtS) \
643 : V(I32x4GeS) \
644 : V(I32x4UConvertF32x4) \
645 : V(I32x4UConvertI16x8Low) \
646 : V(I32x4UConvertI16x8High) \
647 : V(I32x4ShrU) \
648 : V(I32x4MinU) \
649 : V(I32x4MaxU) \
650 : V(I32x4LtU) \
651 : V(I32x4LeU) \
652 : V(I32x4GtU) \
653 : V(I32x4GeU) \
654 : V(I16x8Splat) \
655 : V(I16x8ExtractLane) \
656 : V(I16x8ReplaceLane) \
657 : V(I16x8SConvertI8x16Low) \
658 : V(I16x8SConvertI8x16High) \
659 : V(I16x8Neg) \
660 : V(I16x8Shl) \
661 : V(I16x8ShrS) \
662 : V(I16x8SConvertI32x4) \
663 : V(I16x8Add) \
664 : V(I16x8AddSaturateS) \
665 : V(I16x8AddHoriz) \
666 : V(I16x8Sub) \
667 : V(I16x8SubSaturateS) \
668 : V(I16x8Mul) \
669 : V(I16x8MinS) \
670 : V(I16x8MaxS) \
671 : V(I16x8Eq) \
672 : V(I16x8Ne) \
673 : V(I16x8LtS) \
674 : V(I16x8LeS) \
675 : V(I16x8GtS) \
676 : V(I16x8GeS) \
677 : V(I16x8UConvertI8x16Low) \
678 : V(I16x8UConvertI8x16High) \
679 : V(I16x8ShrU) \
680 : V(I16x8UConvertI32x4) \
681 : V(I16x8AddSaturateU) \
682 : V(I16x8SubSaturateU) \
683 : V(I16x8MinU) \
684 : V(I16x8MaxU) \
685 : V(I16x8LtU) \
686 : V(I16x8LeU) \
687 : V(I16x8GtU) \
688 : V(I16x8GeU) \
689 : V(I8x16Splat) \
690 : V(I8x16ExtractLane) \
691 : V(I8x16ReplaceLane) \
692 : V(I8x16SConvertI16x8) \
693 : V(I8x16Neg) \
694 : V(I8x16Shl) \
695 : V(I8x16ShrS) \
696 : V(I8x16Add) \
697 : V(I8x16AddSaturateS) \
698 : V(I8x16Sub) \
699 : V(I8x16SubSaturateS) \
700 : V(I8x16Mul) \
701 : V(I8x16MinS) \
702 : V(I8x16MaxS) \
703 : V(I8x16Eq) \
704 : V(I8x16Ne) \
705 : V(I8x16LtS) \
706 : V(I8x16LeS) \
707 : V(I8x16GtS) \
708 : V(I8x16GeS) \
709 : V(I8x16UConvertI16x8) \
710 : V(I8x16AddSaturateU) \
711 : V(I8x16SubSaturateU) \
712 : V(I8x16ShrU) \
713 : V(I8x16MinU) \
714 : V(I8x16MaxU) \
715 : V(I8x16LtU) \
716 : V(I8x16LeU) \
717 : V(I8x16GtU) \
718 : V(I8x16GeU) \
719 : V(S128Load) \
720 : V(S128Store) \
721 : V(S128Zero) \
722 : V(S128Not) \
723 : V(S128And) \
724 : V(S128Or) \
725 : V(S128Xor) \
726 : V(S128Select) \
727 : V(S8x16Shuffle) \
728 : V(S1x4AnyTrue) \
729 : V(S1x4AllTrue) \
730 : V(S1x8AnyTrue) \
731 : V(S1x8AllTrue) \
732 : V(S1x16AnyTrue) \
733 : V(S1x16AllTrue)
734 :
735 : #define VALUE_OP_LIST(V) \
736 : COMMON_OP_LIST(V) \
737 : SIMPLIFIED_OP_LIST(V) \
738 : MACHINE_OP_LIST(V) \
739 : MACHINE_SIMD_OP_LIST(V) \
740 : JS_OP_LIST(V)
741 :
742 : // The combination of all operators at all levels and the common operators.
743 : #define ALL_OP_LIST(V) \
744 : CONTROL_OP_LIST(V) \
745 : VALUE_OP_LIST(V)
746 :
747 : namespace v8 {
748 : namespace internal {
749 : namespace compiler {
750 :
751 : // Declare an enumeration with all the opcodes at all levels so that they
752 : // can be globally, uniquely numbered.
753 : class V8_EXPORT_PRIVATE IrOpcode {
754 : public:
755 : enum Value {
756 : #define DECLARE_OPCODE(x) k##x,
757 : ALL_OP_LIST(DECLARE_OPCODE)
758 : #undef DECLARE_OPCODE
759 : kLast = -1
760 : #define COUNT_OPCODE(x) +1
761 : ALL_OP_LIST(COUNT_OPCODE)
762 : #undef COUNT_OPCODE
763 : };
764 :
765 : // Returns the mnemonic name of an opcode.
766 : static char const* Mnemonic(Value value);
767 :
768 : // Returns true if opcode for common operator.
769 : static bool IsCommonOpcode(Value value) {
770 627 : return kStart <= value && value <= kDead;
771 : }
772 :
773 : // Returns true if opcode for control operator.
774 : static bool IsControlOpcode(Value value) {
775 627 : return kStart <= value && value <= kEnd;
776 : }
777 :
778 : // Returns true if opcode for JavaScript operator.
779 : static bool IsJsOpcode(Value value) {
780 978441626 : return kJSEqual <= value && value <= kJSDebugger;
781 : }
782 :
783 : // Returns true if opcode for constant operator.
784 : static bool IsConstantOpcode(Value value) {
785 31805284 : return kInt32Constant <= value && value <= kRelocatableInt64Constant;
786 : }
787 :
788 : static bool IsPhiOpcode(Value value) {
789 265040371 : return value == kPhi || value == kEffectPhi;
790 : }
791 :
792 : static bool IsMergeOpcode(Value value) {
793 254124239 : return value == kMerge || value == kLoop;
794 : }
795 :
796 : static bool IsIfProjectionOpcode(Value value) {
797 : return kIfTrue <= value && value <= kIfDefault;
798 : }
799 :
800 : // Returns true if opcode terminates control flow in a graph (i.e. respective
801 : // nodes are expected to have control uses by the graphs {End} node only).
802 : static bool IsGraphTerminator(Value value) {
803 0 : return value == kDeoptimize || value == kReturn || value == kTailCall ||
804 0 : value == kTerminate || value == kThrow;
805 : }
806 :
807 : // Returns true if opcode can be inlined.
808 : static bool IsInlineeOpcode(Value value) {
809 30740601 : return value == kJSConstruct || value == kJSCall;
810 : }
811 :
812 : // Returns true if opcode for comparison operator.
813 : static bool IsComparisonOpcode(Value value) {
814 1041438 : return (kJSEqual <= value && value <= kJSGreaterThanOrEqual) ||
815 1562142 : (kNumberEqual <= value && value <= kStringLessThanOrEqual) ||
816 520704 : (kWord32Equal <= value && value <= kFloat64LessThanOrEqual);
817 : }
818 :
819 : static bool IsContextChainExtendingOpcode(Value value) {
820 15740 : return kJSCreateFunctionContext <= value && value <= kJSCreateScriptContext;
821 : }
822 : };
823 :
824 : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, IrOpcode::Value);
825 :
826 : } // namespace compiler
827 : } // namespace internal
828 : } // namespace v8
829 :
830 : #endif // V8_COMPILER_OPCODES_H_
|