Question about modifying LLVM

   I am trying to use LLVM to implement one register allocation algorithm. I think I understand the code, and I've started my implementation. But I am having a problem, mostly due to my ignorance of C++. I am basically modifying the code of llvm/lib/CodeGen/RegAllocLocal.cpp. But if I type 'gmake' in that directory, the changes are not reflected in the llc tool, even though the LLVMCodeGen.o library is updated. In order to see my changes,

You need to relink llc to see the changes.

what I am doing is to go to llvm/ , and then to 'gmake clean' everything, and then to call 'gmake' again, what takes very long time.

Yup, that would take a long time :slight_smile:

So, could you explain me how to see my changes reflected in 'llc' without having to recompile everything? I am sorry for sending you such silly question, and if you don't have time to answer, I will try to figure it out by myself.

The easiest thing to do is just do a 'make' from the top-level of the tree. You should never have to do 'make clean'. In this case, make will recurse into lib/CodeGen, rebuild it, then eventually go into tools/llc, and relink it.

There is a short-cut for this, if you are operating in a single directory. If you add 'llvm/utils' to your path, you can use the makellvm tool. If you are in the llvm/lib/CodeGen directory, for example, "makellvm llc" will do a make in the current directory, then it will do a make in the llvm/tools/llc directory.

This often saves time and is simple to use. The caveat is that your tree can get out of sync if you modify code in a different directory and forget to rebuild it. If this happens, a 'make' from the top-level will rectify things.

Also, if you are on a multiprocessor system, try 'make -j2' (where 2 is the number of processors on your system), it will build LLVM significantly faster.

-Chris