DMD backend generation future with the new AI race processor

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Tue Mar 12 04:36:42 UTC 2024


On 12/03/2024 4:47 PM, Walter Bright wrote:
> On 3/10/2024 5:40 PM, Richard (Rikki) Andrew Cattermole wrote:
>> Even with Walter working full time on it for a few years, that backend 
>> will never match what LLVM 19 can do without things like that.
> 
> I regularly have people telling me what I can't do :-)
> 
> For example, people in this forum used to tell me that DMD didn't do 
> Data Flow Analysis and DFA had been invented in the 2000s.
> 
> Never mind that Datalight C circa 1985 was the very first DOS compiler 
> to do DFA.
> 
> I was told the backend couldn't do loop unrolling which was a special 
> magical thing that only super advanced engineers could write, which it 
> now does.
> 
> Then I was told the backend couldn't do SROA, which it does now.
> 
> Then I was told the backend couldn't do SIMD, which it does now.
> 
> And so on.
> 
> It just takes time to do these things, and I'm pretty booked. The DMD 
> backend is doing remarkably well considering how little time I spend on it.
> 
> Just recently the imminent demise of it was predicted because it wasn't 
> generating IBT (Indirect Branch Tracking) code. It generates IBT now.

It's not that I wouldn't love to see you do it, its just that you have 
25 years worth of work to do if you want to get it up to state of the art.

That is an incredible amount of work for a team to do, let alone one person.

The most beneficial thing now would probably be refactoring it into 
something the average compiler developer can recognize.

That way others can improve it whilst you work on other things ;)

I would absolutely love to see that backend discussed being used on 
r/compilers and r/ProgrammingLanguages. It could fill a very niche role 
in the programming language development communities that would be ideal 
to getting D used there.

It could quite easily make QBE look like a toy, it's just a shame it 
can't without some massive refactoring and documentation efforts.


More information about the Digitalmars-d mailing list