John Criswell via llvm-dev
2016-Oct-28 13:33 UTC
[llvm-dev] How to split module into several ones
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 list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-- John Criswell Assistant Professor Department of Computer Science, University of Rochester http://www.cs.rochester.edu/u/criswell -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161028/7d454df3/attachment.html>
Teresa Johnson via llvm-dev
2016-Nov-17 14:29 UTC
[llvm-dev] How to split module into several ones
On Thu, Nov 17, 2016 at 1:37 AM, Aliaksei Zasenka via llvm-dev < llvm-dev at lists.llvm.org> wrote:> 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? >What is your ld version? The Gold ld can invoke LLVM's gold-plugin when given bitcode input files, which will perform LTO. However, while the GNU ld recently gained the ability to invoke LLVM's gold-plugin to do this for bitcode, it is not a configuration we test, so I'd recommend Gold ld. Also, LLVM's lld has support for bitcode inputs and will also invoke LTO. For the gold plugin, see http://llvm.org/docs/GoldPlugin.html for ensuring it is configured properly. Teresa> 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 >> >> > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-- Teresa Johnson | Software Engineer | tejohnson at google.com | 408-460-2413 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161117/430ac29e/attachment-0001.html>