Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 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 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 8 | #include <iosfwd> |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 9 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 10 | // Opcodes for control operators. |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 11 | #define CONTROL_OP_LIST(V) \ |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 12 | V(Start) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 13 | V(Loop) \ |
| 14 | V(Branch) \ |
| 15 | V(Switch) \ |
| 16 | V(IfTrue) \ |
| 17 | V(IfFalse) \ |
| 18 | V(IfSuccess) \ |
| 19 | V(IfException) \ |
| 20 | V(IfValue) \ |
| 21 | V(IfDefault) \ |
| 22 | V(Merge) \ |
| 23 | V(Deoptimize) \ |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 24 | V(DeoptimizeIf) \ |
| 25 | V(DeoptimizeUnless) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 26 | V(Return) \ |
| 27 | V(TailCall) \ |
| 28 | V(Terminate) \ |
| 29 | V(OsrNormalEntry) \ |
| 30 | V(OsrLoopEntry) \ |
| 31 | V(Throw) \ |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 32 | V(End) |
| 33 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 34 | // Opcodes for constant operators. |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame] | 35 | #define CONSTANT_OP_LIST(V) \ |
| 36 | V(Int32Constant) \ |
| 37 | V(Int64Constant) \ |
| 38 | V(Float32Constant) \ |
| 39 | V(Float64Constant) \ |
| 40 | V(ExternalConstant) \ |
| 41 | V(NumberConstant) \ |
| 42 | V(HeapConstant) \ |
| 43 | V(RelocatableInt32Constant) \ |
| 44 | V(RelocatableInt64Constant) |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 45 | |
| 46 | #define INNER_OP_LIST(V) \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 47 | V(Select) \ |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 48 | V(Phi) \ |
| 49 | V(EffectPhi) \ |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 50 | V(Checkpoint) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 51 | V(BeginRegion) \ |
| 52 | V(FinishRegion) \ |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 53 | V(FrameState) \ |
| 54 | V(StateValues) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 55 | V(TypedStateValues) \ |
| 56 | V(ObjectState) \ |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 57 | V(Call) \ |
| 58 | V(Parameter) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 59 | V(OsrValue) \ |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 60 | V(Projection) |
| 61 | |
| 62 | #define COMMON_OP_LIST(V) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 63 | CONSTANT_OP_LIST(V) \ |
| 64 | INNER_OP_LIST(V) \ |
| 65 | V(Dead) |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 66 | |
| 67 | // Opcodes for JavaScript operators. |
| 68 | #define JS_COMPARE_BINOP_LIST(V) \ |
| 69 | V(JSEqual) \ |
| 70 | V(JSNotEqual) \ |
| 71 | V(JSStrictEqual) \ |
| 72 | V(JSStrictNotEqual) \ |
| 73 | V(JSLessThan) \ |
| 74 | V(JSGreaterThan) \ |
| 75 | V(JSLessThanOrEqual) \ |
| 76 | V(JSGreaterThanOrEqual) |
| 77 | |
| 78 | #define JS_BITWISE_BINOP_LIST(V) \ |
| 79 | V(JSBitwiseOr) \ |
| 80 | V(JSBitwiseXor) \ |
| 81 | V(JSBitwiseAnd) \ |
| 82 | V(JSShiftLeft) \ |
| 83 | V(JSShiftRight) \ |
| 84 | V(JSShiftRightLogical) |
| 85 | |
| 86 | #define JS_ARITH_BINOP_LIST(V) \ |
| 87 | V(JSAdd) \ |
| 88 | V(JSSubtract) \ |
| 89 | V(JSMultiply) \ |
| 90 | V(JSDivide) \ |
| 91 | V(JSModulus) |
| 92 | |
| 93 | #define JS_SIMPLE_BINOP_LIST(V) \ |
| 94 | JS_COMPARE_BINOP_LIST(V) \ |
| 95 | JS_BITWISE_BINOP_LIST(V) \ |
| 96 | JS_ARITH_BINOP_LIST(V) |
| 97 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 98 | #define JS_CONVERSION_UNOP_LIST(V) \ |
| 99 | V(JSToBoolean) \ |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 100 | V(JSToInteger) \ |
| 101 | V(JSToLength) \ |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 102 | V(JSToName) \ |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 103 | V(JSToNumber) \ |
| 104 | V(JSToObject) \ |
| 105 | V(JSToString) |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 106 | |
| 107 | #define JS_OTHER_UNOP_LIST(V) \ |
| 108 | V(JSTypeOf) |
| 109 | |
| 110 | #define JS_SIMPLE_UNOP_LIST(V) \ |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 111 | JS_CONVERSION_UNOP_LIST(V) \ |
| 112 | JS_OTHER_UNOP_LIST(V) |
| 113 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 114 | #define JS_OBJECT_OP_LIST(V) \ |
| 115 | V(JSCreate) \ |
| 116 | V(JSCreateArguments) \ |
| 117 | V(JSCreateArray) \ |
| 118 | V(JSCreateClosure) \ |
| 119 | V(JSCreateIterResultObject) \ |
| 120 | V(JSCreateLiteralArray) \ |
| 121 | V(JSCreateLiteralObject) \ |
| 122 | V(JSCreateLiteralRegExp) \ |
| 123 | V(JSLoadProperty) \ |
| 124 | V(JSLoadNamed) \ |
| 125 | V(JSLoadGlobal) \ |
| 126 | V(JSStoreProperty) \ |
| 127 | V(JSStoreNamed) \ |
| 128 | V(JSStoreGlobal) \ |
| 129 | V(JSDeleteProperty) \ |
| 130 | V(JSHasProperty) \ |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 131 | V(JSInstanceOf) |
| 132 | |
| 133 | #define JS_CONTEXT_OP_LIST(V) \ |
| 134 | V(JSLoadContext) \ |
| 135 | V(JSStoreContext) \ |
| 136 | V(JSCreateFunctionContext) \ |
| 137 | V(JSCreateCatchContext) \ |
| 138 | V(JSCreateWithContext) \ |
| 139 | V(JSCreateBlockContext) \ |
| 140 | V(JSCreateModuleContext) \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 141 | V(JSCreateScriptContext) |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 142 | |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 143 | #define JS_OTHER_OP_LIST(V) \ |
| 144 | V(JSCallConstruct) \ |
| 145 | V(JSCallFunction) \ |
| 146 | V(JSCallRuntime) \ |
| 147 | V(JSConvertReceiver) \ |
| 148 | V(JSForInDone) \ |
| 149 | V(JSForInNext) \ |
| 150 | V(JSForInPrepare) \ |
| 151 | V(JSForInStep) \ |
| 152 | V(JSLoadMessage) \ |
| 153 | V(JSStoreMessage) \ |
| 154 | V(JSGeneratorStore) \ |
| 155 | V(JSGeneratorRestoreContinuation) \ |
| 156 | V(JSGeneratorRestoreRegister) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 157 | V(JSStackCheck) |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 158 | |
| 159 | #define JS_OP_LIST(V) \ |
| 160 | JS_SIMPLE_BINOP_LIST(V) \ |
| 161 | JS_SIMPLE_UNOP_LIST(V) \ |
| 162 | JS_OBJECT_OP_LIST(V) \ |
| 163 | JS_CONTEXT_OP_LIST(V) \ |
| 164 | JS_OTHER_OP_LIST(V) |
| 165 | |
| 166 | // Opcodes for VirtuaMachine-level operators. |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 167 | #define SIMPLIFIED_COMPARE_BINOP_LIST(V) \ |
| 168 | V(NumberEqual) \ |
| 169 | V(NumberLessThan) \ |
| 170 | V(NumberLessThanOrEqual) \ |
| 171 | V(ReferenceEqual) \ |
| 172 | V(StringEqual) \ |
| 173 | V(StringLessThan) \ |
| 174 | V(StringLessThanOrEqual) |
| 175 | |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 176 | #define SIMPLIFIED_OP_LIST(V) \ |
| 177 | SIMPLIFIED_COMPARE_BINOP_LIST(V) \ |
| 178 | V(PlainPrimitiveToNumber) \ |
| 179 | V(PlainPrimitiveToWord32) \ |
| 180 | V(PlainPrimitiveToFloat64) \ |
| 181 | V(BooleanNot) \ |
| 182 | V(BooleanToNumber) \ |
| 183 | V(SpeculativeNumberAdd) \ |
| 184 | V(SpeculativeNumberSubtract) \ |
| 185 | V(SpeculativeNumberMultiply) \ |
| 186 | V(SpeculativeNumberDivide) \ |
| 187 | V(SpeculativeNumberModulus) \ |
| 188 | V(SpeculativeNumberEqual) \ |
| 189 | V(SpeculativeNumberLessThan) \ |
| 190 | V(SpeculativeNumberLessThanOrEqual) \ |
| 191 | V(NumberAdd) \ |
| 192 | V(NumberSubtract) \ |
| 193 | V(NumberMultiply) \ |
| 194 | V(NumberDivide) \ |
| 195 | V(NumberModulus) \ |
| 196 | V(NumberBitwiseOr) \ |
| 197 | V(NumberBitwiseXor) \ |
| 198 | V(NumberBitwiseAnd) \ |
| 199 | V(NumberShiftLeft) \ |
| 200 | V(NumberShiftRight) \ |
| 201 | V(NumberShiftRightLogical) \ |
| 202 | V(NumberImul) \ |
| 203 | V(NumberAbs) \ |
| 204 | V(NumberClz32) \ |
| 205 | V(NumberCeil) \ |
| 206 | V(NumberCos) \ |
| 207 | V(NumberFloor) \ |
| 208 | V(NumberFround) \ |
| 209 | V(NumberAtan) \ |
| 210 | V(NumberAtan2) \ |
| 211 | V(NumberAtanh) \ |
| 212 | V(NumberExp) \ |
| 213 | V(NumberExpm1) \ |
| 214 | V(NumberLog) \ |
| 215 | V(NumberLog1p) \ |
| 216 | V(NumberLog2) \ |
| 217 | V(NumberLog10) \ |
| 218 | V(NumberCbrt) \ |
| 219 | V(NumberRound) \ |
| 220 | V(NumberSin) \ |
| 221 | V(NumberSqrt) \ |
| 222 | V(NumberTan) \ |
| 223 | V(NumberTrunc) \ |
| 224 | V(NumberToInt32) \ |
| 225 | V(NumberToUint32) \ |
| 226 | V(NumberSilenceNaN) \ |
| 227 | V(StringFromCharCode) \ |
| 228 | V(StringToNumber) \ |
| 229 | V(ChangeTaggedSignedToInt32) \ |
| 230 | V(ChangeTaggedToInt32) \ |
| 231 | V(ChangeTaggedToUint32) \ |
| 232 | V(ChangeTaggedToFloat64) \ |
| 233 | V(ChangeInt31ToTaggedSigned) \ |
| 234 | V(ChangeInt32ToTagged) \ |
| 235 | V(ChangeUint32ToTagged) \ |
| 236 | V(ChangeFloat64ToTagged) \ |
| 237 | V(ChangeTaggedToBit) \ |
| 238 | V(ChangeBitToTagged) \ |
| 239 | V(CheckBounds) \ |
| 240 | V(CheckTaggedPointer) \ |
| 241 | V(CheckTaggedSigned) \ |
| 242 | V(CheckedInt32Add) \ |
| 243 | V(CheckedInt32Sub) \ |
| 244 | V(CheckedUint32ToInt32) \ |
| 245 | V(CheckedFloat64ToInt32) \ |
| 246 | V(CheckedTaggedToInt32) \ |
| 247 | V(CheckedTaggedToFloat64) \ |
| 248 | V(CheckFloat64Hole) \ |
| 249 | V(CheckTaggedHole) \ |
| 250 | V(TruncateTaggedToWord32) \ |
| 251 | V(TruncateTaggedToFloat64) \ |
| 252 | V(Allocate) \ |
| 253 | V(LoadField) \ |
| 254 | V(LoadBuffer) \ |
| 255 | V(LoadElement) \ |
| 256 | V(StoreField) \ |
| 257 | V(StoreBuffer) \ |
| 258 | V(StoreElement) \ |
| 259 | V(ObjectIsCallable) \ |
| 260 | V(ObjectIsNumber) \ |
| 261 | V(ObjectIsReceiver) \ |
| 262 | V(ObjectIsSmi) \ |
| 263 | V(ObjectIsString) \ |
| 264 | V(ObjectIsUndetectable) \ |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame] | 265 | V(TypeGuard) |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 266 | |
| 267 | // Opcodes for Machine-level operators. |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 268 | #define MACHINE_COMPARE_BINOP_LIST(V) \ |
| 269 | V(Word32Equal) \ |
| 270 | V(Word64Equal) \ |
| 271 | V(Int32LessThan) \ |
| 272 | V(Int32LessThanOrEqual) \ |
| 273 | V(Uint32LessThan) \ |
| 274 | V(Uint32LessThanOrEqual) \ |
| 275 | V(Int64LessThan) \ |
| 276 | V(Int64LessThanOrEqual) \ |
| 277 | V(Uint64LessThan) \ |
| 278 | V(Uint64LessThanOrEqual) \ |
| 279 | V(Float32Equal) \ |
| 280 | V(Float32LessThan) \ |
| 281 | V(Float32LessThanOrEqual) \ |
| 282 | V(Float64Equal) \ |
| 283 | V(Float64LessThan) \ |
| 284 | V(Float64LessThanOrEqual) |
| 285 | |
| 286 | #define MACHINE_OP_LIST(V) \ |
| 287 | MACHINE_COMPARE_BINOP_LIST(V) \ |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 288 | V(DebugBreak) \ |
| 289 | V(Comment) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 290 | V(Load) \ |
| 291 | V(Store) \ |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 292 | V(StackSlot) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 293 | V(Word32And) \ |
| 294 | V(Word32Or) \ |
| 295 | V(Word32Xor) \ |
| 296 | V(Word32Shl) \ |
| 297 | V(Word32Shr) \ |
| 298 | V(Word32Sar) \ |
| 299 | V(Word32Ror) \ |
| 300 | V(Word32Clz) \ |
| 301 | V(Word32Ctz) \ |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 302 | V(Word32ReverseBits) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 303 | V(Word32Popcnt) \ |
| 304 | V(Word64Popcnt) \ |
| 305 | V(Word64And) \ |
| 306 | V(Word64Or) \ |
| 307 | V(Word64Xor) \ |
| 308 | V(Word64Shl) \ |
| 309 | V(Word64Shr) \ |
| 310 | V(Word64Sar) \ |
| 311 | V(Word64Ror) \ |
| 312 | V(Word64Clz) \ |
| 313 | V(Word64Ctz) \ |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 314 | V(Word64ReverseBits) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 315 | V(Int32Add) \ |
| 316 | V(Int32AddWithOverflow) \ |
| 317 | V(Int32Sub) \ |
| 318 | V(Int32SubWithOverflow) \ |
| 319 | V(Int32Mul) \ |
| 320 | V(Int32MulHigh) \ |
| 321 | V(Int32Div) \ |
| 322 | V(Int32Mod) \ |
| 323 | V(Uint32Div) \ |
| 324 | V(Uint32Mod) \ |
| 325 | V(Uint32MulHigh) \ |
| 326 | V(Int64Add) \ |
| 327 | V(Int64AddWithOverflow) \ |
| 328 | V(Int64Sub) \ |
| 329 | V(Int64SubWithOverflow) \ |
| 330 | V(Int64Mul) \ |
| 331 | V(Int64Div) \ |
| 332 | V(Int64Mod) \ |
| 333 | V(Uint64Div) \ |
| 334 | V(Uint64Mod) \ |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame] | 335 | V(BitcastWordToTagged) \ |
| 336 | V(TruncateFloat64ToWord32) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 337 | V(ChangeFloat32ToFloat64) \ |
| 338 | V(ChangeFloat64ToInt32) \ |
| 339 | V(ChangeFloat64ToUint32) \ |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 340 | V(Float64SilenceNaN) \ |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 341 | V(TruncateFloat64ToUint32) \ |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 342 | V(TruncateFloat32ToInt32) \ |
| 343 | V(TruncateFloat32ToUint32) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 344 | V(TryTruncateFloat32ToInt64) \ |
| 345 | V(TryTruncateFloat64ToInt64) \ |
| 346 | V(TryTruncateFloat32ToUint64) \ |
| 347 | V(TryTruncateFloat64ToUint64) \ |
| 348 | V(ChangeInt32ToFloat64) \ |
| 349 | V(ChangeInt32ToInt64) \ |
| 350 | V(ChangeUint32ToFloat64) \ |
| 351 | V(ChangeUint32ToUint64) \ |
| 352 | V(TruncateFloat64ToFloat32) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 353 | V(TruncateInt64ToInt32) \ |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame] | 354 | V(RoundFloat64ToInt32) \ |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 355 | V(RoundInt32ToFloat32) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 356 | V(RoundInt64ToFloat32) \ |
| 357 | V(RoundInt64ToFloat64) \ |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 358 | V(RoundUint32ToFloat32) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 359 | V(RoundUint64ToFloat32) \ |
| 360 | V(RoundUint64ToFloat64) \ |
| 361 | V(BitcastFloat32ToInt32) \ |
| 362 | V(BitcastFloat64ToInt64) \ |
| 363 | V(BitcastInt32ToFloat32) \ |
| 364 | V(BitcastInt64ToFloat64) \ |
| 365 | V(Float32Add) \ |
| 366 | V(Float32Sub) \ |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame] | 367 | V(Float32SubPreserveNan) \ |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 368 | V(Float32Neg) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 369 | V(Float32Mul) \ |
| 370 | V(Float32Div) \ |
| 371 | V(Float32Max) \ |
| 372 | V(Float32Min) \ |
| 373 | V(Float32Abs) \ |
| 374 | V(Float32Sqrt) \ |
| 375 | V(Float32RoundDown) \ |
| 376 | V(Float64Add) \ |
| 377 | V(Float64Sub) \ |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame] | 378 | V(Float64SubPreserveNan) \ |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 379 | V(Float64Neg) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 380 | V(Float64Mul) \ |
| 381 | V(Float64Div) \ |
| 382 | V(Float64Mod) \ |
| 383 | V(Float64Max) \ |
| 384 | V(Float64Min) \ |
| 385 | V(Float64Abs) \ |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 386 | V(Float64Atan) \ |
| 387 | V(Float64Atan2) \ |
| 388 | V(Float64Atanh) \ |
| 389 | V(Float64Cbrt) \ |
| 390 | V(Float64Cos) \ |
| 391 | V(Float64Exp) \ |
| 392 | V(Float64Expm1) \ |
| 393 | V(Float64Log) \ |
| 394 | V(Float64Log1p) \ |
| 395 | V(Float64Log10) \ |
| 396 | V(Float64Log2) \ |
| 397 | V(Float64Sin) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 398 | V(Float64Sqrt) \ |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 399 | V(Float64Tan) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 400 | V(Float64RoundDown) \ |
| 401 | V(Float32RoundUp) \ |
| 402 | V(Float64RoundUp) \ |
| 403 | V(Float32RoundTruncate) \ |
| 404 | V(Float64RoundTruncate) \ |
| 405 | V(Float64RoundTiesAway) \ |
| 406 | V(Float32RoundTiesEven) \ |
| 407 | V(Float64RoundTiesEven) \ |
| 408 | V(Float64ExtractLowWord32) \ |
| 409 | V(Float64ExtractHighWord32) \ |
| 410 | V(Float64InsertLowWord32) \ |
| 411 | V(Float64InsertHighWord32) \ |
| 412 | V(LoadStackPointer) \ |
| 413 | V(LoadFramePointer) \ |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 414 | V(LoadParentFramePointer) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 415 | V(CheckedLoad) \ |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 416 | V(CheckedStore) \ |
| 417 | V(Int32PairAdd) \ |
| 418 | V(Int32PairSub) \ |
| 419 | V(Int32PairMul) \ |
| 420 | V(Word32PairShl) \ |
| 421 | V(Word32PairShr) \ |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame] | 422 | V(Word32PairSar) \ |
| 423 | V(AtomicLoad) \ |
| 424 | V(AtomicStore) |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 425 | |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame] | 426 | #define MACHINE_SIMD_RETURN_SIMD_OP_LIST(V) \ |
| 427 | V(CreateFloat32x4) \ |
| 428 | V(Float32x4ReplaceLane) \ |
| 429 | V(Float32x4Abs) \ |
| 430 | V(Float32x4Neg) \ |
| 431 | V(Float32x4Sqrt) \ |
| 432 | V(Float32x4RecipApprox) \ |
| 433 | V(Float32x4RecipSqrtApprox) \ |
| 434 | V(Float32x4Add) \ |
| 435 | V(Float32x4Sub) \ |
| 436 | V(Float32x4Mul) \ |
| 437 | V(Float32x4Div) \ |
| 438 | V(Float32x4Min) \ |
| 439 | V(Float32x4Max) \ |
| 440 | V(Float32x4MinNum) \ |
| 441 | V(Float32x4MaxNum) \ |
| 442 | V(Float32x4Equal) \ |
| 443 | V(Float32x4NotEqual) \ |
| 444 | V(Float32x4LessThan) \ |
| 445 | V(Float32x4LessThanOrEqual) \ |
| 446 | V(Float32x4GreaterThan) \ |
| 447 | V(Float32x4GreaterThanOrEqual) \ |
| 448 | V(Float32x4Select) \ |
| 449 | V(Float32x4Swizzle) \ |
| 450 | V(Float32x4Shuffle) \ |
| 451 | V(Float32x4FromInt32x4) \ |
| 452 | V(Float32x4FromUint32x4) \ |
| 453 | V(CreateInt32x4) \ |
| 454 | V(Int32x4ReplaceLane) \ |
| 455 | V(Int32x4Neg) \ |
| 456 | V(Int32x4Add) \ |
| 457 | V(Int32x4Sub) \ |
| 458 | V(Int32x4Mul) \ |
| 459 | V(Int32x4Min) \ |
| 460 | V(Int32x4Max) \ |
| 461 | V(Int32x4ShiftLeftByScalar) \ |
| 462 | V(Int32x4ShiftRightByScalar) \ |
| 463 | V(Int32x4Equal) \ |
| 464 | V(Int32x4NotEqual) \ |
| 465 | V(Int32x4LessThan) \ |
| 466 | V(Int32x4LessThanOrEqual) \ |
| 467 | V(Int32x4GreaterThan) \ |
| 468 | V(Int32x4GreaterThanOrEqual) \ |
| 469 | V(Int32x4Select) \ |
| 470 | V(Int32x4Swizzle) \ |
| 471 | V(Int32x4Shuffle) \ |
| 472 | V(Int32x4FromFloat32x4) \ |
| 473 | V(Uint32x4Min) \ |
| 474 | V(Uint32x4Max) \ |
| 475 | V(Uint32x4ShiftLeftByScalar) \ |
| 476 | V(Uint32x4ShiftRightByScalar) \ |
| 477 | V(Uint32x4LessThan) \ |
| 478 | V(Uint32x4LessThanOrEqual) \ |
| 479 | V(Uint32x4GreaterThan) \ |
| 480 | V(Uint32x4GreaterThanOrEqual) \ |
| 481 | V(Uint32x4FromFloat32x4) \ |
| 482 | V(CreateBool32x4) \ |
| 483 | V(Bool32x4ReplaceLane) \ |
| 484 | V(Bool32x4And) \ |
| 485 | V(Bool32x4Or) \ |
| 486 | V(Bool32x4Xor) \ |
| 487 | V(Bool32x4Not) \ |
| 488 | V(Bool32x4Swizzle) \ |
| 489 | V(Bool32x4Shuffle) \ |
| 490 | V(Bool32x4Equal) \ |
| 491 | V(Bool32x4NotEqual) \ |
| 492 | V(CreateInt16x8) \ |
| 493 | V(Int16x8ReplaceLane) \ |
| 494 | V(Int16x8Neg) \ |
| 495 | V(Int16x8Add) \ |
| 496 | V(Int16x8AddSaturate) \ |
| 497 | V(Int16x8Sub) \ |
| 498 | V(Int16x8SubSaturate) \ |
| 499 | V(Int16x8Mul) \ |
| 500 | V(Int16x8Min) \ |
| 501 | V(Int16x8Max) \ |
| 502 | V(Int16x8ShiftLeftByScalar) \ |
| 503 | V(Int16x8ShiftRightByScalar) \ |
| 504 | V(Int16x8Equal) \ |
| 505 | V(Int16x8NotEqual) \ |
| 506 | V(Int16x8LessThan) \ |
| 507 | V(Int16x8LessThanOrEqual) \ |
| 508 | V(Int16x8GreaterThan) \ |
| 509 | V(Int16x8GreaterThanOrEqual) \ |
| 510 | V(Int16x8Select) \ |
| 511 | V(Int16x8Swizzle) \ |
| 512 | V(Int16x8Shuffle) \ |
| 513 | V(Uint16x8AddSaturate) \ |
| 514 | V(Uint16x8SubSaturate) \ |
| 515 | V(Uint16x8Min) \ |
| 516 | V(Uint16x8Max) \ |
| 517 | V(Uint16x8ShiftLeftByScalar) \ |
| 518 | V(Uint16x8ShiftRightByScalar) \ |
| 519 | V(Uint16x8LessThan) \ |
| 520 | V(Uint16x8LessThanOrEqual) \ |
| 521 | V(Uint16x8GreaterThan) \ |
| 522 | V(Uint16x8GreaterThanOrEqual) \ |
| 523 | V(CreateBool16x8) \ |
| 524 | V(Bool16x8ReplaceLane) \ |
| 525 | V(Bool16x8And) \ |
| 526 | V(Bool16x8Or) \ |
| 527 | V(Bool16x8Xor) \ |
| 528 | V(Bool16x8Not) \ |
| 529 | V(Bool16x8Swizzle) \ |
| 530 | V(Bool16x8Shuffle) \ |
| 531 | V(Bool16x8Equal) \ |
| 532 | V(Bool16x8NotEqual) \ |
| 533 | V(CreateInt8x16) \ |
| 534 | V(Int8x16ReplaceLane) \ |
| 535 | V(Int8x16Neg) \ |
| 536 | V(Int8x16Add) \ |
| 537 | V(Int8x16AddSaturate) \ |
| 538 | V(Int8x16Sub) \ |
| 539 | V(Int8x16SubSaturate) \ |
| 540 | V(Int8x16Mul) \ |
| 541 | V(Int8x16Min) \ |
| 542 | V(Int8x16Max) \ |
| 543 | V(Int8x16ShiftLeftByScalar) \ |
| 544 | V(Int8x16ShiftRightByScalar) \ |
| 545 | V(Int8x16Equal) \ |
| 546 | V(Int8x16NotEqual) \ |
| 547 | V(Int8x16LessThan) \ |
| 548 | V(Int8x16LessThanOrEqual) \ |
| 549 | V(Int8x16GreaterThan) \ |
| 550 | V(Int8x16GreaterThanOrEqual) \ |
| 551 | V(Int8x16Select) \ |
| 552 | V(Int8x16Swizzle) \ |
| 553 | V(Int8x16Shuffle) \ |
| 554 | V(Uint8x16AddSaturate) \ |
| 555 | V(Uint8x16SubSaturate) \ |
| 556 | V(Uint8x16Min) \ |
| 557 | V(Uint8x16Max) \ |
| 558 | V(Uint8x16ShiftLeftByScalar) \ |
| 559 | V(Uint8x16ShiftRightByScalar) \ |
| 560 | V(Uint8x16LessThan) \ |
| 561 | V(Uint8x16LessThanOrEqual) \ |
| 562 | V(Uint8x16GreaterThan) \ |
| 563 | V(Uint8x16GreaterThanOrEqual) \ |
| 564 | V(CreateBool8x16) \ |
| 565 | V(Bool8x16ReplaceLane) \ |
| 566 | V(Bool8x16And) \ |
| 567 | V(Bool8x16Or) \ |
| 568 | V(Bool8x16Xor) \ |
| 569 | V(Bool8x16Not) \ |
| 570 | V(Bool8x16Swizzle) \ |
| 571 | V(Bool8x16Shuffle) \ |
| 572 | V(Bool8x16Equal) \ |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 573 | V(Bool8x16NotEqual) |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame] | 574 | |
| 575 | #define MACHINE_SIMD_RETURN_NUM_OP_LIST(V) \ |
| 576 | V(Float32x4ExtractLane) \ |
| 577 | V(Int32x4ExtractLane) \ |
| 578 | V(Int16x8ExtractLane) \ |
| 579 | V(Int8x16ExtractLane) |
| 580 | |
| 581 | #define MACHINE_SIMD_RETURN_BOOL_OP_LIST(V) \ |
| 582 | V(Bool32x4ExtractLane) \ |
| 583 | V(Bool32x4AnyTrue) \ |
| 584 | V(Bool32x4AllTrue) \ |
| 585 | V(Bool16x8ExtractLane) \ |
| 586 | V(Bool16x8AnyTrue) \ |
| 587 | V(Bool16x8AllTrue) \ |
| 588 | V(Bool8x16ExtractLane) \ |
| 589 | V(Bool8x16AnyTrue) \ |
| 590 | V(Bool8x16AllTrue) |
| 591 | |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 592 | #define MACHINE_SIMD_GENERIC_OP_LIST(V) \ |
| 593 | V(Simd128Load) \ |
| 594 | V(Simd128Load1) \ |
| 595 | V(Simd128Load2) \ |
| 596 | V(Simd128Load3) \ |
| 597 | V(Simd128Store) \ |
| 598 | V(Simd128Store1) \ |
| 599 | V(Simd128Store2) \ |
| 600 | V(Simd128Store3) \ |
| 601 | V(Simd128And) \ |
| 602 | V(Simd128Or) \ |
| 603 | V(Simd128Xor) \ |
| 604 | V(Simd128Not) |
| 605 | |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame] | 606 | #define MACHINE_SIMD_OP_LIST(V) \ |
| 607 | MACHINE_SIMD_RETURN_SIMD_OP_LIST(V) \ |
| 608 | MACHINE_SIMD_RETURN_NUM_OP_LIST(V) \ |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 609 | MACHINE_SIMD_RETURN_BOOL_OP_LIST(V) \ |
| 610 | MACHINE_SIMD_GENERIC_OP_LIST(V) |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame] | 611 | |
| 612 | #define VALUE_OP_LIST(V) \ |
| 613 | COMMON_OP_LIST(V) \ |
| 614 | SIMPLIFIED_OP_LIST(V) \ |
| 615 | MACHINE_OP_LIST(V) \ |
| 616 | MACHINE_SIMD_OP_LIST(V) \ |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 617 | JS_OP_LIST(V) |
| 618 | |
| 619 | // The combination of all operators at all levels and the common operators. |
| 620 | #define ALL_OP_LIST(V) \ |
| 621 | CONTROL_OP_LIST(V) \ |
| 622 | VALUE_OP_LIST(V) |
| 623 | |
| 624 | namespace v8 { |
| 625 | namespace internal { |
| 626 | namespace compiler { |
| 627 | |
| 628 | // Declare an enumeration with all the opcodes at all levels so that they |
| 629 | // can be globally, uniquely numbered. |
| 630 | class IrOpcode { |
| 631 | public: |
| 632 | enum Value { |
| 633 | #define DECLARE_OPCODE(x) k##x, |
| 634 | ALL_OP_LIST(DECLARE_OPCODE) |
| 635 | #undef DECLARE_OPCODE |
| 636 | kLast = -1 |
| 637 | #define COUNT_OPCODE(x) +1 |
| 638 | ALL_OP_LIST(COUNT_OPCODE) |
| 639 | #undef COUNT_OPCODE |
| 640 | }; |
| 641 | |
| 642 | // Returns the mnemonic name of an opcode. |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 643 | static char const* Mnemonic(Value value); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 644 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 645 | // Returns true if opcode for common operator. |
| 646 | static bool IsCommonOpcode(Value value) { |
| 647 | return kStart <= value && value <= kDead; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 648 | } |
| 649 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 650 | // Returns true if opcode for control operator. |
| 651 | static bool IsControlOpcode(Value value) { |
| 652 | return kStart <= value && value <= kEnd; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 653 | } |
| 654 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 655 | // Returns true if opcode for JavaScript operator. |
| 656 | static bool IsJsOpcode(Value value) { |
| 657 | return kJSEqual <= value && value <= kJSStackCheck; |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 658 | } |
| 659 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 660 | // Returns true if opcode for constant operator. |
| 661 | static bool IsConstantOpcode(Value value) { |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame] | 662 | return kInt32Constant <= value && value <= kRelocatableInt64Constant; |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 663 | } |
| 664 | |
| 665 | static bool IsPhiOpcode(Value value) { |
| 666 | return value == kPhi || value == kEffectPhi; |
| 667 | } |
| 668 | |
| 669 | static bool IsMergeOpcode(Value value) { |
| 670 | return value == kMerge || value == kLoop; |
| 671 | } |
| 672 | |
| 673 | static bool IsIfProjectionOpcode(Value value) { |
| 674 | return kIfTrue <= value && value <= kIfDefault; |
| 675 | } |
| 676 | |
| 677 | // Returns true if opcode can be inlined. |
| 678 | static bool IsInlineeOpcode(Value value) { |
| 679 | return value == kJSCallConstruct || value == kJSCallFunction; |
| 680 | } |
| 681 | |
| 682 | // Returns true if opcode for comparison operator. |
| 683 | static bool IsComparisonOpcode(Value value) { |
| 684 | return (kJSEqual <= value && value <= kJSGreaterThanOrEqual) || |
| 685 | (kNumberEqual <= value && value <= kStringLessThanOrEqual) || |
| 686 | (kWord32Equal <= value && value <= kFloat64LessThanOrEqual); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 687 | } |
| 688 | }; |
| 689 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 690 | std::ostream& operator<<(std::ostream&, IrOpcode::Value); |
| 691 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 692 | } // namespace compiler |
| 693 | } // namespace internal |
| 694 | } // namespace v8 |
| 695 | |
| 696 | #endif // V8_COMPILER_OPCODES_H_ |