Line data Source code
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 : #ifndef V8_UNITTESTS_COMPILER_NODE_TEST_UTILS_H_
6 : #define V8_UNITTESTS_COMPILER_NODE_TEST_UTILS_H_
7 :
8 : #include "src/compiler/common-operator.h"
9 : #include "src/compiler/machine-operator.h"
10 : #include "src/compiler/opcodes.h"
11 : #include "src/compiler/simplified-operator.h"
12 : #include "src/machine-type.h"
13 : #include "testing/gmock/include/gmock/gmock.h"
14 :
15 : namespace v8 {
16 : namespace internal {
17 :
18 : // Forward declarations.
19 : class ExternalReference;
20 : template <typename T>
21 : class Handle;
22 : class HeapObject;
23 : class Type;
24 : enum TypeofMode : int;
25 :
26 : namespace compiler {
27 :
28 : // Forward declarations.
29 : class BufferAccess;
30 : class CallDescriptor;
31 : class ContextAccess;
32 : struct ElementAccess;
33 : struct FieldAccess;
34 : class Node;
35 :
36 :
37 : using ::testing::Matcher;
38 :
39 : Matcher<Node*> IsDead();
40 : Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher);
41 : Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher,
42 : const Matcher<Node*>& control1_matcher);
43 : Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher,
44 : const Matcher<Node*>& control1_matcher,
45 : const Matcher<Node*>& control2_matcher);
46 : Matcher<Node*> IsBranch(const Matcher<Node*>& value_matcher,
47 : const Matcher<Node*>& control_matcher);
48 : Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher,
49 : const Matcher<Node*>& control1_matcher);
50 : Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher,
51 : const Matcher<Node*>& control1_matcher,
52 : const Matcher<Node*>& control2_matcher);
53 : Matcher<Node*> IsLoop(const Matcher<Node*>& control0_matcher,
54 : const Matcher<Node*>& control1_matcher);
55 : Matcher<Node*> IsLoop(const Matcher<Node*>& control0_matcher,
56 : const Matcher<Node*>& control1_matcher,
57 : const Matcher<Node*>& control2_matcher);
58 : Matcher<Node*> IsIfTrue(const Matcher<Node*>& control_matcher);
59 : Matcher<Node*> IsIfFalse(const Matcher<Node*>& control_matcher);
60 : Matcher<Node*> IsIfSuccess(const Matcher<Node*>& control_matcher);
61 : Matcher<Node*> IsSwitch(const Matcher<Node*>& value_matcher,
62 : const Matcher<Node*>& control_matcher);
63 : Matcher<Node*> IsIfValue(const Matcher<IfValueParameters>& value_matcher,
64 : const Matcher<Node*>& control_matcher);
65 : Matcher<Node*> IsIfDefault(const Matcher<Node*>& control_matcher);
66 : Matcher<Node*> IsBeginRegion(const Matcher<Node*>& effect_matcher);
67 : Matcher<Node*> IsFinishRegion(const Matcher<Node*>& value_matcher,
68 : const Matcher<Node*>& effect_matcher);
69 : Matcher<Node*> IsReturn(const Matcher<Node*>& value_matcher,
70 : const Matcher<Node*>& effect_matcher,
71 : const Matcher<Node*>& control_matcher);
72 : Matcher<Node*> IsReturn2(const Matcher<Node*>& value_matcher,
73 : const Matcher<Node*>& value2_matcher,
74 : const Matcher<Node*>& effect_matcher,
75 : const Matcher<Node*>& control_matcher);
76 : Matcher<Node*> IsTerminate(const Matcher<Node*>& effect_matcher,
77 : const Matcher<Node*>& control_matcher);
78 : Matcher<Node*> IsTypeGuard(const Matcher<Node*>& value_matcher,
79 : const Matcher<Node*>& control_matcher);
80 : Matcher<Node*> IsExternalConstant(
81 : const Matcher<ExternalReference>& value_matcher);
82 : Matcher<Node*> IsHeapConstant(Handle<HeapObject> value);
83 : Matcher<Node*> IsFloat32Constant(const Matcher<float>& value_matcher);
84 : Matcher<Node*> IsFloat64Constant(const Matcher<double>& value_matcher);
85 : Matcher<Node*> IsInt32Constant(const Matcher<int32_t>& value_matcher);
86 : Matcher<Node*> IsInt64Constant(const Matcher<int64_t>& value_matcher);
87 : Matcher<Node*> IsNumberConstant(const Matcher<double>& value_matcher);
88 : Matcher<Node*> IsPointerConstant(const Matcher<intptr_t>& value_matcher);
89 : Matcher<Node*> IsSelect(const Matcher<MachineRepresentation>& type_matcher,
90 : const Matcher<Node*>& value0_matcher,
91 : const Matcher<Node*>& value1_matcher,
92 : const Matcher<Node*>& value2_matcher);
93 : Matcher<Node*> IsPhi(const Matcher<MachineRepresentation>& type_matcher,
94 : const Matcher<Node*>& value0_matcher,
95 : const Matcher<Node*>& value1_matcher,
96 : const Matcher<Node*>& merge_matcher);
97 : Matcher<Node*> IsPhi(const Matcher<MachineRepresentation>& type_matcher,
98 : const Matcher<Node*>& value0_matcher,
99 : const Matcher<Node*>& value1_matcher,
100 : const Matcher<Node*>& value2_matcher,
101 : const Matcher<Node*>& merge_matcher);
102 : Matcher<Node*> IsEffectPhi(const Matcher<Node*>& effect0_matcher,
103 : const Matcher<Node*>& effect1_matcher,
104 : const Matcher<Node*>& merge_matcher);
105 : Matcher<Node*> IsProjection(const Matcher<size_t>& index_matcher,
106 : const Matcher<Node*>& base_matcher);
107 : Matcher<Node*> IsCall(const Matcher<const CallDescriptor*>& descriptor_matcher,
108 : const Matcher<Node*>& value0_matcher,
109 : const Matcher<Node*>& effect_matcher,
110 : const Matcher<Node*>& control_matcher);
111 : Matcher<Node*> IsCall(const Matcher<const CallDescriptor*>& descriptor_matcher,
112 : const Matcher<Node*>& value0_matcher,
113 : const Matcher<Node*>& value1_matcher,
114 : const Matcher<Node*>& effect_matcher,
115 : const Matcher<Node*>& control_matcher);
116 : Matcher<Node*> IsCall(const Matcher<const CallDescriptor*>& descriptor_matcher,
117 : const Matcher<Node*>& value0_matcher,
118 : const Matcher<Node*>& value1_matcher,
119 : const Matcher<Node*>& value2_matcher,
120 : const Matcher<Node*>& effect_matcher,
121 : const Matcher<Node*>& control_matcher);
122 : Matcher<Node*> IsCall(const Matcher<const CallDescriptor*>& descriptor_matcher,
123 : const Matcher<Node*>& value0_matcher,
124 : const Matcher<Node*>& value1_matcher,
125 : const Matcher<Node*>& value2_matcher,
126 : const Matcher<Node*>& value3_matcher,
127 : const Matcher<Node*>& effect_matcher,
128 : const Matcher<Node*>& control_matcher);
129 : Matcher<Node*> IsCall(const Matcher<const CallDescriptor*>& descriptor_matcher,
130 : const Matcher<Node*>& value0_matcher,
131 : const Matcher<Node*>& value1_matcher,
132 : const Matcher<Node*>& value2_matcher,
133 : const Matcher<Node*>& value3_matcher,
134 : const Matcher<Node*>& value4_matcher,
135 : const Matcher<Node*>& effect_matcher,
136 : const Matcher<Node*>& control_matcher);
137 : Matcher<Node*> IsCall(const Matcher<const CallDescriptor*>& descriptor_matcher,
138 : const Matcher<Node*>& value0_matcher,
139 : const Matcher<Node*>& value1_matcher,
140 : const Matcher<Node*>& value2_matcher,
141 : const Matcher<Node*>& value3_matcher,
142 : const Matcher<Node*>& value4_matcher,
143 : const Matcher<Node*>& value5_matcher,
144 : const Matcher<Node*>& effect_matcher,
145 : const Matcher<Node*>& control_matcher);
146 : Matcher<Node*> IsCall(
147 : const Matcher<const CallDescriptor*>& descriptor_matcher,
148 : const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
149 : const Matcher<Node*>& value2_matcher, const Matcher<Node*>& value3_matcher,
150 : const Matcher<Node*>& value4_matcher, const Matcher<Node*>& value5_matcher,
151 : const Matcher<Node*>& value6_matcher, const Matcher<Node*>& effect_matcher,
152 : const Matcher<Node*>& control_matcher);
153 : Matcher<Node*> IsTailCall(
154 : const Matcher<CallDescriptor const*>& descriptor_matcher,
155 : const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
156 : const Matcher<Node*>& effect_matcher,
157 : const Matcher<Node*>& control_matcher);
158 : Matcher<Node*> IsTailCall(
159 : const Matcher<CallDescriptor const*>& descriptor_matcher,
160 : const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
161 : const Matcher<Node*>& value2_matcher, const Matcher<Node*>& effect_matcher,
162 : const Matcher<Node*>& control_matcher);
163 : Matcher<Node*> IsTailCall(
164 : const Matcher<CallDescriptor const*>& descriptor_matcher,
165 : const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
166 : const Matcher<Node*>& value2_matcher, const Matcher<Node*>& value3_matcher,
167 : const Matcher<Node*>& effect_matcher,
168 : const Matcher<Node*>& control_matcher);
169 : Matcher<Node*> IsTailCall(
170 : const Matcher<CallDescriptor const*>& descriptor_matcher,
171 : const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
172 : const Matcher<Node*>& value2_matcher, const Matcher<Node*>& value3_matcher,
173 : const Matcher<Node*>& value4_matcher, const Matcher<Node*>& effect_matcher,
174 : const Matcher<Node*>& control_matcher);
175 : Matcher<Node*> IsTailCall(
176 : const Matcher<CallDescriptor const*>& descriptor_matcher,
177 : const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
178 : const Matcher<Node*>& value2_matcher, const Matcher<Node*>& value3_matcher,
179 : const Matcher<Node*>& value4_matcher, const Matcher<Node*>& value5_matcher,
180 : const Matcher<Node*>& effect_matcher,
181 : const Matcher<Node*>& control_matcher);
182 : Matcher<Node*> IsTailCall(
183 : const Matcher<CallDescriptor const*>& descriptor_matcher,
184 : const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
185 : const Matcher<Node*>& value2_matcher, const Matcher<Node*>& value3_matcher,
186 : const Matcher<Node*>& value4_matcher, const Matcher<Node*>& value5_matcher,
187 : const Matcher<Node*>& value6_matcher, const Matcher<Node*>& effect_matcher,
188 : const Matcher<Node*>& control_matcher);
189 : Matcher<Node*> IsTailCall(
190 : const Matcher<CallDescriptor const*>& descriptor_matcher,
191 : const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
192 : const Matcher<Node*>& value2_matcher, const Matcher<Node*>& value3_matcher,
193 : const Matcher<Node*>& value4_matcher, const Matcher<Node*>& value5_matcher,
194 : const Matcher<Node*>& value6_matcher, const Matcher<Node*>& value7_matcher,
195 : const Matcher<Node*>& effect_matcher,
196 : const Matcher<Node*>& control_matcher);
197 :
198 :
199 : Matcher<Node*> IsBooleanNot(const Matcher<Node*>& value_matcher);
200 : Matcher<Node*> IsReferenceEqual(const Matcher<Node*>& lhs_matcher,
201 : const Matcher<Node*>& rhs_matcher);
202 : Matcher<Node*> IsNumberEqual(const Matcher<Node*>& lhs_matcher,
203 : const Matcher<Node*>& rhs_matcher);
204 : Matcher<Node*> IsNumberLessThan(const Matcher<Node*>& lhs_matcher,
205 : const Matcher<Node*>& rhs_matcher);
206 : Matcher<Node*> IsNumberAdd(const Matcher<Node*>& lhs_matcher,
207 : const Matcher<Node*>& rhs_matcher);
208 :
209 : #define DECLARE_SPECULATIVE_BINOP_MATCHER(opcode) \
210 : Matcher<Node*> Is##opcode(const Matcher<NumberOperationHint>& hint_matcher, \
211 : const Matcher<Node*>& lhs_matcher, \
212 : const Matcher<Node*>& rhs_matcher, \
213 : const Matcher<Node*>& effect_matcher, \
214 : const Matcher<Node*>& control_matcher);
215 : SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DECLARE_SPECULATIVE_BINOP_MATCHER)
216 : DECLARE_SPECULATIVE_BINOP_MATCHER(SpeculativeNumberEqual)
217 : DECLARE_SPECULATIVE_BINOP_MATCHER(SpeculativeNumberLessThan)
218 : DECLARE_SPECULATIVE_BINOP_MATCHER(SpeculativeNumberLessThanOrEqual)
219 : #undef DECLARE_SPECULATIVE_BINOP_MATCHER
220 :
221 : Matcher<Node*> IsNumberSubtract(const Matcher<Node*>& lhs_matcher,
222 : const Matcher<Node*>& rhs_matcher);
223 : Matcher<Node*> IsNumberMultiply(const Matcher<Node*>& lhs_matcher,
224 : const Matcher<Node*>& rhs_matcher);
225 : Matcher<Node*> IsNumberShiftLeft(const Matcher<Node*>& lhs_matcher,
226 : const Matcher<Node*>& rhs_matcher);
227 : Matcher<Node*> IsNumberShiftRight(const Matcher<Node*>& lhs_matcher,
228 : const Matcher<Node*>& rhs_matcher);
229 : Matcher<Node*> IsNumberShiftRightLogical(const Matcher<Node*>& lhs_matcher,
230 : const Matcher<Node*>& rhs_matcher);
231 : Matcher<Node*> IsNumberImul(const Matcher<Node*>& lhs_matcher,
232 : const Matcher<Node*>& rhs_matcher);
233 : Matcher<Node*> IsNumberAbs(const Matcher<Node*>& value_matcher);
234 : Matcher<Node*> IsNumberAcos(const Matcher<Node*>& value_matcher);
235 : Matcher<Node*> IsNumberAcosh(const Matcher<Node*>& value_matcher);
236 : Matcher<Node*> IsNumberAsin(const Matcher<Node*>& value_matcher);
237 : Matcher<Node*> IsNumberAsinh(const Matcher<Node*>& value_matcher);
238 : Matcher<Node*> IsNumberAtan(const Matcher<Node*>& value_matcher);
239 : Matcher<Node*> IsNumberAtanh(const Matcher<Node*>& value_matcher);
240 : Matcher<Node*> IsNumberAtan2(const Matcher<Node*>& lhs_matcher,
241 : const Matcher<Node*>& rhs_matcher);
242 : Matcher<Node*> IsNumberCbrt(const Matcher<Node*>& value_matcher);
243 : Matcher<Node*> IsNumberCeil(const Matcher<Node*>& value_matcher);
244 : Matcher<Node*> IsNumberClz32(const Matcher<Node*>& value_matcher);
245 : Matcher<Node*> IsNumberCos(const Matcher<Node*>& value_matcher);
246 : Matcher<Node*> IsNumberCosh(const Matcher<Node*>& value_matcher);
247 : Matcher<Node*> IsNumberExp(const Matcher<Node*>& value_matcher);
248 : Matcher<Node*> IsNumberExpm1(const Matcher<Node*>& value_matcher);
249 : Matcher<Node*> IsNumberFloor(const Matcher<Node*>& value_matcher);
250 : Matcher<Node*> IsNumberFround(const Matcher<Node*>& value_matcher);
251 : Matcher<Node*> IsNumberLog(const Matcher<Node*>& value_matcher);
252 : Matcher<Node*> IsNumberLog1p(const Matcher<Node*>& value_matcher);
253 : Matcher<Node*> IsNumberLog10(const Matcher<Node*>& value_matcher);
254 : Matcher<Node*> IsNumberLog2(const Matcher<Node*>& value_matcher);
255 : Matcher<Node*> IsNumberMax(const Matcher<Node*>& lhs_matcher,
256 : const Matcher<Node*>& rhs_matcher);
257 : Matcher<Node*> IsNumberMin(const Matcher<Node*>& lhs_matcher,
258 : const Matcher<Node*>& rhs_matcher);
259 : Matcher<Node*> IsNumberRound(const Matcher<Node*>& value_matcher);
260 : Matcher<Node*> IsNumberPow(const Matcher<Node*>& lhs_matcher,
261 : const Matcher<Node*>& rhs_matcher);
262 : Matcher<Node*> IsNumberSign(const Matcher<Node*>& value_matcher);
263 : Matcher<Node*> IsNumberSin(const Matcher<Node*>& value_matcher);
264 : Matcher<Node*> IsNumberSinh(const Matcher<Node*>& value_matcher);
265 : Matcher<Node*> IsNumberSqrt(const Matcher<Node*>& value_matcher);
266 : Matcher<Node*> IsNumberTan(const Matcher<Node*>& value_matcher);
267 : Matcher<Node*> IsNumberTanh(const Matcher<Node*>& value_matcher);
268 : Matcher<Node*> IsNumberTrunc(const Matcher<Node*>& value_matcher);
269 : Matcher<Node*> IsStringConcat(const Matcher<Node*>& length_matcher,
270 : const Matcher<Node*>& lhs_matcher,
271 : const Matcher<Node*>& rhs_matcher);
272 : Matcher<Node*> IsStringFromSingleCharCode(const Matcher<Node*>& value_matcher);
273 : Matcher<Node*> IsStringLength(const Matcher<Node*>& value_matcher);
274 : Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher,
275 : const Matcher<Node*>& effect_matcher,
276 : const Matcher<Node*>& control_matcher);
277 : Matcher<Node*> IsLoadField(const Matcher<FieldAccess>& access_matcher,
278 : const Matcher<Node*>& base_matcher,
279 : const Matcher<Node*>& effect_matcher,
280 : const Matcher<Node*>& control_matcher);
281 : Matcher<Node*> IsStoreField(const Matcher<FieldAccess>& access_matcher,
282 : const Matcher<Node*>& base_matcher,
283 : const Matcher<Node*>& value_matcher,
284 : const Matcher<Node*>& effect_matcher,
285 : const Matcher<Node*>& control_matcher);
286 : Matcher<Node*> IsLoadBuffer(const Matcher<BufferAccess>& access_matcher,
287 : const Matcher<Node*>& buffer_matcher,
288 : const Matcher<Node*>& offset_matcher,
289 : const Matcher<Node*>& length_matcher,
290 : const Matcher<Node*>& effect_matcher,
291 : const Matcher<Node*>& control_matcher);
292 : Matcher<Node*> IsStoreBuffer(const Matcher<BufferAccess>& access_matcher,
293 : const Matcher<Node*>& buffer_matcher,
294 : const Matcher<Node*>& offset_matcher,
295 : const Matcher<Node*>& length_matcher,
296 : const Matcher<Node*>& value_matcher,
297 : const Matcher<Node*>& effect_matcher,
298 : const Matcher<Node*>& control_matcher);
299 : Matcher<Node*> IsLoadElement(const Matcher<ElementAccess>& access_matcher,
300 : const Matcher<Node*>& base_matcher,
301 : const Matcher<Node*>& index_matcher,
302 : const Matcher<Node*>& control_matcher,
303 : const Matcher<Node*>& effect_matcher);
304 : Matcher<Node*> IsStoreElement(const Matcher<ElementAccess>& access_matcher,
305 : const Matcher<Node*>& base_matcher,
306 : const Matcher<Node*>& index_matcher,
307 : const Matcher<Node*>& value_matcher,
308 : const Matcher<Node*>& effect_matcher,
309 : const Matcher<Node*>& control_matcher);
310 :
311 : Matcher<Node*> IsObjectIsFiniteNumber(const Matcher<Node*>& value_matcher);
312 : Matcher<Node*> IsNumberIsFinite(const Matcher<Node*>& value_matcher);
313 : Matcher<Node*> IsObjectIsInteger(const Matcher<Node*>& value_matcher);
314 : Matcher<Node*> IsObjectIsSafeInteger(const Matcher<Node*>& value_matcher);
315 : Matcher<Node*> IsObjectIsNaN(const Matcher<Node*>& value_matcher);
316 : Matcher<Node*> IsNumberIsNaN(const Matcher<Node*>& value_matcher);
317 : Matcher<Node*> IsObjectIsReceiver(const Matcher<Node*>& value_matcher);
318 : Matcher<Node*> IsObjectIsSmi(const Matcher<Node*>& value_matcher);
319 : Matcher<Node*> IsObjectIsUndetectable(const Matcher<Node*>& value_matcher);
320 :
321 : Matcher<Node*> IsLoad(const Matcher<LoadRepresentation>& rep_matcher,
322 : const Matcher<Node*>& base_matcher,
323 : const Matcher<Node*>& index_matcher,
324 : const Matcher<Node*>& effect_matcher,
325 : const Matcher<Node*>& control_matcher);
326 : Matcher<Node*> IsPoisonedLoad(const Matcher<LoadRepresentation>& rep_matcher,
327 : const Matcher<Node*>& base_matcher,
328 : const Matcher<Node*>& index_matcher,
329 : const Matcher<Node*>& effect_matcher,
330 : const Matcher<Node*>& control_matcher);
331 : Matcher<Node*> IsUnalignedLoad(const Matcher<LoadRepresentation>& rep_matcher,
332 : const Matcher<Node*>& base_matcher,
333 : const Matcher<Node*>& index_matcher,
334 : const Matcher<Node*>& effect_matcher,
335 : const Matcher<Node*>& control_matcher);
336 : Matcher<Node*> IsStore(const Matcher<StoreRepresentation>& rep_matcher,
337 : const Matcher<Node*>& base_matcher,
338 : const Matcher<Node*>& index_matcher,
339 : const Matcher<Node*>& value_matcher,
340 : const Matcher<Node*>& effect_matcher,
341 : const Matcher<Node*>& control_matcher);
342 : Matcher<Node*> IsUnalignedStore(
343 : const Matcher<UnalignedStoreRepresentation>& rep_matcher,
344 : const Matcher<Node*>& base_matcher, const Matcher<Node*>& index_matcher,
345 : const Matcher<Node*>& value_matcher, const Matcher<Node*>& effect_matcher,
346 : const Matcher<Node*>& control_matcher);
347 : Matcher<Node*> IsStackSlot(const Matcher<StackSlotRepresentation>& rep_matcher);
348 : Matcher<Node*> IsWord32Popcnt(const Matcher<Node*>& value_matcher);
349 : Matcher<Node*> IsWord32And(const Matcher<Node*>& lhs_matcher,
350 : const Matcher<Node*>& rhs_matcher);
351 : Matcher<Node*> IsWord32Or(const Matcher<Node*>& lhs_matcher,
352 : const Matcher<Node*>& rhs_matcher);
353 : Matcher<Node*> IsWord32Xor(const Matcher<Node*>& lhs_matcher,
354 : const Matcher<Node*>& rhs_matcher);
355 : Matcher<Node*> IsWord32Sar(const Matcher<Node*>& lhs_matcher,
356 : const Matcher<Node*>& rhs_matcher);
357 : Matcher<Node*> IsWord32Shl(const Matcher<Node*>& lhs_matcher,
358 : const Matcher<Node*>& rhs_matcher);
359 : Matcher<Node*> IsWord32Shr(const Matcher<Node*>& lhs_matcher,
360 : const Matcher<Node*>& rhs_matcher);
361 : Matcher<Node*> IsWord32Ror(const Matcher<Node*>& lhs_matcher,
362 : const Matcher<Node*>& rhs_matcher);
363 : Matcher<Node*> IsWord32Equal(const Matcher<Node*>& lhs_matcher,
364 : const Matcher<Node*>& rhs_matcher);
365 : Matcher<Node*> IsWord32Clz(const Matcher<Node*>& value_matcher);
366 : Matcher<Node*> IsWord32Ctz(const Matcher<Node*>& value_matcher);
367 : Matcher<Node*> IsWord32Popcnt(const Matcher<Node*>& value_matcher);
368 : Matcher<Node*> IsWord64And(const Matcher<Node*>& lhs_matcher,
369 : const Matcher<Node*>& rhs_matcher);
370 : Matcher<Node*> IsWord64Or(const Matcher<Node*>& lhs_matcher,
371 : const Matcher<Node*>& rhs_matcher);
372 : Matcher<Node*> IsWord64Xor(const Matcher<Node*>& lhs_matcher,
373 : const Matcher<Node*>& rhs_matcher);
374 : Matcher<Node*> IsWord64Shl(const Matcher<Node*>& lhs_matcher,
375 : const Matcher<Node*>& rhs_matcher);
376 : Matcher<Node*> IsWord64Shr(const Matcher<Node*>& lhs_matcher,
377 : const Matcher<Node*>& rhs_matcher);
378 : Matcher<Node*> IsWord64Sar(const Matcher<Node*>& lhs_matcher,
379 : const Matcher<Node*>& rhs_matcher);
380 : Matcher<Node*> IsWord64Equal(const Matcher<Node*>& lhs_matcher,
381 : const Matcher<Node*>& rhs_matcher);
382 : Matcher<Node*> IsInt32AddWithOverflow(const Matcher<Node*>& lhs_matcher,
383 : const Matcher<Node*>& rhs_matcher);
384 : Matcher<Node*> IsInt32SubWithOverflow(const Matcher<Node*>& lhs_matcher,
385 : const Matcher<Node*>& rhs_matcher);
386 : Matcher<Node*> IsInt32Add(const Matcher<Node*>& lhs_matcher,
387 : const Matcher<Node*>& rhs_matcher);
388 : Matcher<Node*> IsInt32Sub(const Matcher<Node*>& lhs_matcher,
389 : const Matcher<Node*>& rhs_matcher);
390 : Matcher<Node*> IsInt32Div(const Matcher<Node*>& lhs_matcher,
391 : const Matcher<Node*>& rhs_matcher);
392 : Matcher<Node*> IsInt32Mul(const Matcher<Node*>& lhs_matcher,
393 : const Matcher<Node*>& rhs_matcher);
394 : Matcher<Node*> IsInt32MulHigh(const Matcher<Node*>& lhs_matcher,
395 : const Matcher<Node*>& rhs_matcher);
396 : Matcher<Node*> IsInt32LessThan(const Matcher<Node*>& lhs_matcher,
397 : const Matcher<Node*>& rhs_matcher);
398 : Matcher<Node*> IsUint32LessThan(const Matcher<Node*>& lhs_matcher,
399 : const Matcher<Node*>& rhs_matcher);
400 : Matcher<Node*> IsUint32LessThanOrEqual(const Matcher<Node*>& lhs_matcher,
401 : const Matcher<Node*>& rhs_matcher);
402 : Matcher<Node*> IsInt64Add(const Matcher<Node*>& lhs_matcher,
403 : const Matcher<Node*>& rhs_matcher);
404 : Matcher<Node*> IsInt64Sub(const Matcher<Node*>& lhs_matcher,
405 : const Matcher<Node*>& rhs_matcher);
406 : Matcher<Node*> IsInt64Mul(const Matcher<Node*>& lhs_matcher,
407 : const Matcher<Node*>& rhs_matcher);
408 : Matcher<Node*> IsInt64Div(const Matcher<Node*>& lhs_matcher,
409 : const Matcher<Node*>& rhs_matcher);
410 : Matcher<Node*> IsJSAdd(const Matcher<Node*>& lhs_matcher,
411 : const Matcher<Node*>& rhs_matcher);
412 : Matcher<Node*> IsJSParseInt(const Matcher<Node*>& lhs_matcher,
413 : const Matcher<Node*>& rhs_matcher);
414 : Matcher<Node*> IsBitcastTaggedToWord(const Matcher<Node*>& input_matcher);
415 : Matcher<Node*> IsBitcastWordToTagged(const Matcher<Node*>& input_matcher);
416 : Matcher<Node*> IsBitcastWordToTaggedSigned(const Matcher<Node*>& input_matcher);
417 : Matcher<Node*> IsTruncateFloat64ToWord32(const Matcher<Node*>& input_matcher);
418 : Matcher<Node*> IsChangeFloat64ToInt32(const Matcher<Node*>& input_matcher);
419 : Matcher<Node*> IsChangeFloat64ToUint32(const Matcher<Node*>& input_matcher);
420 : Matcher<Node*> IsChangeInt32ToFloat64(const Matcher<Node*>& input_matcher);
421 : Matcher<Node*> IsChangeInt32ToInt64(const Matcher<Node*>& input_matcher);
422 : Matcher<Node*> IsChangeUint32ToFloat64(const Matcher<Node*>& input_matcher);
423 : Matcher<Node*> IsChangeUint32ToUint64(const Matcher<Node*>& input_matcher);
424 : Matcher<Node*> IsChangeCompressedToTagged(const Matcher<Node*>& input_matcher);
425 : Matcher<Node*> IsTruncateFloat64ToFloat32(const Matcher<Node*>& input_matcher);
426 : Matcher<Node*> IsTruncateInt64ToInt32(const Matcher<Node*>& input_matcher);
427 : Matcher<Node*> IsFloat32Abs(const Matcher<Node*>& input_matcher);
428 : Matcher<Node*> IsFloat32Neg(const Matcher<Node*>& input_matcher);
429 : Matcher<Node*> IsFloat32Equal(const Matcher<Node*>& lhs_matcher,
430 : const Matcher<Node*>& rhs_matcher);
431 : Matcher<Node*> IsFloat32LessThan(const Matcher<Node*>& lhs_matcher,
432 : const Matcher<Node*>& rhs_matcher);
433 : Matcher<Node*> IsFloat32LessThanOrEqual(const Matcher<Node*>& lhs_matcher,
434 : const Matcher<Node*>& rhs_matcher);
435 : Matcher<Node*> IsFloat64Max(const Matcher<Node*>& lhs_matcher,
436 : const Matcher<Node*>& rhs_matcher);
437 : Matcher<Node*> IsFloat64Min(const Matcher<Node*>& lhs_matcher,
438 : const Matcher<Node*>& rhs_matcher);
439 : Matcher<Node*> IsFloat64Add(const Matcher<Node*>& lhs_matcher,
440 : const Matcher<Node*>& rhs_matcher);
441 : Matcher<Node*> IsFloat64Sub(const Matcher<Node*>& lhs_matcher,
442 : const Matcher<Node*>& rhs_matcher);
443 : Matcher<Node*> IsFloat64Mul(const Matcher<Node*>& lhs_matcher,
444 : const Matcher<Node*>& rhs_matcher);
445 : Matcher<Node*> IsFloat64Abs(const Matcher<Node*>& input_matcher);
446 : Matcher<Node*> IsFloat64Neg(const Matcher<Node*>& input_matcher);
447 : Matcher<Node*> IsFloat64Sqrt(const Matcher<Node*>& input_matcher);
448 : Matcher<Node*> IsFloat64RoundDown(const Matcher<Node*>& input_matcher);
449 : Matcher<Node*> IsFloat64RoundTruncate(const Matcher<Node*>& input_matcher);
450 : Matcher<Node*> IsFloat64RoundTiesAway(const Matcher<Node*>& input_matcher);
451 : Matcher<Node*> IsFloat64ExtractLowWord32(const Matcher<Node*>& input_matcher);
452 : Matcher<Node*> IsFloat64ExtractHighWord32(const Matcher<Node*>& input_matcher);
453 : Matcher<Node*> IsFloat64InsertLowWord32(const Matcher<Node*>& lhs_matcher,
454 : const Matcher<Node*>& rhs_matcher);
455 : Matcher<Node*> IsFloat64InsertHighWord32(const Matcher<Node*>& lhs_matcher,
456 : const Matcher<Node*>& rhs_matcher);
457 : Matcher<Node*> IsToNumber(const Matcher<Node*>& base_matcher,
458 : const Matcher<Node*>& context_matcher,
459 : const Matcher<Node*>& effect_matcher,
460 : const Matcher<Node*>& control_matcher);
461 : Matcher<Node*> IsLoadContext(const Matcher<ContextAccess>& access_matcher,
462 : const Matcher<Node*>& context_matcher);
463 : Matcher<Node*> IsNumberToBoolean(const Matcher<Node*>& input_matcher);
464 : Matcher<Node*> IsNumberToInt32(const Matcher<Node*>& input_matcher);
465 : Matcher<Node*> IsNumberToUint32(const Matcher<Node*>& input_matcher);
466 : Matcher<Node*> IsParameter(const Matcher<int> index_matcher);
467 : Matcher<Node*> IsSpeculationPoison();
468 : Matcher<Node*> IsLoadFramePointer();
469 : Matcher<Node*> IsLoadParentFramePointer();
470 : Matcher<Node*> IsPlainPrimitiveToNumber(const Matcher<Node*>& input_matcher);
471 :
472 : Matcher<Node*> IsInt32PairAdd(const Matcher<Node*>& a_matcher,
473 : const Matcher<Node*>& b_matcher,
474 : const Matcher<Node*>& c_matcher,
475 : const Matcher<Node*>& d_matcher);
476 : Matcher<Node*> IsInt32PairSub(const Matcher<Node*>& a_matcher,
477 : const Matcher<Node*>& b_matcher,
478 : const Matcher<Node*>& c_matcher,
479 : const Matcher<Node*>& d_matcher);
480 : Matcher<Node*> IsInt32PairMul(const Matcher<Node*>& a_matcher,
481 : const Matcher<Node*>& b_matcher,
482 : const Matcher<Node*>& c_matcher,
483 : const Matcher<Node*>& d_matcher);
484 :
485 : Matcher<Node*> IsWord32PairShl(const Matcher<Node*>& lhs_matcher,
486 : const Matcher<Node*>& mid_matcher,
487 : const Matcher<Node*>& rhs_matcher);
488 : Matcher<Node*> IsWord32PairShr(const Matcher<Node*>& lhs_matcher,
489 : const Matcher<Node*>& mid_matcher,
490 : const Matcher<Node*>& rhs_matcher);
491 :
492 : Matcher<Node*> IsWord32PairSar(const Matcher<Node*>& lhs_matcher,
493 : const Matcher<Node*>& mid_matcher,
494 : const Matcher<Node*>& rhs_matcher);
495 : Matcher<Node*> IsWord32ReverseBytes(const Matcher<Node*>& value_matcher);
496 :
497 : Matcher<Node*> IsStackSlot();
498 :
499 : Matcher<Node*> IsSpeculativeToNumber(const Matcher<Node*>& value_matcher);
500 :
501 : // Helpers
502 3090 : static inline Matcher<Node*> IsIntPtrConstant(const intptr_t value) {
503 : return kSystemPointerSize == 8 ? IsInt64Constant(static_cast<int64_t>(value))
504 6180 : : IsInt32Constant(static_cast<int32_t>(value));
505 : }
506 :
507 : static inline Matcher<Node*> IsIntPtrAdd(const Matcher<Node*>& lhs_matcher,
508 : const Matcher<Node*>& rhs_matcher) {
509 : return kSystemPointerSize == 8 ? IsInt64Add(lhs_matcher, rhs_matcher)
510 1096 : : IsInt32Add(lhs_matcher, rhs_matcher);
511 : }
512 :
513 : static inline Matcher<Node*> IsIntPtrSub(const Matcher<Node*>& lhs_matcher,
514 : const Matcher<Node*>& rhs_matcher) {
515 : return kSystemPointerSize == 8 ? IsInt64Sub(lhs_matcher, rhs_matcher)
516 1 : : IsInt32Sub(lhs_matcher, rhs_matcher);
517 : }
518 :
519 : static inline Matcher<Node*> IsIntPtrMul(const Matcher<Node*>& lhs_matcher,
520 : const Matcher<Node*>& rhs_matcher) {
521 : return kSystemPointerSize == 8 ? IsInt64Mul(lhs_matcher, rhs_matcher)
522 1 : : IsInt32Mul(lhs_matcher, rhs_matcher);
523 : }
524 :
525 : static inline Matcher<Node*> IsIntPtrDiv(const Matcher<Node*>& lhs_matcher,
526 : const Matcher<Node*>& rhs_matcher) {
527 : return kSystemPointerSize == 8 ? IsInt64Div(lhs_matcher, rhs_matcher)
528 1 : : IsInt32Div(lhs_matcher, rhs_matcher);
529 : }
530 :
531 : static inline Matcher<Node*> IsWordShl(const Matcher<Node*>& lhs_matcher,
532 : const Matcher<Node*>& rhs_matcher) {
533 : return kSystemPointerSize == 8 ? IsWord64Shl(lhs_matcher, rhs_matcher)
534 519 : : IsWord32Shl(lhs_matcher, rhs_matcher);
535 : }
536 :
537 : static inline Matcher<Node*> IsWordShr(const Matcher<Node*>& lhs_matcher,
538 : const Matcher<Node*>& rhs_matcher) {
539 : return kSystemPointerSize == 8 ? IsWord64Shr(lhs_matcher, rhs_matcher)
540 1 : : IsWord32Shr(lhs_matcher, rhs_matcher);
541 : }
542 :
543 : static inline Matcher<Node*> IsWordSar(const Matcher<Node*>& lhs_matcher,
544 : const Matcher<Node*>& rhs_matcher) {
545 : return kSystemPointerSize == 8 ? IsWord64Sar(lhs_matcher, rhs_matcher)
546 2 : : IsWord32Sar(lhs_matcher, rhs_matcher);
547 : }
548 :
549 : static inline Matcher<Node*> IsWordAnd(const Matcher<Node*>& lhs_matcher,
550 : const Matcher<Node*>& rhs_matcher) {
551 : return kSystemPointerSize == 8 ? IsWord64And(lhs_matcher, rhs_matcher)
552 1 : : IsWord32And(lhs_matcher, rhs_matcher);
553 : }
554 :
555 : static inline Matcher<Node*> IsWordOr(const Matcher<Node*>& lhs_matcher,
556 : const Matcher<Node*>& rhs_matcher) {
557 : return kSystemPointerSize == 8 ? IsWord64Or(lhs_matcher, rhs_matcher)
558 1 : : IsWord32Or(lhs_matcher, rhs_matcher);
559 : }
560 :
561 : static inline Matcher<Node*> IsWordXor(const Matcher<Node*>& lhs_matcher,
562 : const Matcher<Node*>& rhs_matcher) {
563 : return kSystemPointerSize == 8 ? IsWord64Xor(lhs_matcher, rhs_matcher)
564 1 : : IsWord32Xor(lhs_matcher, rhs_matcher);
565 : }
566 :
567 : static inline Matcher<Node*> IsChangeInt32ToIntPtr(
568 : const Matcher<Node*>& matcher) {
569 336 : return kSystemPointerSize == 8 ? IsChangeInt32ToInt64(matcher) : matcher;
570 : }
571 :
572 : static inline Matcher<Node*> IsChangeUint32ToWord(
573 : const Matcher<Node*>& matcher) {
574 369 : return kSystemPointerSize == 8 ? IsChangeUint32ToUint64(matcher) : matcher;
575 : }
576 :
577 : static inline Matcher<Node*> IsTruncateIntPtrToInt32(
578 : const Matcher<Node*>& matcher) {
579 : return kSystemPointerSize == 8 ? IsTruncateInt64ToInt32(matcher) : matcher;
580 : }
581 :
582 : } // namespace compiler
583 : } // namespace internal
584 : } // namespace v8
585 :
586 : #endif // V8_UNITTESTS_COMPILER_NODE_TEST_UTILS_H_
|