new method
authorChris Lattner <sabre@nondot.org>
Wed, 23 Feb 2005 16:51:11 +0000 (16:51 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 23 Feb 2005 16:51:11 +0000 (16:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20288 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Value.cpp

index 9dc45f267e47e7af1e6394356b7d53999ad6068f..b3b133f77984fa75c0afbfb625cbf7a24e2624b5 100644 (file)
@@ -72,6 +72,19 @@ bool Value::hasNUses(unsigned N) const {
   return UI == E;
 }
 
+/// hasNUsesOrMore - Return true if this value has N users or more.  This is
+/// logically equivalent to getNumUses() >= N.
+///
+bool Value::hasNUsesOrMore(unsigned N) const {
+  use_const_iterator UI = use_begin(), E = use_end();
+
+  for (; N; --N, ++UI)
+    if (UI == E) return false;  // Too few.
+
+  return true;
+}
+
+
 /// getNumUses - This method computes the number of uses of this Value.  This
 /// is a linear time operation.  Use hasOneUse or hasNUses to check for specific
 /// values.