MLton 20100608 XMLShrink
Home  Index  
XMLShrink is an optimization pass for the XML IntermediateLanguage, invoked from XMLSimplify.

Description

This pass performs optimizations based on a reduction system.

Implementation

[WWW]shrink.sig [WWW]shrink.fun

Details and Notes

The simplifier is based on Shrinking Lambda Expressions in Linear Time.

The source program may contain functions that are only called once, or not even called at all. Match compilation introduces many such functions. In order to reduce the program size, speed up later phases, and improve the flow analysis, a source to source simplifier is run on XML after type inference and match compilation.

The simplifier implements the reductions shown below. The reductions eliminate unnecessary declarations (see the side constraint in the figure), applications where the function is immediate, and case statements where the test is immediate. Declarations can be eliminated only when the expression is nonexpansive (see Section 4.7 of the Definition), which is a syntactic condition that ensures that the expression has no effects (assignments, raises, or nontermination). The reductions on case statements do not show the other irrelevant cases that may exist. The reductions were chosen so that they were strongly normalizing and so that they never increased tree size.


Last edited on 2006-11-02 17:33:47 by MatthewFluet.