<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">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.<div class=""><br class=""></div><div class="">-Chris<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Aug 27, 2016, at 2:11 PM, Donghyeon Lee via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">I'd write new transform pass related to some function optimization, and contribute it into LLVM. But <a href="http://llvm.org/docs/WritingAnLLVMPass.html" class="">Writing an LLVM Pass</a> was described only using as dynamic LLVM loadable modules (.so extensions).</div><div class=""><br class=""></div><div class="">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?</div></div>
_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></blockquote></div><br class=""></div></div></body></html>