<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Dear Jian,<br>
    <br>
    Can you be more specific about what you don't understand?  Do you
    not know how to write an LLVM pass that can be loaded into opt, or
    do you not understand the API that an LLVM pass uses to instrument
    code?<br>
    <br>
    In any event, make sure to read
    <a class="moz-txt-link-freetext" href="http://llvm.org/docs/WritingAnLLVMPass.html">http://llvm.org/docs/WritingAnLLVMPass.html</a>.  It describes how to
    write a skeleton LLVM pass.<br>
    <br>
    -- John T.<br>
    <br>
    On 7/15/11 4:42 PM, Jian Cai wrote:
    <blockquote
cite="mid:1310766156.74392.YahooMailClassic@web114212.mail.gq1.yahoo.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <table border="0" cellpadding="0" cellspacing="0">
        <tbody>
          <tr>
            <td style="font: inherit;" valign="top">
              <div id="yiv422548798">
                <table id="yiv422548798bodyDrftID" class="yiv422548798"
                  border="0" cellpadding="0" cellspacing="0">
                  <tbody>
                    <tr>
                      <td id="yiv422548798drftMsgContent"
                        style="font:inherit;font-family:arial;font-size:10pt;">
                        <div id="yiv422548798">
                          <table id="yiv422548798bodyDrftID"
                            class="yiv422548798" border="0"
                            cellpadding="0" cellspacing="0">
                            <tbody>
                              <tr>
                                <td id="yiv422548798drftMsgContent"
                                  style="font:inherit;font-family:arial;font-size:10pt;">
                                  <div id="yiv422548798">
                                    <table id="yiv422548798bodyDrftID"
                                      class="yiv422548798" border="0"
                                      cellpadding="0" cellspacing="0">
                                      <tbody>
                                        <tr>
                                          <td
                                            id="yiv422548798drftMsgContent"
style="font:inherit;font-family:arial;font-size:10pt;">Hi, 
                                            <div>
                                              <div>I am trying to write
                                                a pass and add it into
                                                the LLVM optimizer so to
                                                insert functions for
                                                optimization before and
                                                after every function
                                                call.</div>
                                              <div>For example, I create
                                                a test file test.c.
                                                There is  a function
                                                f1() just printing out
                                                "Print f1", which is
                                                called in the main
                                                function. That's all the
                                                test.c do. Now I want to
                                                insert optimazation
                                                function opt_begin()
                                                before f1() and
                                                opt_end() after by
                                                adding the command line
                                                of my pass in the
                                                compilation option of
                                                llvm-gcc. Does anyone
                                                 have any idea about how
                                                to implement this? I
                                                would really appreciate
                                                if anyone can help me
                                                out, since I was stuck
                                                by this question for
                                                really  a long time.<br>
                                              </div>
                                              <div><br>
                                              </div>
                                              <div>Jian</div>
                                              <div><br>
                                              </div>
                                            </div>
                                          </td>
                                        </tr>
                                      </tbody>
                                    </table>
                                  </div>
                                </td>
                              </tr>
                            </tbody>
                          </table>
                        </div>
                      </td>
                    </tr>
                  </tbody>
                </table>
              </div>
            </td>
          </tr>
        </tbody>
      </table>
      <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>
    <br>
  </body>
</html>