[LLVMdev] Fwd: LLVM Help

Zahra Marj zahrafatehimarj at gmail.com
Fri Nov 7 23:50:59 PST 2014


very simple and good commands :

<create basic_block_pass.cpp with pass name myPass in any location>

$ clang++ -c basic_block_pass.cpp `llvm-config --cxxflags`
$ clang++ -shared -o pass.so basic_block_pass.o `llvm-config --ldflags`
$ opt -load ./pass.so -myPass < hello.bc > /dev/null
link :
http://stackoverflow.com/questions/22007458/how-to-create-you-own-pass-in-llvm?rq=1
​

On Sat, Nov 8, 2014 at 10:03 AM, Dan Liew <dan at su-root.co.uk> wrote:

> > It ought to be possible to compile your own pass to a .so file and
> > load it into opt dynamically. There's some kind of documentation at
> > http://llvm.org/docs/CMake.html#cmake-out-of-source-pass, but I've not
> > done it before so I don't know how reliable it is.
>
> It is indeed possible. I have a simple example of doing this for the
> "hello pass" in [1] in the "helloPass" folder. In the same directory it
> also shows how to load the pass as a clang plug-in and have it run
> automatically. This built fine against LLVM3.5 but I've not tested if this
> builds against trunk.
>
> [1] https://github.com/delcypher/srg-llvm-pass-tutorial/
>
> HTH,
> Dan
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141108/0f442497/attachment.html>


More information about the llvm-dev mailing list