<div dir="ltr">> 1) Is building a custom LLVM pass out-of-source not recommended?<div><br></div><div>From my experience, it's possible but slightly harder to setup. There's an on-going review</div><div><br></div><div>    <a href="https://reviews.llvm.org/D61446">https://reviews.llvm.org/D61446</a></div><div><br></div><div>to make it easier to add out-of tree passes and register them in clang/opt/bugpoint</div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, May 25, 2019 at 9:30 AM Kihong Heo via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word">Hi list,<div><br></div><div>I have several questions about LLVM pass.</div><div><br></div><div>1) Is building a custom LLVM pass out-of-source not recommended?</div><div>The official document only contains instructions about in-source build (<a href="http://llvm.org/docs/WritingAnLLVMPass.html" target="_blank">http://llvm.org/docs/WritingAnLLVMPass.html</a>).</div><div><br></div><div>2) opt (ver >= 4) with custom pass libraries does not work as before. When I have a simple custom LLVM pass called “helloworld", loading the library works well with 3.9 but opt-4.0 cannot not find the pass:</div><div><br></div><div><div>$ opt-3.9 -load ../build/hello/LLVMHelloWorld.so -helloworld hello.bc -S > /dev/null</div><div>Hello: main</div><div><br></div><div>$ opt-4.0 -load ../build/hello/LLVMHelloWorld.so -helloworld hello.bc -S > /dev/null</div><div>opt-4.0: Unknown command line argument '-helloworld'.  Try: 'opt-4.0 -help'</div><div>opt-4.0: Did you mean '-loops’?</div></div><div><br></div><div><br></div><div>3) I tried to invoke custom LLVM passes from clang rather than opt. I followed instructions from several articles like</div><div><a href="https://www.cs.cornell.edu/~asampson/blog/llvm.html" target="_blank">https://www.cs.cornell.edu/~asampson/blog/llvm.html</a></div><div><a href="https://medium.com/@mshockwave/writing-llvm-pass-in-2018-part-iii-d44cd0c2c354" target="_blank">https://medium.com/@mshockwave/writing-llvm-pass-in-2018-part-iii-d44cd0c2c354</a></div><div>and registered the pass to clang’s workflow with legacy pass manger. But it raises segmentation fault errors.</div><div>What is a recommended way to register custom passes to clang directly?</div><div><br></div><div>Thanks in advance.</div><div><br></div><div>Best,</div><div>Kihong</div></div>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>