Difference between revisions of "LDC"

From D Wiki
Jump to: navigation, search
(Add Johan's presentations)
(Presentations)
Line 90: Line 90:
 
* Kai's [https://archive.fosdem.org/2015/schedule/event/llvm_internal_asm/ talk about the LLVM assembler] in the [https://archive.fosdem.org/2015/schedule/track/llvm_toolchain/ LLVM toolchain devroom] at [https://archive.fosdem.org/2015/ FOSDEM'15]: [https://archive.fosdem.org/2015/schedule/event/llvm_internal_asm/attachments/slides/711/export/events/attachments/llvm_internal_asm/slides/711/Nacke_Extending_Assembler.pdf Slides] [http://video.fosdem.org/2015/devroom-llvm_toolchain/internal_asm__CAM_ONLY_PARTIAL_AUDIO.mp4 Video]
 
* Kai's [https://archive.fosdem.org/2015/schedule/event/llvm_internal_asm/ talk about the LLVM assembler] in the [https://archive.fosdem.org/2015/schedule/track/llvm_toolchain/ LLVM toolchain devroom] at [https://archive.fosdem.org/2015/ FOSDEM'15]: [https://archive.fosdem.org/2015/schedule/event/llvm_internal_asm/attachments/slides/711/export/events/attachments/llvm_internal_asm/slides/711/Nacke_Extending_Assembler.pdf Slides] [http://video.fosdem.org/2015/devroom-llvm_toolchain/internal_asm__CAM_ONLY_PARTIAL_AUDIO.mp4 Video]
 
* David's [http://dconf.org/2015/talks/nadlinger.html talk about DRuntime] at [http://dconf.org/2015/index.html DConf 2015]: [http://dconf.org/2015/talks/nadlinger.pdf Slides] [http://dconf.org/2015/talks/nadlinger.html Video HD] [https://www.youtube.com/watch?v=rmRmfoKxMCE Video SD]
 
* David's [http://dconf.org/2015/talks/nadlinger.html talk about DRuntime] at [http://dconf.org/2015/index.html DConf 2015]: [http://dconf.org/2015/talks/nadlinger.pdf Slides] [http://dconf.org/2015/talks/nadlinger.html Video HD] [https://www.youtube.com/watch?v=rmRmfoKxMCE Video SD]
* Johan's [http://dconf.org/2017/talks/engelen.html talk about Abstraction Cost and Optimization] at [http://dconf.org/2017/index.html DConf 2017]: [http://dconf.org/2017/talks/engelen.pdf Slides] [https://www.youtube.com/watch?v=IZY67TBZ0V4 Video]
+
* Johan's [http://dconf.org/2017/talks/engelen.html talk about LDC's optimized assembly output] at [http://dconf.org/2017/index.html DConf 2017]: [http://dconf.org/2017/talks/engelen.pdf Slides] [https://www.youtube.com/watch?v=IZY67TBZ0V4 Video]
* Johan's [http://dconf.org/2018/talks/engelen.html talk about PGO, fuzzing, and Address Sanitizer] at [http://dconf.org/2018/index.html DConf 2018]: [http://dconf.org/2018/talks/engelen.pdf Slides] [https://www.youtube.com/watch?v=GMKvYrjaaoU Video]
+
* Johan's [http://dconf.org/2018/talks/engelen.html talk about LDC's LLVM-backed goodies: PGO, fuzzing, and Address Sanitizer] at [http://dconf.org/2018/index.html DConf 2018]: [http://dconf.org/2018/talks/engelen.pdf Slides] [https://www.youtube.com/watch?v=GMKvYrjaaoU Video]
  
 
== Useful Links ==
 
== Useful Links ==

Revision as of 19:36, 9 May 2020

Compilers: OverviewDMDGDCLDC

The LDC project aims to provide a portable D programming language compiler with modern optimization and code generation capabilities. The compiler uses the official DMD frontend to support the latest D2 version and relies on the LLVM Core libraries for code generation.

LDC is fully Open Source; the parts of the code not taken/adapted from other projects are BSD-licensed (see the LICENSE file for details).

D1 is no longer supported in the current development tree; the last version supporting it can be found at the d1 Git branch.

Getting started

Project status

NOTE: As Wiki pages usually don't keep up with development, the changelog might be of use to check for recent developments and newly conquered targets.

Architectures

x86 / x86_64 Fine, CI-tested.
64-bit ARM Usable, a few testsuite failures remain (at least for non-Apple OS). See tracker issue and latest Linux CI logs for current status.
32-bit ARM Should be okay-ish, not really CI-tested though (Android ARMv7-A somewhat is). E.g., see tracker issue and Minimal semihosted ARM Cortex-M "Hello_World".
WebAssembly Should work fine; currently limited to -betterC (lacking druntime/Phobos support).
PowerPC Incomplete; has been worked on (32-bit, 64-bit big & little endian) but not touched/tested in years. E.g., see tracker issue.
MIPS Incomplete; has been worked on but not really touched/tested in years. E.g., see tracker issue.
Others Basic code generation should work as long as there's an LLVM backend, and simple -betterC code might just work.
druntime/Phobos support is most likely lacking (and probably requires a new version predefined by the compiler).
Proper C(++) interop most likely requires a new TargetABI implementation in the compiler.

Operating Systems

Linux glibc environments are working fine & CI-tested (on i686/x86_64 and AArch64).
musl/uClibc should be usable but aren't tested.
macOS Fine, CI-tested on x86_64. Requires macOS v10.7+ for native TLS. 32-bit support was dropped with LDC v1.15.
Windows Fine for 'native' MSVC (Microsoft Visual C++) environments, CI-tested on Win32 & Win64.
NOTE: LDC uses 64-bit double precision for real, unlike DMD, for MSVC long double compatibility.
32-bit MinGW support was almost complete at one stage but got neglected; a manageable number of adaptations (mainly in druntime) would probably suffice to support it again.
Android Should be usable for ARMv7-A / AArch64 / i686 / x86_64, only rudimentarily CI-tested though (compilability).
NOTE: Requires an LDC linked against our LLVM fork due to a custom TLS emulation scheme.
See Cross-compiling with LDC for how to set up cross-compilation with the Android NDK.
Also check out the extensive (but a bit dated) Build D for Android article, but note that quite a few steps would now be much simpler with a properly set up ldc2.conf.
iOS / tvOS / watchOS Should be usable with 64-bit ARM (all druntime/Phobos unittests pass on iOS with LDC v1.21), only rudimentarily CI-tested though.
The official prebuilt macOS package supports cross-compilation out-of-the-box, just use -mtriple=arm64-apple-ios12.0.
BSDs Should be usable, not CI-tested though.
Solaris Ditto.

Contributing

LDC is an entirely community-driven effort, so all contributions are warmly welcomed. The easiest way to help with development is to write high-quality bug reports for any issues you run into. For a quick guide on what a useful report should contain, please see Reporting LDC issues.

If you are interested in getting into compiler development, anecdotal evidence suggests that hacking on LDC might be a nice first step, particularly because the LLVM backend is very comfortable to work with. To get started, just browse through the issue list, find a ticket that tickles your fancy (some of them are specifically marked as "junior jobs"), and work on a fix – and of course don't hesitate to ask for advice at the mailing list or on IRC. An LDC contributor's guide is in the works. Have a look at LDC project ideas for a list of features/improvements to add to LDC.

We would also be excited to see LDC packages in more OS distributions, particular Debian and its derivatives. So, if you think you might be able to help, please just drop us a line at the development mailing list. We will actively try to make packaging as smooth as possible, but besides the fact that upstream-maintained packages are sometimes discouraged, it is hard to build good packages for a system you don't know well, so we need to rely on external contributors here.

Presentations

LDC is an active project and the team promotes the use of D and LDC.

Useful Links