How hard would it be to create a new backend in D?

IGotD- nise at nise.com
Fri Aug 5 21:54:52 UTC 2022


On Friday, 5 August 2022 at 20:37:19 UTC, rempas wrote:
> I was wondering how easy it would be to create a new backend in 
> D? From what I know all of the tree DMD, LDC and GDC are using 
> the same frontend which is the one from DMD. So I would suppose 
> that there is a way to do that and that probably DMD has 
> evolved over the years to make its frontend more portable. 
> However, how strain-forward is it? Is it legit to do it or will 
> it require "hacking" (if you understand what I mean). So it's 
> not about working hard but if the work makes sense or if I'll 
> constantly find obstacles that no one would be able to help me 
> with.
>
> I know some of you will ask so, I want to use 
> [mir](https://github.com/vnmakarov/mir) as a backend because of 
> it's fast compile times and it's great runtime performance! So 
> yeah, not a question purely out of curiosity!

Why would you want to create a new backend when you have LLVM and 
GCC? Scrap the DMD backend. The only claimed benefit is that it 
is fast which isn't much compared to the amount of time spent on 
maintenance.

It's not the 90s anymore where you only had a Intel Pentium 
target. Now you have many Intel optimizations options, ARM (many 
models there as well), RISC V, PowerPC etc. and more are coming.

Let's focus on the language because CPU support is out of scope 
for the D project.



More information about the Digitalmars-d mailing list