1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

add match support for casts.

llvm-svn: 45744
This commit is contained in:
Chris Lattner 2008-01-08 07:02:44 +00:00
parent aeab9aefb3
commit a39e69f292

View File

@ -321,6 +321,30 @@ m_FCmp(FCmpInst::Predicate &Pred, const LHS &L, const RHS &R) {
FCmpInst, FCmpInst::Predicate>(Pred, L, R);
}
//===----------------------------------------------------------------------===//
// Matchers for CastInst classes
//
template<typename Op_t, typename Class>
struct CastClass_match {
Op_t Op;
CastClass_match(const Op_t &OpMatch) : Op(OpMatch) {}
template<typename OpTy>
bool match(OpTy *V) {
if (Class *I = dyn_cast<Class>(V))
return Op.match(I->getOperand(0));
return false;
}
};
template<typename Class, typename OpTy>
inline CastClass_match<OpTy, Class> m_Cast(const OpTy &Op) {
return CastClass_match<OpTy, Class>(Op);
}
//===----------------------------------------------------------------------===//
// Matchers for unary operators
//