Tuesday, April 05, 2011

WWDC2010 Session312 What's New in the LLVM Compiler

LLVM stands for Low Level Virtual Machine which is a compiler infrastructure, written in C++. The LLVM project started in 2000 at the University of Illinois at Urbana-Champaign, under the direction of Vikram Adve and Chris Lattner. In late 2000, Lattner joined the University of Illinois at Urbana-Champaign as a research assistant and M.Sc. student. Lattner was hired by Apple in 2005.

Compiler Landscape

Three compilers

3 compilers

LLVM Compiler in Xcode 3.2.3 does not support C++. You have to use LLVM-GCC for C++ in Xcode 3.2.3. Now LLVM Compiler 2.0 in Xcode 4 supports C++. That is why the default compiler of Xcode 4 is LLVM Compiler. GCC 4.2 is not recommended because Apple will not fix bugs any more.

WebKit, JavaScriptCore, OpenSSL are built with LLVM in iOS 4. Performance improvement: Open SSL 28%, JavaScriptCore 11%.

LLVM Compiler:

1. Fast compile times - Almost 3x faster debug builds

2. Great user features

3. Beautiful error messages

4. compatible with GCC

Clang Frontend is a parser for C family of languages including C, Objective-C, C++.

Clang is part of many great new tools: LLVM Compiler, Xcode Static Analyzer, Xcode 4, LLDB Debugger, OpenCL. Clang is integrated into Xcode 4 for source code indexing, syntax highlighting, code completion, live warnings and Fix-its.

Xcode Static Analyzer
Automatically find bugs by analyzing your code.

Benefits of LLVM Compiler 2 C++

1. Faster compilation

2. Greatly improved warnings and errors

3. Complete binary compatibility

4. Better C++ standards conformance

5. Objective-C++ support

PerformanceC++ compile-time performance: 25% fasterC++ memory usage: 33% smaller
Upcoming C++ '0x Standard

libc++ introduced for new C++ standard.
libc++: A New C++ Standard library

I think every developer using Xcode 4 should move onto LLVM compiler.

WWDC2010 Session312 What's New in the LLVM Compiler

Author: Chris Lattner - LLVM Chief Architect

No comments: