search for: intfunc

Displaying 1 result from an estimated 1 matches for "intfunc".

Did you mean: initfunc
2008 Oct 08
1
[LLVMdev] How can I create CallInst with a pointer to function
Hi I mean when I have in my program pointer to a function how should I build IR to call the function by the pointer? Or how can I create llvm::Function with a pointer to a function? I want to have something like this: int factorial (int n) { return n==0 ? 1 : n*factorial(n-1); } typedef int (*intFunc) (int); intFunc fptr = factorial; Value * N = ConstantInt::get(Type::Int32Ty,10); irb.CreateCall(fptr,N); OR Function *F = Function::Create(intFuncTy,Function::ExternalLinkage,fptr,myModule); irb.CreateCall(F,N); Thanks