<div dir="ltr"><div style="font-family:tahoma,sans-serif" class="gmail_default"><font color="#000000" size="3" face="Times New Roman">

</font><p style="margin:0in 0in 10pt" class="MsoNormal"><span lang="EN"><font color="#000000" size="3" face="Times New Roman">Thank you for the
very useful guidance. It helped me. I understood </font><a href="http://llvm.org/docs/WritingAnLLVMPass.html"><font color="#0000ff" size="3" face="Times New Roman">http://llvm.org/docs/WritingAnLLVMPass.html</font></a><font color="#000000" size="3" face="Times New Roman">
and </font><a href="http://llvm.org/docs/CMake.html#cmake-out-of-source-pass"><font color="#0000ff" size="3" face="Times New Roman">http://llvm.org/docs/CMake.html#cmake-out-of-source-pass</font></a><font size="3"><font color="#000000"><font face="Times New Roman">
and applied to my pass. But I have another problem. After any change in pass, I
must build LLVM again? It takes a long time. Is there a way to build only pass?</font></font></font></span></p><font color="#000000" size="3" face="Times New Roman">

</font><p style="margin:0in 0in 10pt" class="MsoNormal"><span lang="EN"><font color="#000000" size="3" face="Times New Roman">Thanks again.</font></span></p><font color="#000000" size="3" face="Times New Roman">

​</font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 7, 2014 at 2:47 AM, John Criswell <span dir="ltr"><<a href="mailto:jtcriswel@gmail.com" target="_blank">jtcriswel@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <div>Dear Zahra,<br>
      <br>
      To reorder basic blocks, all you need to do is to write an LLVM
      pass that changes the order that the block appear within the list
      of basic blocks that belong to the function.  The only block you
      can't reorder is the entry block which, I think, always needs to
      be the first basic block in the list.<br>
      <br>
      The first thing you should do is read the document "Writing an
      LLVM Pass" (<a href="http://llvm.org/docs/WritingAnLLVMPass.html" target="_blank">http://llvm.org/docs/WritingAnLLVMPass.html</a>).  You
      should also read the "LLVM Programmer's Manual"
      (<a href="http://llvm.org/docs/ProgrammersManual.html" target="_blank">http://llvm.org/docs/ProgrammersManual.html</a>).  To look up
      specific information on LLVM classes, use doxygen
      (<a href="http://llvm.org/doxygen/hierarchy.html" target="_blank">http://llvm.org/doxygen/hierarchy.html</a>).<br>
      <br>
      The first coding task would be to write a skeleton FunctionPass
      and run it through the opt program.  After that, you should be
      able to add code to your FunctionPass to reorder the basic blocks
      within a function.<br>
      <br>
      Regards,<br>
      <br>
      John Criswell<div><div class="h5"><br>
      <br>
      <br>
      On 10/5/14, 11:34 AM, Zahra fatehi marj wrote:<br>
    </div></div></div>
    <blockquote type="cite"><div><div class="h5">
      <div dir="ltr">
        <div style="font-family:tahoma,sans-serif" class="gmail_default">​
          Hi.</div>
        <div style="font-family:tahoma,sans-serif" class="gmail_default">I
          want to change order of code basic blocks in memory. I visited
          "<a href="http://llvm.org/docs/ExtendingLLVM.html" target="_blank">http://llvm.org/docs/ExtendingLLVM.html</a>"
          page and it advised me to ask it before any effort.</div>
        <div style="font-family:tahoma,sans-serif" class="gmail_default">What
          parts of LLVM help me and how? I am a newbie on LLVM.</div>
        <div style="font-family:tahoma,sans-serif" class="gmail_default">Thanks.</div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><pre>_______________________________________________
LLVM Developers mailing list
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><span class="HOEnZb"><font color="#888888">
</font></span></pre><span class="HOEnZb"><font color="#888888">
    </font></span></blockquote><span class="HOEnZb"><font color="#888888">
    <br>
    <br>
    <pre cols="72">-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
<a href="http://www.cs.rochester.edu/u/criswell" target="_blank">http://www.cs.rochester.edu/u/criswell</a></pre>
  </font></span></div>

</blockquote></div><br></div>