[LLVMdev] Why llvm-gcc? Another beginner's question.
John Criswell
criswell at uiuc.edu
Tue Jun 3 07:23:46 PDT 2008
Hendrik Boom wrote:
> What is the reason for llvm-gcc? Will regular gcc work (except for the
> releases that are broken, of course)? Does llvm in any way depend on
> features of llvm-gcc instead of gcc?
>
llvm-gcc has a two-fold purpose. First, they are the front-end
compilers for C/C++ for LLVM. In other words, they take C/C++ source
code and translate it to LLVM assembly code which can then be assembled
using llvm-as and transformed/analysis using the LLVM tools. This
functionality is enabled using the -emit-llvm option.
Second, llvm-gcc is a compiler built using LLVM that compiles C/C++ code
to native code. It does the same thing as regular gcc except that it
uses the LLVM optimization and code generation libraries instead of the
original ones found in gcc. This is the default way of using llvm-gcc;
it basically makes it easier for people to use LLVM as a drop-in
replacement for GCC.
> Or is it optional? Was it conceived to give llvm itself a through
> shakedown? Is it there just in case you really want llvm code in some
> form from a C program? Is such llvm code necessary for some kind of use
> -- might it be that that a compiler that uses llvm can only link with
> ofher llvm-generated code?
>
It depends on what you want to do. If you want to use LLVM as a
replacement for GCC, then yes. If you want to compiler C/C++ code to
LLVM so that you can analyze/transform it using your own LLVM passes,
yes. If you're writing your own language front-end for LLVM, then no.
Hope that helps.
-- John T.
> -- hendrik
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
More information about the llvm-dev
mailing list