[llvm-commits] [llvm] r47249 - /llvm/trunk/include/llvm/Support/CallSite.h

Owen Anderson resistor at mac.com
Sun Feb 17 16:10:55 PST 2008


Author: resistor
Date: Sun Feb 17 18:10:55 2008
New Revision: 47249

URL: http://llvm.org/viewvc/llvm-project?rev=47249&view=rev
Log:
Add support for setting parameters to CallSite.

Modified:
    llvm/trunk/include/llvm/Support/CallSite.h

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

==============================================================================
--- llvm/trunk/include/llvm/Support/CallSite.h (original)
+++ llvm/trunk/include/llvm/Support/CallSite.h Sun Feb 17 18:10:55 2008
@@ -114,6 +114,15 @@
     return *(arg_begin()+ArgNo);
   }
 
+  void setArgument(unsigned ArgNo, Value* newVal) {
+    assert(I && "Not a call or invoke instruction!");
+    assert(arg_begin() + ArgNo < arg_end() && "Argument # out of range!");
+    if (I->getOpcode() == Instruction::Call)
+      I->setOperand(ArgNo+1, newVal); // Skip Function
+    else
+      I->setOperand(ArgNo+3, newVal); // Skip Function, BB, BB
+  }
+
   /// arg_iterator - The type of iterator to use when looping over actual
   /// arguments at this call site...
   typedef User::op_iterator arg_iterator;





More information about the llvm-commits mailing list