@@ -1663,14 +1663,14 @@ template <typename Op_t, unsigned Opcode> struct CastOperator_match {
1663
1663
}
1664
1664
};
1665
1665
1666
- template <typename Op_t, unsigned Opcode > struct CastInst_match {
1666
+ template <typename Op_t, typename Class > struct CastInst_match {
1667
1667
Op_t Op;
1668
1668
1669
1669
CastInst_match (const Op_t &OpMatch) : Op(OpMatch) {}
1670
1670
1671
1671
template <typename OpTy> bool match (OpTy *V) {
1672
- if (auto *I = dyn_cast<Instruction >(V))
1673
- return I-> getOpcode () == Opcode && Op.match (I->getOperand (0 ));
1672
+ if (auto *I = dyn_cast<Class >(V))
1673
+ return Op.match (I->getOperand (0 ));
1674
1674
return false ;
1675
1675
}
1676
1676
};
@@ -1698,9 +1698,8 @@ template <typename Op_t> struct NNegZExt_match {
1698
1698
NNegZExt_match (const Op_t &OpMatch) : Op(OpMatch) {}
1699
1699
1700
1700
template <typename OpTy> bool match (OpTy *V) {
1701
- if (auto *I = dyn_cast<Instruction>(V))
1702
- return I->getOpcode () == Instruction::ZExt && I->hasNonNeg () &&
1703
- Op.match (I->getOperand (0 ));
1701
+ if (auto *I = dyn_cast<ZExtInst>(V))
1702
+ return I->hasNonNeg () && Op.match (I->getOperand (0 ));
1704
1703
return false ;
1705
1704
}
1706
1705
};
@@ -1746,14 +1745,14 @@ m_TruncOrSelf(const OpTy &Op) {
1746
1745
1747
1746
// / Matches SExt.
1748
1747
template <typename OpTy>
1749
- inline CastInst_match<OpTy, Instruction::SExt > m_SExt (const OpTy &Op) {
1750
- return CastInst_match<OpTy, Instruction::SExt >(Op);
1748
+ inline CastInst_match<OpTy, SExtInst > m_SExt (const OpTy &Op) {
1749
+ return CastInst_match<OpTy, SExtInst >(Op);
1751
1750
}
1752
1751
1753
1752
// / Matches ZExt.
1754
1753
template <typename OpTy>
1755
- inline CastInst_match<OpTy, Instruction::ZExt > m_ZExt (const OpTy &Op) {
1756
- return CastInst_match<OpTy, Instruction::ZExt >(Op);
1754
+ inline CastInst_match<OpTy, ZExtInst > m_ZExt (const OpTy &Op) {
1755
+ return CastInst_match<OpTy, ZExtInst >(Op);
1757
1756
}
1758
1757
1759
1758
template <typename OpTy>
@@ -1762,70 +1761,67 @@ inline NNegZExt_match<OpTy> m_NNegZExt(const OpTy &Op) {
1762
1761
}
1763
1762
1764
1763
template <typename OpTy>
1765
- inline match_combine_or<CastInst_match<OpTy, Instruction::ZExt >, OpTy>
1764
+ inline match_combine_or<CastInst_match<OpTy, ZExtInst >, OpTy>
1766
1765
m_ZExtOrSelf (const OpTy &Op) {
1767
1766
return m_CombineOr (m_ZExt (Op), Op);
1768
1767
}
1769
1768
1770
1769
template <typename OpTy>
1771
- inline match_combine_or<CastInst_match<OpTy, Instruction::SExt >, OpTy>
1770
+ inline match_combine_or<CastInst_match<OpTy, SExtInst >, OpTy>
1772
1771
m_SExtOrSelf (const OpTy &Op) {
1773
1772
return m_CombineOr (m_SExt (Op), Op);
1774
1773
}
1775
1774
1776
1775
// / Match either "sext" or "zext nneg".
1777
1776
template <typename OpTy>
1778
- inline match_combine_or<CastInst_match<OpTy, Instruction::SExt>,
1779
- NNegZExt_match<OpTy>>
1777
+ inline match_combine_or<CastInst_match<OpTy, SExtInst>, NNegZExt_match<OpTy>>
1780
1778
m_SExtLike (const OpTy &Op) {
1781
1779
return m_CombineOr (m_SExt (Op), m_NNegZExt (Op));
1782
1780
}
1783
1781
1784
1782
template <typename OpTy>
1785
- inline match_combine_or<CastInst_match<OpTy, Instruction::ZExt >,
1786
- CastInst_match<OpTy, Instruction::SExt >>
1783
+ inline match_combine_or<CastInst_match<OpTy, ZExtInst >,
1784
+ CastInst_match<OpTy, SExtInst >>
1787
1785
m_ZExtOrSExt (const OpTy &Op) {
1788
1786
return m_CombineOr (m_ZExt (Op), m_SExt (Op));
1789
1787
}
1790
1788
1791
1789
template <typename OpTy>
1792
- inline match_combine_or<
1793
- match_combine_or<CastInst_match<OpTy, Instruction::ZExt>,
1794
- CastInst_match<OpTy, Instruction::SExt>>,
1795
- OpTy>
1790
+ inline match_combine_or<match_combine_or<CastInst_match<OpTy, ZExtInst>,
1791
+ CastInst_match<OpTy, SExtInst>>,
1792
+ OpTy>
1796
1793
m_ZExtOrSExtOrSelf (const OpTy &Op) {
1797
1794
return m_CombineOr (m_ZExtOrSExt (Op), Op);
1798
1795
}
1799
1796
1800
1797
template <typename OpTy>
1801
- inline CastInst_match<OpTy, Instruction::UIToFP > m_UIToFP (const OpTy &Op) {
1802
- return CastInst_match<OpTy, Instruction::UIToFP >(Op);
1798
+ inline CastInst_match<OpTy, UIToFPInst > m_UIToFP (const OpTy &Op) {
1799
+ return CastInst_match<OpTy, UIToFPInst >(Op);
1803
1800
}
1804
1801
1805
1802
template <typename OpTy>
1806
- inline CastInst_match<OpTy, Instruction::SIToFP > m_SIToFP (const OpTy &Op) {
1807
- return CastInst_match<OpTy, Instruction::SIToFP >(Op);
1803
+ inline CastInst_match<OpTy, SIToFPInst > m_SIToFP (const OpTy &Op) {
1804
+ return CastInst_match<OpTy, SIToFPInst >(Op);
1808
1805
}
1809
1806
1810
1807
template <typename OpTy>
1811
- inline CastInst_match<OpTy, Instruction::FPToUI > m_FPToUI (const OpTy &Op) {
1812
- return CastInst_match<OpTy, Instruction::FPToUI >(Op);
1808
+ inline CastInst_match<OpTy, FPToUIInst > m_FPToUI (const OpTy &Op) {
1809
+ return CastInst_match<OpTy, FPToUIInst >(Op);
1813
1810
}
1814
1811
1815
1812
template <typename OpTy>
1816
- inline CastInst_match<OpTy, Instruction::FPToSI > m_FPToSI (const OpTy &Op) {
1817
- return CastInst_match<OpTy, Instruction::FPToSI >(Op);
1813
+ inline CastInst_match<OpTy, FPToSIInst > m_FPToSI (const OpTy &Op) {
1814
+ return CastInst_match<OpTy, FPToSIInst >(Op);
1818
1815
}
1819
1816
1820
1817
template <typename OpTy>
1821
- inline CastInst_match<OpTy, Instruction::FPTrunc>
1822
- m_FPTrunc (const OpTy &Op) {
1823
- return CastInst_match<OpTy, Instruction::FPTrunc>(Op);
1818
+ inline CastInst_match<OpTy, FPTruncInst> m_FPTrunc (const OpTy &Op) {
1819
+ return CastInst_match<OpTy, FPTruncInst>(Op);
1824
1820
}
1825
1821
1826
1822
template <typename OpTy>
1827
- inline CastInst_match<OpTy, Instruction::FPExt > m_FPExt (const OpTy &Op) {
1828
- return CastInst_match<OpTy, Instruction::FPExt >(Op);
1823
+ inline CastInst_match<OpTy, FPExtInst > m_FPExt (const OpTy &Op) {
1824
+ return CastInst_match<OpTy, FPExtInst >(Op);
1829
1825
}
1830
1826
1831
1827
// ===----------------------------------------------------------------------===//
0 commit comments