[llvm-commits] CVS: llvm/lib/VMCore/Value.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Feb 23 08:51:24 PST 2005



Changes in directory llvm/lib/VMCore:

Value.cpp updated: 1.53 -> 1.54
---
Log message:

new method



---
Diffs of the changes:  (+13 -0)

 Value.cpp |   13 +++++++++++++
 1 files changed, 13 insertions(+)


Index: llvm/lib/VMCore/Value.cpp
diff -u llvm/lib/VMCore/Value.cpp:1.53 llvm/lib/VMCore/Value.cpp:1.54
--- llvm/lib/VMCore/Value.cpp:1.53	Fri Feb  4 19:37:58 2005
+++ llvm/lib/VMCore/Value.cpp	Wed Feb 23 10:51:11 2005
@@ -72,6 +72,19 @@
   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.






More information about the llvm-commits mailing list