Simplify the implementations of classof using the new IntrinsicInst classof.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25291 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2006-01-13 20:00:51 +00:00
parent e90da97f3e
commit b419b0e682

View File

@ -70,21 +70,19 @@ namespace llvm {
// Methods for support type inquiry through isa, cast, and dyn_cast: // Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const DbgInfoIntrinsic *) { return true; } static inline bool classof(const DbgInfoIntrinsic *) { return true; }
static inline bool classof(const CallInst *I) { static inline bool classof(const IntrinsicInst *I) {
if (const Function *CF = I->getCalledFunction()) switch (I->getIntrinsicID()) {
switch (CF->getIntrinsicID()) { case Intrinsic::dbg_stoppoint:
case Intrinsic::dbg_stoppoint: case Intrinsic::dbg_region_start:
case Intrinsic::dbg_region_start: case Intrinsic::dbg_region_end:
case Intrinsic::dbg_region_end: case Intrinsic::dbg_func_start:
case Intrinsic::dbg_func_start: case Intrinsic::dbg_declare:
case Intrinsic::dbg_declare: return true;
return true; default: return false;
default: break; }
}
return false;
} }
static inline bool classof(const Value *V) { static inline bool classof(const Value *V) {
return isa<CallInst>(V) && classof(cast<CallInst>(V)); return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
} }
}; };
@ -104,13 +102,11 @@ namespace llvm {
// Methods for support type inquiry through isa, cast, and dyn_cast: // Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const DbgStopPointInst *) { return true; } static inline bool classof(const DbgStopPointInst *) { return true; }
static inline bool classof(const CallInst *I) { static inline bool classof(const IntrinsicInst *I) {
if (const Function *CF = I->getCalledFunction()) return I->getIntrinsicID() == Intrinsic::dbg_stoppoint;
return CF->getIntrinsicID() == Intrinsic::dbg_stoppoint;
return false;
} }
static inline bool classof(const Value *V) { static inline bool classof(const Value *V) {
return isa<CallInst>(V) && classof(cast<CallInst>(V)); return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
} }
}; };
@ -150,19 +146,17 @@ namespace llvm {
// Methods for support type inquiry through isa, cast, and dyn_cast: // Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const MemIntrinsic *) { return true; } static inline bool classof(const MemIntrinsic *) { return true; }
static inline bool classof(const CallInst *I) { static inline bool classof(const IntrinsicInst *I) {
if (const Function *CF = I->getCalledFunction()) switch (I->getIntrinsicID()) {
switch (CF->getIntrinsicID()) { case Intrinsic::memcpy:
case Intrinsic::memcpy: case Intrinsic::memmove:
case Intrinsic::memmove: case Intrinsic::memset:
case Intrinsic::memset: return true;
return true; default: return false;
default: break; }
}
return false;
} }
static inline bool classof(const Value *V) { static inline bool classof(const Value *V) {
return isa<CallInst>(V) && classof(cast<CallInst>(V)); return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
} }
}; };
@ -188,17 +182,11 @@ namespace llvm {
// Methods for support type inquiry through isa, cast, and dyn_cast: // Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const MemCpyInst *) { return true; } static inline bool classof(const MemCpyInst *) { return true; }
static inline bool classof(const MemIntrinsic *I) { static inline bool classof(const IntrinsicInst *I) {
return I->getCalledFunction()->getIntrinsicID() == Intrinsic::memcpy; return I->getIntrinsicID() == Intrinsic::memcpy;
}
static inline bool classof(const CallInst *I) {
if (const Function *CF = I->getCalledFunction())
if (CF->getIntrinsicID() == Intrinsic::memcpy)
return true;
return false;
} }
static inline bool classof(const Value *V) { static inline bool classof(const Value *V) {
return isa<CallInst>(V) && classof(cast<CallInst>(V)); return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
} }
}; };
@ -222,17 +210,11 @@ namespace llvm {
// Methods for support type inquiry through isa, cast, and dyn_cast: // Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const MemMoveInst *) { return true; } static inline bool classof(const MemMoveInst *) { return true; }
static inline bool classof(const MemIntrinsic *I) { static inline bool classof(const IntrinsicInst *I) {
return I->getCalledFunction()->getIntrinsicID() == Intrinsic::memmove; return I->getIntrinsicID() == Intrinsic::memmove;
}
static inline bool classof(const CallInst *I) {
if (const Function *CF = I->getCalledFunction())
if (CF->getIntrinsicID() == Intrinsic::memmove)
return true;
return false;
} }
static inline bool classof(const Value *V) { static inline bool classof(const Value *V) {
return isa<CallInst>(V) && classof(cast<CallInst>(V)); return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
} }
}; };
@ -251,17 +233,11 @@ namespace llvm {
// Methods for support type inquiry through isa, cast, and dyn_cast: // Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const MemSetInst *) { return true; } static inline bool classof(const MemSetInst *) { return true; }
static inline bool classof(const MemIntrinsic *I) { static inline bool classof(const IntrinsicInst *I) {
return I->getCalledFunction()->getIntrinsicID() == Intrinsic::memset; return I->getIntrinsicID() == Intrinsic::memset;
}
static inline bool classof(const CallInst *I) {
if (const Function *CF = I->getCalledFunction())
if (CF->getIntrinsicID() == Intrinsic::memset)
return true;
return false;
} }
static inline bool classof(const Value *V) { static inline bool classof(const Value *V) {
return isa<CallInst>(V) && classof(cast<CallInst>(V)); return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
} }
}; };
} }