@@ -330,9 +330,7 @@ template <typename... Preds> struct And {
330
330
template <typename Pred, typename ... Preds>
331
331
struct And <Pred, Preds...> : And<Preds...> {
332
332
Pred P;
333
- And (Pred &&p, Preds &&...preds)
334
- : And<Preds...>(std::forward<Preds>(preds)...), P(std::forward<Pred>(p)) {
335
- }
333
+ And (const Pred &p, const Preds &...preds) : And<Preds...>(preds...), P(p) {}
336
334
337
335
template <typename MatchContext>
338
336
bool match (const MatchContext &Ctx, SDValue N) {
@@ -349,8 +347,7 @@ template <typename... Preds> struct Or {
349
347
template <typename Pred, typename ... Preds>
350
348
struct Or <Pred, Preds...> : Or<Preds...> {
351
349
Pred P;
352
- Or (Pred &&p, Preds &&...preds)
353
- : Or<Preds...>(std::forward<Preds>(preds)...), P(std::forward<Pred>(p)) {}
350
+ Or (const Pred &p, const Preds &...preds) : Or<Preds...>(preds...), P(p) {}
354
351
355
352
template <typename MatchContext>
356
353
bool match (const MatchContext &Ctx, SDValue N) {
@@ -376,16 +373,16 @@ template <typename Pred> inline Not<Pred> m_Unless(const Pred &P) {
376
373
return Not{P};
377
374
}
378
375
379
- template <typename ... Preds> And<Preds...> m_AllOf (Preds & &...preds) {
380
- return And<Preds...>(std::forward<Preds>( preds) ...);
376
+ template <typename ... Preds> And<Preds...> m_AllOf (const Preds &...preds) {
377
+ return And<Preds...>(preds...);
381
378
}
382
379
383
- template <typename ... Preds> Or<Preds...> m_AnyOf (Preds & &...preds) {
384
- return Or<Preds...>(std::forward<Preds>( preds) ...);
380
+ template <typename ... Preds> Or<Preds...> m_AnyOf (const Preds &...preds) {
381
+ return Or<Preds...>(preds...);
385
382
}
386
383
387
- template <typename ... Preds> auto m_NoneOf (Preds & &...preds) {
388
- return m_Unless (m_AnyOf (std::forward<Preds>( preds) ...));
384
+ template <typename ... Preds> auto m_NoneOf (const Preds &...preds) {
385
+ return m_Unless (m_AnyOf (preds...));
389
386
}
390
387
391
388
// === Generic node matching ===
@@ -402,10 +399,8 @@ struct Operands_match<OpIdx, OpndPred, OpndPreds...>
402
399
: Operands_match<OpIdx + 1 , OpndPreds...> {
403
400
OpndPred P;
404
401
405
- Operands_match (OpndPred &&p, OpndPreds &&...preds)
406
- : Operands_match<OpIdx + 1 , OpndPreds...>(
407
- std::forward<OpndPreds>(preds)...),
408
- P (std::forward<OpndPred>(p)) {}
402
+ Operands_match (const OpndPred &p, const OpndPreds &...preds)
403
+ : Operands_match<OpIdx + 1 , OpndPreds...>(preds...), P(p) {}
409
404
410
405
template <typename MatchContext>
411
406
bool match (const MatchContext &Ctx, SDValue N) {
@@ -419,9 +414,8 @@ struct Operands_match<OpIdx, OpndPred, OpndPreds...>
419
414
};
420
415
421
416
template <typename ... OpndPreds>
422
- auto m_Node (unsigned Opcode, OpndPreds &&...preds) {
423
- return m_AllOf (m_Opc (Opcode), Operands_match<0 , OpndPreds...>(
424
- std::forward<OpndPreds>(preds)...));
417
+ auto m_Node (unsigned Opcode, const OpndPreds &...preds) {
418
+ return m_AllOf (m_Opc (Opcode), Operands_match<0 , OpndPreds...>(preds...));
425
419
}
426
420
427
421
// / Provide number of operands that are not chain or glue, as well as the first
@@ -647,10 +641,9 @@ template <typename Opnd> inline UnaryOpc_match<Opnd> m_ZExt(const Opnd &Op) {
647
641
return UnaryOpc_match<Opnd>(ISD::ZERO_EXTEND, Op);
648
642
}
649
643
650
- template <typename Opnd> inline auto m_SExt (Opnd &&Op) {
651
- return m_AnyOf (
652
- UnaryOpc_match<Opnd>(ISD::SIGN_EXTEND, Op),
653
- m_Node (ISD::SIGN_EXTEND_INREG, std::forward<Opnd>(Op), m_Value ()));
644
+ template <typename Opnd> inline auto m_SExt (const Opnd &Op) {
645
+ return m_AnyOf (UnaryOpc_match<Opnd>(ISD::SIGN_EXTEND, Op),
646
+ m_Node (ISD::SIGN_EXTEND_INREG, Op, m_Value ()));
654
647
}
655
648
656
649
template <typename Opnd> inline UnaryOpc_match<Opnd> m_AnyExt (const Opnd &Op) {
@@ -663,30 +656,28 @@ template <typename Opnd> inline UnaryOpc_match<Opnd> m_Trunc(const Opnd &Op) {
663
656
664
657
// / Match a zext or identity
665
658
// / Allows to peek through optional extensions
666
- template <typename Opnd> inline auto m_ZExtOrSelf (Opnd & &Op) {
667
- return m_AnyOf (m_ZExt (std::forward<Opnd>( Op)), std::forward<Opnd>(Op) );
659
+ template <typename Opnd> inline auto m_ZExtOrSelf (const Opnd &Op) {
660
+ return m_AnyOf (m_ZExt (Op), Op );
668
661
}
669
662
670
663
// / Match a sext or identity
671
664
// / Allows to peek through optional extensions
672
- template <typename Opnd> inline auto m_SExtOrSelf (Opnd & &Op) {
673
- return m_AnyOf (m_SExt (std::forward<Opnd>( Op)), std::forward<Opnd>(Op) );
665
+ template <typename Opnd> inline auto m_SExtOrSelf (const Opnd &Op) {
666
+ return m_AnyOf (m_SExt (Op), Op );
674
667
}
675
668
676
669
// / Match a aext or identity
677
670
// / Allows to peek through optional extensions
678
671
template <typename Opnd>
679
- inline Or<UnaryOpc_match<Opnd>, Opnd> m_AExtOrSelf (Opnd &&Op) {
680
- return Or<UnaryOpc_match<Opnd>, Opnd>(m_AnyExt (std::forward<Opnd>(Op)),
681
- std::forward<Opnd>(Op));
672
+ inline Or<UnaryOpc_match<Opnd>, Opnd> m_AExtOrSelf (const Opnd &Op) {
673
+ return Or<UnaryOpc_match<Opnd>, Opnd>(m_AnyExt (Op), Op);
682
674
}
683
675
684
676
// / Match a trunc or identity
685
677
// / Allows to peek through optional truncations
686
678
template <typename Opnd>
687
- inline Or<UnaryOpc_match<Opnd>, Opnd> m_TruncOrSelf (Opnd &&Op) {
688
- return Or<UnaryOpc_match<Opnd>, Opnd>(m_Trunc (std::forward<Opnd>(Op)),
689
- std::forward<Opnd>(Op));
679
+ inline Or<UnaryOpc_match<Opnd>, Opnd> m_TruncOrSelf (const Opnd &Op) {
680
+ return Or<UnaryOpc_match<Opnd>, Opnd>(m_Trunc (Op), Op);
690
681
}
691
682
692
683
// === Constants ===
0 commit comments