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

Florian Hahn via llvm-dev llvm-dev at lists.llvm.org
Wed Jul 10 13:17:45 PDT 2019


Hi,

> On Jul 10, 2019, at 20:45, Scott Pakin via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> I'm looking for a "Hello, world" pass example that ideally has all of
> the following properties:
> 
>  1) Complete.  That is, it should have functional CMakeLists.txt,
>     etc. files.
> 
>  2) Out-of-source.  That is, it should build against a binary LLVM
>     installation.
> 
>  3) Modern.  That is, I don't want to use any deprecated APIs or
>     CMake macros.
> 
>  4) Clang-compatible.  That is, I'd like the pass to be able to run
>     directly from Clang instead of having to generate bitcode, run
>     opt on it, and then feed it back to Clang for linking.
> 
> Does such an example exist and if so, where can I find it?

http://www.cs.cornell.edu/~asampson/blog/llvm.html describes how to create an out-of-source pass (see 'Let’s Write a Pass’). I think it is for LLVM 3.8 though.

Cheers,
Florian


More information about the llvm-dev mailing list