Duncan Sands wrote:
how do you compile a program with LLVM? It's not a compiler, it's a set of optimization and codegen libraries. You also need a front-end, which takes the users code and turns it into the LLVM intermediate representation [IR]. The dragonegg plugin takes the output of the gcc-4.5 front-ends, turns it into LLVM IR and runs the LLVM optimizers and code generators on it. In other words, it is exactly what you need in order to compile programs with LLVM. There is also llvm-gcc, which is a hacked version of gcc-4.2 that does much the same thing, and for C and C++ there is now the clang front-end to LLVM. The big advantage of dragonegg is that it isolates the effect of the LLVM optimizers and code generators by removing the effect of having a different front-end. For example, if llvm-gcc produces slower code than gcc-4.5, this might be due to front-end changes between gcc-4.2 and gcc-4.5 rather than because the gcc optimizers are doing a better job. This confounding factor goes away with the dragonegg plugin.
Goes away is a bit strong. In practice, front ends know about their back ends and are tuned in various ways for things to work well.
Ciao, Duncan.