[LLVMdev] New GCC4-based C/C++/ObjC front-end for LLVM

Chris Lattner sabre at nondot.org
Tue Jan 24 16:14:51 PST 2006

Hi Everyone,

I just pushed out the latest version of my new GCC4-based llvm-gcc here:
This email includes status and instructions for use.

Compared to the old llvm-gcc, this front-end has many advantages: it is 
far faster, is based on GCC 4.0.1 instead of a GCC 3.4 prerelease 
snapshot, and it fixes several dozen of the "impossible to fix in the old 
front-end" bugs revolving around bitfield layout and static initialization 
global unions (see http://llvm.cs.uiuc.edu/PR498 for examples).

This front-end is different than the old llvm-gcc in several ways: in 
particular, it defaults to acting like a *normal* compiler.  Specifically:

1. "llvm-gcc x.c -S -o x.s" will give you an *unoptimized* *native*
    assembly file, not an unoptimized LLVM .ll file.
2. "llvm-gcc x.c -c -o x.o" will give you an *unoptimized* *native* object
    file, not an *optimized* LLVM .bc file.
3. "llvm-gcc x.c" will give you a native a.out, not a .bc file.
4. -O[123] flags change the output of the compiler, though they are all
    very basic.  The new compiler does not yet run all of the optimizations
    the old one did with "-c".
5. The new front-end does not exec gccas/gccld, instead it links to the
    appropriate LLVM libraries.
6. Link-time IPO hasn't been implemented yet.

Finally, note that passing both the new and old front-ends "-S -emit-llvm" 
will cause them both to behave the same: they both write an LLVM .ll file 
to the .s file.  This allows the testsuite to work with both front-ends.

I would appreciate it if people would try it out and see how it works for 
them.  I'd like to add support for the Alpha, itanium, and sparc backends, 
but would like the target maintainers to test it for basic functionality. 
The link above includes instructions to build the new front-end.  If you 
build with --program-prefix=llvm- and configure LLVM with the installed 
compiler, you can run the llvm-test suite as normal, using the new 
front-end instead of the old one.

Ideally, I would like to "ship" this front-end along with the current 
front-end for the next LLVM release (1.7), and then drop the old llvm-gcc 
for the next one (1.8).

Comments and questions welcome,



More information about the llvm-dev mailing list