[llvm-commits] [llvm] r51946 - in /llvm/trunk: include/llvm/Support/CallSite.h lib/VMCore/Instructions.cpp
Chris Lattner
clattner at apple.com
Wed Jun 4 10:00:30 PDT 2008
On Jun 4, 2008, at 9:31 AM, Matthijs Kooijman wrote:
> 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.
Hey Matthijs,
This is nice, but I think the method should be marked 'const' and take
a const Value*.
-Chris
>
>
> 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
> //
> =
> =
> =
> ----------------------------------------------------------------------=
> ==//
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list