X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=c%CE%BBash%2FCLasH%2FNormalize.hs;h=1f5ee427069751c0d7d56d4ecb563c5fad978c8e;hb=7d3ab3315462e18a84e6d0312dd3c444292e43bb;hp=38ee353ac4225fe49dc3b8e85c7c248de7f66f6e;hpb=f570cf39514c5e691b8160f8cd80e60d964fe9e6;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git diff --git "a/c\316\273ash/CLasH/Normalize.hs" "b/c\316\273ash/CLasH/Normalize.hs" index 38ee353..1f5ee42 100644 --- "a/c\316\273ash/CLasH/Normalize.hs" +++ "b/c\316\273ash/CLasH/Normalize.hs" @@ -324,10 +324,11 @@ inlinetoplevel, inlinetopleveltop :: Transform -- Any system name is candidate for inlining. Never inline user-defined -- functions, to preserver structure. inlinetoplevel expr@(Var f) | not $ isUserDefined f = do + norm <- isNormalizeable f -- See if this is a top level binding for which we have a body body_maybe <- Trans.lift $ getGlobalBind f - case body_maybe of - Just body -> do + if norm && Maybe.isJust body_maybe + then do -- Get the normalized version norm <- Trans.lift $ getNormalized f if needsInline norm @@ -335,9 +336,9 @@ inlinetoplevel expr@(Var f) | not $ isUserDefined f = do change norm else return expr - -- No body, this is probably a local variable or builtin or external - -- function. - Nothing -> return expr + else + -- No body or not normalizeable. + return expr -- Leave all other expressions unchanged inlinetoplevel expr = return expr inlinetopleveltop = everywhere ("inlinetoplevel", inlinetoplevel)