<div dir="ltr"><br><div>I am a little confused. Can anyone explain me in short? The definition of `func` is as below:</div><div><br></div><div><div>   void func(int var_addr) {</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">     </span>printf("[instr]: Global variable at address 0x%x\n", var_addr);</div><div>   }</div></div><div><br></div><div>I want to insert a call to `func` just before the store instruction with the address `x` of global variable `g` as parameter.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 28 April 2017 at 14:34, Tim Northover <span dir="ltr"><<a href="mailto:t.p.northover@gmail.com" target="_blank">t.p.northover@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 28 April 2017 at 14:32, Jonathan Roelofs via llvm-dev<br>
<<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
> You need a load instruction since your function takes an i32, not an<br>
> i32*.... A global's value in llvm is its address, not the numeric data it<br>
> contains.<br>
<br>
I suspect he actually wants to make his function take an "i8*" and<br>
bitcast his pointer to that type before calling it. [*]<br>
<br>
Tim.<br>
<br>
[*] Keeping it as an i32/i64 and using ptrtoint instead of bitcast<br>
would also work, but be less portable and elegant.<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><span><div><div dir="ltr"><p>Thanks & Regards,</p>
<div>Dipanjan</div></div></div></span></div></div>
</div>