[LLVMdev] Passing an array to an external function
rmann at latencyzero.com
Sun Jan 27 00:46:10 PST 2013
On Jan 26, 2013, at 19:24 , SArora <silkyar at umich.edu> wrote:
> Hi all,
> I am new to LLVM, and I am learning how to use LLVM for profiling. I need to
> pass an array to an external method, and insert a call instruction to the
> method in the code.
> After reading a few source files, I've tried using GetElementPtrInst to pass
> an array, but it fails at llvm::GetElementPtrInst::hasAllZeroIndices() const
> + 0
I'm fairly new to LLVM myself, but I'm not sure why you're using GEP at all, let alone with two indices. Does it work to just pass the array value? If not, try using GEP with a single index of 0. The second index would try to index off of element 1 (the second), and then the third element of that, which is an int, and doesn't have sub elements.
More information about the llvm-dev