From: Jason Todd Slack-Moehrle <mailinglists@mailnewsrss.com>
To: llvmdev@cs.uiuc.edu
Sent: Sunday, June 14, 2009 8:09:03 PM
Subject: [LLVMdev] Some understanding of LLVM vs gCC vs Intel C++ Compilers
Hi All,
Hello Jason,
I know that it is a C/C++ Compiler, but how do I use it? Is it
Makefile based?
Wrong. LLVM-GCC is a frontend for LLVM that converts C/C++ code into the intermediate representation that is LLVM.
Does it replace GCC?
It uses a special version of GCC currently to generate its bitcode from C/C++. There is a GCC replacement called Clang that is coming up but not mature yet.
LLVM stands for Low-Level Virtual Machine. It is an open-source, cross-architecture compiler infrastructure. It runs on and generates code for MacOSX 10.4+ for both PPC and Intel, Windows XP+, Linux on several processor types, and others in the works.
With some effort, it is possible to write a compiler to generate bitcode that will run on any processor independently of the one it was written on. It does not have a thick abstraction layer like .NET or Java, however. For that extension you'll want to look into VMKit which is another implementation of Java and .NET using LLVM. Anther compiler that is going to use the LLVM architecture is Google's Unladen Swallow project which aims to make the Python programming language execute 5 times faster.
Sam's response is right on for general guidance, here is some mac-specific guidance.
I have spent a better part of my 32 years on this earth writing
Solaris software and more recently leaving that and returning back to
Mac OS.
I obviously know about GCC and the Intel C++ Compilers.
I am looking to have more freedom and flexibility along with producing
better quality software.
How does LLVm fit in?
The llvm project provides two open source compilers, llvm-gcc and clang. Clang is considered production quality on the mac for C and ObjC. llvm-gcc on the mac supports c/objc/c++/objc++. Apple productizes these and ships them with the Xcode installation.
I know that it is a C/C++ Compiler, but how do I use it? Is it
Makefile based?
Does it replace GCC?
Both llvm-gcc and clang work as drop in replacements for GCC. They take the same command line options etc, and are both quite usable on the command line.
Can one build full OS X applications with it? (What I mean is dont
need to use XCode or anything if I dont want to)
The llvm project provides two open source compilers, llvm-gcc and
clang. Clang is considered production quality on the mac for C and
ObjC. llvm-gcc on the mac supports c/objc/c++/objc++. Apple
productizes these and ships them with the Xcode installation.
I know that it is a C/C++ Compiler, but how do I use it? Is it
Makefile based?
Does it replace GCC?
Both llvm-gcc and clang work as drop in replacements for GCC. They
take the same command line options etc, and are both quite usable on
the command line.
Can you provide advice on why Intel C++ compilers vs LLVM-GCC vs just normal GCC? Like benefits to one over the others? Pros and Cons, etc, etc...
My (possibly faultly) understanding is that intel's has good support
for numerics, presumably through auto-vectorization and such, but only
works for intel's architectures and is only excellent on intel chips.
llvm-gcc is a temporary thing until clang can compile llvm. GCC is
for when you don't want to use the llvm infrastructure, and just want
something easy to grab from the package manager.
My (possibly faultly) understanding is that intel's has good support
for numerics, presumably through auto-vectorization and such, but only
Yes, that's true.
works for intel's architectures and is only excellent on intel chips.
That used to be the case, but not so anymore. Intel compilers generate
just fine code for AMD processors. Since AMD doesn't produce their
own compilers, it's likely on par with any other vendor producing an
AMD compiler.
Intel doesn't have the internal AMD designs so it can't make use of
proprietary knowledge as it can for Intel chips. But then, no AMD
compiler vendor can, so they're all operating on a level playing
field. That's all I meant. It is faster on some codes than other
AMD compilers. On other codes, it's slower. This is no different
than any other compiler.
Trying to capture a notion of overall compiler optimization
in a representative set of benchmarks is a hard problem.
If you're interested in performance, it's best to measure it
on the applications you're interested in.
You should be suspicious of any one-dimensional analysis
of compiler optimization, especially if it's presented by
someone with an interest in a particular compiler.
We're on the LLVM users page, but that probably needs an update. I'll look at
checking something in.
The Cray X86 compiler is in use by customers today. The first release
happened in December with an update coming RSN. It's being used for real
science, today, on massively parallel supercomputers. We're talking tens of
thousands of processors.
So all you LLVM developers, put another feather in your cap. Our (yours and
Cray compiler devlopers') code is being used to solve the world's most
challenging and groundbreaking scientific problems!
I have seen codes where even minor tweaks to a register allocation spilling
heuristic can have a 10-20% performance impact on X86. Compiler
transformations are often very sensitive to particular pieaces of code.
It's impossible to declare one compiler "better" than another because it's
likely the design goals of the compilers are quite different.
The great advantage of LLVM/Clang, in my mind, is its clean design and
relatively shallow learning curve. It's not only a smart business decision
to use the code because of its utilitarian value, it's smart from an
employee training perspective as well.
All IMHO, nothing I say here is an official Cray position, blah, blah,
blah.