OSDN Git Service

Add a hasAddressTaken for BasicBlock.
authorDan Gohman <gohman@apple.com>
Thu, 29 Oct 2009 00:09:08 +0000 (00:09 +0000)
committerDan Gohman <gohman@apple.com>
Thu, 29 Oct 2009 00:09:08 +0000 (00:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85449 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/BasicBlock.h
lib/VMCore/BasicBlock.cpp

index 95e3971..c6e6080 100644 (file)
@@ -235,6 +235,10 @@ public:
   /// keeping loop information consistent, use the SplitBlock utility function.
   ///
   BasicBlock *splitBasicBlock(iterator I, const Twine &BBName = "");
+
+  /// hasAddressTaken - returns true if there are any uses of this basic block
+  /// other than direct branches, switches, etc. to it.
+  bool hasAddressTaken() const;
 };
 
 } // End llvm namespace
index 50cf84c..ede2d12 100644 (file)
@@ -277,3 +277,12 @@ BasicBlock *BasicBlock::splitBasicBlock(iterator I, const Twine &BBName) {
   }
   return New;
 }
+
+/// hasAddressTaken - returns true if there are any uses of this basic block
+/// other than direct branches, switches, etc. to it.
+bool BasicBlock::hasAddressTaken() const {
+  for (Value::use_const_iterator I = use_begin(), E = use_end(); I != E; ++I)
+    if (isa<BlockAddress>(*I))
+      return true;
+  return false;
+}