[llvm-commits] CVS: llvm/include/llvm/IntrinsicInst.h

Chris Lattner lattner at cs.uiuc.edu
Fri Jan 13 12:01:03 PST 2006



Changes in directory llvm/include/llvm:

IntrinsicInst.h updated: 1.8 -> 1.9
---
Log message:

Simplify the implementations of classof using the new IntrinsicInst classof.


---
Diffs of the changes:  (+32 -56)

 IntrinsicInst.h |   88 ++++++++++++++++++++------------------------------------
 1 files changed, 32 insertions(+), 56 deletions(-)


Index: llvm/include/llvm/IntrinsicInst.h
diff -u llvm/include/llvm/IntrinsicInst.h:1.8 llvm/include/llvm/IntrinsicInst.h:1.9
--- llvm/include/llvm/IntrinsicInst.h:1.8	Fri Jan 13 13:49:02 2006
+++ llvm/include/llvm/IntrinsicInst.h	Fri Jan 13 14:00:51 2006
@@ -70,21 +70,19 @@
 
     // Methods for support type inquiry through isa, cast, and dyn_cast:
     static inline bool classof(const DbgInfoIntrinsic *) { return true; }
-    static inline bool classof(const CallInst *I) {
-      if (const Function *CF = I->getCalledFunction())
-        switch (CF->getIntrinsicID()) {
-        case Intrinsic::dbg_stoppoint:
-        case Intrinsic::dbg_region_start:
-        case Intrinsic::dbg_region_end:
-        case Intrinsic::dbg_func_start:
-        case Intrinsic::dbg_declare:
-          return true;
-        default: break;
-        }
-      return false;
+    static inline bool classof(const IntrinsicInst *I) {
+      switch (I->getIntrinsicID()) {
+      case Intrinsic::dbg_stoppoint:
+      case Intrinsic::dbg_region_start:
+      case Intrinsic::dbg_region_end:
+      case Intrinsic::dbg_func_start:
+      case Intrinsic::dbg_declare:
+        return true;
+      default: return false;
+      }
     }
     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 @@
 
     // Methods for support type inquiry through isa, cast, and dyn_cast:
     static inline bool classof(const DbgStopPointInst *) { return true; }
-    static inline bool classof(const CallInst *I) {
-      if (const Function *CF = I->getCalledFunction())
-        return CF->getIntrinsicID() == Intrinsic::dbg_stoppoint;
-      return false;
+    static inline bool classof(const IntrinsicInst *I) {
+      return I->getIntrinsicID() == Intrinsic::dbg_stoppoint;
     }
     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 @@
 
     // Methods for support type inquiry through isa, cast, and dyn_cast:
     static inline bool classof(const MemIntrinsic *) { return true; }
-    static inline bool classof(const CallInst *I) {
-      if (const Function *CF = I->getCalledFunction())
-        switch (CF->getIntrinsicID()) {
-        case Intrinsic::memcpy:
-        case Intrinsic::memmove:
-        case Intrinsic::memset:
-          return true;
-        default: break;
-        }
-      return false;
+    static inline bool classof(const IntrinsicInst *I) {
+      switch (I->getIntrinsicID()) {
+      case Intrinsic::memcpy:
+      case Intrinsic::memmove:
+      case Intrinsic::memset:
+        return true;
+      default: return false;
+      }
     }
     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 @@
 
     // Methods for support type inquiry through isa, cast, and dyn_cast:
     static inline bool classof(const MemCpyInst *) { return true; }
-    static inline bool classof(const MemIntrinsic *I) {
-      return I->getCalledFunction()->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 IntrinsicInst *I) {
+      return I->getIntrinsicID() == Intrinsic::memcpy;
     }
     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 @@
 
     // Methods for support type inquiry through isa, cast, and dyn_cast:
     static inline bool classof(const MemMoveInst *) { return true; }
-    static inline bool classof(const MemIntrinsic *I) {
-      return I->getCalledFunction()->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 IntrinsicInst *I) {
+      return I->getIntrinsicID() == Intrinsic::memmove;
     }
     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 @@
 
     // Methods for support type inquiry through isa, cast, and dyn_cast:
     static inline bool classof(const MemSetInst *) { return true; }
-    static inline bool classof(const MemIntrinsic *I) {
-      return I->getCalledFunction()->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 IntrinsicInst *I) {
+      return I->getIntrinsicID() == Intrinsic::memset;
     }
     static inline bool classof(const Value *V) {
-      return isa<CallInst>(V) && classof(cast<CallInst>(V));
+      return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
     }
   };
 }






More information about the llvm-commits mailing list