mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-24 23:22:10 +00:00
Return iterator from BasicBlock::eraseFromParent
Summary: Same as the last patch, but for BasicBlock (Requires same code movement) Reviewers: chandlerc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D8801 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233992 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
dc3292a4b1
commit
cc6ce0857c
@ -28,6 +28,23 @@ class LandingPadInst;
|
|||||||
class TerminatorInst;
|
class TerminatorInst;
|
||||||
class LLVMContext;
|
class LLVMContext;
|
||||||
class BlockAddress;
|
class BlockAddress;
|
||||||
|
class Function;
|
||||||
|
|
||||||
|
// Traits for intrusive list of basic blocks...
|
||||||
|
template<> struct ilist_traits<BasicBlock>
|
||||||
|
: public SymbolTableListTraits<BasicBlock, Function> {
|
||||||
|
|
||||||
|
BasicBlock *createSentinel() const;
|
||||||
|
static void destroySentinel(BasicBlock*) {}
|
||||||
|
|
||||||
|
BasicBlock *provideInitialHead() const { return createSentinel(); }
|
||||||
|
BasicBlock *ensureHead(BasicBlock*) const { return createSentinel(); }
|
||||||
|
static void noteHead(BasicBlock*, BasicBlock*) {}
|
||||||
|
|
||||||
|
static ValueSymbolTable *getSymTab(Function *ItemParent);
|
||||||
|
private:
|
||||||
|
mutable ilist_half_node<BasicBlock> Sentinel;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/// \brief LLVM Basic Block Representation
|
/// \brief LLVM Basic Block Representation
|
||||||
@ -151,7 +168,9 @@ public:
|
|||||||
void removeFromParent();
|
void removeFromParent();
|
||||||
|
|
||||||
/// \brief Unlink 'this' from the containing function and delete it.
|
/// \brief Unlink 'this' from the containing function and delete it.
|
||||||
void eraseFromParent();
|
///
|
||||||
|
// \returns an iterator pointing to the element after the erased one.
|
||||||
|
iplist<BasicBlock>::iterator eraseFromParent();
|
||||||
|
|
||||||
/// \brief Unlink this basic block from its current function and insert it
|
/// \brief Unlink this basic block from its current function and insert it
|
||||||
/// into the function that \p MovePos lives in, right before \p MovePos.
|
/// into the function that \p MovePos lives in, right before \p MovePos.
|
||||||
@ -307,6 +326,12 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// createSentinel is used to get hold of the node that marks the end of the
|
||||||
|
// list... (same trick used here as in ilist_traits<Instruction>)
|
||||||
|
inline BasicBlock *ilist_traits<BasicBlock>::createSentinel() const {
|
||||||
|
return static_cast<BasicBlock*>(&Sentinel);
|
||||||
|
}
|
||||||
|
|
||||||
// Create wrappers for C Binding types (see CBindingWrapping.h).
|
// Create wrappers for C Binding types (see CBindingWrapping.h).
|
||||||
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(BasicBlock, LLVMBasicBlockRef)
|
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(BasicBlock, LLVMBasicBlockRef)
|
||||||
|
|
||||||
|
@ -31,26 +31,6 @@ namespace llvm {
|
|||||||
class FunctionType;
|
class FunctionType;
|
||||||
class LLVMContext;
|
class LLVMContext;
|
||||||
|
|
||||||
// Traits for intrusive list of basic blocks...
|
|
||||||
template<> struct ilist_traits<BasicBlock>
|
|
||||||
: public SymbolTableListTraits<BasicBlock, Function> {
|
|
||||||
|
|
||||||
// createSentinel is used to get hold of the node that marks the end of the
|
|
||||||
// list... (same trick used here as in ilist_traits<Instruction>)
|
|
||||||
BasicBlock *createSentinel() const {
|
|
||||||
return static_cast<BasicBlock*>(&Sentinel);
|
|
||||||
}
|
|
||||||
static void destroySentinel(BasicBlock*) {}
|
|
||||||
|
|
||||||
BasicBlock *provideInitialHead() const { return createSentinel(); }
|
|
||||||
BasicBlock *ensureHead(BasicBlock*) const { return createSentinel(); }
|
|
||||||
static void noteHead(BasicBlock*, BasicBlock*) {}
|
|
||||||
|
|
||||||
static ValueSymbolTable *getSymTab(Function *ItemParent);
|
|
||||||
private:
|
|
||||||
mutable ilist_half_node<BasicBlock> Sentinel;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<> struct ilist_traits<Argument>
|
template<> struct ilist_traits<Argument>
|
||||||
: public SymbolTableListTraits<Argument, Function> {
|
: public SymbolTableListTraits<Argument, Function> {
|
||||||
|
|
||||||
|
@ -94,8 +94,8 @@ void BasicBlock::removeFromParent() {
|
|||||||
getParent()->getBasicBlockList().remove(this);
|
getParent()->getBasicBlockList().remove(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasicBlock::eraseFromParent() {
|
iplist<BasicBlock>::iterator BasicBlock::eraseFromParent() {
|
||||||
getParent()->getBasicBlockList().erase(this);
|
return getParent()->getBasicBlockList().erase(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Unlink this basic block from its current function and
|
/// Unlink this basic block from its current function and
|
||||||
|
Loading…
x
Reference in New Issue
Block a user