* module/language/cps.scm ($rec): Replace $letrec with $rec, which is an
expression, not a term. This means that the names bound by the letrec
appear twice: once in the $rec term, and once in the continuation.
This is not very elegant, but the situation is better than it was
before. Adapt all callers.
* doc/ref/compiler.texi (CPS in Guile): Incomplete documentation
updates. I'll update these later when the IL settles down.
* module/language/cps/cse.scm:
* module/language/cps/dfg.scm (compute-idoms, compute-dom-edges): Move
these procedures from cse.scm to dfg.scm.
Remove loop-detection code; that can come back later but it is
bitrotten for now.
* module/language/cps/effects-analysis.scm: Rewrite so that instead of
the depends/causes effects, there is just &type-check, &allocation,
&read, and &write. The object kind is a separate part of the
bitfield, and the field in the object (if appropriate) is another
field. Effects are still a fixnum. This enables precise effects for
vectors and structs on all architectures.
This kind of effects analysis was not possible in Tree-IL because
Tree-IL relied on logior-ing effects of subexpressions, whereas with
CPS we have no sub-expressions and we do flow analysis instead.
(effect-clobbers?): Replace effects-commute? with this inherently
directional and precise predicate.
* module/language/cps/cse.scm (compute-always-available-expressions):
(compute-equivalent-subexpressions): Adapt to effects analysis
change.
* module/language/cps/dce.scm (compute-live-code): Likewise.
* module/language/cps/cse.scm (compute-always-available-expressions):
Use constant? instead of zero?, to avoid punching through the effects
abstraction.
* module/language/cps/cse.scm (compute-available-expressions):
Simplify initialization.
(compute-equivalent-subexpressions): When synthesizing definitions,
use substed vars. Add synthetic definitions after processing an
expression, to take advantage of the substed vars.
* module/language/cps/effects-analysis.scm (effects-clobber): New
helper.
(length): Only depend on &cdr.
(synthesize-definition-effects!): New interface.
* module/language/cps/cse.scm (compute-available-expressions): Don't
count out constructors here -- we'll do that below.
(compute-defs): Add a comment.
(compute-equivalent-subexpressions): Synthesize getter calls at
constructor/setter sites, so that (set-car! x y) can cause a
future (car x) to just reference y. The equiv-labels set now stores
the defined vars, so there is no need for the defs vector.
(cse, apply-cse): Adapt to compute-equivalent-subexpressions change.
* module/language/cps.scm (make-global-cont-folder)
(make-local-cont-folder): Separate this macro in two. It's hot and
the difference can be important for perf.
* module/language/cps/dfg.scm (compute-label-and-var-ranges):
* module/language/cps/cse.scm (compute-label-and-var-ranges):
* module/language/cps/dce.scm (compute-live-code): Adapt.
* module/language/cps/cse.scm (compute-truthy-expressions):
(compute-equivalent-subexpressions, apply-cse): Arrange to infer
truthiness of expressions, and use that information to elide redundant
tests.
* module/language/cps/cse.scm (compute-available-expressions, cse):
(compute-idoms, compute-equivalent-subexpressions, apply-cse): Remove
attempts to deal with bailout, as the bailout pass handles that
already.
* module/language/cps/cse.scm (compute-available-expressions): Compute a
bailout set -- or at least, set things up so that we can do so.
(compute-idoms): Don't add predecessors that bail out.
(apply-cse, cse, compute-equivalent-subexpressions): Thread the
bailout set through the computations.
* module/language/cps/cse.scm (compute-available-expressions): Prepare
for being able to prune joins from bailouts. Always loop after the
first iteration.
* module/language/cps/effects-analysis.scm: Remove &possible-bailout.
Rename &definite-bailout to &bailout, and rename
&all-effects-but-bailout to &unknown-effects.
* module/language/cps/cse.scm: New file.
* module/language/cps/compile-bytecode.scm: Wire up CSE, on by default.
Currently using the #:cps-cse? keyword.
* module/Makefile.am: Add new file.