diff options
| author | Chris Lattner <sabre@nondot.org> | 2006-01-13 19:49:02 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2006-01-13 19:49:02 +0000 |
| commit | d5bb9df4d8686882cfd0e16bea05a0e7d6ccaa53 (patch) | |
| tree | e7c31ab67f1fe13d117d90d84a54bffd7c4e234a /llvm | |
| parent | 45406c0c538e57636225b877954f423e83659eca (diff) | |
| download | bcm5719-llvm-d5bb9df4d8686882cfd0e16bea05a0e7d6ccaa53.tar.gz bcm5719-llvm-d5bb9df4d8686882cfd0e16bea05a0e7d6ccaa53.zip | |
Add some functionality to the IntrinsicInst class and some comments
llvm-svn: 25289
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/IntrinsicInst.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/include/llvm/IntrinsicInst.h b/llvm/include/llvm/IntrinsicInst.h index 2b26ad52154..90b3761a09b 100644 --- a/llvm/include/llvm/IntrinsicInst.h +++ b/llvm/include/llvm/IntrinsicInst.h @@ -30,6 +30,9 @@ #include "llvm/Intrinsics.h" namespace llvm { + /// IntrinsicInst - A useful wrapper class for inspecting calls to intrinsic + /// functions. This allows the standard isa/dyncast/cast functionality to + /// work with calls to intrinsic functions. class IntrinsicInst : public CallInst { IntrinsicInst(); // DO NOT IMPLEMENT IntrinsicInst(const IntrinsicInst&); // DO NOT IMPLEMENT @@ -40,6 +43,23 @@ namespace llvm { /// casts from the specified value, returning the original uncasted value. /// Note that the returned value is guaranteed to have pointer type. static Value *StripPointerCasts(Value *Ptr); + + /// getIntrinsicID - Return the intrinsic ID of this intrinsic. + /// + Intrinsic::ID getIntrinsicID() const { + return (Intrinsic::ID)getCalledFunction()->getIntrinsicID(); + } + + // Methods for support type inquiry through isa, cast, and dyn_cast: + static inline bool classof(const IntrinsicInst *) { return true; } + static inline bool classof(const CallInst *I) { + if (const Function *CF = I->getCalledFunction()) + return CF->getIntrinsicID() != 0; + return false; + } + static inline bool classof(const Value *V) { + return isa<CallInst>(V) && classof(cast<CallInst>(V)); + } }; /// DbgInfoIntrinsic - This is the common base class for debug info intrinsics |

