www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - How big is the DMD back-end?

reply Don Clugston <dac nospam.com.au> writes:
Walter - Could you give us an idea of the relative size of the source 
code of DMD's back-end, compared to the front end? How much of it is 
optimisation, and how much is code generation?

I'm interested in this because of my work on the BLADE library, which is 
essentially a dedicated optimising compiler for array expressions. I've 
convinced myself that with mixins, it is possible to do almost as well 
as the compiler could. It's not quite as good, because (1) it doesn't 
have access to the results of static analysis from the optimisation 
step, and (2) if I generate inline asm, it interferes with the 
compiler's other optimisations in that function....but it's extremely close.

But just because you can, doesn't mean you should <g>.

Ultimately, the key question I'm interested in is, how difficult is it 
to do such things in a library, compared to in the compiler?
If the code length is ten or a hundred times smaller when it's in the 
compiler, it doesn't make much sense for me to try to turn it into an 
industrial-strength library, and instead, I should try to package it in 
a way which would be easiest for you to integrate into DMD. OTOH there 
may be parts of the task which are easier to do from the library side.
May 02 2007
parent Walter Bright <newshound1 digitalmars.com> writes:
Don Clugston wrote:
 Walter - Could you give us an idea of the relative size of the source 
 code of DMD's back-end, compared to the front end? How much of it is 
 optimisation, and how much is code generation?

The back end is 2.1Mb of source, maybe 15% of that is the optimizer. The front end is 1.8Mb. There's about 100Kb in other stuff. BTW, the email address I have for you doesn't work. Can you send me your current one? Thanks!
May 02 2007