Mitch Pronschinske is the Lead Research Analyst at DZone. Researching and compiling content for DZone's research guides is his primary job. He likes to make his own ringtones, watches cartoons/anime, enjoys card and board games, and plays the accordion. Mitch is a DZone Zone Leader and has posted 2578 posts at DZone. You can read more from them at their website. View Full User Profile

LLVM's Clang Compiler Achieves Self-Hosting

02.05.2010
| 7050 views |
  • submit to reddit
Self-sufficiency is a major milestone for any compiler technology.  The LLVM (Low Level Virtual Machine) developers were pleased to announce that their open source compiler, named Clang, has just reached this milestone.  Clang recently completed its first complete self-host by building all of the LLVM and itself.

In the testing process, Clang was able to compile over 550,000 lines of C++ code, which is the total amount of lines in LLVM and Clang.  The resulting binaries passed all of the regression test suites for Clang and LLVM.  The self-built Clang was then able to build the 550k lines LLVM and Clang code again.  The third Clang build was also fully-functional, which made the bootstrap complete.

Clang is a new front-end for the LLVM that was started several years ago.  The developers' goal is to build a compiler that provides better diagnostics, tighter integration with IDEs, and a license that is compatible with commercial products.  The LLVM team wants a more lightweight compiler in Clang that is easy to develop and maintain.  They say that Clang is great for source analysis or source-to-source transformation.  However, full support for C++ is "still way off," according to the website.

                                                   
                                 Quick-n-dirty performance test results for template instantiation by Douglas Gregor

LLVM got a little extra attention back in October of last year when Adobe announced (at Adobe MAX) that Flash CS5 would be able to use the LLVM compiler infrastructure along with an ActionScript 3 reading front end to build iPhone compatible Flash apps.  Apple and Adobe both support the LLVM project, which was started in 2000 at the University of Illinois.  The LLVM is a virtual machine and compilation system that enables optimization of intermediate code at compile, link, and runtime.  The project initially focused on working with C/C++ code, but the project's community has since developed front-ends for Java byte code, Python, Ruby, ActionScript 3 (as mentioned before), and Microsoft's CIL.

Take a look at the comparisons between Clang and other compilers on their website.