[LLVMdev] calling c-function with a vector
Jörg Werner
schreibubi at gmail.com
Thu Nov 25 14:09:45 PST 2010
Hi all,
I have the following problem: I want to call a function from llvm
(tryf in the following) which takes a vector as an argument. The
function tryf is a c-function and should output the whole vector. But
I only get 0.0. Looks like a problem with how the arguments are
passed. I havn't found anything in the docs about how vectors are
passed. Any help would be appreciated.
The llvm-code looks like this:
declare void @tryf(<4 x float>)
define i32 @main() {
entry:
call void @tryf(<4 x float> <float 0x3FFB0A3D40000000, float
6.250000e+00, float 0x3F847AE160000000, float 1.600000e+01>)
ret i32 3
}
The C-function is defined like this:
#include <stdio.h>
void tryf(float *a1)
{
fprintf(stderr, "%f ",*a1);
a1++;
fprintf(stderr, "%f ",*a1);
a1++;
fprintf(stderr, "%f ",*a1);
a1++;
fprintf(stderr, "%f\n",*a1);
}
Thanks & Regards,
Jörg
--
http://www.meet-the-werners.de
More information about the llvm-dev
mailing list