* module/language/cps2/verify.scm: New diagnostic pass.
* module/Makefile.am: Add verify.scm.
* module/language/cps2/optimize.scm: Wire up verification pass.
Always run the pass at the end, and if a variable is set run it
between passes too.
* module/language/cps2/self-references.scm: New pass, ported from CPS.
* module/language/cps2/optimize.scm: Wire up the self references pass.
* module/Makefile.am: Add new file.
* module/language/cps2/simplify.scm (compute-singly-referenced-vars):
New helper.
(compute-eta-reductions): Turns out, eta conversion on a graph
doesn't work the same way that it works on nested terms -- since
uses and defs are computed using the flow graph and not nested
terms, we need to check additionally that the vars are singly-used.
* module/language/cps/slot-allocation.scm (allocate-slots): Even if an
expression does not define a live value, it might need a place to
put its value. In that case we should stop scanning for hints,
otherwise e.g. an (current-module) primcall whose value isn't used
could clobber a hinted variable.
* module/language/cps2/cse.scm: New file, ported from CPS.
* module/language/cps2/optimize.scm: Wire up CSE.
* module/Makefile.am: Add language/cps2/cse.scm.
* module/language/cps/compile-bytecode.scm (optimize): Disable
prune-top-level-scopes on old CPS. It seems to not work if CSE has
run beforehand.
* module/language/cps2/utils.scm (compute-function-body): $callk does
not add to a local function graph.
(compute-successors): Fix extraction of "handler" continuation for
$prompt.
* module/language/cps2/utils.scm (compute-successors): New helper.
(compute-reverse-post-order): Move here from contification.scm and
rename from "sort-nodes".
(invert-graph): New helper.
(compute-strongly-connected-components): Move here from
contification.scm and rename from "compute-sccs".
* module/language/cps2/contification.scm (sort-nodes, compute-sccs): Remove.
* module/language/cps2/elide-values.scm: New file.
* module/language/cps2/optimize.scm (optimize): Wire up elide-values.
* module/Makefile.am: Add new file.
* module/language/cps2/prune-top-level-scopes.scm
(prune-top-level-scopes): Given that cache-current-module! is an
instruction, it will always continue to a nullary $kargs, so $values
is actually the correct replacement and not a values primcall.
* module/language/cps2/specialize-primcalls.scm: New file.
* module/language/cps2/optimize.scm: Wire up specialize-primcalls.
* module/Makefile.am: Add new file.