[llvm-dev] llvm pass

Serge Guelton via llvm-dev llvm-dev at lists.llvm.org
Mon May 27 01:35:13 PDT 2019


> 1) Is building a custom LLVM pass out-of-source not recommended?

>From my experience, it's possible but slightly harder to setup. There's an
on-going review

    https://reviews.llvm.org/D61446

to make it easier to add out-of tree passes and register them in
clang/opt/bugpoint




On Sat, May 25, 2019 at 9:30 AM Kihong Heo via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hi list,
>
> I have several questions about LLVM pass.
>
> 1) Is building a custom LLVM pass out-of-source not recommended?
> The official document only contains instructions about in-source build (
> http://llvm.org/docs/WritingAnLLVMPass.html).
>
> 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:
>
> $ opt-3.9 -load ../build/hello/LLVMHelloWorld.so -helloworld hello.bc -S >
> /dev/null
> Hello: main
>
> $ opt-4.0 -load ../build/hello/LLVMHelloWorld.so -helloworld hello.bc -S >
> /dev/null
> opt-4.0: Unknown command line argument '-helloworld'.  Try: 'opt-4.0 -help'
> opt-4.0: Did you mean '-loops’?
>
>
> 3) I tried to invoke custom LLVM passes from clang rather than opt. I
> followed instructions from several articles like
> https://www.cs.cornell.edu/~asampson/blog/llvm.html
>
> https://medium.com/@mshockwave/writing-llvm-pass-in-2018-part-iii-d44cd0c2c354
> and registered the pass to clang’s workflow with legacy pass manger. But
> it raises segmentation fault errors.
> What is a recommended way to register custom passes to clang directly?
>
> Thanks in advance.
>
> Best,
> Kihong
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://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/20190527/bcc26d27/attachment.html>


More information about the llvm-dev mailing list