diff options
author | Chris Lattner <sabre@nondot.org> | 2004-11-22 17:18:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-11-22 17:18:05 +0000 |
commit | 3e775143fb562cddc27734ba46a3ccf3aa0f3e01 (patch) | |
tree | decacb7b5c078837b6ed1812d866d5f03e859a9c /include | |
parent | ea3065fc648dcf2632f7b7876985d52a8e24cbd4 (diff) | |
download | llvm-3e775143fb562cddc27734ba46a3ccf3aa0f3e01.tar.gz llvm-3e775143fb562cddc27734ba46a3ccf3aa0f3e01.tar.bz2 llvm-3e775143fb562cddc27734ba46a3ccf3aa0f3e01.tar.xz |
Add a new debug intrinsic parent class. Patch contributed by Michael
McCracken, thanks!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18107 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/IntrinsicInst.h | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/include/llvm/IntrinsicInst.h b/include/llvm/IntrinsicInst.h index 689805a5c1..e82663debc 100644 --- a/include/llvm/IntrinsicInst.h +++ b/include/llvm/IntrinsicInst.h @@ -42,11 +42,37 @@ namespace llvm { 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 @@ namespace llvm { } }; - - /// MemIntrinsic - This is the common base class for memset/memcpy/memmove. /// struct MemIntrinsic : public IntrinsicInst { |