issue with writing a new pass


I am newbie to LLVM. I wish to write an analysis pass. I followed the steps mentioned in the site.

First I downloaded the source files to, say src, folder.

Then I built it in another folder, say build.

Everything went well.

Then I wrote a HelloWorld pass (as mentioned in the site). But then encountered make errors.

I did a bit of googling and realised that the issue is with separate directories for src and build. To overcome this issue I came up with two ‘solutions’:

  1. redo the whole process of compiling llvm source by having source and build in the same directory.

  2. Have two directories - src and build (as mentioned in the site) - write your (new) pass in relevant file in src directory. Then after you run make on this (new) pass, copy the library thus created in src/Debug+Asserts/lib to build/Debug+Asserts/lib .

Would like to know which is a better solution? (Or suggest me a much better than these.) My concerns are thus :

  • I am expecting to write a complex analysis pass which depends on the existing passes.

  • This is a long term project. Hence would like to opt for a clean solution than a quick-fix one.