[LLVMdev] Taking the address of an array?
Kenneth Uildriks
kennethuil at gmail.com
Fri Feb 12 17:54:51 PST 2010
On Fri, Feb 12, 2010 at 7:41 PM, Patrick Alexander Simmons
<simmon12 at cs.uiuc.edu> wrote:
> I read this before posting; however, that article says that the first
> operand to this instruction must be a pointer type. The type I have is
> [16 x i8*], not [16 x i8*]*.
>
> --Patrick
You can not take the address of anything that lives in a virtual
register. You must store it to memory through some pointer, and then
use that pointer (pass it to GEP, pass it to a C function, whatever).
alloca will allocate that memory for you in the function's local
stack. It will return a pointer - store the array through that
pointer, pass the pointer to GEP, then pass the resulting pointer to
the C function.
More information about the llvm-dev
mailing list