Andrei Alexandrescu:

> Sounds good, thanks. If anyone is up to the task, we'd all be grateful.

LLVM is good for D/LDC for several things:
- The LLVM optimizer is good, usually quite better than the DMD one. If you 
write D C-like code you usually reach performance similar to true C code.
- LLVM misses some optimizations, like de-virtualization, auto-vectorization, 
and some more, but LLVM is a very alive project (partially paid by Apple) so 
probably eventually those things will be added. I have shown bugs to LLVM 
people and they have fixed it in few days. They were almost as fast as LDC 
developers (lately LDC devs seem sleepy to me).
- LLVM is written in a good enough C++, its API is not bad. You can use LLVM 
for your purposes in just few days for small projects. Try doing the same thing 
with GCC.
- LLVM is not a compiler, it's a compilation framework. More and more projects 
use it in several different ways. D is not a VM-based language, but eventually 
it can even be possible for LDC to compile and run code at runtime, for example 
to instantiate templates at runtime. LLVM can be used for several other things.
- LLVM will probably offer ways to implement a lint tool for D.
- LLVM is designed for all different kinds of purposes, so inside it you can 
find things like overflow-safe fixed-sized integers, stack canaries, other 
stack protection means, ways to design a precise GC that keeps in account the 
stack too (and eventually registers too).
- LLVM offers and will offer some modern things, like link-time optimization, a 
good (goden) linker, an ecosystem of tools that work and can communicate to 
each other using reliable languages like bc and ll.
- You can use LLVM on 64 bit CPUs too, and eventually exceptions on Windows 
too, etc. Some of the other optimizations useful for C++ (de-virtualization) 
will be pushed in the back-end (and not in the new front-end Clang) so they 
will be usable by LDC too for free.
- LLVM is made of parts, so you can use them and re-combine them for many 
different purposes. There are many research papers written on and with llvm, 
and more will come, because hacking llvm is quite simpler than doing similar 
things with gcc (despite gcc 4.5 has now a plug-in system. LLVM doesn't need it 
because it works in the opposite way). So LLVM will allow to do things that 
today we haven't invented yet.
- Some of the top LLVM developers are paid by Apple, this has disadvantages 
too. You can see an example of this from the missing videos/PDFs of the last 
conference, they were not allowed to show them, because Apple is sometimes even 
more corporative than Microsoft:
http://llvm.org/devmtg/2009-10/

Bye,
bearophile

Reply via email to