D compiler layers

bearophile bearophileHUGS at lycos.com
Wed Nov 25 06:40:43 PST 2009


(This comes from things that Lindquist has vaguely said, but I am not sure).

I am very ignorant about this topic still, so I can be quite wrong, but I think it can be positive to split the D2 front-end in two layers, to simplify the creation of D compilers:
1) A true front-end layer that's almost independant, that can be adapted to different back-ends;
2) A middle-layer that performs some higher-order operations, like run-time execution of functions, certain high level optimizations (like pure function optimizations like pulling pure functions out of loops, and eventually some delegate inlining), that can be missing in the DMD backend but already present in LLVM. Such operations need to know semantics about the code, so LLVM by itself may be unable to perform them.

So when you try to use LLVM to compile D code you don't touch the true front-end, and you replace some of the parts of the middle layer with things already present in LLVM.

Bye,
bearophile



More information about the Digitalmars-d mailing list