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

Chris Lattner lattner at cs.uiuc.edu
Mon Nov 22 09:18:19 PST 2004



Changes in directory llvm/include/llvm:

IntrinsicInst.h updated: 1.3 -> 1.4
---
Log message:

Add a new debug intrinsic parent class.  Patch contributed by Michael 
McCracken, thanks!


---
Diffs of the changes:  (+28 -4)

Index: llvm/include/llvm/IntrinsicInst.h
diff -u llvm/include/llvm/IntrinsicInst.h:1.3 llvm/include/llvm/IntrinsicInst.h:1.4
--- llvm/include/llvm/IntrinsicInst.h:1.3	Thu Nov 18 15:41:16 2004
+++ llvm/include/llvm/IntrinsicInst.h	Mon Nov 22 11:18:05 2004
@@ -42,11 +42,37 @@
     static Value *StripPointerCasts(Value *Ptr);
   };
 
-  /// DbgStopPointInst - This represent llvm.dbg.stoppoint instructions.
+  /// DbgInfoIntrinsic - This is the common base class for debug info intrinsics
   ///
-  struct DbgStopPointInst : public IntrinsicInst {
+  struct DbgInfoIntrinsic : public IntrinsicInst {
 
     Value *getChain() const { return const_cast<Value*>(getOperand(1)); }
+
+    // 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 Value *V) {
+      return isa<CallInst>(V) && classof(cast<CallInst>(V));
+    }
+  };
+
+
+  /// DbgStopPointInst - This represent llvm.dbg.stoppoint instructions.
+  ///
+  struct DbgStopPointInst : public DbgInfoIntrinsic {
+
     unsigned getLineNo() const {
       return cast<ConstantInt>(getOperand(2))->getRawValue();
     }
@@ -68,8 +94,6 @@
     }
   };
 
-
-
   /// MemIntrinsic - This is the common base class for memset/memcpy/memmove.
   ///
   struct MemIntrinsic : public IntrinsicInst {






More information about the llvm-commits mailing list