Contributed by merdely on 2007-09-15 from the pretty-cool-compiler dept.

Anders Magnusson's BSD-licensed pcc compiler has been imported into CVS. He wrote to NetBSD's tech-toolchain list:

It is not yet bug-free, but it can compile the i386 userspace. The big benefit of it (apart from that it's BSD licensed, for license geeks :-) is that it is fast, 5-10 times faster than gcc, while still producing reasonable code. The only optimization added so far is a multiple-register-class graph-coloring register allocator, which may be one of the best register allocators today. Conversion to SSA format is also implemented, but not yet the phi function. Not too difficult though, after that strength reduction is high on the list.

Anders continues:

It is also quite simple to port, writing the basics for i386 took three hours (hello world) and complete port (pretty much as it is right now) two days. I have added most of the C99 stuff (it is supposed to be a c99 compiler) but some stuff is still missing, like the ability to do variable declarations anywhere (requires some rewriting of the yacc code).

NetBSD also imported pcc into pkgsrc. The commit message gives a little bit of pcc's history:

The compiler is based on the original Portable C Compiler by S. C. Johnson, written in the late 70's. Even though much of the compiler has been rewritten, some of the basics still remain. The intention is to write a C99 compiler while still keeping it small, simple, fast and understandable. I think of it as if it shall be able to compile and run on PDP11 (even if it may not happen in reality). But with this in mind it becomes important to think twice about what algorithms are used. The compiler is conceptually structured in two parts; pass1 which is language-dependent, does parsing, typechecking and build trees, and pass2 which is mostly language-independent. About 50% of the frontend code and 80% of the backend code has been rewritten. Most stuff is written by me, with the exception of the data-flow analysis part and the SSA conversion code which is written by Peter A Jonsson, and the Mips port that were written as part of a project by undergraduate students at LTU.

Otto Moerbeek (otto@) wrote to the pcc mailing list: