[LLVMdev] Preferring to use GCC instead of LLVM

kr512 kr512 at optusnet.com.au
Sat May 10 19:55:50 PDT 2008


Chris Lattner wrote:
> If you'd prefer to use GCC, go for it.  No one is forcing 
> you to use LLVM.

No, we would prefer to use LLVM, but a missing part in LLVM 
makes it difficult.  It would be wonderful if this missing 
part could be supplied.

> You are seriously ignorant of what LLVM is all about. 
> Please go inform yourself.

Alright, I read some more on llvm.org and it confirmed what 
I was saying:
http://www.llvm.org/docs/GettingStarted.html#tutorial

See at the end where it says:
-----------
6.Compile the program to native assembly using the LLC code 
generator:
  % llc hello.bc -o hello.s
7.Assemble the native assembly language file into a program:
  % gcc hello.s -o hello.native
8.Execute the native code program:
  % ./hello.native
-----------

See how gcc is invoked to generate the final executable 
file.  This means LLVM is an incomplete backend, 
unfortunately.

Here are the instructions for MS Win, where the situation is 
even worse:
http://www.llvm.org/docs/GettingStartedVS.html#tutorial

-----------
5. Compile the program to C using the LLC code generator:
   % llc -march=c hello.bc
6. Compile to binary using Microsoft C:
   % cl hello.cbe.c
7. Execute the native code program:
   % hello.cbe.exe
-----------

See how nasty that is?  Compiling to C source code, and then 
invoking the Microsoft C compiler!  If you are going to do 
that, then you may as well just use the Microsoft C compiler 
by itself, and not bother with LLVM.  This is a major 
problem that needs to be resolved.

Terence Parr wrote:
> GCC is not the only assembler / linker on windoze.  I 
> believe M$ provides assemblers / linkers so people can 
> develop on windoze.

Yes, but if you install the Microsoft development tools, 
then you may as well just use them to do everything, and not 
bother with LLVM.   But I would prefer to use LLVM.  But I 
can't because LLVM is missing the final stages.  LLVM is an 
incomplete backend.

Bill Wendling wrote:
> I don't know about your computer, by mine comes with an 
> assembler.

MS Windows does not come with an assembler, AFAIK.  So your 
computer is superior in that area, yes, but we have 
customers using MS Win, and we have customers using Linux, 
and we need to support them both.

John Criswell wrote:
> As other have stated, most systems come with an assembler 
> (even GCC relies on an assembler to generate native code).

Correct me if I am wrong, but MS Windows does not come with 
an assembler.  The Microsoft development tools can be 
obtained separately and installed, but that is too difficult 
for an average end-user to do -- we cannot reasonably tell 
them to first install the Microsoft dev tools before they 
can use our product.   And if installing the Microsoft dev 
tools is a requirement, then as I said, may as well just use 
them to do everything and not bother with LLVM, which is a 
real shame because I would prefer to use LLVM and get the 
other advantages of LLVM.

jlh wrote:
> GCC merely generates assembler files which then run 
> through the assembler to generate object files.  Then the 
> linker is called to generate the final executable.  GCC 
> just can call these steps for your convenience, but it 
> doesn't do it itself.  And there's nothing wrong with 
> separating those steps.  LLVM does exactly the same.

Yes there is nothing wrong with separating those steps, but 
the point is that LLVM does not provide the necessary final 
steps to make a ready-to-execute .EXE or .DLL, and for this 
reason unfortunately LLVM fails to appeal over using the 
normal GCC or MS compiler.  But this issue could be solved, 
and then LLVM would be the better choice.

> LLVM only uses GCC as a front-end for languages such as C 
> and C++.

Additionally, LLVM appears to require use of the GCC package 
or MS compiler (or an assembler provided with the system) as 
part of the backend as well -- to generate the final 
ready-to-execute .EXE or .DLL file.  LLVM fails to provide a 
complete backend solution.

> However, an own front-end (clang) is in the works, which 
> will remove this dependency.

That doesn't help us.  We have a front-end.  We need a 
back-end.   But LLVM is an incomplete backend because LLVM 
by itself cannot generate ready-to-execute .EXE or .DLL 
file.

> You also failed to see all the things that LLVM can do, 
> but stable GCCs can't.  For example 
> link-time-optimization, but there are many more 
> advantages.

Yes LLVM is an excellent idea and a very worthy project, but 
this problem of it being an incomplete back-end is a major 
problem that should be rectified.

Mark





More information about the llvm-dev mailing list