<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 4/18/13 9:56 AM, Jun Koi wrote:<br>
    </div>
    <blockquote
cite="mid:CA+g7VZ0gJ-cS7XSgUGwQjMwDrZGVCTUp0c7u+-CL4x=gA+hT5w@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <div dir="ltr">
        <div>
          <div>
            <div>hi,<br>
              <br>
              i am writing a simple LLVM pass to analyze the Store
              instruction.<br>
              my pass derives from InstVisitor class, and the method to
              handle Store instruction is like this:<br>
              <br>
              void MyPass::visitStoreInst(StoreInst &I) {<br>
              ...<br>
              }<br>
              <br>
              It is pretty simple to handle Store. however, in on test i
              got an instruction like below:<br>
              <br>
                store i8 %tmp5, i8* inttoptr (i32 301959828 to i8*)<br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    The inttoptr used here is a Constant Expression
    (llvm::ConstantExpr).  You'll need to take the operand to the store,
    cast it to llvm::ConstantExpr, and then examine the opcode and
    operands of the constant expression.<br>
    <br>
    The ConstantExpr class is documented at
    <a class="moz-txt-link-freetext" href="http://llvm.org/doxygen/classllvm_1_1ConstantExpr.html">http://llvm.org/doxygen/classllvm_1_1ConstantExpr.html</a> and is
    described in the LLVM Language Reference Manual.<br>
    <br>
    -- John T.<br>
    <br>
    <blockquote
cite="mid:CA+g7VZ0gJ-cS7XSgUGwQjMwDrZGVCTUp0c7u+-CL4x=gA+hT5w@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div><br>
            </div>
            the second operand is "i8* inttoptr (i32 301959828 to i8*)",
            and i have no idea how i can retrieve the address 301959828,
            given the StoreInst argument of visitStoreInst.<br>
            <br>
          </div>
          i am looking in the the code of LLVM, but still fail to see
          how to extract this information.<br>
          <br>
        </div>
        any suggestion is very appreciated. i am really struggling here
        now ...<br>
        <br>
        thanks so much.<br>
        Jun<br>
        <div>
          <div>
            <div><br>
            </div>
          </div>
        </div>
      </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>