Nim's ORC - Vorsprung durch Algorithmen

Petar Petar
Wed Feb 3 08:58:18 UTC 2021


On Tuesday, 2 February 2021 at 11:32:53 UTC, Max Haughton wrote:
> On Tuesday, 2 February 2021 at 11:14:24 UTC, Ola Fosheim 
> Grøstad wrote:
>> On Tuesday, 2 February 2021 at 08:11:03 UTC, Max Haughton 
>> wrote:
>>> HOWEVER - all of these changes effectively mean bolting even 
>>> more flow analysis to the compiler which isn't great given 
>>> the current coding styles in dmd (It's very "flat" i.e. not 
>>> much abstraction, and there is a tendency to dump everything 
>>> in one 10k line file) - this is an easily solvable problem, 
>>> we just need to be more forward thinking.
>>
>> There is a need for a new typed intermediate representation 
>> that is higher level than the LLVM IR.
>>
>> One problem is that D allows directly emitting low level 
>> constructs.
>>
>> One way to deal with this is to require all low level code to 
>> have a high level counterpart with a version selector.
>
> I'm not convinced that an IR is needed as much as a clearly 
> defined pipeline for the AST as it goes through the compiler, 
> e.g. trying to organise code into passes, at least locally.

One could argue that dmd already has 2 IRs separate from the AST 
representation:

1. https://github.com/dlang/dmd/blob/master/src/dmd/e2ir.d, 
https://github.com/dlang/dmd/blob/master/src/dmd/s2ir.d
2. 
https://github.com/dlang/dmd/blob/7233643c5da2bb531dd0fdec5f823daa12d30217/src/dmd/ob.d#L84-L114


:P


More information about the Digitalmars-d mailing list