Potential of a compiler that creates the executable at once

max haughton maxhaton at gmail.com
Sat Feb 12 17:20:08 UTC 2022


On Saturday, 12 February 2022 at 07:13:15 UTC, Walter Bright 
wrote:
> On 2/11/2022 6:52 AM, max haughton wrote:
>> The object emission code in the backend is quite inefficient,
>
> It's faster than any other compiler.
>
>> it needs to be rewritten (it's horrible old code anyway)
>
> I suppose that depends on what you're used to. The basic design 
> is pretty simple - there's a code gen function for each 
> expression node type. The optimizer uses standard data flow 
> analysis math. There's a separate pass for register allocation, 
> and one for scheduling.
>
> The design was originally written for the 8086. It survived 
> extension to 32 bits, then 64 bits, then SIMD.
>
> The complexity comes from the complexity of the x86 instruction 
> set and the choice of instructions is very dependent on the 
> shape of the expression trees.
>
> The only thing it has really failed at is the x87, which 
> everyone wants to leave behind anyway.

I'm specifically talking about the file that handles elf files, 
it's very messy and uses some absolutely enormous structs which 
are naturally very slow by virtue of their size.



More information about the Digitalmars-d mailing list