Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

LLVM D Compiler

LLVMDC is a compiler for the D programming Language. It is based on the latest DMD 1.0 frontend and uses LLVM 2.4svn as backend. LLVM provides a fast and modern backend for high quality code generation. LLVMDC is released under a BSD license with exceptions for the DMD frontend and code from GDC.

The development takes place mostly on x86-32 Linux and that is where LLVMDC works best. Other platforms and architectures, like x86-64, PPC and PPC64 should be supported, but there may be issues. We are looking for people to test and adjust LLVMDC for those platforms! Some work has been done getting LLVMDC running on Windows, see this page for more information.

Quite a bit of D code already compiles but LLVMDC is not yet close to being production quality. Take a look at the tickets to get a better impression on what still needs to be implemented.

We have two sets of tests living in the tests directory. The mini testsuite in mini/ and minicomplex/ contains a few tests that are supposed to compile or run and is mostly used when fixing a bug. There is also the larger DStress based test suite comparing LLVMDC revisions among themselves and to DMD. However, some of the test cases in DStress are not correct, help us make our list of broken DStress tests complete.

If you're still looking for something to do, take a look at the broken Tango modules page for inspiration ;)

Communication

Feedback is much appreciated, you can contact us via IRC in the #llvmdc channel on FreeNode or the mailing list at llvmdc@googlegroups.com.

The dsource forum is hardly ever looked at by the developers, please use the mailing list instead. If you've found a bug, feel free to report it directly.

D binding for LLVM

While not part of the LLVMDC compiler, a llvm binding to LLVM for D can be found in the old SVN repository. The binding is a wrapper around the LLVM C interface with a few extensions. See the source/samples for more information.

Documentation

Documentation is still sparse, but there is a little on the versions and pragmas.

How To Compile

Dependencies:

First checkout the SVN trunk of LLVM and build it. Getting started with LLVM and LLVM SVN info is what you will need.

You will also need Premake to generate the Makefile, as well as (optionally) the Hans Boehm GC for C/C++ (ArchLinux users get the 'gc' package, Gentoo users - emerge 'boehm-gc', don't forget to check what version you are installing).

Grab LLVMDC from the Mercurial repository:

hg clone http://hg.dsource.org/projects/llvmdc llvmdc
cd llvmdc

Generate the makefile:

premake --target gnu

If you insist on using the Boehm GC, pass --enable-boehm-gc to premake as well. We're currently seeing some bugs when using the GC, so it's not recommended.

Compile LLVMDC:

make

Put LLVMDC into your path. This is necessary if you want it to be easy:

export PATH=$PATH:`pwd`/bin

Fetch, patch and compile the runtime (and Tango core) for your architecture:

svn co http://svn.dsource.org/projects/tango/trunk tango
cd runtime
sh patch-tango.sh
sh build.sh

Try it out, for instance by running the mini test suite in tests/ (compile runminitest.d with dmd and run it). Please report any problems you might have, and good luck :)

Using Rebuild

Finally, if you want to use dsss or rebuild with llvmdc, install the llvmdc-tango rebuild profile:

mkdir -p $HOME/.rebuild
ln -s `pwd`/llvmdc-tango $HOME/.rebuild

After you made sure that llvmdc is in PATH, you can use rebuild from anywhere.

export PATH=$PATH:`pwd`/bin
rebuild -dc=llvmdc-tango test.d

Submitting Patches

Clone the Mercurial repository, make your changes, then use hg export and send the output to either lindquist or Christian:

hg export <revision> > blah-blah.patch
Copyright © 2008, LLVMDC Development Team.