Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 1 | // Copyright 2014 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 | #include "src/compiler/machine-operator.h" |
| 6 | |
| 7 | #include "src/base/lazy-instance.h" |
| 8 | #include "src/compiler/opcodes.h" |
| 9 | #include "src/compiler/operator.h" |
| 10 | |
| 11 | namespace v8 { |
| 12 | namespace internal { |
| 13 | namespace compiler { |
| 14 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 15 | bool operator==(StoreRepresentation lhs, StoreRepresentation rhs) { |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 16 | return lhs.representation() == rhs.representation() && |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 17 | lhs.write_barrier_kind() == rhs.write_barrier_kind(); |
| 18 | } |
| 19 | |
| 20 | |
| 21 | bool operator!=(StoreRepresentation lhs, StoreRepresentation rhs) { |
| 22 | return !(lhs == rhs); |
| 23 | } |
| 24 | |
| 25 | |
| 26 | size_t hash_value(StoreRepresentation rep) { |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 27 | return base::hash_combine(rep.representation(), rep.write_barrier_kind()); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | |
| 31 | std::ostream& operator<<(std::ostream& os, StoreRepresentation rep) { |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 32 | return os << "(" << rep.representation() << " : " << rep.write_barrier_kind() |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 33 | << ")"; |
| 34 | } |
| 35 | |
| 36 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 37 | LoadRepresentation LoadRepresentationOf(Operator const* op) { |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 38 | DCHECK(IrOpcode::kLoad == op->opcode() || |
| 39 | IrOpcode::kAtomicLoad == op->opcode()); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 40 | return OpParameter<LoadRepresentation>(op); |
| 41 | } |
| 42 | |
| 43 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 44 | StoreRepresentation const& StoreRepresentationOf(Operator const* op) { |
| 45 | DCHECK_EQ(IrOpcode::kStore, op->opcode()); |
| 46 | return OpParameter<StoreRepresentation>(op); |
| 47 | } |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 48 | |
| 49 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 50 | CheckedLoadRepresentation CheckedLoadRepresentationOf(Operator const* op) { |
| 51 | DCHECK_EQ(IrOpcode::kCheckedLoad, op->opcode()); |
| 52 | return OpParameter<CheckedLoadRepresentation>(op); |
| 53 | } |
| 54 | |
| 55 | |
| 56 | CheckedStoreRepresentation CheckedStoreRepresentationOf(Operator const* op) { |
| 57 | DCHECK_EQ(IrOpcode::kCheckedStore, op->opcode()); |
| 58 | return OpParameter<CheckedStoreRepresentation>(op); |
| 59 | } |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 60 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 61 | MachineRepresentation StackSlotRepresentationOf(Operator const* op) { |
| 62 | DCHECK_EQ(IrOpcode::kStackSlot, op->opcode()); |
| 63 | return OpParameter<MachineRepresentation>(op); |
| 64 | } |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 65 | |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 66 | MachineRepresentation AtomicStoreRepresentationOf(Operator const* op) { |
| 67 | DCHECK_EQ(IrOpcode::kAtomicStore, op->opcode()); |
| 68 | return OpParameter<MachineRepresentation>(op); |
| 69 | } |
| 70 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 71 | #define PURE_OP_LIST(V) \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 72 | V(Word32And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 73 | V(Word32Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 74 | V(Word32Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 75 | V(Word32Shl, Operator::kNoProperties, 2, 0, 1) \ |
| 76 | V(Word32Shr, Operator::kNoProperties, 2, 0, 1) \ |
| 77 | V(Word32Sar, Operator::kNoProperties, 2, 0, 1) \ |
| 78 | V(Word32Ror, Operator::kNoProperties, 2, 0, 1) \ |
| 79 | V(Word32Equal, Operator::kCommutative, 2, 0, 1) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 80 | V(Word32Clz, Operator::kNoProperties, 1, 0, 1) \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 81 | V(Word64And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 82 | V(Word64Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 83 | V(Word64Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 84 | V(Word64Shl, Operator::kNoProperties, 2, 0, 1) \ |
| 85 | V(Word64Shr, Operator::kNoProperties, 2, 0, 1) \ |
| 86 | V(Word64Sar, Operator::kNoProperties, 2, 0, 1) \ |
| 87 | V(Word64Ror, Operator::kNoProperties, 2, 0, 1) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 88 | V(Word64Clz, Operator::kNoProperties, 1, 0, 1) \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 89 | V(Word64Equal, Operator::kCommutative, 2, 0, 1) \ |
| 90 | V(Int32Add, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 91 | V(Int32AddWithOverflow, Operator::kAssociative | Operator::kCommutative, 2, \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 92 | 0, 2) \ |
| 93 | V(Int32Sub, Operator::kNoProperties, 2, 0, 1) \ |
| 94 | V(Int32SubWithOverflow, Operator::kNoProperties, 2, 0, 2) \ |
| 95 | V(Int32Mul, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 96 | V(Int32MulHigh, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 97 | V(Int32Div, Operator::kNoProperties, 2, 1, 1) \ |
| 98 | V(Int32Mod, Operator::kNoProperties, 2, 1, 1) \ |
| 99 | V(Int32LessThan, Operator::kNoProperties, 2, 0, 1) \ |
| 100 | V(Int32LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
| 101 | V(Uint32Div, Operator::kNoProperties, 2, 1, 1) \ |
| 102 | V(Uint32LessThan, Operator::kNoProperties, 2, 0, 1) \ |
| 103 | V(Uint32LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
| 104 | V(Uint32Mod, Operator::kNoProperties, 2, 1, 1) \ |
| 105 | V(Uint32MulHigh, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 106 | V(Int64Add, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 107 | V(Int64AddWithOverflow, Operator::kAssociative | Operator::kCommutative, 2, \ |
| 108 | 0, 2) \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 109 | V(Int64Sub, Operator::kNoProperties, 2, 0, 1) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 110 | V(Int64SubWithOverflow, Operator::kNoProperties, 2, 0, 2) \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 111 | V(Int64Mul, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 112 | V(Int64Div, Operator::kNoProperties, 2, 1, 1) \ |
| 113 | V(Int64Mod, Operator::kNoProperties, 2, 1, 1) \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 114 | V(Int64LessThan, Operator::kNoProperties, 2, 0, 1) \ |
| 115 | V(Int64LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 116 | V(Uint64Div, Operator::kNoProperties, 2, 1, 1) \ |
| 117 | V(Uint64Mod, Operator::kNoProperties, 2, 1, 1) \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 118 | V(Uint64LessThan, Operator::kNoProperties, 2, 0, 1) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 119 | V(Uint64LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 120 | V(BitcastWordToTagged, Operator::kNoProperties, 1, 0, 1) \ |
| 121 | V(TruncateFloat64ToWord32, Operator::kNoProperties, 1, 0, 1) \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 122 | V(ChangeFloat32ToFloat64, Operator::kNoProperties, 1, 0, 1) \ |
| 123 | V(ChangeFloat64ToInt32, Operator::kNoProperties, 1, 0, 1) \ |
| 124 | V(ChangeFloat64ToUint32, Operator::kNoProperties, 1, 0, 1) \ |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 125 | V(TruncateFloat64ToUint32, Operator::kNoProperties, 1, 0, 1) \ |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 126 | V(TruncateFloat32ToInt32, Operator::kNoProperties, 1, 0, 1) \ |
| 127 | V(TruncateFloat32ToUint32, Operator::kNoProperties, 1, 0, 1) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 128 | V(TryTruncateFloat32ToInt64, Operator::kNoProperties, 1, 0, 2) \ |
| 129 | V(TryTruncateFloat64ToInt64, Operator::kNoProperties, 1, 0, 2) \ |
| 130 | V(TryTruncateFloat32ToUint64, Operator::kNoProperties, 1, 0, 2) \ |
| 131 | V(TryTruncateFloat64ToUint64, Operator::kNoProperties, 1, 0, 2) \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 132 | V(ChangeInt32ToFloat64, Operator::kNoProperties, 1, 0, 1) \ |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 133 | V(RoundFloat64ToInt32, Operator::kNoProperties, 1, 0, 1) \ |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 134 | V(RoundInt32ToFloat32, Operator::kNoProperties, 1, 0, 1) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 135 | V(RoundInt64ToFloat32, Operator::kNoProperties, 1, 0, 1) \ |
| 136 | V(RoundInt64ToFloat64, Operator::kNoProperties, 1, 0, 1) \ |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 137 | V(RoundUint32ToFloat32, Operator::kNoProperties, 1, 0, 1) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 138 | V(RoundUint64ToFloat32, Operator::kNoProperties, 1, 0, 1) \ |
| 139 | V(RoundUint64ToFloat64, Operator::kNoProperties, 1, 0, 1) \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 140 | V(ChangeInt32ToInt64, Operator::kNoProperties, 1, 0, 1) \ |
| 141 | V(ChangeUint32ToFloat64, Operator::kNoProperties, 1, 0, 1) \ |
| 142 | V(ChangeUint32ToUint64, Operator::kNoProperties, 1, 0, 1) \ |
| 143 | V(TruncateFloat64ToFloat32, Operator::kNoProperties, 1, 0, 1) \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 144 | V(TruncateInt64ToInt32, Operator::kNoProperties, 1, 0, 1) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 145 | V(BitcastFloat32ToInt32, Operator::kNoProperties, 1, 0, 1) \ |
| 146 | V(BitcastFloat64ToInt64, Operator::kNoProperties, 1, 0, 1) \ |
| 147 | V(BitcastInt32ToFloat32, Operator::kNoProperties, 1, 0, 1) \ |
| 148 | V(BitcastInt64ToFloat64, Operator::kNoProperties, 1, 0, 1) \ |
| 149 | V(Float32Abs, Operator::kNoProperties, 1, 0, 1) \ |
| 150 | V(Float32Add, Operator::kCommutative, 2, 0, 1) \ |
| 151 | V(Float32Sub, Operator::kNoProperties, 2, 0, 1) \ |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 152 | V(Float32SubPreserveNan, Operator::kNoProperties, 2, 0, 1) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 153 | V(Float32Mul, Operator::kCommutative, 2, 0, 1) \ |
| 154 | V(Float32Div, Operator::kNoProperties, 2, 0, 1) \ |
| 155 | V(Float32Sqrt, Operator::kNoProperties, 1, 0, 1) \ |
| 156 | V(Float64Abs, Operator::kNoProperties, 1, 0, 1) \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 157 | V(Float64Add, Operator::kCommutative, 2, 0, 1) \ |
| 158 | V(Float64Sub, Operator::kNoProperties, 2, 0, 1) \ |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 159 | V(Float64SubPreserveNan, Operator::kNoProperties, 2, 0, 1) \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 160 | V(Float64Mul, Operator::kCommutative, 2, 0, 1) \ |
| 161 | V(Float64Div, Operator::kNoProperties, 2, 0, 1) \ |
| 162 | V(Float64Mod, Operator::kNoProperties, 2, 0, 1) \ |
| 163 | V(Float64Sqrt, Operator::kNoProperties, 1, 0, 1) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 164 | V(Float32Equal, Operator::kCommutative, 2, 0, 1) \ |
| 165 | V(Float32LessThan, Operator::kNoProperties, 2, 0, 1) \ |
| 166 | V(Float32LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 167 | V(Float64Equal, Operator::kCommutative, 2, 0, 1) \ |
| 168 | V(Float64LessThan, Operator::kNoProperties, 2, 0, 1) \ |
| 169 | V(Float64LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 170 | V(Float64ExtractLowWord32, Operator::kNoProperties, 1, 0, 1) \ |
| 171 | V(Float64ExtractHighWord32, Operator::kNoProperties, 1, 0, 1) \ |
| 172 | V(Float64InsertLowWord32, Operator::kNoProperties, 2, 0, 1) \ |
| 173 | V(Float64InsertHighWord32, Operator::kNoProperties, 2, 0, 1) \ |
| 174 | V(LoadStackPointer, Operator::kNoProperties, 0, 0, 1) \ |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 175 | V(LoadFramePointer, Operator::kNoProperties, 0, 0, 1) \ |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 176 | V(LoadParentFramePointer, Operator::kNoProperties, 0, 0, 1) \ |
| 177 | V(Int32PairAdd, Operator::kNoProperties, 4, 0, 2) \ |
| 178 | V(Int32PairSub, Operator::kNoProperties, 4, 0, 2) \ |
| 179 | V(Int32PairMul, Operator::kNoProperties, 4, 0, 2) \ |
| 180 | V(Word32PairShl, Operator::kNoProperties, 3, 0, 2) \ |
| 181 | V(Word32PairShr, Operator::kNoProperties, 3, 0, 2) \ |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 182 | V(Word32PairSar, Operator::kNoProperties, 3, 0, 2) \ |
| 183 | V(CreateFloat32x4, Operator::kNoProperties, 4, 0, 1) \ |
| 184 | V(Float32x4ExtractLane, Operator::kNoProperties, 2, 0, 1) \ |
| 185 | V(Float32x4ReplaceLane, Operator::kNoProperties, 3, 0, 1) \ |
| 186 | V(Float32x4Abs, Operator::kNoProperties, 1, 0, 1) \ |
| 187 | V(Float32x4Neg, Operator::kNoProperties, 1, 0, 1) \ |
| 188 | V(Float32x4Sqrt, Operator::kNoProperties, 1, 0, 1) \ |
| 189 | V(Float32x4RecipApprox, Operator::kNoProperties, 1, 0, 1) \ |
| 190 | V(Float32x4RecipSqrtApprox, Operator::kNoProperties, 1, 0, 1) \ |
| 191 | V(Float32x4Add, Operator::kCommutative, 2, 0, 1) \ |
| 192 | V(Float32x4Sub, Operator::kNoProperties, 2, 0, 1) \ |
| 193 | V(Float32x4Mul, Operator::kCommutative, 2, 0, 1) \ |
| 194 | V(Float32x4Div, Operator::kNoProperties, 2, 0, 1) \ |
| 195 | V(Float32x4Min, Operator::kCommutative, 2, 0, 1) \ |
| 196 | V(Float32x4Max, Operator::kCommutative, 2, 0, 1) \ |
| 197 | V(Float32x4MinNum, Operator::kCommutative, 2, 0, 1) \ |
| 198 | V(Float32x4MaxNum, Operator::kCommutative, 2, 0, 1) \ |
| 199 | V(Float32x4Equal, Operator::kCommutative, 2, 0, 1) \ |
| 200 | V(Float32x4NotEqual, Operator::kCommutative, 2, 0, 1) \ |
| 201 | V(Float32x4LessThan, Operator::kNoProperties, 2, 0, 1) \ |
| 202 | V(Float32x4LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
| 203 | V(Float32x4GreaterThan, Operator::kNoProperties, 2, 0, 1) \ |
| 204 | V(Float32x4GreaterThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
| 205 | V(Float32x4Select, Operator::kNoProperties, 3, 0, 1) \ |
| 206 | V(Float32x4Swizzle, Operator::kNoProperties, 5, 0, 1) \ |
| 207 | V(Float32x4Shuffle, Operator::kNoProperties, 6, 0, 1) \ |
| 208 | V(Float32x4FromInt32x4, Operator::kNoProperties, 1, 0, 1) \ |
| 209 | V(Float32x4FromUint32x4, Operator::kNoProperties, 1, 0, 1) \ |
| 210 | V(CreateInt32x4, Operator::kNoProperties, 4, 0, 1) \ |
| 211 | V(Int32x4ExtractLane, Operator::kNoProperties, 2, 0, 1) \ |
| 212 | V(Int32x4ReplaceLane, Operator::kNoProperties, 3, 0, 1) \ |
| 213 | V(Int32x4Neg, Operator::kNoProperties, 1, 0, 1) \ |
| 214 | V(Int32x4Add, Operator::kCommutative, 2, 0, 1) \ |
| 215 | V(Int32x4Sub, Operator::kNoProperties, 2, 0, 1) \ |
| 216 | V(Int32x4Mul, Operator::kCommutative, 2, 0, 1) \ |
| 217 | V(Int32x4Min, Operator::kCommutative, 2, 0, 1) \ |
| 218 | V(Int32x4Max, Operator::kCommutative, 2, 0, 1) \ |
| 219 | V(Int32x4ShiftLeftByScalar, Operator::kNoProperties, 2, 0, 1) \ |
| 220 | V(Int32x4ShiftRightByScalar, Operator::kNoProperties, 2, 0, 1) \ |
| 221 | V(Int32x4Equal, Operator::kCommutative, 2, 0, 1) \ |
| 222 | V(Int32x4NotEqual, Operator::kCommutative, 2, 0, 1) \ |
| 223 | V(Int32x4LessThan, Operator::kNoProperties, 2, 0, 1) \ |
| 224 | V(Int32x4LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
| 225 | V(Int32x4GreaterThan, Operator::kNoProperties, 2, 0, 1) \ |
| 226 | V(Int32x4GreaterThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
| 227 | V(Int32x4Select, Operator::kNoProperties, 3, 0, 1) \ |
| 228 | V(Int32x4Swizzle, Operator::kNoProperties, 5, 0, 1) \ |
| 229 | V(Int32x4Shuffle, Operator::kNoProperties, 6, 0, 1) \ |
| 230 | V(Int32x4FromFloat32x4, Operator::kNoProperties, 1, 0, 1) \ |
| 231 | V(Uint32x4Min, Operator::kCommutative, 2, 0, 1) \ |
| 232 | V(Uint32x4Max, Operator::kCommutative, 2, 0, 1) \ |
| 233 | V(Uint32x4ShiftLeftByScalar, Operator::kNoProperties, 2, 0, 1) \ |
| 234 | V(Uint32x4ShiftRightByScalar, Operator::kNoProperties, 2, 0, 1) \ |
| 235 | V(Uint32x4LessThan, Operator::kNoProperties, 2, 0, 1) \ |
| 236 | V(Uint32x4LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
| 237 | V(Uint32x4GreaterThan, Operator::kNoProperties, 2, 0, 1) \ |
| 238 | V(Uint32x4GreaterThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
| 239 | V(Uint32x4FromFloat32x4, Operator::kNoProperties, 1, 0, 1) \ |
| 240 | V(CreateBool32x4, Operator::kNoProperties, 4, 0, 1) \ |
| 241 | V(Bool32x4ExtractLane, Operator::kNoProperties, 2, 0, 1) \ |
| 242 | V(Bool32x4ReplaceLane, Operator::kNoProperties, 3, 0, 1) \ |
| 243 | V(Bool32x4And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 244 | V(Bool32x4Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 245 | V(Bool32x4Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 246 | V(Bool32x4Not, Operator::kNoProperties, 1, 0, 1) \ |
| 247 | V(Bool32x4AnyTrue, Operator::kNoProperties, 1, 0, 1) \ |
| 248 | V(Bool32x4AllTrue, Operator::kNoProperties, 1, 0, 1) \ |
| 249 | V(Bool32x4Swizzle, Operator::kNoProperties, 5, 0, 1) \ |
| 250 | V(Bool32x4Shuffle, Operator::kNoProperties, 6, 0, 1) \ |
| 251 | V(Bool32x4Equal, Operator::kCommutative, 2, 0, 1) \ |
| 252 | V(Bool32x4NotEqual, Operator::kCommutative, 2, 0, 1) \ |
| 253 | V(CreateInt16x8, Operator::kNoProperties, 8, 0, 1) \ |
| 254 | V(Int16x8ExtractLane, Operator::kNoProperties, 2, 0, 1) \ |
| 255 | V(Int16x8ReplaceLane, Operator::kNoProperties, 3, 0, 1) \ |
| 256 | V(Int16x8Neg, Operator::kNoProperties, 1, 0, 1) \ |
| 257 | V(Int16x8Add, Operator::kCommutative, 2, 0, 1) \ |
| 258 | V(Int16x8AddSaturate, Operator::kCommutative, 2, 0, 1) \ |
| 259 | V(Int16x8Sub, Operator::kNoProperties, 2, 0, 1) \ |
| 260 | V(Int16x8SubSaturate, Operator::kNoProperties, 2, 0, 1) \ |
| 261 | V(Int16x8Mul, Operator::kCommutative, 2, 0, 1) \ |
| 262 | V(Int16x8Min, Operator::kCommutative, 2, 0, 1) \ |
| 263 | V(Int16x8Max, Operator::kCommutative, 2, 0, 1) \ |
| 264 | V(Int16x8ShiftLeftByScalar, Operator::kNoProperties, 2, 0, 1) \ |
| 265 | V(Int16x8ShiftRightByScalar, Operator::kNoProperties, 2, 0, 1) \ |
| 266 | V(Int16x8Equal, Operator::kCommutative, 2, 0, 1) \ |
| 267 | V(Int16x8NotEqual, Operator::kCommutative, 2, 0, 1) \ |
| 268 | V(Int16x8LessThan, Operator::kNoProperties, 2, 0, 1) \ |
| 269 | V(Int16x8LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
| 270 | V(Int16x8GreaterThan, Operator::kNoProperties, 2, 0, 1) \ |
| 271 | V(Int16x8GreaterThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
| 272 | V(Int16x8Select, Operator::kNoProperties, 3, 0, 1) \ |
| 273 | V(Int16x8Swizzle, Operator::kNoProperties, 9, 0, 1) \ |
| 274 | V(Int16x8Shuffle, Operator::kNoProperties, 10, 0, 1) \ |
| 275 | V(Uint16x8AddSaturate, Operator::kCommutative, 2, 0, 1) \ |
| 276 | V(Uint16x8SubSaturate, Operator::kNoProperties, 2, 0, 1) \ |
| 277 | V(Uint16x8Min, Operator::kCommutative, 2, 0, 1) \ |
| 278 | V(Uint16x8Max, Operator::kCommutative, 2, 0, 1) \ |
| 279 | V(Uint16x8ShiftLeftByScalar, Operator::kNoProperties, 2, 0, 1) \ |
| 280 | V(Uint16x8ShiftRightByScalar, Operator::kNoProperties, 2, 0, 1) \ |
| 281 | V(Uint16x8LessThan, Operator::kNoProperties, 2, 0, 1) \ |
| 282 | V(Uint16x8LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
| 283 | V(Uint16x8GreaterThan, Operator::kNoProperties, 2, 0, 1) \ |
| 284 | V(Uint16x8GreaterThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
| 285 | V(CreateBool16x8, Operator::kNoProperties, 8, 0, 1) \ |
| 286 | V(Bool16x8ExtractLane, Operator::kNoProperties, 2, 0, 1) \ |
| 287 | V(Bool16x8ReplaceLane, Operator::kNoProperties, 3, 0, 1) \ |
| 288 | V(Bool16x8And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 289 | V(Bool16x8Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 290 | V(Bool16x8Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 291 | V(Bool16x8Not, Operator::kNoProperties, 1, 0, 1) \ |
| 292 | V(Bool16x8AnyTrue, Operator::kNoProperties, 1, 0, 1) \ |
| 293 | V(Bool16x8AllTrue, Operator::kNoProperties, 1, 0, 1) \ |
| 294 | V(Bool16x8Swizzle, Operator::kNoProperties, 9, 0, 1) \ |
| 295 | V(Bool16x8Shuffle, Operator::kNoProperties, 10, 0, 1) \ |
| 296 | V(Bool16x8Equal, Operator::kCommutative, 2, 0, 1) \ |
| 297 | V(Bool16x8NotEqual, Operator::kCommutative, 2, 0, 1) \ |
| 298 | V(CreateInt8x16, Operator::kNoProperties, 16, 0, 1) \ |
| 299 | V(Int8x16ExtractLane, Operator::kNoProperties, 2, 0, 1) \ |
| 300 | V(Int8x16ReplaceLane, Operator::kNoProperties, 3, 0, 1) \ |
| 301 | V(Int8x16Neg, Operator::kNoProperties, 1, 0, 1) \ |
| 302 | V(Int8x16Add, Operator::kCommutative, 2, 0, 1) \ |
| 303 | V(Int8x16AddSaturate, Operator::kCommutative, 2, 0, 1) \ |
| 304 | V(Int8x16Sub, Operator::kNoProperties, 2, 0, 1) \ |
| 305 | V(Int8x16SubSaturate, Operator::kNoProperties, 2, 0, 1) \ |
| 306 | V(Int8x16Mul, Operator::kCommutative, 2, 0, 1) \ |
| 307 | V(Int8x16Min, Operator::kCommutative, 2, 0, 1) \ |
| 308 | V(Int8x16Max, Operator::kCommutative, 2, 0, 1) \ |
| 309 | V(Int8x16ShiftLeftByScalar, Operator::kNoProperties, 2, 0, 1) \ |
| 310 | V(Int8x16ShiftRightByScalar, Operator::kNoProperties, 2, 0, 1) \ |
| 311 | V(Int8x16Equal, Operator::kCommutative, 2, 0, 1) \ |
| 312 | V(Int8x16NotEqual, Operator::kCommutative, 2, 0, 1) \ |
| 313 | V(Int8x16LessThan, Operator::kNoProperties, 2, 0, 1) \ |
| 314 | V(Int8x16LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
| 315 | V(Int8x16GreaterThan, Operator::kNoProperties, 2, 0, 1) \ |
| 316 | V(Int8x16GreaterThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
| 317 | V(Int8x16Select, Operator::kNoProperties, 3, 0, 1) \ |
| 318 | V(Int8x16Swizzle, Operator::kNoProperties, 17, 0, 1) \ |
| 319 | V(Int8x16Shuffle, Operator::kNoProperties, 18, 0, 1) \ |
| 320 | V(Uint8x16AddSaturate, Operator::kCommutative, 2, 0, 1) \ |
| 321 | V(Uint8x16SubSaturate, Operator::kNoProperties, 2, 0, 1) \ |
| 322 | V(Uint8x16Min, Operator::kCommutative, 2, 0, 1) \ |
| 323 | V(Uint8x16Max, Operator::kCommutative, 2, 0, 1) \ |
| 324 | V(Uint8x16ShiftLeftByScalar, Operator::kNoProperties, 2, 0, 1) \ |
| 325 | V(Uint8x16ShiftRightByScalar, Operator::kNoProperties, 2, 0, 1) \ |
| 326 | V(Uint8x16LessThan, Operator::kNoProperties, 2, 0, 1) \ |
| 327 | V(Uint8x16LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
| 328 | V(Uint8x16GreaterThan, Operator::kNoProperties, 2, 0, 1) \ |
| 329 | V(Uint8x16GreaterThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
| 330 | V(CreateBool8x16, Operator::kNoProperties, 16, 0, 1) \ |
| 331 | V(Bool8x16ExtractLane, Operator::kNoProperties, 2, 0, 1) \ |
| 332 | V(Bool8x16ReplaceLane, Operator::kNoProperties, 3, 0, 1) \ |
| 333 | V(Bool8x16And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 334 | V(Bool8x16Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 335 | V(Bool8x16Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 336 | V(Bool8x16Not, Operator::kNoProperties, 1, 0, 1) \ |
| 337 | V(Bool8x16AnyTrue, Operator::kNoProperties, 1, 0, 1) \ |
| 338 | V(Bool8x16AllTrue, Operator::kNoProperties, 1, 0, 1) \ |
| 339 | V(Bool8x16Swizzle, Operator::kNoProperties, 17, 0, 1) \ |
| 340 | V(Bool8x16Shuffle, Operator::kNoProperties, 18, 0, 1) \ |
| 341 | V(Bool8x16Equal, Operator::kCommutative, 2, 0, 1) \ |
| 342 | V(Bool8x16NotEqual, Operator::kCommutative, 2, 0, 1) \ |
| 343 | V(Simd128Load, Operator::kNoProperties, 2, 0, 1) \ |
| 344 | V(Simd128Load1, Operator::kNoProperties, 2, 0, 1) \ |
| 345 | V(Simd128Load2, Operator::kNoProperties, 2, 0, 1) \ |
| 346 | V(Simd128Load3, Operator::kNoProperties, 2, 0, 1) \ |
| 347 | V(Simd128Store, Operator::kNoProperties, 3, 0, 1) \ |
| 348 | V(Simd128Store1, Operator::kNoProperties, 3, 0, 1) \ |
| 349 | V(Simd128Store2, Operator::kNoProperties, 3, 0, 1) \ |
| 350 | V(Simd128Store3, Operator::kNoProperties, 3, 0, 1) \ |
| 351 | V(Simd128And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 352 | V(Simd128Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 353 | V(Simd128Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 354 | V(Simd128Not, Operator::kNoProperties, 1, 0, 1) |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 355 | |
| 356 | #define PURE_OPTIONAL_OP_LIST(V) \ |
| 357 | V(Word32Ctz, Operator::kNoProperties, 1, 0, 1) \ |
| 358 | V(Word64Ctz, Operator::kNoProperties, 1, 0, 1) \ |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 359 | V(Word32ReverseBits, Operator::kNoProperties, 1, 0, 1) \ |
| 360 | V(Word64ReverseBits, Operator::kNoProperties, 1, 0, 1) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 361 | V(Word32Popcnt, Operator::kNoProperties, 1, 0, 1) \ |
| 362 | V(Word64Popcnt, Operator::kNoProperties, 1, 0, 1) \ |
| 363 | V(Float32Max, Operator::kNoProperties, 2, 0, 1) \ |
| 364 | V(Float32Min, Operator::kNoProperties, 2, 0, 1) \ |
| 365 | V(Float64Max, Operator::kNoProperties, 2, 0, 1) \ |
| 366 | V(Float64Min, Operator::kNoProperties, 2, 0, 1) \ |
| 367 | V(Float32RoundDown, Operator::kNoProperties, 1, 0, 1) \ |
| 368 | V(Float64RoundDown, Operator::kNoProperties, 1, 0, 1) \ |
| 369 | V(Float32RoundUp, Operator::kNoProperties, 1, 0, 1) \ |
| 370 | V(Float64RoundUp, Operator::kNoProperties, 1, 0, 1) \ |
| 371 | V(Float32RoundTruncate, Operator::kNoProperties, 1, 0, 1) \ |
| 372 | V(Float64RoundTruncate, Operator::kNoProperties, 1, 0, 1) \ |
| 373 | V(Float64RoundTiesAway, Operator::kNoProperties, 1, 0, 1) \ |
| 374 | V(Float32RoundTiesEven, Operator::kNoProperties, 1, 0, 1) \ |
| 375 | V(Float64RoundTiesEven, Operator::kNoProperties, 1, 0, 1) |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 376 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 377 | #define MACHINE_TYPE_LIST(V) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 378 | V(Float32) \ |
| 379 | V(Float64) \ |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 380 | V(Simd128) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 381 | V(Int8) \ |
| 382 | V(Uint8) \ |
| 383 | V(Int16) \ |
| 384 | V(Uint16) \ |
| 385 | V(Int32) \ |
| 386 | V(Uint32) \ |
| 387 | V(Int64) \ |
| 388 | V(Uint64) \ |
| 389 | V(Pointer) \ |
| 390 | V(AnyTagged) |
| 391 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 392 | #define MACHINE_REPRESENTATION_LIST(V) \ |
| 393 | V(kFloat32) \ |
| 394 | V(kFloat64) \ |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 395 | V(kSimd128) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 396 | V(kWord8) \ |
| 397 | V(kWord16) \ |
| 398 | V(kWord32) \ |
| 399 | V(kWord64) \ |
| 400 | V(kTagged) |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 401 | |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 402 | #define ATOMIC_TYPE_LIST(V) \ |
| 403 | V(Int8) \ |
| 404 | V(Uint8) \ |
| 405 | V(Int16) \ |
| 406 | V(Uint16) \ |
| 407 | V(Int32) \ |
| 408 | V(Uint32) |
| 409 | |
| 410 | #define ATOMIC_REPRESENTATION_LIST(V) \ |
| 411 | V(kWord8) \ |
| 412 | V(kWord16) \ |
| 413 | V(kWord32) |
| 414 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 415 | struct MachineOperatorGlobalCache { |
| 416 | #define PURE(Name, properties, value_input_count, control_input_count, \ |
| 417 | output_count) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 418 | struct Name##Operator final : public Operator { \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 419 | Name##Operator() \ |
| 420 | : Operator(IrOpcode::k##Name, Operator::kPure | properties, #Name, \ |
| 421 | value_input_count, 0, control_input_count, output_count, 0, \ |
| 422 | 0) {} \ |
| 423 | }; \ |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 424 | Name##Operator k##Name; |
| 425 | PURE_OP_LIST(PURE) |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 426 | PURE_OPTIONAL_OP_LIST(PURE) |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 427 | #undef PURE |
| 428 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 429 | #define LOAD(Type) \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 430 | struct Load##Type##Operator final : public Operator1<LoadRepresentation> { \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 431 | Load##Type##Operator() \ |
| 432 | : Operator1<LoadRepresentation>( \ |
| 433 | IrOpcode::kLoad, Operator::kNoThrow | Operator::kNoWrite, \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 434 | "Load", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 435 | }; \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 436 | struct CheckedLoad##Type##Operator final \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 437 | : public Operator1<CheckedLoadRepresentation> { \ |
| 438 | CheckedLoad##Type##Operator() \ |
| 439 | : Operator1<CheckedLoadRepresentation>( \ |
| 440 | IrOpcode::kCheckedLoad, Operator::kNoThrow | Operator::kNoWrite, \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 441 | "CheckedLoad", 3, 1, 1, 1, 1, 0, MachineType::Type()) {} \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 442 | }; \ |
| 443 | Load##Type##Operator kLoad##Type; \ |
| 444 | CheckedLoad##Type##Operator kCheckedLoad##Type; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 445 | MACHINE_TYPE_LIST(LOAD) |
| 446 | #undef LOAD |
| 447 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 448 | #define STACKSLOT(Type) \ |
| 449 | struct StackSlot##Type##Operator final \ |
| 450 | : public Operator1<MachineRepresentation> { \ |
| 451 | StackSlot##Type##Operator() \ |
| 452 | : Operator1<MachineRepresentation>( \ |
| 453 | IrOpcode::kStackSlot, Operator::kNoThrow, "StackSlot", 0, 0, 0, \ |
| 454 | 1, 0, 0, MachineType::Type().representation()) {} \ |
| 455 | }; \ |
| 456 | StackSlot##Type##Operator kStackSlot##Type; |
| 457 | MACHINE_TYPE_LIST(STACKSLOT) |
| 458 | #undef STACKSLOT |
| 459 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 460 | #define STORE(Type) \ |
| 461 | struct Store##Type##Operator : public Operator1<StoreRepresentation> { \ |
| 462 | explicit Store##Type##Operator(WriteBarrierKind write_barrier_kind) \ |
| 463 | : Operator1<StoreRepresentation>( \ |
| 464 | IrOpcode::kStore, Operator::kNoRead | Operator::kNoThrow, \ |
| 465 | "Store", 3, 1, 1, 0, 1, 0, \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 466 | StoreRepresentation(MachineRepresentation::Type, \ |
| 467 | write_barrier_kind)) {} \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 468 | }; \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 469 | struct Store##Type##NoWriteBarrier##Operator final \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 470 | : public Store##Type##Operator { \ |
| 471 | Store##Type##NoWriteBarrier##Operator() \ |
| 472 | : Store##Type##Operator(kNoWriteBarrier) {} \ |
| 473 | }; \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 474 | struct Store##Type##MapWriteBarrier##Operator final \ |
| 475 | : public Store##Type##Operator { \ |
| 476 | Store##Type##MapWriteBarrier##Operator() \ |
| 477 | : Store##Type##Operator(kMapWriteBarrier) {} \ |
| 478 | }; \ |
| 479 | struct Store##Type##PointerWriteBarrier##Operator final \ |
| 480 | : public Store##Type##Operator { \ |
| 481 | Store##Type##PointerWriteBarrier##Operator() \ |
| 482 | : Store##Type##Operator(kPointerWriteBarrier) {} \ |
| 483 | }; \ |
| 484 | struct Store##Type##FullWriteBarrier##Operator final \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 485 | : public Store##Type##Operator { \ |
| 486 | Store##Type##FullWriteBarrier##Operator() \ |
| 487 | : Store##Type##Operator(kFullWriteBarrier) {} \ |
| 488 | }; \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 489 | struct CheckedStore##Type##Operator final \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 490 | : public Operator1<CheckedStoreRepresentation> { \ |
| 491 | CheckedStore##Type##Operator() \ |
| 492 | : Operator1<CheckedStoreRepresentation>( \ |
| 493 | IrOpcode::kCheckedStore, Operator::kNoRead | Operator::kNoThrow, \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 494 | "CheckedStore", 4, 1, 1, 0, 1, 0, MachineRepresentation::Type) { \ |
| 495 | } \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 496 | }; \ |
| 497 | Store##Type##NoWriteBarrier##Operator kStore##Type##NoWriteBarrier; \ |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 498 | Store##Type##MapWriteBarrier##Operator kStore##Type##MapWriteBarrier; \ |
| 499 | Store##Type##PointerWriteBarrier##Operator \ |
| 500 | kStore##Type##PointerWriteBarrier; \ |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 501 | Store##Type##FullWriteBarrier##Operator kStore##Type##FullWriteBarrier; \ |
| 502 | CheckedStore##Type##Operator kCheckedStore##Type; |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 503 | MACHINE_REPRESENTATION_LIST(STORE) |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 504 | #undef STORE |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 505 | |
| 506 | #define ATOMIC_LOAD(Type) \ |
| 507 | struct AtomicLoad##Type##Operator final \ |
| 508 | : public Operator1<LoadRepresentation> { \ |
| 509 | AtomicLoad##Type##Operator() \ |
| 510 | : Operator1<LoadRepresentation>( \ |
| 511 | IrOpcode::kAtomicLoad, Operator::kNoThrow | Operator::kNoWrite, \ |
| 512 | "AtomicLoad", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \ |
| 513 | }; \ |
| 514 | AtomicLoad##Type##Operator kAtomicLoad##Type; |
| 515 | ATOMIC_TYPE_LIST(ATOMIC_LOAD) |
| 516 | #undef ATOMIC_LOAD |
| 517 | |
| 518 | #define ATOMIC_STORE(Type) \ |
| 519 | struct AtomicStore##Type##Operator \ |
| 520 | : public Operator1<MachineRepresentation> { \ |
| 521 | AtomicStore##Type##Operator() \ |
| 522 | : Operator1<MachineRepresentation>( \ |
| 523 | IrOpcode::kAtomicStore, Operator::kNoRead | Operator::kNoThrow, \ |
| 524 | "AtomicStore", 3, 1, 1, 0, 1, 0, MachineRepresentation::Type) {} \ |
| 525 | }; \ |
| 526 | AtomicStore##Type##Operator kAtomicStore##Type; |
| 527 | ATOMIC_REPRESENTATION_LIST(ATOMIC_STORE) |
| 528 | #undef STORE |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 529 | }; |
| 530 | |
| 531 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 532 | static base::LazyInstance<MachineOperatorGlobalCache>::type kCache = |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 533 | LAZY_INSTANCE_INITIALIZER; |
| 534 | |
| 535 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 536 | MachineOperatorBuilder::MachineOperatorBuilder(Zone* zone, |
| 537 | MachineRepresentation word, |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 538 | Flags flags) |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 539 | : cache_(kCache.Get()), word_(word), flags_(flags) { |
| 540 | DCHECK(word == MachineRepresentation::kWord32 || |
| 541 | word == MachineRepresentation::kWord64); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 542 | } |
| 543 | |
| 544 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 545 | #define PURE(Name, properties, value_input_count, control_input_count, \ |
| 546 | output_count) \ |
| 547 | const Operator* MachineOperatorBuilder::Name() { return &cache_.k##Name; } |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 548 | PURE_OP_LIST(PURE) |
| 549 | #undef PURE |
| 550 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 551 | #define PURE(Name, properties, value_input_count, control_input_count, \ |
| 552 | output_count) \ |
| 553 | const OptionalOperator MachineOperatorBuilder::Name() { \ |
| 554 | return OptionalOperator(flags_ & k##Name ? &cache_.k##Name : nullptr); \ |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 555 | } |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 556 | PURE_OPTIONAL_OP_LIST(PURE) |
| 557 | #undef PURE |
| 558 | |
| 559 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 560 | const Operator* MachineOperatorBuilder::Load(LoadRepresentation rep) { |
| 561 | #define LOAD(Type) \ |
| 562 | if (rep == MachineType::Type()) { \ |
| 563 | return &cache_.kLoad##Type; \ |
| 564 | } |
| 565 | MACHINE_TYPE_LIST(LOAD) |
| 566 | #undef LOAD |
| 567 | UNREACHABLE(); |
| 568 | return nullptr; |
| 569 | } |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 570 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 571 | const Operator* MachineOperatorBuilder::StackSlot(MachineRepresentation rep) { |
| 572 | #define STACKSLOT(Type) \ |
| 573 | if (rep == MachineType::Type().representation()) { \ |
| 574 | return &cache_.kStackSlot##Type; \ |
| 575 | } |
| 576 | MACHINE_TYPE_LIST(STACKSLOT) |
| 577 | #undef STACKSLOT |
| 578 | UNREACHABLE(); |
| 579 | return nullptr; |
| 580 | } |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 581 | |
| 582 | const Operator* MachineOperatorBuilder::Store(StoreRepresentation store_rep) { |
| 583 | switch (store_rep.representation()) { |
| 584 | #define STORE(kRep) \ |
| 585 | case MachineRepresentation::kRep: \ |
| 586 | switch (store_rep.write_barrier_kind()) { \ |
| 587 | case kNoWriteBarrier: \ |
| 588 | return &cache_.k##Store##kRep##NoWriteBarrier; \ |
| 589 | case kMapWriteBarrier: \ |
| 590 | return &cache_.k##Store##kRep##MapWriteBarrier; \ |
| 591 | case kPointerWriteBarrier: \ |
| 592 | return &cache_.k##Store##kRep##PointerWriteBarrier; \ |
| 593 | case kFullWriteBarrier: \ |
| 594 | return &cache_.k##Store##kRep##FullWriteBarrier; \ |
| 595 | } \ |
| 596 | break; |
| 597 | MACHINE_REPRESENTATION_LIST(STORE) |
| 598 | #undef STORE |
| 599 | case MachineRepresentation::kBit: |
| 600 | case MachineRepresentation::kNone: |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 601 | break; |
| 602 | } |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 603 | UNREACHABLE(); |
| 604 | return nullptr; |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 605 | } |
| 606 | |
| 607 | |
| 608 | const Operator* MachineOperatorBuilder::CheckedLoad( |
| 609 | CheckedLoadRepresentation rep) { |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 610 | #define LOAD(Type) \ |
| 611 | if (rep == MachineType::Type()) { \ |
| 612 | return &cache_.kCheckedLoad##Type; \ |
| 613 | } |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 614 | MACHINE_TYPE_LIST(LOAD) |
| 615 | #undef LOAD |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 616 | UNREACHABLE(); |
| 617 | return nullptr; |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 618 | } |
| 619 | |
| 620 | |
| 621 | const Operator* MachineOperatorBuilder::CheckedStore( |
| 622 | CheckedStoreRepresentation rep) { |
| 623 | switch (rep) { |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 624 | #define STORE(kRep) \ |
| 625 | case MachineRepresentation::kRep: \ |
| 626 | return &cache_.kCheckedStore##kRep; |
| 627 | MACHINE_REPRESENTATION_LIST(STORE) |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 628 | #undef STORE |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 629 | case MachineRepresentation::kBit: |
| 630 | case MachineRepresentation::kNone: |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 631 | break; |
| 632 | } |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 633 | UNREACHABLE(); |
| 634 | return nullptr; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 635 | } |
| 636 | |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 637 | // On 32 bit platforms we need to get a reference to optional operators of |
| 638 | // 64-bit instructions for later Int64Lowering, even though 32 bit platforms |
| 639 | // don't support the original 64-bit instruction. |
| 640 | const Operator* MachineOperatorBuilder::Word64PopcntPlaceholder() { |
| 641 | return &cache_.kWord64Popcnt; |
| 642 | } |
| 643 | |
| 644 | // On 32 bit platforms we need to get a reference to optional operators of |
| 645 | // 64-bit instructions for later Int64Lowering, even though 32 bit platforms |
| 646 | // don't support the original 64-bit instruction. |
| 647 | const Operator* MachineOperatorBuilder::Word64CtzPlaceholder() { |
| 648 | return &cache_.kWord64Ctz; |
| 649 | } |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 650 | |
| 651 | const Operator* MachineOperatorBuilder::AtomicLoad(LoadRepresentation rep) { |
| 652 | #define LOAD(Type) \ |
| 653 | if (rep == MachineType::Type()) { \ |
| 654 | return &cache_.kAtomicLoad##Type; \ |
| 655 | } |
| 656 | ATOMIC_TYPE_LIST(LOAD) |
| 657 | #undef LOAD |
| 658 | UNREACHABLE(); |
| 659 | return nullptr; |
| 660 | } |
| 661 | |
| 662 | const Operator* MachineOperatorBuilder::AtomicStore(MachineRepresentation rep) { |
| 663 | #define STORE(kRep) \ |
| 664 | if (rep == MachineRepresentation::kRep) { \ |
| 665 | return &cache_.kAtomicStore##kRep; \ |
| 666 | } |
| 667 | ATOMIC_REPRESENTATION_LIST(STORE) |
| 668 | #undef STORE |
| 669 | UNREACHABLE(); |
| 670 | return nullptr; |
| 671 | } |
| 672 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 673 | } // namespace compiler |
| 674 | } // namespace internal |
| 675 | } // namespace v8 |