<div dir="auto">Thanks a lot Sam,<div dir="auto">I'll try to follow your suggestion and see if it works :)</div><div dir="auto"><br></div><div dir="auto">Thanks again</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Nov 21, 2019, 13:36 Sam Elliott <<a href="mailto:selliott@lowrisc.org">selliott@lowrisc.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Pointer arithmetic in LLVM is done using the getelementptr (GEP) instruction.<br>
<br>
There’s a document which explains them [1], but I found this tutorial [2] from EuroLLVM 2019 was the first resource to explain it in a way I understood.<br>
<br>
I hope this helps!<br>
<br>
Sam<br>
<br>
[1]: <a href="https://llvm.org/docs/GetElementPtr.html" rel="noreferrer noreferrer" target="_blank">https://llvm.org/docs/GetElementPtr.html</a><br>
[2]: <a href="https://www.youtube.com/watch?v=m8G_S5LwlTo" rel="noreferrer noreferrer" target="_blank">https://www.youtube.com/watch?v=m8G_S5LwlTo</a><br>
<br>
> On 20 Nov 2019, at 12:24 pm, Alberto Barbaro via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" rel="noreferrer">llvm-dev@lists.llvm.org</a>> wrote:<br>
> <br>
> Hi all,<br>
> I have a global array declared as: table = internal constant [8 x [256 x i32]] ...<br>
> <br>
> At the moment I'm able to get the reference to table using Constant* g_var = cast<GlobalVariable>(I.getOperand(0))->getInitializer(); ( please consider I to be a GetElementPtrInst object ).<br>
> <br>
> Now I would like to understand how to get the address of table[2][3], for instance, considering that I have the g_var variable.<br>
> <br>
> In addition, I was able to access to the value table[2][3] so for me would be also OK to have the address of that specific value once I already have access to the value.<br>
> <br>
> Thanks<br>
> Alberto<br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank" rel="noreferrer">llvm-dev@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br>
--<br>
Sam Elliott<br>
Software Developer - LLVM<br>
lowRISC CIC<br>
--<br>
<br>
</blockquote></div>