This is the code that expands array and record assignments out into multiple
assignments. Having it done as a pass means it can do a better job -- this
fixes some problems with cgtest56 where the old version of the code couldn't
handle record assignments from literals.
This is the first pass that's had to add a replicator to the tree, so this also
introduces a helper function for generating new replicator counters.
The types have been added to the AST. Beyond the obvious trivial changes (extra cases in functions, etc), the only
significant change was that isSafeConversion needed to be changed. I took the opportunity to totally rewrite the
function into a graph-like mechanism rather than just using a list. To demonstrate its correctness I also wrote an
exhaustive test for it.
The compiler itself is under the GPLv2+; the support code that gets built into
user programs is under the LGPLv2+. This matches the existing practice for the
KRoC project.
(As with Occade, I've used the new GPLv3-style license header in the source
files, though, since that avoids having to update the FSF's postal address.)
This does about the minimum necessary for assembly analysis to work. It assumes
that any function it hasn't been able to analyse itself needs 512 bytes (most
need far less); it doesn't do any flow analysis; it doesn't do a lot of sanity
checking. However, it produces sensible numbers, and works with the demos I've
tried so far.
I was originally going to make this a separate tool, but there are a number of
bits of the code can be nicely reused, so it's a separate "operating mode" in
the existing program (as is parse-only mode now).
... and update GenerateCPPCSP to do so. This works by having a structure of
operations (GenOps) through which all the recursive calls go, and having
GenerateCPPCSP replace only the operations that it wants to override.