[LLVMdev] Why llvm-gcc? Another beginner's question.

Holger Schurig hs4233 at mail.mn-solutions.de
Tue Jun 3 08:00:00 PDT 2008


> What is the reason for llvm-gcc?  Will regular gcc work
> (except for the releases that are broken, of course)?

No one can tell the answer to this question ... because the 
answer depends on what you're up to.

LLVM itself is frontend agnostic. It itself starts from a 
low-level, assembly like, but SSA-formed language. See 
http://www.llvm.org/docs/LangRef.html.

Mangling objects in this language are a bunch of analyzers and 
optimizers, http://www.llvm.org/docs/Passes.html. And finally, 
there are a bunch of various backends that generate 
assembly-language ... to JIT or to link as a standalong 
applicant.


Now, how do you get this Low-Level-Language?  For one, you can 
write it by hand. Many test-case in the LLVM framework have been 
written by hand, see all the *.ll file at 
http://www.llvm.org/viewvc/llvm-project/llvm/trunk/test/

Or you can use a compiler. llvm-gcc is just one of the possible 
compilers. It uses gcc to parse C, C++, produces gimple, like 
gcc normally does. But then the gimple is converted to the LLVM 
low-level language and handed over to LLVM.

There are other frontends, e.g. "clang", which aims to be a 
faster and less-resource-hungry compiler (or, compiler library, 
e.g. easy to include/link into an IDE). Or I have heard about a 
compiler for the "D" language to LLVM, see 
http://www.dsource.org/projects/llvmdc. There's an examply 
forth-link front page ... and so on.


> Does llvm in any way depend on features of llvm-gcc instead of
> gcc? 

Now you might realize that this question doesn't really make 
sense.

> Or is it optional?

Again, this depends. If you want to compile/optimize C++ via 
llvm, you need llvm-g++, so it's not optional. But for some C 
programs, clang migth already be usable (yet it's highly 
experimental). If it's needed for your needs ...   who knows, 
but you?

Greetings, Holger



More information about the llvm-dev mailing list