From: Matthijs Kooijman Date: Fri, 14 Aug 2009 12:12:50 +0000 (+0200) Subject: No longer add a top level let before normalization. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=a225f53c9ac84f9c325d498867e92b302cbac83a;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git No longer add a top level let before normalization. This was previously required to ensure there was always a let on top level. However, since we are using nonrecursive lets now and use a splitNormalized instead of hard matching a Let constructor, there is no need for an (empty) let at the top anymore. --- diff --git "a/c\316\273ash/CLasH/Normalize.hs" "b/c\316\273ash/CLasH/Normalize.hs" index 9fe4ed1..6eee47b 100644 --- "a/c\316\273ash/CLasH/Normalize.hs" +++ "b/c\316\273ash/CLasH/Normalize.hs" @@ -587,15 +587,11 @@ normalizeExpr :: -> TranslatorSession CoreSyn.CoreExpr -- ^ The normalized expression normalizeExpr what expr = do - -- Introduce an empty Let at the top level, so there will always be - -- a let in the expression (none of the transformations will remove - -- the last let). - let expr' = Let (Rec []) expr -- Normalize this expression - trace (what ++ " before normalization:\n\n" ++ showSDoc ( ppr expr' ) ++ "\n") $ return () - expr'' <- dotransforms transforms expr' - trace ("\n" ++ what ++ " after normalization:\n\n" ++ showSDoc ( ppr expr'')) $ return () - return expr'' + trace (what ++ " before normalization:\n\n" ++ showSDoc ( ppr expr ) ++ "\n") $ return () + expr' <- dotransforms transforms expr + trace ("\n" ++ what ++ " after normalization:\n\n" ++ showSDoc ( ppr expr')) $ return () + return expr' -- | Get the value that is bound to the given binder at top level. Fails when -- there is no such binding.