You do not have to keep it under llvm src tree.
http://llvm.org/docs/Projects.html shows how to setup a project outside the
src root
and it applies for writing a Pass. But as first step of practicing, staying
inside the src
root will save some efforts.
Not sure about your errors. But one mistake I made is that configure was
invokded using
../llvm-src/configure from llvm-build, and then I put pass in llvm-src.
make failed because
the top level is in llvm-build(if I understand it correctly). So I reinvoke
./configure in llvm-src
to let it re-generate Makefiles. And then it's ok. Hope it helps.
--
Best regards,
Ryan
On Wed, Jul 4, 2012 at 2:27 PM, Arnamoy Bhattacharyya
<arnamoy at ualberta.ca>wrote:
> Hi;
>
> I wrote an LLVM transformation pass and I put my code inside the
> llvm-src/lib/Transforms/my-pass directory. I want to know what is the
> correct method for compiling it and building my plugin for the pass. After
> reading the http://llvm.org/docs/WritingAnLLVMPass.html page, I felt that
> I have to keep my pass inside the above said directory. But when I run
> make from inside my-pass directory but I am getting the errors -
>
> ../../../Makefile.common:60: ../../../Makefile.config: No such file or
> directory
> ../../../Makefile.common:68: /Makefile.rules: No such file or directory
> make: *** No rule to make target `/Makefile.rules'. Stop.
>
> Which kinds of makes sense as there is no Makefile.config in the llvm-src
> directory.
>
> So I tried to place my-pass directory inside the llvm-build/lib/Transforms
> directory and run make from there. But got the following error -
>
> make: *** No rule to make target
> `/home/arnie/llvm-development/llvm/lib/Transforms/LoopMem/Makefile',
needed
> by `Makefile'. Stop.
>
> However, if I configure and build the whole LLVM again (with my pass), it
> is able to produce the shared library. Is it the only way to integrate my
> pass into LLVM? Because, every time I modify my pass, I have to rebuilt
> LLVM which takes close to half-an-hour to build?
>
> Thank you;
> --
> Arnamoy Bhattacharyya
> Athabasca Hall 143
> Department of Computing Science - University of Alberta
> Edmonton, Alberta, Canada, T6G 2E8
> 587-710-7073
>
> _______________________________________________
> 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/20120704/d1cfa1dc/attachment.html>