[LLVMdev] extending LLVM - basic block reordering

Zahra Marj zahrafatehimarj at gmail.com
Sun Oct 26 02:14:22 PDT 2014


Thank you for the very useful guidance. It helped me. I understood
http://llvm.org/docs/WritingAnLLVMPass.html and
http://llvm.org/docs/CMake.html#cmake-out-of-source-pass 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?

Thanks again.
​

On Tue, Oct 7, 2014 at 2:47 AM, John Criswell <jtcriswel at gmail.com> wrote:

>  Dear Zahra,
>
> 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.
>
> The first thing you should do is read the document "Writing an LLVM Pass" (
> http://llvm.org/docs/WritingAnLLVMPass.html).  You should also read the
> "LLVM Programmer's Manual" (http://llvm.org/docs/ProgrammersManual.html).
> To look up specific information on LLVM classes, use doxygen (
> http://llvm.org/doxygen/hierarchy.html).
>
> 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.
>
> Regards,
>
> John Criswell
>
>
>
> On 10/5/14, 11:34 AM, Zahra fatehi marj wrote:
>
>  ​ Hi.
> I want to change order of code basic blocks in memory. I visited "
> http://llvm.org/docs/ExtendingLLVM.html" page and it advised me to ask it
> before any effort.
> What parts of LLVM help me and how? I am a newbie on LLVM.
> Thanks.
>
>
> _______________________________________________
> LLVM Developers mailing listLLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.eduhttp://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
>
> --
> John Criswell
> Assistant Professor
> Department of Computer Science, University of Rochesterhttp://www.cs.rochester.edu/u/criswell
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141026/4ecda10a/attachment.html>


More information about the llvm-dev mailing list