<div dir="ltr"><pre><span style="font-family:tahoma,sans-serif"><font>On 24.09.2013, at 17:38, Eirini Psallida <<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">eirini.psallida at gmail.com</a>> wrote:

><i> Hi, 
</i>><i> i want to get the address in memory of an instruction pointer and use it as a key in my tables.
</i>><i> i iterate over the instructions in LLVM IR like this:
</i>><i> for (Module::iterator fi = Mod->begin(), fi_end = Mod->end(); fi != fi_end; ++fi) {
</i>><i>     for (inst_iterator I = inst_begin(fi), E = inst_end(fi); I != E; ++I) { 
</i>><i>             Instruction *ii = dyn_cast<Instruction>(&*I);
</i>><i>             errs() << &ii << "\n";
</i>><i>    }
</i>><i> 
</i>><i> but i get the same address for every instruction, eg 0xbfc979fc
</i>><i> Why is this happening and how can i get the rigth address?
</i>
> You're printing the address of a variable on the stack. Try removing the '&' before 'ii'.
<br></font></span></pre><pre><span style="font-family:tahoma,sans-serif"><font><font>B</font>ut then i will have the address of where 'ii' points to. This might not be unique<br></font></span></pre><pre><span style="font-family:tahoma,sans-serif"><font>if other instruction pointers point to the same instruction. I want the address of <br>
the instruction pointer that's why i used '&ii'.<br></font></span></pre><pre><span style="font-family:tahoma,sans-serif"><font>Eirini</font></span><br></pre></div>