[LLVMdev] Maintaining pass code outside of the LLVM directory

Trevor Harmon trevor.w.harmon at nasa.gov
Mon Mar 22 18:00:47 PDT 2010


Hi,

I'm developing an LLVM pass and am running into code maintenance  
issues. Specifically, the "Writing an LLVM Pass" document assumes that  
the pass directory is placed somewhere in the LLVM source base (e.g.  
lib/Transforms), but this is a problem for me because:

1) Testing the pass against two different LLVM versions is difficult.  
For example, testing with the LLVM 2.6 release and the LLVM 2.7  
prerelease requires either moving the pass directory back and forth or  
maintaining two different copies of the same pass, one in each LLVM  
source base. Neither option is much fun.

2) Mixing custom code with the LLVM source base can lead to dangerous  
mistakes. For example, I had added some extensive debugging code to  
the LLVM source, and I wanted to start over with a clean build, so I  
did "rm -rf" on the LLVM directory. Of course this wiped out my pass  
code as well! (Luckily I had checked in the code to a personal SVN  
repo.)

I really need a way to keep my pass code separate from the LLVM source  
base. I tried to get clever by creating a soft link from my pass  
directory to lib/Transforms, but this doesn't work because the $PWD is  
relative to the link's source directory, even when I cd into the  
link's target directory. This screws up the LEVEL variable in the  
Makefile and causes build errors. I tried to adjust LEVEL to account  
for the new location but that still didn't work.

Any suggestions? Thanks,

Trevor




More information about the llvm-dev mailing list