[LLVMdev] Referring to an argument in another function

Scott Ricketts sricketts at maxentric.com
Fri Jun 19 14:06:56 PDT 2009

On Thu, Jun 18, 2009 at 12:41 PM, Frits van Bommel<fvbommel at wxs.nl> wrote:
> You want to look at the operands of the call/invoke/free instruction, not the
> arguments of the function being called.
> So if you're sure it's a call or invoke (not a 'free' instruction), try
> something like this:
> #include "llvm/Support/CallSite.h"
> // ...
>         CallSite CS(&I);
>         CallSite::arg_iterator ait = CS.arg_begin(), aend = CS.arg_end();
>>       if (ait) {
> You want
>         if (ait != aend) {
> here.


CallSite is what I needed. I ended up getting P with CS.getArgument(0)
instead of an arg_iterator, but only because I first check that it is
an externally linked call to free with 1 argument.


More information about the llvm-dev mailing list