From 832e51575f3361daefd1e0d0c0e25ba7397c2e6a Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Tue, 30 Mar 2010 16:49:51 +0200 Subject: [PATCH] Add LetBody and LetBinding to the CoreContext. --- "c\316\273ash/CLasH/Normalize/NormalizeTools.hs" | 8 ++++---- "c\316\273ash/CLasH/Normalize/NormalizeTypes.hs" | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git "a/c\316\273ash/CLasH/Normalize/NormalizeTools.hs" "b/c\316\273ash/CLasH/Normalize/NormalizeTools.hs" index 9ca2aa0..09ae3f5 100644 --- "a/c\316\273ash/CLasH/Normalize/NormalizeTools.hs" +++ "b/c\316\273ash/CLasH/Normalize/NormalizeTools.hs" @@ -62,18 +62,18 @@ subeverywhere trans c (App a b) = do return $ App a' b' subeverywhere trans c (Let (NonRec b bexpr) expr) = do - bexpr' <- trans (Other:c) bexpr - expr' <- trans (Other:c) expr + bexpr' <- trans (LetBinding:c) bexpr + expr' <- trans (LetBody:c) expr return $ Let (NonRec b bexpr') expr' subeverywhere trans c (Let (Rec binds) expr) = do - expr' <- trans (Other:c) expr + expr' <- trans (LetBody:c) expr binds' <- mapM transbind binds return $ Let (Rec binds') expr' where transbind :: (CoreBndr, CoreExpr) -> TransformMonad (CoreBndr, CoreExpr) transbind (b, e) = do - e' <- trans (Other:c) e + e' <- trans (LetBinding:c) e return (b, e') subeverywhere trans c (Lam x expr) = do diff --git "a/c\316\273ash/CLasH/Normalize/NormalizeTypes.hs" "b/c\316\273ash/CLasH/Normalize/NormalizeTypes.hs" index 9059252..e412e96 100644 --- "a/c\316\273ash/CLasH/Normalize/NormalizeTypes.hs" +++ "b/c\316\273ash/CLasH/Normalize/NormalizeTypes.hs" @@ -21,6 +21,11 @@ data CoreContext = AppFirst -- ^ The expression is the first | AppSecond -- ^ The expression is the second -- argument of an application -- (i.e., something is applied to it) + | LetBinding -- ^ The expression is bound in a + -- (recursive or non-recursive) let + -- expression. + | LetBody -- ^ The expression is the body of a + -- let expression | Other -- ^ Another context -- | Transforms a CoreExpr and keeps track if it has changed. -- 2.30.2