[llvm-dev] Get arguments of a function (bitcast)

Mohammad Norouzi via llvm-dev llvm-dev at lists.llvm.org
Tue Jan 12 07:43:13 PST 2016


Hi All,

I need to get the list of arguments of a function which is bitcasted.

Here is the C code excerpt:

main()
{
 .....

  /* Get input samples */
  input_dsp(input, N, 1);

.....
}

and here is llvm ir for the code section:

%call = call i32 (i32*, i32, i32, ...)* bitcast (i32 (...)* @input_dsp to
i32 (i32*, i32, i32, ...)*)(i32* getelementptr inbounds ([256 x i32]*
@input, i32 0, i32 0), i32 256, i32 1)


When I use the ordinary method for getting arguments,

for (Function::ArgumentListType::iterator it =
f->getArgumentList().begin(); it != f->getArgumentList().end(); it++) {...}

i get a segmentation fault which i think i valid. But how can i get
arguments of *input_dsp* which are *input*, *N* and *1* in this case.

Best,
Mo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160112/9e651c09/attachment.html>


More information about the llvm-dev mailing list