[llvm-commits] [llvm] r51946 - in /llvm/trunk: include/llvm/Support/CallSite.h lib/VMCore/Instructions.cpp

Matthijs Kooijman matthijs at stdin.nl
Wed Jun 4 09:31:12 PDT 2008


Author: matthijs
Date: Wed Jun  4 11:31:12 2008
New Revision: 51946

URL: http://llvm.org/viewvc/llvm-project?rev=51946&view=rev
Log:
Add CallSite::hasArgument to allow for seeing if a call passes a certain value as an argument quickly.

Modified:
    llvm/trunk/include/llvm/Support/CallSite.h
    llvm/trunk/lib/VMCore/Instructions.cpp

Modified: llvm/trunk/include/llvm/Support/CallSite.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CallSite.h?rev=51946&r1=51945&r2=51946&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/CallSite.h (original)
+++ llvm/trunk/include/llvm/Support/CallSite.h Wed Jun  4 11:31:12 2008
@@ -129,6 +129,10 @@
     else
       I->setOperand(ArgNo+3, newVal); // Skip Function, BB, BB
   }
+  
+  /// hasArgument - Returns true if this CallSite passes the given Value* as an
+  /// argument to the called function.
+  bool hasArgument(Value *Arg);
 
   /// arg_iterator - The type of iterator to use when looping over actual
   /// arguments at this call site...

Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=51946&r1=51945&r2=51946&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Wed Jun  4 11:31:12 2008
@@ -91,6 +91,13 @@
     cast<InvokeInst>(I)->setDoesNotThrow(doesNotThrow);
 }
 
+bool CallSite::hasArgument(Value *Arg) {
+  for (arg_iterator AI = this->arg_begin(), E = this->arg_end(); AI != E; ++AI)
+    if (AI->get() == Arg)
+      return true;
+  return false;
+}
+
 //===----------------------------------------------------------------------===//
 //                            TerminatorInst Class
 //===----------------------------------------------------------------------===//





More information about the llvm-commits mailing list