Module PostUnfold

This module performs some compression on the resultants. This is necessary because the termination criteria leads to many intermediate specializations which occur only once and can therefore be inlined.

Note that some optimizations may never be applied depending on the partial evaluation mechanism.

Author: Elvira Albert, German Vidal, Michael Hanus, Björn Peemöller

Version: September 2015

Summary of exported operations:

postUnfold :: Options -> [(String,String)] -> [(Expr,((String,String),[Int]))] -> [(((String,String),[Int]),Expr)] -> ([(Expr,((String,String),[Int]))],[(((String,String),[Int]),Expr)])   
Compress the resultants.
unAlias :: [(Expr,((String,String),[Int]))] -> [(((String,String),[Int]),Expr)] -> ([(Expr,((String,String),[Int]))],[(((String,String),[Int]),Expr)])   
Remove aliases and duplicates.
removeCopies :: Prog -> [(Expr,((String,String),[Int]))] -> [(((String,String),[Int]),Expr)] -> ([(Expr,((String,String),[Int]))],[(((String,String),[Int]),Expr)])   
Removes any resultants that are copies of ordinary program functions to avoid code duplication.

Exported operations:

postUnfold :: Options -> [(String,String)] -> [(Expr,((String,String),[Int]))] -> [(((String,String),[Int]),Expr)] -> ([(Expr,((String,String),[Int]))],[(((String,String),[Int]),Expr)])   

Compress the resultants.

Example call:
(postUnfold fs rs)
Parameters:
  • fs : List of functions called by user-annotated expressions.
  • rs : Resultants to be compressed.

unAlias :: [(Expr,((String,String),[Int]))] -> [(((String,String),[Int]),Expr)] -> ([(Expr,((String,String),[Int]))],[(((String,String),[Int]),Expr)])   

Remove aliases and duplicates.

removeCopies :: Prog -> [(Expr,((String,String),[Int]))] -> [(((String,String),[Int]),Expr)] -> ([(Expr,((String,String),[Int]))],[(((String,String),[Int]),Expr)])   

Removes any resultants that are copies of ordinary program functions to avoid code duplication.