5 #include "src/compiler/machine-operator.h" 7 #include "src/base/lazy-instance.h" 8 #include "src/compiler/opcodes.h" 9 #include "src/compiler/operator.h" 15 bool operator==(StoreRepresentation lhs, StoreRepresentation rhs) {
16 return lhs.representation() == rhs.representation() &&
17 lhs.write_barrier_kind() == rhs.write_barrier_kind();
21 bool operator!=(StoreRepresentation lhs, StoreRepresentation rhs) {
26 size_t hash_value(StoreRepresentation rep) {
27 return base::hash_combine(rep.representation(), rep.write_barrier_kind());
31 std::ostream& operator<<(std::ostream& os, StoreRepresentation rep) {
32 return os <<
"(" << rep.representation() <<
" : " << rep.write_barrier_kind()
37 LoadRepresentation LoadRepresentationOf(Operator
const* op) {
38 DCHECK(IrOpcode::kLoad == op->opcode() ||
39 IrOpcode::kProtectedLoad == op->opcode() ||
40 IrOpcode::kWord32AtomicLoad == op->opcode() ||
41 IrOpcode::kWord64AtomicLoad == op->opcode() ||
42 IrOpcode::kWord32AtomicPairLoad == op->opcode() ||
43 IrOpcode::kPoisonedLoad == op->opcode() ||
44 IrOpcode::kUnalignedLoad == op->opcode());
45 return OpParameter<LoadRepresentation>(op);
49 StoreRepresentation
const& StoreRepresentationOf(Operator
const* op) {
50 DCHECK(IrOpcode::kStore == op->opcode() ||
51 IrOpcode::kProtectedStore == op->opcode());
52 return OpParameter<StoreRepresentation>(op);
55 UnalignedStoreRepresentation
const& UnalignedStoreRepresentationOf(
57 DCHECK_EQ(IrOpcode::kUnalignedStore, op->opcode());
58 return OpParameter<UnalignedStoreRepresentation>(op);
61 bool operator==(StackSlotRepresentation lhs, StackSlotRepresentation rhs) {
62 return lhs.size() == rhs.size() && lhs.alignment() == rhs.alignment();
65 bool operator!=(StackSlotRepresentation lhs, StackSlotRepresentation rhs) {
69 size_t hash_value(StackSlotRepresentation rep) {
70 return base::hash_combine(rep.size(), rep.alignment());
73 std::ostream& operator<<(std::ostream& os, StackSlotRepresentation rep) {
74 return os <<
"(" << rep.size() <<
" : " << rep.alignment() <<
")";
77 StackSlotRepresentation
const& StackSlotRepresentationOf(Operator
const* op) {
78 DCHECK_EQ(IrOpcode::kStackSlot, op->opcode());
79 return OpParameter<StackSlotRepresentation>(op);
82 MachineRepresentation AtomicStoreRepresentationOf(Operator
const* op) {
83 DCHECK(IrOpcode::kWord32AtomicStore == op->opcode() ||
84 IrOpcode::kWord64AtomicStore == op->opcode());
85 return OpParameter<MachineRepresentation>(op);
88 MachineType AtomicOpType(Operator
const* op) {
89 return OpParameter<MachineType>(op);
92 #define PURE_BINARY_OP_LIST_32(V) \ 93 V(Word32And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 94 V(Word32Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 95 V(Word32Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 96 V(Word32Shl, Operator::kNoProperties, 2, 0, 1) \ 97 V(Word32Shr, Operator::kNoProperties, 2, 0, 1) \ 98 V(Word32Sar, Operator::kNoProperties, 2, 0, 1) \ 99 V(Word32Ror, Operator::kNoProperties, 2, 0, 1) \ 100 V(Word32Equal, Operator::kCommutative, 2, 0, 1) \ 101 V(Int32Add, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 102 V(Int32Sub, Operator::kNoProperties, 2, 0, 1) \ 103 V(Int32Mul, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 104 V(Int32MulHigh, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 105 V(Int32Div, Operator::kNoProperties, 2, 1, 1) \ 106 V(Int32Mod, Operator::kNoProperties, 2, 1, 1) \ 107 V(Int32LessThan, Operator::kNoProperties, 2, 0, 1) \ 108 V(Int32LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ 109 V(Uint32Div, Operator::kNoProperties, 2, 1, 1) \ 110 V(Uint32LessThan, Operator::kNoProperties, 2, 0, 1) \ 111 V(Uint32LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ 112 V(Uint32Mod, Operator::kNoProperties, 2, 1, 1) \ 113 V(Uint32MulHigh, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) 115 #define PURE_BINARY_OP_LIST_64(V) \ 116 V(Word64And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 117 V(Word64Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 118 V(Word64Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 119 V(Word64Shl, Operator::kNoProperties, 2, 0, 1) \ 120 V(Word64Shr, Operator::kNoProperties, 2, 0, 1) \ 121 V(Word64Sar, Operator::kNoProperties, 2, 0, 1) \ 122 V(Word64Ror, Operator::kNoProperties, 2, 0, 1) \ 123 V(Word64Equal, Operator::kCommutative, 2, 0, 1) \ 124 V(Int64Add, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 125 V(Int64Sub, Operator::kNoProperties, 2, 0, 1) \ 126 V(Int64Mul, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 127 V(Int64Div, Operator::kNoProperties, 2, 1, 1) \ 128 V(Int64Mod, Operator::kNoProperties, 2, 1, 1) \ 129 V(Int64LessThan, Operator::kNoProperties, 2, 0, 1) \ 130 V(Int64LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ 131 V(Uint64Div, Operator::kNoProperties, 2, 1, 1) \ 132 V(Uint64Mod, Operator::kNoProperties, 2, 1, 1) \ 133 V(Uint64LessThan, Operator::kNoProperties, 2, 0, 1) \ 134 V(Uint64LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) 136 #define MACHINE_PURE_OP_LIST(V) \ 137 PURE_BINARY_OP_LIST_32(V) \ 138 PURE_BINARY_OP_LIST_64(V) \ 139 V(Word32Clz, Operator::kNoProperties, 1, 0, 1) \ 140 V(Word64Clz, Operator::kNoProperties, 1, 0, 1) \ 141 V(Word32ReverseBytes, Operator::kNoProperties, 1, 0, 1) \ 142 V(Word64ReverseBytes, Operator::kNoProperties, 1, 0, 1) \ 143 V(BitcastWordToTaggedSigned, Operator::kNoProperties, 1, 0, 1) \ 144 V(TruncateFloat64ToWord32, Operator::kNoProperties, 1, 0, 1) \ 145 V(ChangeFloat32ToFloat64, Operator::kNoProperties, 1, 0, 1) \ 146 V(ChangeFloat64ToInt32, Operator::kNoProperties, 1, 0, 1) \ 147 V(ChangeFloat64ToInt64, Operator::kNoProperties, 1, 0, 1) \ 148 V(ChangeFloat64ToUint32, Operator::kNoProperties, 1, 0, 1) \ 149 V(ChangeFloat64ToUint64, Operator::kNoProperties, 1, 0, 1) \ 150 V(TruncateFloat64ToInt64, Operator::kNoProperties, 1, 0, 1) \ 151 V(TruncateFloat64ToUint32, Operator::kNoProperties, 1, 0, 1) \ 152 V(TruncateFloat32ToInt32, Operator::kNoProperties, 1, 0, 1) \ 153 V(TruncateFloat32ToUint32, Operator::kNoProperties, 1, 0, 1) \ 154 V(TryTruncateFloat32ToInt64, Operator::kNoProperties, 1, 0, 2) \ 155 V(TryTruncateFloat64ToInt64, Operator::kNoProperties, 1, 0, 2) \ 156 V(TryTruncateFloat32ToUint64, Operator::kNoProperties, 1, 0, 2) \ 157 V(TryTruncateFloat64ToUint64, Operator::kNoProperties, 1, 0, 2) \ 158 V(ChangeInt32ToFloat64, Operator::kNoProperties, 1, 0, 1) \ 159 V(ChangeInt64ToFloat64, Operator::kNoProperties, 1, 0, 1) \ 160 V(Float64SilenceNaN, Operator::kNoProperties, 1, 0, 1) \ 161 V(RoundFloat64ToInt32, Operator::kNoProperties, 1, 0, 1) \ 162 V(RoundInt32ToFloat32, Operator::kNoProperties, 1, 0, 1) \ 163 V(RoundInt64ToFloat32, Operator::kNoProperties, 1, 0, 1) \ 164 V(RoundInt64ToFloat64, Operator::kNoProperties, 1, 0, 1) \ 165 V(RoundUint32ToFloat32, Operator::kNoProperties, 1, 0, 1) \ 166 V(RoundUint64ToFloat32, Operator::kNoProperties, 1, 0, 1) \ 167 V(RoundUint64ToFloat64, Operator::kNoProperties, 1, 0, 1) \ 168 V(ChangeInt32ToInt64, Operator::kNoProperties, 1, 0, 1) \ 169 V(ChangeUint32ToFloat64, Operator::kNoProperties, 1, 0, 1) \ 170 V(ChangeUint32ToUint64, Operator::kNoProperties, 1, 0, 1) \ 171 V(TruncateFloat64ToFloat32, Operator::kNoProperties, 1, 0, 1) \ 172 V(TruncateInt64ToInt32, Operator::kNoProperties, 1, 0, 1) \ 173 V(BitcastFloat32ToInt32, Operator::kNoProperties, 1, 0, 1) \ 174 V(BitcastFloat64ToInt64, Operator::kNoProperties, 1, 0, 1) \ 175 V(BitcastInt32ToFloat32, Operator::kNoProperties, 1, 0, 1) \ 176 V(BitcastInt64ToFloat64, Operator::kNoProperties, 1, 0, 1) \ 177 V(SignExtendWord8ToInt32, Operator::kNoProperties, 1, 0, 1) \ 178 V(SignExtendWord16ToInt32, Operator::kNoProperties, 1, 0, 1) \ 179 V(SignExtendWord8ToInt64, Operator::kNoProperties, 1, 0, 1) \ 180 V(SignExtendWord16ToInt64, Operator::kNoProperties, 1, 0, 1) \ 181 V(SignExtendWord32ToInt64, Operator::kNoProperties, 1, 0, 1) \ 182 V(Float32Abs, Operator::kNoProperties, 1, 0, 1) \ 183 V(Float32Add, Operator::kCommutative, 2, 0, 1) \ 184 V(Float32Sub, Operator::kNoProperties, 2, 0, 1) \ 185 V(Float32Mul, Operator::kCommutative, 2, 0, 1) \ 186 V(Float32Div, Operator::kNoProperties, 2, 0, 1) \ 187 V(Float32Neg, Operator::kNoProperties, 1, 0, 1) \ 188 V(Float32Sqrt, Operator::kNoProperties, 1, 0, 1) \ 189 V(Float32Max, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 190 V(Float32Min, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 191 V(Float64Abs, Operator::kNoProperties, 1, 0, 1) \ 192 V(Float64Acos, Operator::kNoProperties, 1, 0, 1) \ 193 V(Float64Acosh, Operator::kNoProperties, 1, 0, 1) \ 194 V(Float64Asin, Operator::kNoProperties, 1, 0, 1) \ 195 V(Float64Asinh, Operator::kNoProperties, 1, 0, 1) \ 196 V(Float64Atan, Operator::kNoProperties, 1, 0, 1) \ 197 V(Float64Atan2, Operator::kNoProperties, 2, 0, 1) \ 198 V(Float64Atanh, Operator::kNoProperties, 1, 0, 1) \ 199 V(Float64Cbrt, Operator::kNoProperties, 1, 0, 1) \ 200 V(Float64Cos, Operator::kNoProperties, 1, 0, 1) \ 201 V(Float64Cosh, Operator::kNoProperties, 1, 0, 1) \ 202 V(Float64Exp, Operator::kNoProperties, 1, 0, 1) \ 203 V(Float64Expm1, Operator::kNoProperties, 1, 0, 1) \ 204 V(Float64Log, Operator::kNoProperties, 1, 0, 1) \ 205 V(Float64Log1p, Operator::kNoProperties, 1, 0, 1) \ 206 V(Float64Log2, Operator::kNoProperties, 1, 0, 1) \ 207 V(Float64Log10, Operator::kNoProperties, 1, 0, 1) \ 208 V(Float64Max, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 209 V(Float64Min, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 210 V(Float64Neg, Operator::kNoProperties, 1, 0, 1) \ 211 V(Float64Add, Operator::kCommutative, 2, 0, 1) \ 212 V(Float64Sub, Operator::kNoProperties, 2, 0, 1) \ 213 V(Float64Mul, Operator::kCommutative, 2, 0, 1) \ 214 V(Float64Div, Operator::kNoProperties, 2, 0, 1) \ 215 V(Float64Mod, Operator::kNoProperties, 2, 0, 1) \ 216 V(Float64Pow, Operator::kNoProperties, 2, 0, 1) \ 217 V(Float64Sin, Operator::kNoProperties, 1, 0, 1) \ 218 V(Float64Sinh, Operator::kNoProperties, 1, 0, 1) \ 219 V(Float64Sqrt, Operator::kNoProperties, 1, 0, 1) \ 220 V(Float64Tan, Operator::kNoProperties, 1, 0, 1) \ 221 V(Float64Tanh, Operator::kNoProperties, 1, 0, 1) \ 222 V(Float32Equal, Operator::kCommutative, 2, 0, 1) \ 223 V(Float32LessThan, Operator::kNoProperties, 2, 0, 1) \ 224 V(Float32LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ 225 V(Float64Equal, Operator::kCommutative, 2, 0, 1) \ 226 V(Float64LessThan, Operator::kNoProperties, 2, 0, 1) \ 227 V(Float64LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ 228 V(Float64ExtractLowWord32, Operator::kNoProperties, 1, 0, 1) \ 229 V(Float64ExtractHighWord32, Operator::kNoProperties, 1, 0, 1) \ 230 V(Float64InsertLowWord32, Operator::kNoProperties, 2, 0, 1) \ 231 V(Float64InsertHighWord32, Operator::kNoProperties, 2, 0, 1) \ 232 V(LoadStackPointer, Operator::kNoProperties, 0, 0, 1) \ 233 V(LoadFramePointer, Operator::kNoProperties, 0, 0, 1) \ 234 V(LoadParentFramePointer, Operator::kNoProperties, 0, 0, 1) \ 235 V(Int32PairAdd, Operator::kNoProperties, 4, 0, 2) \ 236 V(Int32PairSub, Operator::kNoProperties, 4, 0, 2) \ 237 V(Int32PairMul, Operator::kNoProperties, 4, 0, 2) \ 238 V(Word32PairShl, Operator::kNoProperties, 3, 0, 2) \ 239 V(Word32PairShr, Operator::kNoProperties, 3, 0, 2) \ 240 V(Word32PairSar, Operator::kNoProperties, 3, 0, 2) \ 241 V(F32x4Splat, Operator::kNoProperties, 1, 0, 1) \ 242 V(F32x4SConvertI32x4, Operator::kNoProperties, 1, 0, 1) \ 243 V(F32x4UConvertI32x4, Operator::kNoProperties, 1, 0, 1) \ 244 V(F32x4Abs, Operator::kNoProperties, 1, 0, 1) \ 245 V(F32x4Neg, Operator::kNoProperties, 1, 0, 1) \ 246 V(F32x4RecipApprox, Operator::kNoProperties, 1, 0, 1) \ 247 V(F32x4RecipSqrtApprox, Operator::kNoProperties, 1, 0, 1) \ 248 V(F32x4Add, Operator::kCommutative, 2, 0, 1) \ 249 V(F32x4AddHoriz, Operator::kNoProperties, 2, 0, 1) \ 250 V(F32x4Sub, Operator::kNoProperties, 2, 0, 1) \ 251 V(F32x4Mul, Operator::kCommutative, 2, 0, 1) \ 252 V(F32x4Min, Operator::kCommutative, 2, 0, 1) \ 253 V(F32x4Max, Operator::kCommutative, 2, 0, 1) \ 254 V(F32x4Eq, Operator::kCommutative, 2, 0, 1) \ 255 V(F32x4Ne, Operator::kCommutative, 2, 0, 1) \ 256 V(F32x4Lt, Operator::kNoProperties, 2, 0, 1) \ 257 V(F32x4Le, Operator::kNoProperties, 2, 0, 1) \ 258 V(I32x4Splat, Operator::kNoProperties, 1, 0, 1) \ 259 V(I32x4SConvertF32x4, Operator::kNoProperties, 1, 0, 1) \ 260 V(I32x4SConvertI16x8Low, Operator::kNoProperties, 1, 0, 1) \ 261 V(I32x4SConvertI16x8High, Operator::kNoProperties, 1, 0, 1) \ 262 V(I32x4Neg, Operator::kNoProperties, 1, 0, 1) \ 263 V(I32x4Add, Operator::kCommutative, 2, 0, 1) \ 264 V(I32x4AddHoriz, Operator::kNoProperties, 2, 0, 1) \ 265 V(I32x4Sub, Operator::kNoProperties, 2, 0, 1) \ 266 V(I32x4Mul, Operator::kCommutative, 2, 0, 1) \ 267 V(I32x4MinS, Operator::kCommutative, 2, 0, 1) \ 268 V(I32x4MaxS, Operator::kCommutative, 2, 0, 1) \ 269 V(I32x4Eq, Operator::kCommutative, 2, 0, 1) \ 270 V(I32x4Ne, Operator::kCommutative, 2, 0, 1) \ 271 V(I32x4GtS, Operator::kNoProperties, 2, 0, 1) \ 272 V(I32x4GeS, Operator::kNoProperties, 2, 0, 1) \ 273 V(I32x4UConvertF32x4, Operator::kNoProperties, 1, 0, 1) \ 274 V(I32x4UConvertI16x8Low, Operator::kNoProperties, 1, 0, 1) \ 275 V(I32x4UConvertI16x8High, Operator::kNoProperties, 1, 0, 1) \ 276 V(I32x4MinU, Operator::kCommutative, 2, 0, 1) \ 277 V(I32x4MaxU, Operator::kCommutative, 2, 0, 1) \ 278 V(I32x4GtU, Operator::kNoProperties, 2, 0, 1) \ 279 V(I32x4GeU, Operator::kNoProperties, 2, 0, 1) \ 280 V(I16x8Splat, Operator::kNoProperties, 1, 0, 1) \ 281 V(I16x8SConvertI8x16Low, Operator::kNoProperties, 1, 0, 1) \ 282 V(I16x8SConvertI8x16High, Operator::kNoProperties, 1, 0, 1) \ 283 V(I16x8Neg, Operator::kNoProperties, 1, 0, 1) \ 284 V(I16x8SConvertI32x4, Operator::kNoProperties, 2, 0, 1) \ 285 V(I16x8Add, Operator::kCommutative, 2, 0, 1) \ 286 V(I16x8AddSaturateS, Operator::kCommutative, 2, 0, 1) \ 287 V(I16x8AddHoriz, Operator::kNoProperties, 2, 0, 1) \ 288 V(I16x8Sub, Operator::kNoProperties, 2, 0, 1) \ 289 V(I16x8SubSaturateS, Operator::kNoProperties, 2, 0, 1) \ 290 V(I16x8Mul, Operator::kCommutative, 2, 0, 1) \ 291 V(I16x8MinS, Operator::kCommutative, 2, 0, 1) \ 292 V(I16x8MaxS, Operator::kCommutative, 2, 0, 1) \ 293 V(I16x8Eq, Operator::kCommutative, 2, 0, 1) \ 294 V(I16x8Ne, Operator::kCommutative, 2, 0, 1) \ 295 V(I16x8GtS, Operator::kNoProperties, 2, 0, 1) \ 296 V(I16x8GeS, Operator::kNoProperties, 2, 0, 1) \ 297 V(I16x8UConvertI8x16Low, Operator::kNoProperties, 1, 0, 1) \ 298 V(I16x8UConvertI8x16High, Operator::kNoProperties, 1, 0, 1) \ 299 V(I16x8UConvertI32x4, Operator::kNoProperties, 2, 0, 1) \ 300 V(I16x8AddSaturateU, Operator::kCommutative, 2, 0, 1) \ 301 V(I16x8SubSaturateU, Operator::kNoProperties, 2, 0, 1) \ 302 V(I16x8MinU, Operator::kCommutative, 2, 0, 1) \ 303 V(I16x8MaxU, Operator::kCommutative, 2, 0, 1) \ 304 V(I16x8GtU, Operator::kNoProperties, 2, 0, 1) \ 305 V(I16x8GeU, Operator::kNoProperties, 2, 0, 1) \ 306 V(I8x16Splat, Operator::kNoProperties, 1, 0, 1) \ 307 V(I8x16Neg, Operator::kNoProperties, 1, 0, 1) \ 308 V(I8x16SConvertI16x8, Operator::kNoProperties, 2, 0, 1) \ 309 V(I8x16Add, Operator::kCommutative, 2, 0, 1) \ 310 V(I8x16AddSaturateS, Operator::kCommutative, 2, 0, 1) \ 311 V(I8x16Sub, Operator::kNoProperties, 2, 0, 1) \ 312 V(I8x16SubSaturateS, Operator::kNoProperties, 2, 0, 1) \ 313 V(I8x16Mul, Operator::kCommutative, 2, 0, 1) \ 314 V(I8x16MinS, Operator::kCommutative, 2, 0, 1) \ 315 V(I8x16MaxS, Operator::kCommutative, 2, 0, 1) \ 316 V(I8x16Eq, Operator::kCommutative, 2, 0, 1) \ 317 V(I8x16Ne, Operator::kCommutative, 2, 0, 1) \ 318 V(I8x16GtS, Operator::kNoProperties, 2, 0, 1) \ 319 V(I8x16GeS, Operator::kNoProperties, 2, 0, 1) \ 320 V(I8x16UConvertI16x8, Operator::kNoProperties, 2, 0, 1) \ 321 V(I8x16AddSaturateU, Operator::kCommutative, 2, 0, 1) \ 322 V(I8x16SubSaturateU, Operator::kNoProperties, 2, 0, 1) \ 323 V(I8x16MinU, Operator::kCommutative, 2, 0, 1) \ 324 V(I8x16MaxU, Operator::kCommutative, 2, 0, 1) \ 325 V(I8x16GtU, Operator::kNoProperties, 2, 0, 1) \ 326 V(I8x16GeU, Operator::kNoProperties, 2, 0, 1) \ 327 V(S128Load, Operator::kNoProperties, 2, 0, 1) \ 328 V(S128Store, Operator::kNoProperties, 3, 0, 1) \ 329 V(S128Zero, Operator::kNoProperties, 0, 0, 1) \ 330 V(S128And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 331 V(S128Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 332 V(S128Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 333 V(S128Not, Operator::kNoProperties, 1, 0, 1) \ 334 V(S128Select, Operator::kNoProperties, 3, 0, 1) \ 335 V(S1x4AnyTrue, Operator::kNoProperties, 1, 0, 1) \ 336 V(S1x4AllTrue, Operator::kNoProperties, 1, 0, 1) \ 337 V(S1x8AnyTrue, Operator::kNoProperties, 1, 0, 1) \ 338 V(S1x8AllTrue, Operator::kNoProperties, 1, 0, 1) \ 339 V(S1x16AnyTrue, Operator::kNoProperties, 1, 0, 1) \ 340 V(S1x16AllTrue, Operator::kNoProperties, 1, 0, 1) 342 #define PURE_OPTIONAL_OP_LIST(V) \ 343 V(Word32Ctz, Operator::kNoProperties, 1, 0, 1) \ 344 V(Word64Ctz, Operator::kNoProperties, 1, 0, 1) \ 345 V(Word32ReverseBits, Operator::kNoProperties, 1, 0, 1) \ 346 V(Word64ReverseBits, Operator::kNoProperties, 1, 0, 1) \ 347 V(Int32AbsWithOverflow, Operator::kNoProperties, 1, 0, 2) \ 348 V(Int64AbsWithOverflow, Operator::kNoProperties, 1, 0, 2) \ 349 V(Word32Popcnt, Operator::kNoProperties, 1, 0, 1) \ 350 V(Word64Popcnt, Operator::kNoProperties, 1, 0, 1) \ 351 V(Float32RoundDown, Operator::kNoProperties, 1, 0, 1) \ 352 V(Float64RoundDown, Operator::kNoProperties, 1, 0, 1) \ 353 V(Float32RoundUp, Operator::kNoProperties, 1, 0, 1) \ 354 V(Float64RoundUp, Operator::kNoProperties, 1, 0, 1) \ 355 V(Float32RoundTruncate, Operator::kNoProperties, 1, 0, 1) \ 356 V(Float64RoundTruncate, Operator::kNoProperties, 1, 0, 1) \ 357 V(Float64RoundTiesAway, Operator::kNoProperties, 1, 0, 1) \ 358 V(Float32RoundTiesEven, Operator::kNoProperties, 1, 0, 1) \ 359 V(Float64RoundTiesEven, Operator::kNoProperties, 1, 0, 1) 361 #define OVERFLOW_OP_LIST(V) \ 362 V(Int32AddWithOverflow, Operator::kAssociative | Operator::kCommutative) \ 363 V(Int32SubWithOverflow, Operator::kNoProperties) \ 364 V(Int32MulWithOverflow, Operator::kAssociative | Operator::kCommutative) \ 365 V(Int64AddWithOverflow, Operator::kAssociative | Operator::kCommutative) \ 366 V(Int64SubWithOverflow, Operator::kNoProperties) 368 #define MACHINE_TYPE_LIST(V) \ 385 #define MACHINE_REPRESENTATION_LIST(V) \ 397 #define ATOMIC_U32_TYPE_LIST(V) \ 402 #define ATOMIC_TYPE_LIST(V) \ 403 ATOMIC_U32_TYPE_LIST(V) \ 408 #define ATOMIC_U64_TYPE_LIST(V) \ 409 ATOMIC_U32_TYPE_LIST(V) \ 412 #define ATOMIC_REPRESENTATION_LIST(V) \ 417 #define ATOMIC64_REPRESENTATION_LIST(V) \ 418 ATOMIC_REPRESENTATION_LIST(V) \ 421 #define ATOMIC_PAIR_BINOP_LIST(V) \ 429 #define SIMD_LANE_OP_LIST(V) \ 435 #define SIMD_FORMAT_LIST(V) \ 440 #define STACK_SLOT_CACHED_SIZES_ALIGNMENTS_LIST(V) \ 441 V(4, 0) V(8, 0) V(16, 0) V(4, 4) V(8, 8) V(16, 16) 446 IrOpcode::kStackSlot, Operator::kNoDeopt | Operator::kNoThrow,
447 "StackSlot", 0, 0, 0, 1, 0, 0,
452 #define PURE(Name, properties, value_input_count, control_input_count, \ 454 struct Name##Operator final : public Operator { \ 456 : Operator(IrOpcode::k##Name, Operator::kPure | properties, #Name, \ 457 value_input_count, 0, control_input_count, output_count, 0, \ 460 Name##Operator k##Name; 461 MACHINE_PURE_OP_LIST(PURE)
462 PURE_OPTIONAL_OP_LIST(PURE)
465 #define OVERFLOW_OP(Name, properties) \ 466 struct Name##Operator final : public Operator { \ 468 : Operator(IrOpcode::k##Name, \ 469 Operator::kEliminatable | Operator::kNoRead | properties, \ 470 #Name, 2, 0, 1, 2, 0, 0) {} \ 472 Name##Operator k##Name; 473 OVERFLOW_OP_LIST(OVERFLOW_OP)
477 struct Load##Type##Operator final : public Operator1<LoadRepresentation> { \ 478 Load##Type##Operator() \ 479 : Operator1<LoadRepresentation>( \ 481 Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, \ 482 "Load", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \ 484 struct PoisonedLoad##Type##Operator final \ 485 : public Operator1<LoadRepresentation> { \ 486 PoisonedLoad##Type##Operator() \ 487 : Operator1<LoadRepresentation>( \ 488 IrOpcode::kPoisonedLoad, \ 489 Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, \ 490 "PoisonedLoad", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \ 492 struct UnalignedLoad##Type##Operator final \ 493 : public Operator1<LoadRepresentation> { \ 494 UnalignedLoad##Type##Operator() \ 495 : Operator1<LoadRepresentation>( \ 496 IrOpcode::kUnalignedLoad, \ 497 Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, \ 498 "UnalignedLoad", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \ 500 struct ProtectedLoad##Type##Operator final \ 501 : public Operator1<LoadRepresentation> { \ 502 ProtectedLoad##Type##Operator() \ 503 : Operator1<LoadRepresentation>( \ 504 IrOpcode::kProtectedLoad, \ 505 Operator::kNoDeopt | Operator::kNoThrow, "ProtectedLoad", 2, 1, \ 506 1, 1, 1, 0, MachineType::Type()) {} \ 508 Load##Type##Operator kLoad##Type; \ 509 PoisonedLoad##Type##Operator kPoisonedLoad##Type; \ 510 UnalignedLoad##Type##Operator kUnalignedLoad##Type; \ 511 ProtectedLoad##Type##Operator kProtectedLoad##Type; 512 MACHINE_TYPE_LIST(LOAD)
515 #define STACKSLOT(Size, Alignment) \ 516 struct StackSlotOfSize##Size##OfAlignment##Alignment##Operator final \ 517 : public StackSlotOperator { \ 518 StackSlotOfSize##Size##OfAlignment##Alignment##Operator() \ 519 : StackSlotOperator(Size, Alignment) {} \ 521 StackSlotOfSize##Size##OfAlignment##Alignment##Operator \ 522 kStackSlotOfSize##Size##OfAlignment##Alignment; 523 STACK_SLOT_CACHED_SIZES_ALIGNMENTS_LIST(STACKSLOT)
526 #define STORE(Type) \ 527 struct Store##Type##Operator : public Operator1<StoreRepresentation> { \ 528 explicit Store##Type##Operator(WriteBarrierKind write_barrier_kind) \ 529 : Operator1<StoreRepresentation>( \ 531 Operator::kNoDeopt | Operator::kNoRead | Operator::kNoThrow, \ 532 "Store", 3, 1, 1, 0, 1, 0, \ 533 StoreRepresentation(MachineRepresentation::Type, \ 534 write_barrier_kind)) {} \ 536 struct Store##Type##NoWriteBarrier##Operator final \ 537 : public Store##Type##Operator { \ 538 Store##Type##NoWriteBarrier##Operator() \ 539 : Store##Type##Operator(kNoWriteBarrier) {} \ 541 struct Store##Type##MapWriteBarrier##Operator final \ 542 : public Store##Type##Operator { \ 543 Store##Type##MapWriteBarrier##Operator() \ 544 : Store##Type##Operator(kMapWriteBarrier) {} \ 546 struct Store##Type##PointerWriteBarrier##Operator final \ 547 : public Store##Type##Operator { \ 548 Store##Type##PointerWriteBarrier##Operator() \ 549 : Store##Type##Operator(kPointerWriteBarrier) {} \ 551 struct Store##Type##FullWriteBarrier##Operator final \ 552 : public Store##Type##Operator { \ 553 Store##Type##FullWriteBarrier##Operator() \ 554 : Store##Type##Operator(kFullWriteBarrier) {} \ 556 struct UnalignedStore##Type##Operator final \ 557 : public Operator1<UnalignedStoreRepresentation> { \ 558 UnalignedStore##Type##Operator() \ 559 : Operator1<UnalignedStoreRepresentation>( \ 560 IrOpcode::kUnalignedStore, \ 561 Operator::kNoDeopt | Operator::kNoRead | Operator::kNoThrow, \ 562 "UnalignedStore", 3, 1, 1, 0, 1, 0, \ 563 MachineRepresentation::Type) {} \ 565 struct ProtectedStore##Type##Operator \ 566 : public Operator1<StoreRepresentation> { \ 567 explicit ProtectedStore##Type##Operator() \ 568 : Operator1<StoreRepresentation>( \ 569 IrOpcode::kProtectedStore, \ 570 Operator::kNoDeopt | Operator::kNoRead | Operator::kNoThrow, \ 571 "Store", 3, 1, 1, 0, 1, 0, \ 572 StoreRepresentation(MachineRepresentation::Type, \ 573 kNoWriteBarrier)) {} \ 575 Store##Type##NoWriteBarrier##Operator kStore##Type##NoWriteBarrier; \ 576 Store##Type##MapWriteBarrier##Operator kStore##Type##MapWriteBarrier; \ 577 Store##Type##PointerWriteBarrier##Operator \ 578 kStore##Type##PointerWriteBarrier; \ 579 Store##Type##FullWriteBarrier##Operator kStore##Type##FullWriteBarrier; \ 580 UnalignedStore##Type##Operator kUnalignedStore##Type; \ 581 ProtectedStore##Type##Operator kProtectedStore##Type; 582 MACHINE_REPRESENTATION_LIST(STORE)
585 #define ATOMIC_LOAD(Type) \ 586 struct Word32AtomicLoad##Type##Operator final \ 587 : public Operator1<LoadRepresentation> { \ 588 Word32AtomicLoad##Type##Operator() \ 589 : Operator1<LoadRepresentation>( \ 590 IrOpcode::kWord32AtomicLoad, \ 591 Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, \ 592 "Word32AtomicLoad", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \ 594 Word32AtomicLoad##Type##Operator kWord32AtomicLoad##Type; 595 ATOMIC_TYPE_LIST(ATOMIC_LOAD)
598 #define ATOMIC_LOAD(Type) \ 599 struct Word64AtomicLoad##Type##Operator final \ 600 : public Operator1<LoadRepresentation> { \ 601 Word64AtomicLoad##Type##Operator() \ 602 : Operator1<LoadRepresentation>( \ 603 IrOpcode::kWord64AtomicLoad, \ 604 Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, \ 605 "Word64AtomicLoad", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \ 607 Word64AtomicLoad##Type##Operator kWord64AtomicLoad##Type; 608 ATOMIC_U64_TYPE_LIST(ATOMIC_LOAD)
611 #define ATOMIC_STORE(Type) \ 612 struct Word32AtomicStore##Type##Operator \ 613 : public Operator1<MachineRepresentation> { \ 614 Word32AtomicStore##Type##Operator() \ 615 : Operator1<MachineRepresentation>( \ 616 IrOpcode::kWord32AtomicStore, \ 617 Operator::kNoDeopt | Operator::kNoRead | Operator::kNoThrow, \ 618 "Word32AtomicStore", 3, 1, 1, 0, 1, 0, \ 619 MachineRepresentation::Type) {} \ 621 Word32AtomicStore##Type##Operator kWord32AtomicStore##Type; 622 ATOMIC_REPRESENTATION_LIST(ATOMIC_STORE)
625 #define ATOMIC_STORE(Type) \ 626 struct Word64AtomicStore##Type##Operator \ 627 : public Operator1<MachineRepresentation> { \ 628 Word64AtomicStore##Type##Operator() \ 629 : Operator1<MachineRepresentation>( \ 630 IrOpcode::kWord64AtomicStore, \ 631 Operator::kNoDeopt | Operator::kNoRead | Operator::kNoThrow, \ 632 "Word64AtomicStore", 3, 1, 1, 0, 1, 0, \ 633 MachineRepresentation::Type) {} \ 635 Word64AtomicStore##Type##Operator kWord64AtomicStore##Type; 636 ATOMIC64_REPRESENTATION_LIST(ATOMIC_STORE)
639 #define ATOMIC_OP(op, type) \ 640 struct op##type##Operator : public Operator1<MachineType> { \ 641 op##type##Operator() \ 642 : Operator1<MachineType>(IrOpcode::k##op, \ 643 Operator::kNoDeopt | Operator::kNoThrow, #op, \ 644 3, 1, 1, 1, 1, 0, MachineType::type()) {} \ 646 op##type##Operator k##op##type; 647 #define ATOMIC_OP_LIST(type) \ 648 ATOMIC_OP(Word32AtomicAdd, type) \ 649 ATOMIC_OP(Word32AtomicSub, type) \ 650 ATOMIC_OP(Word32AtomicAnd, type) \ 651 ATOMIC_OP(Word32AtomicOr, type) \ 652 ATOMIC_OP(Word32AtomicXor, type) \ 653 ATOMIC_OP(Word32AtomicExchange, type) 654 ATOMIC_TYPE_LIST(ATOMIC_OP_LIST)
655 #undef ATOMIC_OP_LIST 656 #define ATOMIC64_OP_LIST(type) \ 657 ATOMIC_OP(Word64AtomicAdd, type) \ 658 ATOMIC_OP(Word64AtomicSub, type) \ 659 ATOMIC_OP(Word64AtomicAnd, type) \ 660 ATOMIC_OP(Word64AtomicOr, type) \ 661 ATOMIC_OP(Word64AtomicXor, type) \ 662 ATOMIC_OP(Word64AtomicExchange, type) 663 ATOMIC_U64_TYPE_LIST(ATOMIC64_OP_LIST)
664 #undef ATOMIC64_OP_LIST 667 #define ATOMIC_COMPARE_EXCHANGE(Type) \ 668 struct Word32AtomicCompareExchange##Type##Operator \ 669 : public Operator1<MachineType> { \ 670 Word32AtomicCompareExchange##Type##Operator() \ 671 : Operator1<MachineType>(IrOpcode::kWord32AtomicCompareExchange, \ 672 Operator::kNoDeopt | Operator::kNoThrow, \ 673 "Word32AtomicCompareExchange", 4, 1, 1, 1, 1, \ 674 0, MachineType::Type()) {} \ 676 Word32AtomicCompareExchange##Type##Operator \ 677 kWord32AtomicCompareExchange##Type; 678 ATOMIC_TYPE_LIST(ATOMIC_COMPARE_EXCHANGE)
679 #undef ATOMIC_COMPARE_EXCHANGE 681 #define ATOMIC_COMPARE_EXCHANGE(Type) \ 682 struct Word64AtomicCompareExchange##Type##Operator \ 683 : public Operator1<MachineType> { \ 684 Word64AtomicCompareExchange##Type##Operator() \ 685 : Operator1<MachineType>(IrOpcode::kWord64AtomicCompareExchange, \ 686 Operator::kNoDeopt | Operator::kNoThrow, \ 687 "Word64AtomicCompareExchange", 4, 1, 1, 1, 1, \ 688 0, MachineType::Type()) {} \ 690 Word64AtomicCompareExchange##Type##Operator \ 691 kWord64AtomicCompareExchange##Type; 692 ATOMIC_U64_TYPE_LIST(ATOMIC_COMPARE_EXCHANGE)
693 #undef ATOMIC_COMPARE_EXCHANGE 697 :
Operator(IrOpcode::kWord32AtomicPairLoad,
698 Operator::kNoDeopt | Operator::kNoThrow,
699 "Word32AtomicPairLoad", 2, 1, 1, 2, 1, 0) {}
705 :
Operator(IrOpcode::kWord32AtomicPairStore,
706 Operator::kNoDeopt | Operator::kNoThrow,
707 "Word32AtomicPairStore", 4, 1, 1, 0, 1, 0) {}
711 #define ATOMIC_PAIR_OP(op) \ 712 struct Word32AtomicPair##op##Operator : public Operator { \ 713 Word32AtomicPair##op##Operator() \ 714 : Operator(IrOpcode::kWord32AtomicPair##op, \ 715 Operator::kNoDeopt | Operator::kNoThrow, \ 716 "Word32AtomicPair##op", 4, 1, 1, 2, 1, 0) {} \ 718 Word32AtomicPair##op##Operator kWord32AtomicPair##op; 719 ATOMIC_PAIR_BINOP_LIST(ATOMIC_PAIR_OP)
720 #undef ATOMIC_PAIR_OP 721 #undef ATOMIC_PAIR_BINOP_LIST 725 :
Operator(IrOpcode::kWord32AtomicPairCompareExchange,
726 Operator::kNoDeopt | Operator::kNoThrow,
727 "Word32AtomicPairCompareExchange", 6, 1, 1, 2, 1, 0) {}
738 :
Operator(IrOpcode::kBitcastWordToTagged,
739 Operator::kEliminatable | Operator::kNoWrite,
740 "BitcastWordToTagged", 1, 1, 1, 1, 1, 0) {}
746 :
Operator(IrOpcode::kBitcastTaggedToWord,
747 Operator::kEliminatable | Operator::kNoWrite,
748 "BitcastTaggedToWord", 1, 1, 1, 1, 1, 0) {}
754 :
Operator(IrOpcode::kBitcastTaggedToWord,
755 Operator::kEliminatable | Operator::kNoWrite,
756 "BitcastMaybeObjectToWord", 1, 1, 1, 1, 1, 0) {}
762 :
Operator(IrOpcode::kTaggedPoisonOnSpeculation,
763 Operator::kEliminatable | Operator::kNoWrite,
764 "TaggedPoisonOnSpeculation", 1, 1, 1, 1, 1, 0) {}
770 :
Operator(IrOpcode::kWord32PoisonOnSpeculation,
771 Operator::kEliminatable | Operator::kNoWrite,
772 "Word32PoisonOnSpeculation", 1, 1, 1, 1, 1, 0) {}
778 :
Operator(IrOpcode::kWord64PoisonOnSpeculation,
779 Operator::kEliminatable | Operator::kNoWrite,
780 "Word64PoisonOnSpeculation", 1, 1, 1, 1, 1, 0) {}
786 :
Operator(IrOpcode::kSpeculationFence, Operator::kNoThrow,
787 "SpeculationFence", 0, 1, 1, 0, 1, 0) {}
793 :
Operator(IrOpcode::kDebugAbort, Operator::kNoThrow,
"DebugAbort", 1,
800 :
Operator(IrOpcode::kDebugBreak, Operator::kNoThrow,
"DebugBreak", 0,
807 :
Operator(IrOpcode::kUnsafePointerAdd, Operator::kKontrol,
808 "UnsafePointerAdd", 2, 1, 1, 1, 1, 0) {}
816 "Comment", 0, 0, 0, 0, 0, 0, msg) {}
820 kMachineOperatorGlobalCache = LAZY_INSTANCE_INITIALIZER;
822 MachineOperatorBuilder::MachineOperatorBuilder(
823 Zone* zone, MachineRepresentation word, Flags flags,
824 AlignmentRequirements alignmentRequirements)
826 cache_(kMachineOperatorGlobalCache.Get()),
829 alignment_requirements_(alignmentRequirements) {
830 DCHECK(word == MachineRepresentation::kWord32 ||
831 word == MachineRepresentation::kWord64);
834 const Operator* MachineOperatorBuilder::UnalignedLoad(LoadRepresentation rep) {
836 if (rep == MachineType::Type()) { \ 837 return &cache_.kUnalignedLoad##Type; \ 839 MACHINE_TYPE_LIST(LOAD)
844 const Operator* MachineOperatorBuilder::UnalignedStore(
845 UnalignedStoreRepresentation rep) {
847 #define STORE(kRep) \ 848 case MachineRepresentation::kRep: \ 849 return &cache_.kUnalignedStore##kRep; 850 MACHINE_REPRESENTATION_LIST(STORE)
852 case MachineRepresentation::kBit:
853 case MachineRepresentation::kNone:
859 #define PURE(Name, properties, value_input_count, control_input_count, \ 861 const Operator* MachineOperatorBuilder::Name() { return &cache_.k##Name; } 862 MACHINE_PURE_OP_LIST(PURE)
865 #define PURE(Name, properties, value_input_count, control_input_count, \ 867 const OptionalOperator MachineOperatorBuilder::Name() { \ 868 return OptionalOperator(flags_ & k##Name, &cache_.k##Name); \ 870 PURE_OPTIONAL_OP_LIST(PURE)
873 #define OVERFLOW_OP(Name, properties) \ 874 const Operator* MachineOperatorBuilder::Name() { return &cache_.k##Name; } 875 OVERFLOW_OP_LIST(OVERFLOW_OP)
878 const Operator* MachineOperatorBuilder::Load(LoadRepresentation rep) {
880 if (rep == MachineType::Type()) { \ 881 return &cache_.kLoad##Type; \ 883 MACHINE_TYPE_LIST(LOAD)
888 const Operator* MachineOperatorBuilder::PoisonedLoad(LoadRepresentation rep) {
890 if (rep == MachineType::Type()) { \ 891 return &cache_.kPoisonedLoad##Type; \ 893 MACHINE_TYPE_LIST(LOAD)
898 const Operator* MachineOperatorBuilder::ProtectedLoad(LoadRepresentation rep) {
900 if (rep == MachineType::Type()) { \ 901 return &cache_.kProtectedLoad##Type; \ 903 MACHINE_TYPE_LIST(LOAD)
908 const Operator* MachineOperatorBuilder::StackSlot(
int size,
int alignment) {
910 DCHECK(alignment == 0 || alignment == 4 || alignment == 8 || alignment == 16);
911 #define CASE_CACHED_SIZE(Size, Alignment) \ 912 if (size == Size && alignment == Alignment) { \ 913 return &cache_.kStackSlotOfSize##Size##OfAlignment##Alignment; \ 916 STACK_SLOT_CACHED_SIZES_ALIGNMENTS_LIST(CASE_CACHED_SIZE)
918 #undef CASE_CACHED_SIZE 919 return new (zone_) StackSlotOperator(size, alignment);
922 const Operator* MachineOperatorBuilder::StackSlot(MachineRepresentation rep,
924 return StackSlot(1 << ElementSizeLog2Of(rep), alignment);
927 const Operator* MachineOperatorBuilder::Store(StoreRepresentation store_rep) {
928 switch (store_rep.representation()) {
929 #define STORE(kRep) \ 930 case MachineRepresentation::kRep: \ 931 switch (store_rep.write_barrier_kind()) { \ 932 case kNoWriteBarrier: \ 933 return &cache_.k##Store##kRep##NoWriteBarrier; \ 934 case kMapWriteBarrier: \ 935 return &cache_.k##Store##kRep##MapWriteBarrier; \ 936 case kPointerWriteBarrier: \ 937 return &cache_.k##Store##kRep##PointerWriteBarrier; \ 938 case kFullWriteBarrier: \ 939 return &cache_.k##Store##kRep##FullWriteBarrier; \ 942 MACHINE_REPRESENTATION_LIST(STORE)
944 case MachineRepresentation::kBit:
945 case MachineRepresentation::kNone:
951 const Operator* MachineOperatorBuilder::ProtectedStore(
952 MachineRepresentation rep) {
954 #define STORE(kRep) \ 955 case MachineRepresentation::kRep: \ 956 return &cache_.kProtectedStore##kRep; \ 958 MACHINE_REPRESENTATION_LIST(STORE)
960 case MachineRepresentation::kBit:
961 case MachineRepresentation::kNone:
967 const Operator* MachineOperatorBuilder::UnsafePointerAdd() {
968 return &cache_.kUnsafePointerAdd;
971 const Operator* MachineOperatorBuilder::BitcastWordToTagged() {
972 return &cache_.kBitcastWordToTagged;
975 const Operator* MachineOperatorBuilder::BitcastTaggedToWord() {
976 return &cache_.kBitcastTaggedToWord;
979 const Operator* MachineOperatorBuilder::BitcastMaybeObjectToWord() {
980 return &cache_.kBitcastMaybeObjectToWord;
983 const Operator* MachineOperatorBuilder::DebugAbort() {
984 return &cache_.kDebugAbort;
987 const Operator* MachineOperatorBuilder::DebugBreak() {
988 return &cache_.kDebugBreak;
991 const Operator* MachineOperatorBuilder::Comment(
const char* msg) {
992 return new (zone_) CommentOperator(msg);
995 const Operator* MachineOperatorBuilder::Word32AtomicLoad(
996 LoadRepresentation rep) {
998 if (rep == MachineType::Type()) { \ 999 return &cache_.kWord32AtomicLoad##Type; \ 1001 ATOMIC_TYPE_LIST(LOAD)
1006 const Operator* MachineOperatorBuilder::Word32AtomicStore(
1007 MachineRepresentation rep) {
1008 #define STORE(kRep) \ 1009 if (rep == MachineRepresentation::kRep) { \ 1010 return &cache_.kWord32AtomicStore##kRep; \ 1012 ATOMIC_REPRESENTATION_LIST(STORE)
1017 const Operator* MachineOperatorBuilder::Word32AtomicExchange(MachineType type) {
1018 #define EXCHANGE(kType) \ 1019 if (type == MachineType::kType()) { \ 1020 return &cache_.kWord32AtomicExchange##kType; \ 1022 ATOMIC_TYPE_LIST(EXCHANGE)
1027 const Operator* MachineOperatorBuilder::Word32AtomicCompareExchange(
1029 #define COMPARE_EXCHANGE(kType) \ 1030 if (type == MachineType::kType()) { \ 1031 return &cache_.kWord32AtomicCompareExchange##kType; \ 1033 ATOMIC_TYPE_LIST(COMPARE_EXCHANGE)
1034 #undef COMPARE_EXCHANGE 1038 const Operator* MachineOperatorBuilder::Word32AtomicAdd(MachineType type) {
1039 #define ADD(kType) \ 1040 if (type == MachineType::kType()) { \ 1041 return &cache_.kWord32AtomicAdd##kType; \ 1043 ATOMIC_TYPE_LIST(ADD)
1048 const Operator* MachineOperatorBuilder::Word32AtomicSub(MachineType type) {
1049 #define SUB(kType) \ 1050 if (type == MachineType::kType()) { \ 1051 return &cache_.kWord32AtomicSub##kType; \ 1053 ATOMIC_TYPE_LIST(SUB)
1058 const Operator* MachineOperatorBuilder::Word32AtomicAnd(MachineType type) {
1059 #define AND(kType) \ 1060 if (type == MachineType::kType()) { \ 1061 return &cache_.kWord32AtomicAnd##kType; \ 1063 ATOMIC_TYPE_LIST(AND)
1068 const Operator* MachineOperatorBuilder::Word32AtomicOr(MachineType type) {
1070 if (type == MachineType::kType()) { \ 1071 return &cache_.kWord32AtomicOr##kType; \ 1073 ATOMIC_TYPE_LIST(OR)
1078 const Operator* MachineOperatorBuilder::Word32AtomicXor(MachineType type) {
1079 #define XOR(kType) \ 1080 if (type == MachineType::kType()) { \ 1081 return &cache_.kWord32AtomicXor##kType; \ 1083 ATOMIC_TYPE_LIST(XOR)
1088 const Operator* MachineOperatorBuilder::Word64AtomicLoad(
1089 LoadRepresentation rep) {
1090 #define LOAD(Type) \ 1091 if (rep == MachineType::Type()) { \ 1092 return &cache_.kWord64AtomicLoad##Type; \ 1094 ATOMIC_U64_TYPE_LIST(LOAD)
1099 const Operator* MachineOperatorBuilder::Word64AtomicStore(
1100 MachineRepresentation rep) {
1101 #define STORE(kRep) \ 1102 if (rep == MachineRepresentation::kRep) { \ 1103 return &cache_.kWord64AtomicStore##kRep; \ 1105 ATOMIC64_REPRESENTATION_LIST(STORE)
1110 const Operator* MachineOperatorBuilder::Word64AtomicAdd(MachineType type) {
1111 #define ADD(kType) \ 1112 if (type == MachineType::kType()) { \ 1113 return &cache_.kWord64AtomicAdd##kType; \ 1115 ATOMIC_U64_TYPE_LIST(ADD)
1120 const Operator* MachineOperatorBuilder::Word64AtomicSub(MachineType type) {
1121 #define SUB(kType) \ 1122 if (type == MachineType::kType()) { \ 1123 return &cache_.kWord64AtomicSub##kType; \ 1125 ATOMIC_U64_TYPE_LIST(SUB)
1130 const Operator* MachineOperatorBuilder::Word64AtomicAnd(MachineType type) {
1131 #define AND(kType) \ 1132 if (type == MachineType::kType()) { \ 1133 return &cache_.kWord64AtomicAnd##kType; \ 1135 ATOMIC_U64_TYPE_LIST(AND)
1140 const Operator* MachineOperatorBuilder::Word64AtomicOr(MachineType type) {
1142 if (type == MachineType::kType()) { \ 1143 return &cache_.kWord64AtomicOr##kType; \ 1145 ATOMIC_U64_TYPE_LIST(OR)
1150 const Operator* MachineOperatorBuilder::Word64AtomicXor(MachineType type) {
1151 #define XOR(kType) \ 1152 if (type == MachineType::kType()) { \ 1153 return &cache_.kWord64AtomicXor##kType; \ 1155 ATOMIC_U64_TYPE_LIST(XOR)
1160 const Operator* MachineOperatorBuilder::Word64AtomicExchange(MachineType type) {
1161 #define EXCHANGE(kType) \ 1162 if (type == MachineType::kType()) { \ 1163 return &cache_.kWord64AtomicExchange##kType; \ 1165 ATOMIC_U64_TYPE_LIST(EXCHANGE)
1170 const Operator* MachineOperatorBuilder::Word64AtomicCompareExchange(
1172 #define COMPARE_EXCHANGE(kType) \ 1173 if (type == MachineType::kType()) { \ 1174 return &cache_.kWord64AtomicCompareExchange##kType; \ 1176 ATOMIC_U64_TYPE_LIST(COMPARE_EXCHANGE)
1177 #undef COMPARE_EXCHANGE 1181 const Operator* MachineOperatorBuilder::Word32AtomicPairLoad() {
1182 return &cache_.kWord32AtomicPairLoad;
1185 const Operator* MachineOperatorBuilder::Word32AtomicPairStore() {
1186 return &cache_.kWord32AtomicPairStore;
1189 const Operator* MachineOperatorBuilder::Word32AtomicPairAdd() {
1190 return &cache_.kWord32AtomicPairAdd;
1193 const Operator* MachineOperatorBuilder::Word32AtomicPairSub() {
1194 return &cache_.kWord32AtomicPairSub;
1197 const Operator* MachineOperatorBuilder::Word32AtomicPairAnd() {
1198 return &cache_.kWord32AtomicPairAnd;
1201 const Operator* MachineOperatorBuilder::Word32AtomicPairOr() {
1202 return &cache_.kWord32AtomicPairOr;
1205 const Operator* MachineOperatorBuilder::Word32AtomicPairXor() {
1206 return &cache_.kWord32AtomicPairXor;
1209 const Operator* MachineOperatorBuilder::Word32AtomicPairExchange() {
1210 return &cache_.kWord32AtomicPairExchange;
1213 const Operator* MachineOperatorBuilder::Word32AtomicPairCompareExchange() {
1214 return &cache_.kWord32AtomicPairCompareExchange;
1217 const Operator* MachineOperatorBuilder::TaggedPoisonOnSpeculation() {
1218 return &cache_.kTaggedPoisonOnSpeculation;
1221 const Operator* MachineOperatorBuilder::Word32PoisonOnSpeculation() {
1222 return &cache_.kWord32PoisonOnSpeculation;
1225 const Operator* MachineOperatorBuilder::Word64PoisonOnSpeculation() {
1226 return &cache_.kWord64PoisonOnSpeculation;
1229 const OptionalOperator MachineOperatorBuilder::SpeculationFence() {
1230 return OptionalOperator(flags_ & kSpeculationFence,
1231 &cache_.kSpeculationFence);
1234 #define SIMD_LANE_OPS(Type, lane_count) \ 1235 const Operator* MachineOperatorBuilder::Type##ExtractLane( \ 1236 int32_t lane_index) { \ 1237 DCHECK(0 <= lane_index && lane_index < lane_count); \ 1238 return new (zone_) \ 1239 Operator1<int32_t>(IrOpcode::k##Type##ExtractLane, Operator::kPure, \ 1240 "Extract lane", 1, 0, 0, 1, 0, 0, lane_index); \ 1242 const Operator* MachineOperatorBuilder::Type##ReplaceLane( \ 1243 int32_t lane_index) { \ 1244 DCHECK(0 <= lane_index && lane_index < lane_count); \ 1245 return new (zone_) \ 1246 Operator1<int32_t>(IrOpcode::k##Type##ReplaceLane, Operator::kPure, \ 1247 "Replace lane", 2, 0, 0, 1, 0, 0, lane_index); \ 1249 SIMD_LANE_OP_LIST(SIMD_LANE_OPS)
1250 #undef SIMD_LANE_OPS 1252 #define SIMD_SHIFT_OPS(format, bits) \ 1253 const Operator* MachineOperatorBuilder::I##format##Shl(int32_t shift) { \ 1254 DCHECK(0 <= shift && shift < bits); \ 1255 return new (zone_) \ 1256 Operator1<int32_t>(IrOpcode::kI##format##Shl, Operator::kPure, \ 1257 "Shift left", 1, 0, 0, 1, 0, 0, shift); \ 1259 const Operator* MachineOperatorBuilder::I##format##ShrS(int32_t shift) { \ 1260 DCHECK(0 < shift && shift <= bits); \ 1261 return new (zone_) \ 1262 Operator1<int32_t>(IrOpcode::kI##format##ShrS, Operator::kPure, \ 1263 "Arithmetic shift right", 1, 0, 0, 1, 0, 0, shift); \ 1265 const Operator* MachineOperatorBuilder::I##format##ShrU(int32_t shift) { \ 1266 DCHECK(0 <= shift && shift < bits); \ 1267 return new (zone_) \ 1268 Operator1<int32_t>(IrOpcode::kI##format##ShrU, Operator::kPure, \ 1269 "Shift right", 1, 0, 0, 1, 0, 0, shift); \ 1271 SIMD_FORMAT_LIST(SIMD_SHIFT_OPS)
1272 #undef SIMD_SHIFT_OPS 1274 const Operator* MachineOperatorBuilder::S8x16Shuffle(
1275 const uint8_t shuffle[16]) {
1276 uint8_t* array = zone_->NewArray<uint8_t>(16);
1277 memcpy(array, shuffle, 16);
1279 Operator1<uint8_t*>(IrOpcode::kS8x16Shuffle, Operator::kPure,
"Shuffle",
1280 2, 0, 0, 1, 0, 0, array);
1283 #undef PURE_BINARY_OP_LIST_32 1284 #undef PURE_BINARY_OP_LIST_64 1285 #undef MACHINE_PURE_OP_LIST 1286 #undef PURE_OPTIONAL_OP_LIST 1287 #undef OVERFLOW_OP_LIST 1288 #undef MACHINE_TYPE_LIST 1289 #undef MACHINE_REPRESENTATION_LIST 1290 #undef ATOMIC_TYPE_LIST 1291 #undef ATOMIC_U64_TYPE_LIST 1292 #undef ATOMIC_U32_TYPE_LIST 1293 #undef ATOMIC_REPRESENTATION_LIST 1294 #undef ATOMIC64_REPRESENTATION_LIST 1295 #undef SIMD_LANE_OP_LIST 1296 #undef SIMD_FORMAT_LIST 1297 #undef STACK_SLOT_CACHED_SIZES_ALIGNMENTS_LIST