<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 9/24/13 10:38 AM, Eirini Psallida
      wrote:<br>
    </div>
    <blockquote
cite="mid:CANiXDLWy4HHnUZ9tOcsVtzot7Vf4+Pf2RYJeaLv-mz90ZeFAdg@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>
                <div>
                  <div>Hi, <br>
                    i want to get the address in memory of an
                    instruction pointer and use it as a key in my
                    tables.<br>
                  </div>
                  <div>i iterate over the instructions in LLVM IR like
                    this:<br>
                    for (Module::iterator fi = Mod->begin(), fi_end =
                    Mod->end(); fi != fi_end; ++fi) {<br>
                        for (inst_iterator I = inst_begin(fi), E =
                    inst_end(fi); I != E; ++I) { <br>
                  </div>
                  <div>            Instruction *ii =
                    dyn_cast<Instruction>(&*I);<br>
                                errs() << &ii << "\n";<br>
                       }<br>
                  </div>
                  <div><br>
                  </div>
                </div>
              </div>
              but i get the same address for every instruction, eg
              0xbfc979fc<br>
            </div>
            Why is this happening and how can i get the rigth address?<br>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    You're getting the same address because you're printing the address
    of the variable that holds the pointer to the instruction (as
    opposed to the pointer itself).  In other words, you want to print
    ii and not &ii.<br>
    <br>
    -- John T.<br>
    <br>
    <blockquote
cite="mid:CANiXDLWy4HHnUZ9tOcsVtzot7Vf4+Pf2RYJeaLv-mz90ZeFAdg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div><br>
          </div>
          Thanks, <br>
          <br>
        </div>
        Eirini<br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>