[llvm-dev] How to split module into several ones

Aliaksei Zasenka via llvm-dev llvm-dev at lists.llvm.org
Thu Nov 17 01:37:07 PST 2016


Hi John,
Thanks for your answer.

The CallGraph pass did the work for me. But since I actually have several
modules and my toolchain looked like

llvm-link
<CallGraph extraction pass>
opt
llc

 I've found that llvm-lto is great for doing all the work: greedy linkage,
optimization and further MC generation.
Here the command line I'm using for that:
llvm-lto -exported-symbol=main -save-merged-module -filetype=asm <or obj>
-o %t2 %t1
(I've attached corresponding llvm-lit test.)

Now I'm wondering if there is any possibility to use LTO within the linker
like ld (mingw) to build a dynamic library from my IR code?

Best regards,
Alexey Zasenko


2016-10-28 16:33 GMT+03:00 John Criswell <jtcriswel at gmail.com>:

> On 10/27/16 11:18 AM, Aliaksei Zasenka via llvm-dev wrote:
>
> Hi all,
> Can anyone give me advice about an appropriate way for extracting number
> of functions from module recursively (starting from entry point). Actually
> it may be more than one entry point so all dependent functions and global
> values must be extracted.
>
> I've tried llvm-extract tool but it can't do work recursively. Maybe it
> would be good to write some Call Graph pass or something. Any thoughts?
>
>
> I thought llvm-extract conservatively extracted anything that was relevant
> to what it was asked to extract.
>
> In any event, if you need a call graph analysis, there are two call graph
> passes available for LLVM.
>
> The first is the CallGraph pass that comes in the LLVM source tree.  It is
> very conservative with function pointers, but its results are
> conservatively correct.
>
> The second is the CallGraph analysis within DSA.  You should be able to
> find a copy for LLVM 3.7 or LLVM 3.8 here (https://github.com/
> jtcriswell/safecode-llvm37) and here (https://github.com/
> jtcriswell/llvm-dsa).
>
> Regards,
>
> John Criswell
>
>
>
> Thanks in advance,
> Alexey Zasenko
>
>
> _______________________________________________
> LLVM Developers mailing listllvm-dev at lists.llvm.orghttp://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
>
> --
> 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/20161117/9e28399a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: src1.ll
Type: application/octet-stream
Size: 1117 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161117/9e28399a/attachment.obj>


More information about the llvm-dev mailing list