v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
operation-matcher.h
Go to the documentation of this file.
1// Copyright 2022 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_COMPILER_TURBOSHAFT_OPERATION_MATCHER_H_
6#define V8_COMPILER_TURBOSHAFT_OPERATION_MATCHER_H_
7
8#include <limits>
9#include <optional>
10#include <type_traits>
11
16
18
19class OperationMatcher;
20
21namespace detail {
22template <typename T, bool HasConstexpr>
23struct ValueMatch {
24 struct Wildcard {};
26
28 ValueMatch(OpIndex index) : v_(index) {} // NOLINT(runtime/explicit)
29 ValueMatch(OpIndex* index) : v_(index) {} // NOLINT(runtime/explicit)
30 ValueMatch(V<T>* index) : v_(index) {} // NOLINT(runtime/explicit)
31 ValueMatch(constexpr_type constant) // NOLINT(runtime/explicit)
32 : v_(constant) {}
33
34 inline bool matches(OpIndex matched, const OperationMatcher* matcher);
35 inline void bind(OpIndex matched, const OperationMatcher* matcher);
36
37 std::variant<Wildcard, OpIndex, OpIndex*, constexpr_type> v_;
38};
39
40template <typename T>
41struct ValueMatch<T, false> {
42 struct Wildcard {};
43
45 ValueMatch(OpIndex index) : v_(index) {} // NOLINT(runtime/explicit)
46 ValueMatch(OpIndex* index) : v_(index) {} // NOLINT(runtime/explicit)
47 ValueMatch(V<T>* index) : v_(index) {} // NOLINT(runtime/explicit)
48
49 inline bool matches(OpIndex matched, const OperationMatcher* matcher) {
50 if (v_.index() == 1) return std::get<1>(v_) == matched;
51 return true;
52 }
53
54 inline void bind(OpIndex matched, const OperationMatcher* matcher) {
55 DCHECK(matches(matched, matcher));
56 if (v_.index() == 2) *std::get<2>(v_) = matched;
57 }
58
59 std::variant<Wildcard, OpIndex, OpIndex*> v_;
60};
61
62template <typename T>
64 struct Wildcard {};
65
67 OptionMatch(const T& value) : v_(value) {} // NOLINT(runtime/explicit)
68 OptionMatch(T* value) : v_(value) {} // NOLINT(runtime/explicit)
69
70 std::variant<Wildcard, T, T*> v_;
71
72 bool matches(const T& matched) {
73 if (v_.index() == 1) return std::get<1>(v_) == matched;
74 return true;
75 }
76
77 void bind(const T& matched) {
78 DCHECK(matches(matched));
79 if (v_.index() == 2) *std::get<2>(v_) = matched;
80 }
81};
82
83} // namespace detail
84
86 public:
87 template <typename T>
89 template <typename T>
91
92 explicit OperationMatcher(const Graph& graph) : graph_(graph) {}
93
94 template <class Op>
95 bool Is(V<AnyOrNone> op_idx) const {
96 return graph_.Get(op_idx).Is<Op>();
97 }
98
99 template <class Op>
101 return graph_.Get(op_idx).TryCast<Op>();
102 }
103
104 template <class Op>
106 return graph_.Get(op_idx).Cast<Op>();
107 }
108
109 const Operation& Get(V<AnyOrNone> op_idx) const { return graph_.Get(op_idx); }
110
111 V<AnyOrNone> Index(const Operation& op) const { return graph_.Index(op); }
112
113 bool MatchZero(V<Any> matched) const {
114 const ConstantOp* op = TryCast<ConstantOp>(matched);
115 if (!op) return false;
116 switch (op->kind) {
119 return op->integral() == 0;
121 return op->float32().get_scalar() == 0;
123 return op->float64().get_scalar() == 0;
125 return op->smi().value() == 0;
126 default:
127 return false;
128 }
129 }
130
131 bool MatchIntegralZero(V<Any> matched) const {
132 int64_t constant;
133 return MatchSignedIntegralConstant(matched, &constant) && constant == 0;
134 }
135
136 bool MatchSmiZero(V<Any> matched) const {
137 const ConstantOp* op = TryCast<ConstantOp>(matched);
138 if (!op) return false;
139 if (op->kind != ConstantOp::Kind::kSmi) return false;
140 return op->smi().value() == 0;
141 }
142
143 bool MatchFloat32Constant(V<Any> matched, float* constant) const {
144 const ConstantOp* op = TryCast<ConstantOp>(matched);
145 if (!op) return false;
146 if (op->kind != ConstantOp::Kind::kFloat32) return false;
147 *constant = op->storage.float32.get_scalar();
148 return true;
149 }
150
151 bool MatchFloat32Constant(V<Any> matched, i::Float32* constant) const {
152 const ConstantOp* op = TryCast<ConstantOp>(matched);
153 if (!op) return false;
154 if (op->kind != ConstantOp::Kind::kFloat32) return false;
155 *constant = op->storage.float32;
156 return true;
157 }
158
159 bool MatchFloat64Constant(V<Any> matched, double* constant) const {
160 const ConstantOp* op = TryCast<ConstantOp>(matched);
161 if (!op) return false;
162 if (op->kind != ConstantOp::Kind::kFloat64) return false;
163 *constant = op->storage.float64.get_scalar();
164 return true;
165 }
166
167 bool MatchFloat64Constant(V<Any> matched, i::Float64* constant) const {
168 const ConstantOp* op = TryCast<ConstantOp>(matched);
169 if (!op) return false;
170 if (op->kind != ConstantOp::Kind::kFloat64) return false;
171 *constant = op->storage.float64;
172 return true;
173 }
174
175 bool MatchFloat(V<Any> matched, double* value) const {
176 const ConstantOp* op = TryCast<ConstantOp>(matched);
177 if (!op) return false;
178 if (op->kind == ConstantOp::Kind::kFloat64) {
179 *value = op->storage.float64.get_scalar();
180 return true;
181 } else if (op->kind == ConstantOp::Kind::kFloat32) {
182 *value = op->storage.float32.get_scalar();
183 return true;
184 }
185 return false;
186 }
187
188 bool MatchFloat(V<Any> matched, double value) const {
189 double k;
190 if (!MatchFloat(matched, &k)) return false;
192 (std::isnan(k) && std::isnan(value));
193 }
194
195 bool MatchNaN(V<Float> matched) const {
196 double k;
197 return MatchFloat(matched, &k) && std::isnan(k);
198 }
199
201 Handle<HeapObject>* tagged = nullptr) const {
202 const ConstantOp* op = TryCast<ConstantOp>(matched);
203 if (!op) return false;
206 return false;
207 }
208 if (tagged) {
209 *tagged = op->handle();
210 }
211 return true;
212 }
213
215 uint64_t* unsigned_constant,
216 int64_t* signed_constant = nullptr) const {
217 const ConstantOp* op = TryCast<ConstantOp>(matched);
218 if (!op) return false;
219 switch (op->kind) {
224 if (rep.value() == WordRepresentation::Word32()) {
225 if (unsigned_constant) {
226 *unsigned_constant = static_cast<uint32_t>(op->integral());
227 }
228 if (signed_constant) {
229 *signed_constant = static_cast<int32_t>(op->signed_integral());
230 }
231 return true;
232 } else if (rep.value() == WordRepresentation::Word64()) {
233 if (unsigned_constant) {
234 *unsigned_constant = op->integral();
235 }
236 if (signed_constant) {
237 *signed_constant = op->signed_integral();
238 }
239 return true;
240 }
241 return false;
242 default:
243 return false;
244 }
245 UNREACHABLE();
246 }
247
249 int64_t* signed_constant) const {
250 return MatchIntegralWordConstant(matched, rep, nullptr, signed_constant);
251 }
252
253 bool MatchIntegralWord32Constant(V<Any> matched, uint32_t* constant) const {
254 if (uint64_t value; MatchIntegralWordConstant(
255 matched, WordRepresentation::Word32(), &value)) {
256 *constant = static_cast<uint32_t>(value);
257 return true;
258 }
259 return false;
260 }
261
262 bool MatchIntegralWord64Constant(V<Any> matched, uint64_t* constant) const {
264 constant);
265 }
266
267 bool MatchIntegralWord32Constant(V<Any> matched, uint32_t constant) const {
268 if (uint64_t value; MatchIntegralWordConstant(
269 matched, WordRepresentation::Word32(), &value)) {
270 return static_cast<uint32_t>(value) == constant;
271 }
272 return false;
273 }
274
275 bool MatchIntegralWord64Constant(V<Any> matched, int64_t* constant) const {
277 constant);
278 }
279
280 bool MatchIntegralWord32Constant(V<Any> matched, int32_t* constant) const {
281 if (int64_t value; MatchIntegralWordConstant(
282 matched, WordRepresentation::Word32(), &value)) {
283 *constant = static_cast<int32_t>(value);
284 return true;
285 }
286 return false;
287 }
288
289 template <typename T = intptr_t>
290 bool MatchIntegralWordPtrConstant(V<Any> matched, T* constant) const {
291 if constexpr (Is64()) {
292 static_assert(sizeof(T) == sizeof(int64_t));
293 int64_t v;
294 if (!MatchIntegralWord64Constant(matched, &v)) return false;
295 *constant = static_cast<T>(v);
296 return true;
297 } else {
298 static_assert(sizeof(T) == sizeof(int32_t));
299 int32_t v;
300 if (!MatchIntegralWord32Constant(matched, &v)) return false;
301 *constant = static_cast<T>(v);
302 return true;
303 }
304 }
305
306 bool MatchSignedIntegralConstant(V<Any> matched, int64_t* constant) const {
307 if (const ConstantOp* c = TryCast<ConstantOp>(matched)) {
308 if (c->kind == ConstantOp::Kind::kWord32 ||
309 c->kind == ConstantOp::Kind::kWord64) {
310 *constant = c->signed_integral();
311 return true;
312 }
313 }
314 return false;
315 }
316
317 bool MatchUnsignedIntegralConstant(V<Any> matched, uint64_t* constant) const {
318 if (const ConstantOp* c = TryCast<ConstantOp>(matched)) {
319 if (c->kind == ConstantOp::Kind::kWord32 ||
320 c->kind == ConstantOp::Kind::kWord64) {
321 *constant = c->integral();
322 return true;
323 }
324 }
325 return false;
326 }
327
329 ExternalReference* reference) const {
330 const ConstantOp* op = TryCast<ConstantOp>(matched);
331 if (!op) return false;
332 if (op->kind != ConstantOp::Kind::kExternal) return false;
333 *reference = op->storage.external;
334 return true;
335 }
336
337 bool MatchWasmStubCallConstant(V<Any> matched, uint64_t* stub_id) const {
338 const ConstantOp* op = TryCast<ConstantOp>(matched);
339 if (!op) return false;
341 return false;
342 }
343 *stub_id = op->integral();
344 return true;
345 }
346
347 template <typename T>
348 bool MatchChange(V<Any> matched, VMatch<T> input,
350 OMatch<ChangeOp::Assumption> assumption = {},
352 OMatch<RegisterRepresentation> to = {}) const {
353 const ChangeOp* op = TryCast<ChangeOp>(matched);
354 if (!op) return false;
355 if (input.matches(op->input(), this) && kind.matches(op->kind) &&
356 assumption.matches(op->assumption) && from.matches(op->from) &&
357 to.matches(op->to)) {
358 input.bind(op->input(), this);
359 kind.bind(op->kind);
360 assumption.bind(op->assumption);
361 from.bind(op->from);
362 to.bind(op->to);
363 return true;
364 }
365 return false;
366 }
367
373
374 template <typename T>
375 requires(IsWord<T>())
376 bool MatchWordBinop(V<Any> matched, VMatch<T> left, VMatch<T> right,
378 OMatch<WordRepresentation> rep = {}) const {
379 const WordBinopOp* op = TryCast<WordBinopOp>(matched);
380 if (!op) return false;
381 if (left.matches(op->left(), this) && right.matches(op->right(), this) &&
382 kind.matches(op->kind) && rep.matches(op->rep)) {
383 left.bind(op->left(), this);
384 right.bind(op->right(), this);
385 kind.bind(op->kind);
386 rep.bind(op->rep);
387 return true;
388 }
389 return false;
390 }
391
392 template <class T>
393 requires(IsWord<T>())
394 bool MatchWordAdd(V<Any> matched, V<T>* left, V<T>* right,
395 WordRepresentation rep) const {
396 return MatchWordBinop<T>(matched, left, right, WordBinopOp::Kind::kAdd,
397 rep);
398 }
399
400 template <class T>
401 requires(IsWord<T>())
402 bool MatchWordSub(V<Any> matched, V<T>* left, V<T>* right,
403 WordRepresentation rep) const {
404 return MatchWordBinop<T>(matched, left, right, WordBinopOp::Kind::kSub,
405 rep);
406 }
407
408 template <class T>
409 requires(IsWord<T>())
410 bool MatchWordMul(V<Any> matched, V<T>* left, V<T>* right,
411 WordRepresentation rep) const {
412 return MatchWordBinop<T>(matched, left, right, WordBinopOp::Kind::kMul,
413 rep);
414 }
415
416 template <class T>
417 requires(IsWord<T>())
418 bool MatchBitwiseAnd(V<Any> matched, V<T>* left, V<T>* right,
419 WordRepresentation rep) const {
420 return MatchWordBinop<T>(matched, left, right,
422 }
423
424 template <class T>
425 requires(IsWord<T>())
427 uint64_t* constant,
428 WordRepresentation rep) const {
429 V<T> left, right;
430 if (!MatchBitwiseAnd(matched, &left, &right, rep)) return false;
431 if (MatchIntegralWordConstant(right, rep, constant)) {
432 *value = left;
433 return true;
434 } else if (MatchIntegralWordConstant(left, rep, constant)) {
435 *value = right;
436 return true;
437 }
438 return false;
439 }
440
441 template <typename T>
442 bool MatchEqual(V<Any> matched, V<T>* left, V<T>* right) const {
443 const ComparisonOp* op = TryCast<ComparisonOp>(matched);
444 if (!op || op->kind != ComparisonOp::Kind::kEqual || op->rep != V<T>::rep) {
445 return false;
446 }
447 *left = V<T>::Cast(op->left());
448 *right = V<T>::Cast(op->right());
449 return true;
450 }
451
453 FloatRepresentation rep) const {
454 const FloatUnaryOp* op = TryCast<FloatUnaryOp>(matched);
455 if (!op || op->kind != kind || op->rep != rep) return false;
456 *input = op->input();
457 return true;
458 }
459
460 bool MatchFloatRoundDown(V<Any> matched, V<Float>* input,
461 FloatRepresentation rep) const {
462 return MatchFloatUnary(matched, input, FloatUnaryOp::Kind::kRoundDown, rep);
463 }
464
465 bool MatchFloatBinary(V<Any> matched, V<Float>* left, V<Float>* right,
467 FloatRepresentation rep) const {
468 const FloatBinopOp* op = TryCast<FloatBinopOp>(matched);
469 if (!op || op->kind != kind || op->rep != rep) return false;
470 *left = op->left();
471 *right = op->right();
472 return true;
473 }
474
475 bool MatchFloatSub(V<Any> matched, V<Float>* left, V<Float>* right,
476 FloatRepresentation rep) const {
477 return MatchFloatBinary(matched, left, right, FloatBinopOp::Kind::kSub,
478 rep);
479 }
480
481 template <class T>
482 requires(IsWord<T>())
483 bool MatchConstantShift(V<Any> matched, V<T>* input, ShiftOp::Kind* kind,
484 WordRepresentation* rep, int* amount) const {
485 const ShiftOp* op = TryCast<ShiftOp>(matched);
486 if (uint32_t rhs_constant;
487 op && MatchIntegralWord32Constant(op->right(), &rhs_constant) &&
488 rhs_constant < static_cast<uint64_t>(op->rep.bit_width())) {
489 *input = op->left<T>();
490 *kind = op->kind;
491 *rep = op->rep;
492 *amount = static_cast<int>(rhs_constant);
493 return true;
494 }
495 return false;
496 }
497
498 template <class T>
499 requires(IsWord<T>())
500 bool MatchConstantShift(V<Any> matched, V<T>* input, ShiftOp::Kind kind,
501 WordRepresentation rep, int* amount) const {
503 const ShiftOp* op = TryCast<ShiftOp>(matched);
504 if (uint32_t rhs_constant;
505 op && op->kind == kind &&
506 (op->rep == rep || (ShiftOp::AllowsWord64ToWord32Truncation(kind) &&
508 op->rep == WordRepresentation::Word64())) &&
509 MatchIntegralWord32Constant(op->right(), &rhs_constant) &&
510 rhs_constant < static_cast<uint64_t>(rep.bit_width())) {
511 *input = op->left<T>();
512 *amount = static_cast<int>(rhs_constant);
513 return true;
514 }
515 return false;
516 }
517
518 template <class T>
519 requires(IsWord<T>())
520 bool MatchConstantRightShift(V<Any> matched, V<T>* input,
521 WordRepresentation rep, int* amount) const {
523 const ShiftOp* op = TryCast<ShiftOp>(matched);
524 if (uint32_t rhs_constant;
525 op && ShiftOp::IsRightShift(op->kind) && op->rep == rep &&
526 MatchIntegralWord32Constant(op->right(), &rhs_constant) &&
527 rhs_constant < static_cast<uint32_t>(rep.bit_width())) {
528 *input = op->left<T>();
529 *amount = static_cast<int>(rhs_constant);
530 return true;
531 }
532 return false;
533 }
534
535 template <class T>
536 requires(IsWord<T>())
537 bool MatchConstantLeftShift(V<Any> matched, V<T>* input,
538 WordRepresentation rep, int* amount) const {
540 const ShiftOp* op = TryCast<ShiftOp>(matched);
541 if (uint32_t rhs_constant;
542 op && op->kind == ShiftOp::Kind::kShiftLeft && op->rep == rep &&
543 MatchIntegralWord32Constant(op->right(), &rhs_constant) &&
544 rhs_constant < static_cast<uint32_t>(rep.bit_width())) {
545 *input = op->left<T>();
546 *amount = static_cast<int>(rhs_constant);
547 return true;
548 }
549 return false;
550 }
551
552 template <class T>
553 requires(IsWord<T>())
555 V<T>* input,
557 uint16_t* amount) const {
559 const ShiftOp* op = TryCast<ShiftOp>(matched);
560 if (uint32_t rhs_constant;
561 op && op->kind == ShiftOp::Kind::kShiftRightArithmeticShiftOutZeros &&
562 op->rep == rep &&
563 MatchIntegralWord32Constant(op->right(), &rhs_constant) &&
564 rhs_constant < static_cast<uint64_t>(rep.bit_width())) {
565 *input = op->left<T>();
566 *amount = static_cast<uint16_t>(rhs_constant);
567 return true;
568 }
569 return false;
570 }
571
572 bool MatchPhi(V<Any> matched,
573 std::optional<int> input_count = std::nullopt) const {
574 if (const PhiOp* phi = TryCast<PhiOp>(matched)) {
575 return !input_count.has_value() || phi->input_count == *input_count;
576 }
577 return false;
578 }
579
580 bool MatchPowerOfTwoWordConstant(V<Any> matched, int64_t* ret_cst,
581 WordRepresentation rep) const {
582 int64_t loc_cst;
583 if (MatchIntegralWordConstant(matched, rep, &loc_cst)) {
584 if (base::bits::IsPowerOfTwo(loc_cst)) {
585 *ret_cst = loc_cst;
586 return true;
587 }
588 }
589 return false;
590 }
591
592 bool MatchPowerOfTwoWord32Constant(V<Any> matched, int32_t* divisor) const {
593 int64_t cst;
594 if (MatchPowerOfTwoWordConstant(matched, &cst,
596 DCHECK_LE(cst, std::numeric_limits<int32_t>().max());
597 *divisor = static_cast<int32_t>(cst);
598 return true;
599 }
600 return false;
601 }
602
603 private:
604 const Graph& graph_;
605};
606
607template <typename T, bool HasConstexpr>
609 OpIndex matched, const OperationMatcher* matcher) {
610 switch (v_.index()) {
611 case 0:
612 return true;
613 case 1:
614 return std::get<1>(v_) == matched;
615 case 2:
616 return true;
617 case 3: {
618 const ConstantOp* c = matcher->template TryCast<ConstantOp>(matched);
619 if (!c) return false;
620 if (c->rep != v_traits<T>::rep) return false;
621 // TODO: Need to fix this for handles and such...
622 return c->storage.integral ==
623 (ConstantOp::Storage{static_cast<uint64_t>(std::get<3>(v_))}
624 .integral);
625 }
626 }
627 // unreachable
628 return false;
629}
630
631template <typename T, bool HasConstexpr>
633 OpIndex matched, const OperationMatcher* matcher) {
634 DCHECK(matches(matched, matcher));
635 if (v_.index() == 2) *std::get<2>(v_) = matched;
636}
637
638} // namespace v8::internal::compiler::turboshaft
639
640#endif // V8_COMPILER_TURBOSHAFT_OPERATION_MATCHER_H_
#define T
Builtins::Kind kind
Definition builtins.cc:40
float get_scalar() const
Definition boxed-float.h:38
double get_scalar() const
Definition boxed-float.h:81
V8_INLINE constexpr int32_t value() const
Definition tagged.h:427
bool MatchConstantRightShift(V< Any > matched, V< T > *input, WordRepresentation rep, int *amount) const
bool MatchConstantLeftShift(V< Any > matched, V< T > *input, WordRepresentation rep, int *amount) const
bool MatchBitwiseAnd(V< Any > matched, V< T > *left, V< T > *right, WordRepresentation rep) const
bool MatchIntegralWordConstant(V< Any > matched, WordRepresentation rep, int64_t *signed_constant) const
const Operation & Get(V< AnyOrNone > op_idx) const
bool MatchIntegralWord64Constant(V< Any > matched, int64_t *constant) const
bool MatchHeapConstant(V< Any > matched, Handle< HeapObject > *tagged=nullptr) const
bool MatchFloat(V< Any > matched, double *value) const
bool MatchIntegralWordConstant(V< Any > matched, WordRepresentation rep, uint64_t *unsigned_constant, int64_t *signed_constant=nullptr) const
bool MatchWordMul(V< Any > matched, V< T > *left, V< T > *right, WordRepresentation rep) const
bool MatchWordBinop(V< Any > matched, VMatch< T > left, VMatch< T > right, OMatch< WordBinopOp::Kind > kind={}, OMatch< WordRepresentation > rep={}) const
bool MatchFloat32Constant(V< Any > matched, float *constant) const
bool MatchIntegralWordPtrConstant(V< Any > matched, T *constant) const
bool MatchChange(V< Any > matched, VMatch< T > input, OMatch< ChangeOp::Kind > kind={}, OMatch< ChangeOp::Assumption > assumption={}, OMatch< RegisterRepresentation > from={}, OMatch< RegisterRepresentation > to={}) const
bool MatchFloatRoundDown(V< Any > matched, V< Float > *input, FloatRepresentation rep) const
bool MatchPowerOfTwoWordConstant(V< Any > matched, int64_t *ret_cst, WordRepresentation rep) const
bool MatchPowerOfTwoWord32Constant(V< Any > matched, int32_t *divisor) const
const underlying_operation_t< Op > * TryCast(V< AnyOrNone > op_idx) const
bool MatchFloatBinary(V< Any > matched, V< Float > *left, V< Float > *right, FloatBinopOp::Kind kind, FloatRepresentation rep) const
bool MatchEqual(V< Any > matched, V< T > *left, V< T > *right) const
bool MatchFloat64Constant(V< Any > matched, double *constant) const
bool MatchExternalConstant(V< Any > matched, ExternalReference *reference) const
bool MatchIntegralWord32Constant(V< Any > matched, uint32_t constant) const
bool MatchTruncateWord64ToWord32(V< Any > matched, VMatch< Word64 > input) const
bool MatchFloat(V< Any > matched, double value) const
bool MatchFloat32Constant(V< Any > matched, i::Float32 *constant) const
bool MatchConstantShift(V< Any > matched, V< T > *input, ShiftOp::Kind kind, WordRepresentation rep, int *amount) const
bool MatchWordSub(V< Any > matched, V< T > *left, V< T > *right, WordRepresentation rep) const
bool MatchConstantShift(V< Any > matched, V< T > *input, ShiftOp::Kind *kind, WordRepresentation *rep, int *amount) const
bool MatchIntegralWord64Constant(V< Any > matched, uint64_t *constant) const
const underlying_operation_t< Op > & Cast(V< AnyOrNone > op_idx) const
bool MatchIntegralWord32Constant(V< Any > matched, int32_t *constant) const
bool MatchSignedIntegralConstant(V< Any > matched, int64_t *constant) const
bool MatchFloatSub(V< Any > matched, V< Float > *left, V< Float > *right, FloatRepresentation rep) const
bool MatchBitwiseAndWithConstant(V< Any > matched, V< T > *value, uint64_t *constant, WordRepresentation rep) const
bool MatchWasmStubCallConstant(V< Any > matched, uint64_t *stub_id) const
bool MatchIntegralWord32Constant(V< Any > matched, uint32_t *constant) const
bool MatchFloat64Constant(V< Any > matched, i::Float64 *constant) const
bool MatchPhi(V< Any > matched, std::optional< int > input_count=std::nullopt) const
bool MatchWordAdd(V< Any > matched, V< T > *left, V< T > *right, WordRepresentation rep) const
bool MatchFloatUnary(V< Any > matched, V< Float > *input, FloatUnaryOp::Kind kind, FloatRepresentation rep) const
V< AnyOrNone > Index(const Operation &op) const
bool MatchUnsignedIntegralConstant(V< Any > matched, uint64_t *constant) const
bool MatchConstantShiftRightArithmeticShiftOutZeros(V< Any > matched, V< T > *input, WordRepresentation rep, uint16_t *amount) const
static constexpr RegisterRepresentation Word32()
static constexpr RegisterRepresentation Word64()
static V< T > Cast(V< U > index)
Definition index.h:632
std::vector< int > v_
constexpr bool IsPowerOfTwo(T value)
Definition bits.h:187
V8_INLINE Dest bit_cast(Source const &source)
Definition macros.h:95
typename underlying_operation< T >::type underlying_operation_t
Definition operations.h:929
constexpr bool IsValidTypeFor(RegisterRepresentation repr)
Definition index.h:575
bool TryCast(Tagged< From > value, Tagged< To > *out)
Definition casting.h:77
return value
Definition map-inl.h:893
constexpr bool Is64()
#define DCHECK_LE(v1, v2)
Definition logging.h:490
#define DCHECK(condition)
Definition logging.h:482
IndirectHandle< i::HeapObject > handle() const
union v8::internal::compiler::turboshaft::ConstantOp::Storage storage
void bind(OpIndex matched, const OperationMatcher *matcher)
bool matches(OpIndex matched, const OperationMatcher *matcher)
bool matches(OpIndex matched, const OperationMatcher *matcher)
std::variant< Wildcard, OpIndex, OpIndex *, constexpr_type > v_
typename v_traits< T >::constexpr_type constexpr_type
void bind(OpIndex matched, const OperationMatcher *matcher)