Sat May 4 08:48:55 EDT 2019
It seems simpler to do this by making holes explicit.
There are two ways of looking at it:
- put hole allocation code in the output
- parameterize the remaining code generator with the hole
- run the code generator
- from the outputs it produces, insert the hole allocation before the generated code
so they are pretty much the same thing apart from some juggling.
using outputs would also allow local variables to remain local.
i.e. escape analysis will become simpler: if a value that is computed
inside a loop does not survive it, it can be allocated inside the
loop without reference to the current iteration variable.
so each variable would have its full dimensionality, plus an
annotation indicating at which loop exit it is "dropped".
This needs to ferment.