diff options
author | Chris Lattner <sabre@nondot.org> | 2003-11-21 16:52:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-11-21 16:52:05 +0000 |
commit | 108e4ab159b59a616b0868e396dc7ddc1fb48616 (patch) | |
tree | fa6892850c59a118e0538ff21d0beb01f2d5ce0b /lib/VMCore/BasicBlock.cpp | |
parent | 2436eda94ac811d338a03c50ef82b66e37ddd56f (diff) |
Minor cleanups and simplifications
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10127 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/BasicBlock.cpp')
-rw-r--r-- | lib/VMCore/BasicBlock.cpp | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp index b00ce51f2f..f2b551bbd9 100644 --- a/lib/VMCore/BasicBlock.cpp +++ b/lib/VMCore/BasicBlock.cpp @@ -21,33 +21,33 @@ #include "Support/LeakDetector.h" #include "SymbolTableListTraitsImpl.h" #include <algorithm> +using namespace llvm; + +namespace { + /// DummyInst - An instance of this class is used to mark the end of the + /// instruction list. This is not a real instruction. + struct DummyInst : public Instruction { + DummyInst() : Instruction(Type::VoidTy, OtherOpsEnd) { + // This should not be garbage monitored. + LeakDetector::removeGarbageObject(this); + } -namespace llvm { - -// DummyInst - An instance of this class is used to mark the end of the -// instruction list. This is not a real instruction. -// -struct DummyInst : public Instruction { - DummyInst() : Instruction(Type::VoidTy, OtherOpsEnd) { - // This should not be garbage monitored. - LeakDetector::removeGarbageObject(this); - } - - virtual Instruction *clone() const { - assert(0 && "Cannot clone EOL");abort(); - return 0; - } - virtual const char *getOpcodeName() const { return "*end-of-list-inst*"; } + virtual Instruction *clone() const { + assert(0 && "Cannot clone EOL");abort(); + return 0; + } + virtual const char *getOpcodeName() const { return "*end-of-list-inst*"; } - // Methods for support type inquiry through isa, cast, and dyn_cast... - static inline bool classof(const DummyInst *) { return true; } - static inline bool classof(const Instruction *I) { - return I->getOpcode() == OtherOpsEnd; - } - static inline bool classof(const Value *V) { - return isa<Instruction>(V) && classof(cast<Instruction>(V)); - } -}; + // Methods for support type inquiry through isa, cast, and dyn_cast... + static inline bool classof(const DummyInst *) { return true; } + static inline bool classof(const Instruction *I) { + return I->getOpcode() == OtherOpsEnd; + } + static inline bool classof(const Value *V) { + return isa<Instruction>(V) && classof(cast<Instruction>(V)); + } + }; +} Instruction *ilist_traits<Instruction>::createNode() { return new DummyInst(); @@ -243,7 +243,7 @@ BasicBlock *BasicBlock::splitBasicBlock(iterator I, const std::string &BBName) { } while (Inst != &*I); // Loop until we move the specified instruction. // Add a branch instruction to the newly formed basic block. - new BranchInst(New, 0, 0, this); + new BranchInst(New, this); // Now we must loop through all of the successors of the New block (which // _were_ the successors of the 'this' block), and update any PHI nodes in @@ -265,5 +265,3 @@ BasicBlock *BasicBlock::splitBasicBlock(iterator I, const std::string &BBName) { } return New; } - -} // End llvm namespace |