Add the L10 intermediate language, which is the first IL not
structured around basic blocks (i.e., continuations). The pass10
pass lowers it into the L4 language.
Details
Motivation
Directly translating the source language into a language with explicit
basic blocks is hard. L10 is intended to bridge the gap between the
source language and L4.
Language
The name L10 is chosen so that there's still space for more ILs. It
does away with the basic-block centered structure, instead providing
higher- level control-flow constructs such as if, case, and
loop.
A try/except like facility is currently missing, meaning that
exception handling (where Raise is used) cannot be expressed.
Some way to delimit lifetimes of locals is also missing. Locals are
currently treated as being alive for the whole duration, which can lead
to locals that have their address taken being kept alive longer than
necessary.
Apart from the new control-flow constructs, L10 stays close to L4,
so that the lowering can focus on the splitting the procedure into
basic blocks.
To-Do
[x] improve the tests (mainly the documentation)
[x] make the t01_loop test work
[x] look into improving "pinned local" handling
[x] write a proper commit message
Notes For Reviewers
a try/except like facility can be added later on with ease
for a scoping / lifetime delimiting facility, I think it makes sense to wait until the source language requirements become clearer
Summary
Add the
L10
intermediate language, which is the first IL not structured around basic blocks (i.e., continuations). Thepass10
pass lowers it into theL4
language.Details
Motivation
Directly translating the source language into a language with explicit basic blocks is hard.
L10
is intended to bridge the gap between the source language andL4
.Language
The name
L10
is chosen so that there's still space for more ILs. It does away with the basic-block centered structure, instead providing higher- level control-flow constructs such asif
,case
, andloop
.A
try
/except
like facility is currently missing, meaning that exception handling (whereRaise
is used) cannot be expressed.Some way to delimit lifetimes of locals is also missing. Locals are currently treated as being alive for the whole duration, which can lead to locals that have their address taken being kept alive longer than necessary.
Apart from the new control-flow constructs,
L10
stays close toL4
, so that the lowering can focus on the splitting the procedure into basic blocks.To-Do
t01_loop
test workNotes For Reviewers
try
/except
like facility can be added later on with ease