[LLVMdev] Question about function arguments

Hemanth Murthy hm2474 at columbia.edu
Thu Jul 22 00:17:13 PDT 2010


Hi Duncan,

Thanks for the clarification. My doubt is to know how I can extract the
values contained in the arguments from LLVM IR.

Thanks,
Hemanth

On Thu, Jul 22, 2010 at 2:28 AM, Duncan Sands <baldrick at free.fr> wrote:

> Hi Hemanth,
>
> > I was wondering how I could determine the values of function arguments
> > using the iterators defined in Function.cpp.
>
> are you sure you aren't confusing values and names?  In something like
> this
>    int foo(int a, int b)
> there are names "a" and "b".  To make it easier for humans to read LLVM
> IR, most front-ends will use the same names for the function arguments
> in the LLVM IR.  But names are entirely optional, and everything works
> fine if all function arguments are nameless.  So in general you can't hope
> to extract "a" and "b" from the LLVM IR.
>
> What do you want the names for?  They aren't needed to use and manipulate
> arguments.
>
> > This piece of code works if 'module' contains the definition of function
> > foo. Otherwise, I just get blanks even though the number returned by
> > arg_size() is two.
>
> No names :)
>
> Ciao,
>
> Duncan.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>



-- 

Cheers,
Hemanth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100722/7c0554e1/attachment.html>


More information about the llvm-dev mailing list