[llvm-dev] Can I write LLVM pass using add_llvm_library, not add_llvm_loadable_module?

Chris Bieneman via llvm-dev llvm-dev at lists.llvm.org
Mon Aug 29 16:25:25 PDT 2016


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>


More information about the llvm-dev mailing list