[llvm-dev] Get arguments of a function (bitcast)
Manuel Jacob via llvm-dev
llvm-dev at lists.llvm.org
Tue Jan 12 08:36:05 PST 2016
Hi Mo,
Have a look at the Value::stripPointerCasts() method [1] to strip all
bitcasts from the function pointer.
-Manuel
[1]
http://llvm.org/docs/doxygen/html/classllvm_1_1Value.html#a38ea12c04523d63adda732b9c5d6da0a
On 2016-01-12 16:43, Mohammad Norouzi via llvm-dev wrote:
> 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
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
More information about the llvm-dev
mailing list