diff options
author | Chris Lattner <sabre@nondot.org> | 2004-10-16 18:05:54 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-10-16 18:05:54 +0000 |
commit | 076b3f169379df5e8362dcb37403b14444d5dafb (patch) | |
tree | cc17339deeebb38e82900eec3d967e60aa326009 /include | |
parent | 731cde944717131331be2851bf2e13709cf5eebf (diff) | |
download | external_llvm-076b3f169379df5e8362dcb37403b14444d5dafb.zip external_llvm-076b3f169379df5e8362dcb37403b14444d5dafb.tar.gz external_llvm-076b3f169379df5e8362dcb37403b14444d5dafb.tar.bz2 |
Add new UnreachableInst class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17037 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Instructions.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index bd39db6..96772ed 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -1187,6 +1187,43 @@ struct UnwindInst : public TerminatorInst { } }; +//===----------------------------------------------------------------------===// +// UnreachableInst Class +//===----------------------------------------------------------------------===// + +//===--------------------------------------------------------------------------- +/// UnreachableInst - This function has undefined behavior. In particular, the +/// presence of this instruction indicates some higher level knowledge that the +/// end of the block cannot be reached. +/// +struct UnreachableInst : public TerminatorInst { + UnreachableInst(Instruction *InsertBefore = 0) + : TerminatorInst(Instruction::Unreachable, InsertBefore) { + } + UnreachableInst(BasicBlock *InsertAtEnd) + : TerminatorInst(Instruction::Unreachable, InsertAtEnd) { + } + + virtual UnreachableInst *clone() const; + + virtual const BasicBlock *getSuccessor(unsigned idx) const { + assert(0 && "UnreachableInst has no successors!"); + abort(); + return 0; + } + virtual void setSuccessor(unsigned idx, BasicBlock *NewSucc); + virtual unsigned getNumSuccessors() const { return 0; } + + // Methods for support type inquiry through isa, cast, and dyn_cast: + static inline bool classof(const UnreachableInst *) { return true; } + static inline bool classof(const Instruction *I) { + return I->getOpcode() == Instruction::Unreachable; + } + static inline bool classof(const Value *V) { + return isa<Instruction>(V) && classof(cast<Instruction>(V)); + } +}; + } // End llvm namespace #endif |