- coreSimplify :: UniplateExpr a => a -> a
- coreSimplifyExpr :: CoreExpr -> CoreExpr
- coreSimplifyCaseCon :: CoreExpr -> CoreExpr
- coreSimplifyCaseCase :: CoreExpr -> CoreExpr
- coreSimplifyCaseLet :: CoreExpr -> CoreExpr
- coreSimplifyExprUnique :: UniqueIdM m => CoreExpr -> m CoreExpr
- coreSimplifyExprUniqueExt :: UniqueIdM m => ((CoreExpr -> m CoreExpr) -> CoreExpr -> m CoreExpr) -> CoreExpr -> m CoreExpr
Documentation
coreSimplify :: UniplateExpr a => a -> aSource
coreSimplifyExpr :: CoreExpr -> CoreExprSource
Simplify a single Core Expr.
Performs NO inlining, guaranteed to run in same or better space and time. May increase code size.
Bugs lurk here, with inadvertant free variable capture. Move to a proper free variable monad and a guarantee of uniqueness
coreSimplifyCaseCon :: CoreExpr -> CoreExprSource
Apply the Case (CoreCon ..) rule This rule has a serious sharing bug (doh!)
coreSimplifyCaseCase :: CoreExpr -> CoreExprSource
Apply the Case (Case ..) rule
coreSimplifyCaseLet :: CoreExpr -> CoreExprSource
Apply the Case (Let ..) rule
coreSimplifyExprUnique :: UniqueIdM m => CoreExpr -> m CoreExprSource
Precondition: All variables must be unique
The following patterns must not occur:
CoreApp _ [] CoreLet [] _ CoreLam [] _ CorePos _ _
CoreCase on _ => on notElem
{CoreCon _, CoreApp (CoreCon _) _, CoreLet _ _, CoreCase _ _}
CoreApp x _ => x notElem
{CoreApp _ _, CoreLet _ _, CoreCase _ _, CoreLam _ _}
CoreLet bind _ => all (map snd bind) notElem
{CoreLet _ _, CoreVar _}
The following should be applied if possible (and not breaking sharing):
CoreLet bind x => replaceFreeVars bind x CoreLet (CoreCase x alts) => CoreCase x (CoreLet inside each alt)