[llvm-commits] CVS: llvm/include/llvm/IntrinsicInst.h
Chris Lattner
lattner at cs.uiuc.edu
Fri Jan 13 11:49:14 PST 2006
Changes in directory llvm/include/llvm:
IntrinsicInst.h updated: 1.7 -> 1.8
---
Log message:
Add some functionality to the IntrinsicInst class and some comments
---
Diffs of the changes: (+20 -0)
IntrinsicInst.h | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+)
Index: llvm/include/llvm/IntrinsicInst.h
diff -u llvm/include/llvm/IntrinsicInst.h:1.7 llvm/include/llvm/IntrinsicInst.h:1.8
--- llvm/include/llvm/IntrinsicInst.h:1.7 Thu Apr 21 22:20:18 2005
+++ llvm/include/llvm/IntrinsicInst.h Fri Jan 13 13:49:02 2006
@@ -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 @@
/// 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
More information about the llvm-commits
mailing list