[LLVMdev] print the memory address computed by getelementptr

Eli Friedman eli.friedman at gmail.com
Mon Jul 25 14:43:55 PDT 2011


On Mon, Jul 25, 2011 at 2:32 PM, Jimborean Alexandra
<xinfinity_a at yahoo.com> wrote:
> Hi again,
> Thank you, your suggestion worked well. I was looking for a pointer to void
> actually. But it seems that I do not get the memory address when passing the
> value of the GEP instruction.
> For instance, when I print the address accessed by the second operand of the
> store instruction
>
> store %struct.linked* %tmp23.reload8, %struct.linked** %curr.037.reg2mem
> I obtain a memory address of the form
> 7fff29c28ac8
> But when I try to get the address stored in the GEP
> %tmp18 = getelementptr inbounds %struct.linked* %curr.025.reload, i64 0, i32
> 0
> I obtain
> 2084a10
> which is not the memory location I expect. Is this the computed memory
> location, or I did not access it correctly?

http://llvm.org/docs/GetElementPtr.html

-Eli



More information about the llvm-dev mailing list