[LLVMdev] Question about function arguments
Duncan Sands
baldrick at free.fr
Wed Jul 21 23:28:21 PDT 2010
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.
More information about the llvm-dev
mailing list