From 2c3e0051c31c3f5b2328b447eadf1cf9c4427442 Mon Sep 17 00:00:00 2001 From: Pirama Arumuga Nainar Date: Wed, 6 May 2015 11:46:36 -0700 Subject: Update aosp/master LLVM for rebase to r235153 Change-Id: I9bf53792f9fc30570e81a8d80d296c681d005ea7 (cherry picked from commit 0c7f116bb6950ef819323d855415b2f2b0aad987) --- include/llvm/IR/BasicBlock.h | 46 ++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'include/llvm/IR/BasicBlock.h') diff --git a/include/llvm/IR/BasicBlock.h b/include/llvm/IR/BasicBlock.h index 8f5cdeb..a71946e 100644 --- a/include/llvm/IR/BasicBlock.h +++ b/include/llvm/IR/BasicBlock.h @@ -28,33 +28,25 @@ class LandingPadInst; class TerminatorInst; class LLVMContext; class BlockAddress; +class Function; -template<> struct ilist_traits - : public SymbolTableListTraits { +// Traits for intrusive list of basic blocks... +template<> struct ilist_traits + : public SymbolTableListTraits { - /// \brief Return a node that marks the end of a list. - /// - /// The sentinel is relative to this instance, so we use a non-static - /// method. - Instruction *createSentinel() const { - // Since i(p)lists always publicly derive from their corresponding traits, - // placing a data member in this class will augment the i(p)list. But since - // the NodeTy is expected to be publicly derive from ilist_node, - // there is a legal viable downcast from it to NodeTy. We use this trick to - // superimpose an i(p)list with a "ghostly" NodeTy, which becomes the - // sentinel. Dereferencing the sentinel is forbidden (save the - // ilist_node), so no one will ever notice the superposition. - return static_cast(&Sentinel); - } - static void destroySentinel(Instruction*) {} + BasicBlock *createSentinel() const; + static void destroySentinel(BasicBlock*) {} + + BasicBlock *provideInitialHead() const { return createSentinel(); } + BasicBlock *ensureHead(BasicBlock*) const { return createSentinel(); } + static void noteHead(BasicBlock*, BasicBlock*) {} - Instruction *provideInitialHead() const { return createSentinel(); } - Instruction *ensureHead(Instruction*) const { return createSentinel(); } - static void noteHead(Instruction*, Instruction*) {} + static ValueSymbolTable *getSymTab(Function *ItemParent); private: - mutable ilist_half_node Sentinel; + mutable ilist_half_node Sentinel; }; + /// \brief LLVM Basic Block Representation /// /// This represents a single basic block in LLVM. A basic block is simply a @@ -113,7 +105,7 @@ public: BasicBlock *InsertBefore = nullptr) { return new BasicBlock(Context, Name, Parent, InsertBefore); } - ~BasicBlock(); + ~BasicBlock() override; /// \brief Return the enclosing method, or null if none. const Function *getParent() const { return Parent; } @@ -176,7 +168,9 @@ public: void removeFromParent(); /// \brief Unlink 'this' from the containing function and delete it. - void eraseFromParent(); + /// + // \returns an iterator pointing to the element after the erased one. + iplist::iterator eraseFromParent(); /// \brief Unlink this basic block from its current function and insert it /// into the function that \p MovePos lives in, right before \p MovePos. @@ -332,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) +inline BasicBlock *ilist_traits::createSentinel() const { + return static_cast(&Sentinel); +} + // Create wrappers for C Binding types (see CBindingWrapping.h). DEFINE_SIMPLE_CONVERSION_FUNCTIONS(BasicBlock, LLVMBasicBlockRef) -- cgit v1.1