Donghyeon Lee via llvm-dev
2016-Aug-27 21:11 UTC
[llvm-dev] Can I write LLVM pass using add_llvm_library, not add_llvm_loadable_module?
I'd write new transform pass related to some function optimization, and contribute it into LLVM. But Writing an LLVM Pass <http://llvm.org/docs/WritingAnLLVMPass.html> was described only using as dynamic LLVM loadable modules (.so extensions). I want to write LLVM pass using add_llvm_library, not add_llvm_loadable_module in CMakeLists.txt. Can I do it? If yes, how? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160828/a72b3e6b/attachment.html>
Chris Bieneman via llvm-dev
2016-Aug-29 23:25 UTC
[llvm-dev] Can I write LLVM pass using add_llvm_library, not add_llvm_loadable_module?
Yes you can put a pass in a static or shared library rather than a module. It largely depends on how you want to have it consumed. Using a loadable module is the least intrusive way to create an out-of-tree pass, so that is how the pass tutorial is written. If you use a static archive you’ll need to modify the build system to link your pass into all the tools you wish to use it from. There is very little technical difference between a shared library and a module, but the build system treats them differently because they have different impact on the dependency graph because a runtime loaded module does not need to exist in order to link binaries that depend on it. -Chris> On Aug 27, 2016, at 2:11 PM, Donghyeon Lee via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > I'd write new transform pass related to some function optimization, and contribute it into LLVM. But Writing an LLVM Pass <http://llvm.org/docs/WritingAnLLVMPass.html> was described only using as dynamic LLVM loadable modules (.so extensions). > > I want to write LLVM pass using add_llvm_library, not add_llvm_loadable_module in CMakeLists.txt. Can I do it? If yes, how? > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160829/daca5c0c/attachment.html>
Michael Kruse via llvm-dev
2016-Aug-30 07:58 UTC
[llvm-dev] Can I write LLVM pass using add_llvm_library, not add_llvm_loadable_module?
Polly (polly.llvm.org) creates both, a loadable module, and if built in the tools/polly directory, by default also linked to opt/clang. You might look into Polly's source for how it is done (primarily lib/CMakeLists.txt and lib/Polly.cpp) Michael 2016-08-27 23:11 GMT+02:00 Donghyeon Lee via llvm-dev <llvm-dev at lists.llvm.org>:> I'd write new transform pass related to some function optimization, and > contribute it into LLVM. But Writing an LLVM Pass was described only using > as dynamic LLVM loadable modules (.so extensions). > > I want to write LLVM pass using add_llvm_library, not > add_llvm_loadable_module in CMakeLists.txt. Can I do it? If yes, how? > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >
Andrey Bokhanko via llvm-dev
2016-Aug-30 19:00 UTC
[llvm-dev] Can I write LLVM pass using add_llvm_library, not add_llvm_loadable_module?
You probably don't want to add a new directory? In this case, the easiest would be to take an existing file and implement by analogy. /lib/Transforms/Scalar/ConstantProp.cpp is a good example. The relevant lines are 53-62. Note that createConstantPropagation function is called outside -- grep it and add a call to your own pass creator. Also, you should add your file to relevant CMakeLists.txt. Yours, Andrey On Sun, Aug 28, 2016 at 12:11 AM, Donghyeon Lee via llvm-dev < llvm-dev at lists.llvm.org> wrote:> I'd write new transform pass related to some function optimization, and > contribute it into LLVM. But Writing an LLVM Pass > <http://llvm.org/docs/WritingAnLLVMPass.html> was described only using as > dynamic LLVM loadable modules (.so extensions). > > I want to write LLVM pass using add_llvm_library, not > add_llvm_loadable_module in CMakeLists.txt. Can I do it? If yes, how? > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160830/cba017f6/attachment.html>