Frank Winter
2013-May-20 20:20 UTC
[LLVMdev] module passes that eliminate unused global symbols
My module contains one function that calls a handful of functions in another module (which contains a huge collection of functions). The goal is to make the module 'self-contained', i.e. no calls across module boundaries, and as minimal as possible, i.e. it does not contain any function which is not called directly or indirectly from the original function. So, I linked in the callee module to the caller module and ran the internalize pass to filter/mark the non-external global symbols. Is this a good first step towards the goal? How can I eliminate unused global symbols or make the module minimal (with the existing (trunk) passes)? Ideally only the (directly or indirectly) referenced symbols survive. Is this possible or do I need to develop such passes? Frank
Justin Holewinski
2013-May-20 21:09 UTC
[LLVMdev] module passes that eliminate unused global symbols
Internalize and GlobalDCE should be what you need. On Mon, May 20, 2013 at 4:20 PM, Frank Winter <fwinter at jlab.org> wrote:> My module contains one function that calls a handful of functions in > another module (which contains a huge collection of functions). The goal is > to make the module 'self-contained', i.e. no calls across module > boundaries, and as minimal as possible, i.e. it does not contain any > function which is not called directly or indirectly from the original > function. So, I linked in the callee module to the caller module and ran > the internalize pass to filter/mark the non-external global symbols. Is > this a good first step towards the goal? How can I eliminate unused global > symbols or make the module minimal (with the existing (trunk) passes)? > Ideally only the (directly or indirectly) referenced symbols survive. Is > this possible or do I need to develop such passes? > > Frank > > ______________________________**_________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/**mailman/listinfo/llvmdev<http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev> >-- Thanks, Justin Holewinski -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130520/91b5b625/attachment.html>
Sam Parker
2013-May-20 21:59 UTC
[LLVMdev] module passes that eliminate unused global symbols
I compile my library to bytecode and then declare all my functions as linkonce ( http://llvm.org/docs/LangRef.html#linkage-types) and then use llvm-link to produce a minimal module, which works pretty well for me. Regards, Sam On 20/05/13 21:20, Frank Winter wrote:> My module contains one function that calls a handful of functions in > another module (which contains a huge collection of functions). The > goal is to make the module 'self-contained', i.e. no calls across > module boundaries, and as minimal as possible, i.e. it does not > contain any function which is not called directly or indirectly from > the original function. So, I linked in the callee module to the caller > module and ran the internalize pass to filter/mark the non-external > global symbols. Is this a good first step towards the goal? How can I > eliminate unused global symbols or make the module minimal (with the > existing (trunk) passes)? Ideally only the (directly or indirectly) > referenced symbols survive. Is this possible or do I need to develop > such passes? > > Frank > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130520/70ac0f6c/attachment.html>