[llvm-commits] [llvm] r85449 - in /llvm/trunk: include/llvm/BasicBlock.h lib/VMCore/BasicBlock.cpp

Dan Gohman gohman at apple.com
Wed Oct 28 17:09:08 PDT 2009


Author: djg
Date: Wed Oct 28 19:09:08 2009
New Revision: 85449

URL: http://llvm.org/viewvc/llvm-project?rev=85449&view=rev
Log:
Add a hasAddressTaken for BasicBlock.

Modified:
    llvm/trunk/include/llvm/BasicBlock.h
    llvm/trunk/lib/VMCore/BasicBlock.cpp

Modified: llvm/trunk/include/llvm/BasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BasicBlock.h?rev=85449&r1=85448&r2=85449&view=diff

==============================================================================
--- llvm/trunk/include/llvm/BasicBlock.h (original)
+++ llvm/trunk/include/llvm/BasicBlock.h Wed Oct 28 19:09:08 2009
@@ -235,6 +235,10 @@
   /// 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

Modified: llvm/trunk/lib/VMCore/BasicBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/BasicBlock.cpp?rev=85449&r1=85448&r2=85449&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/BasicBlock.cpp (original)
+++ llvm/trunk/lib/VMCore/BasicBlock.cpp Wed Oct 28 19:09:08 2009
@@ -277,3 +277,12 @@
   }
   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;
+}





More information about the llvm-commits mailing list