aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm/include/llvm/IR/BasicBlock.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/include/llvm/IR/BasicBlock.h')
-rw-r--r--contrib/llvm/include/llvm/IR/BasicBlock.h44
1 files changed, 17 insertions, 27 deletions
diff --git a/contrib/llvm/include/llvm/IR/BasicBlock.h b/contrib/llvm/include/llvm/IR/BasicBlock.h
index 66581bfedbe6..c6b54d308ce6 100644
--- a/contrib/llvm/include/llvm/IR/BasicBlock.h
+++ b/contrib/llvm/include/llvm/IR/BasicBlock.h
@@ -30,22 +30,9 @@ class LLVMContext;
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;
-};
-
+template <>
+struct SymbolTableListSentinelTraits<BasicBlock>
+ : public ilist_half_embedded_sentinel_traits<BasicBlock> {};
/// \brief LLVM Basic Block Representation
///
@@ -63,16 +50,17 @@ private:
/// modifying a program. However, the verifier will ensure that basic blocks
/// are "well formed".
class BasicBlock : public Value, // Basic blocks are data objects also
- public ilist_node<BasicBlock> {
+ public ilist_node_with_parent<BasicBlock, Function> {
friend class BlockAddress;
public:
- typedef iplist<Instruction> InstListType;
+ typedef SymbolTableList<Instruction> InstListType;
+
private:
InstListType InstList;
Function *Parent;
void setParent(Function *parent);
- friend class SymbolTableListTraits<BasicBlock, Function>;
+ friend class SymbolTableListTraits<BasicBlock>;
BasicBlock(const BasicBlock &) = delete;
void operator=(const BasicBlock &) = delete;
@@ -171,7 +159,7 @@ public:
/// \brief Unlink 'this' from the containing function and delete it.
///
// \returns an iterator pointing to the element after the erased one.
- iplist<BasicBlock>::iterator eraseFromParent();
+ SymbolTableList<BasicBlock>::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.
@@ -253,7 +241,7 @@ public:
InstListType &getInstList() { return InstList; }
/// \brief Returns a pointer to a member of the instruction list.
- static iplist<Instruction> BasicBlock::*getSublistAccess(Instruction*) {
+ static InstListType BasicBlock::*getSublistAccess(Instruction*) {
return &BasicBlock::InstList;
}
@@ -283,6 +271,8 @@ public:
/// should be called while the predecessor still refers to this block.
void removePredecessor(BasicBlock *Pred, bool DontDeleteUselessPHIs = false);
+ bool canSplitPredecessors() const;
+
/// \brief Split the basic block into two basic blocks at the specified
/// instruction.
///
@@ -300,6 +290,9 @@ public:
/// Also note that this doesn't preserve any passes. To split blocks while
/// keeping loop information consistent, use the SplitBlock utility function.
BasicBlock *splitBasicBlock(iterator I, const Twine &BBName = "");
+ BasicBlock *splitBasicBlock(Instruction *I, const Twine &BBName = "") {
+ return splitBasicBlock(I->getIterator(), BBName);
+ }
/// \brief Returns true if there are any uses of this basic block other than
/// direct branches, switches, etc. to it.
@@ -309,6 +302,9 @@ public:
/// basic block \p New instead of to it.
void replaceSuccessorsPhiUsesWith(BasicBlock *New);
+ /// \brief Return true if this basic block is an exception handling block.
+ bool isEHPad() const { return getFirstNonPHI()->isEHPad(); }
+
/// \brief Return true if this basic block is a landing pad.
///
/// Being a ``landing pad'' means that the basic block is the destination of
@@ -337,12 +333,6 @@ 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).
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(BasicBlock, LLVMBasicBlockRef)