[llvm-dev] Looking for an out-of-source "Hello, world" LLVM/Clang pass example

Serge Guelton via llvm-dev llvm-dev at lists.llvm.org
Wed Jul 17 06:17:26 PDT 2019


This review https://reviews.llvm.org/D61446 tries hard to address your
needs: it makes it possible to register a pass withing clang/opt/bugpoint
with a dedicated cmake function call. The pass can then behave as a
loadable plugin or be linked statically to LLVM (depending on cmake
options), and the code can live out-of-tree, much like polly.

On Tue, Jul 16, 2019 at 12:01 AM Scott Pakin via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Andrzej,
>
> On 7/14/19 8:02 AM, Andrzej Warzynski wrote:
> > This is still very early stages, but you can be my guinea pig:
> >
> > https://github.com/banach-space/llvm-tutor
> >
> > It's a tutorial that I've been preparing recently and am hoping to
> > present somewhere at some point :-) I believe that it already covers 1),
> > 2) and 3). I haven't had the time to work on 4). It's based on LLVM-8
> > and includes a working CI set-up, so that you can be confident that it
> > works. If it doesn't, ping me - I'm keen on improving it.
>
> Cool, thanks.  I just started reading over that now.  I have a couple
> of questions already, if you don't mind:
>
> 1) I see you're building the pass with
>
>     add_library(lt-cc-static STATIC StaticCallCounter.cpp
> DynamicCallCounter.cpp)
>     add_library(lt-cc-shared MODULE StaticCallCounter.cpp
> DynamicCallCounter.cpp)
>
>   What's the reason for building a STATIC version?  Does any LLVM tool
>   make use of that?
>
>   Is add_library the preferred pass-building CMake macro these days,
>   as opposed to add_llvm_library or add_llvm_loadable_module?
>
> 2) How is the user supposed to install the generated files?  Neither
>    "make install" nor "cmake --target=install" seem to work.
>
> -- Scott
> _______________________________________________
> 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/20190717/ffd4ee84/attachment.html>


More information about the llvm-dev mailing list