The Low Level Virtual Machine made some high-level changes in May, among them the release of Libc++, an implementation of the standard C++ library.
This C++ library is focused on standards compliance and highly efficient generated code. It’s also designed to take advantage of the expected new features of C++ when the language is updated.
LLVM is probably best known as the compiler infrastructure Apple uses in its iPhone SDK. The company now employs around half of all LLVM contributors and has standardized on the software for both its desktop and portable platforms.
Still, LLVM is not a traditional compiler project. Rather, it is a series of optimization libraries that can take code output in an intermediate form from GCC. Anton Korobeynikov, professor of mathematics and mechanics at Saint Petersburg State University in Russia and a contributor to the LLVM project, said it’s important to understand how LLVM is different from GCC.
“While the latter is the classical compiler, the former is a compiler infrastructure,” he said. “Basically it’s just a set of libraries doing compiler-specific tasks. There are libraries that do various sorts of different optimizations, libraries doing code generation to the machine binary code, libraries doing just-in-time compilation. This makes it pretty easy to integrate LLVM to any third-party product. I think it’s almost impossible to do this for GCC except in straightforward run-and-forget ways. Also, LLVM’s license is BSD-like, which solves many integration issues with any third-party code.”
LLVM’s new Libc++ is not the only recent addition to the project. The Glasgow Haskell Compiler (GHC) project released a new version in April, and the developers of that project used the opportunity to discuss the experience of building a Haskell compiler based on LLVM.
David Himmelstrup, GHC developer, wrote a blog post on the subject, where he opined about what he’d like to see in future version of LLVM.
“I’d like to see LLVM gain the needed features to be able to implement the TNTC [tables next to code] optimization in the GHC back end. It would also be great if LLVM was better supported on Sparc, as that’s a platform GHC works reasonably well on where LLVM doesn’t,” he wrote.
He also pointed out just why it is that LLVM was the appropriate infrastructure for building a Haskell compiler.
“When you look at the GHC LLVM back end, it achieves very close or better performance than existing back ends that have been around for years, while having a smaller and simpler codebase,” he wrote.
“That’s what’s good about LLVM. I think you also gain a lot from the LLVM type system, it really helped catch most of the bugs fixed so far in the back end. Finally, [there is] the great documentation. This is something I really appreciate and often is lacking in many projects.”