projects
/
matthijs
/
master-project
/
cλash.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix typo.
[matthijs/master-project/cλash.git]
/
cλash
/
CLasH
/
Normalize.hs
diff --git
a/cλash/CLasH/Normalize.hs
b/cλash/CLasH/Normalize.hs
index 4ef112b605e762c16186f12951123a37574e060d..0d352761dbafec889da2345d1b82bc9dab0b4542 100644
(file)
--- a/
cλash/CLasH/Normalize.hs
+++ b/
cλash/CLasH/Normalize.hs
@@
-64,8
+64,10
@@
etatop = notappargs ("eta", eta)
-- β-reduction
--------------------------------
beta, betatop :: Transform
-- β-reduction
--------------------------------
beta, betatop :: Transform
--- Substitute arg for x in expr
-beta (App (Lam x expr) arg) = setChanged >> substitute x arg expr
+-- Substitute arg for x in expr. For value lambda's, also clone before
+-- substitution.
+beta (App (Lam x expr) arg) | CoreSyn.isTyVar x = setChanged >> substitute x arg expr
+ | otherwise = setChanged >> substitute_clone x arg expr
-- Propagate the application into the let
beta (App (Let binds expr) arg) = change $ Let binds (App expr arg)
-- Propagate the application into each of the alternatives
-- Propagate the application into the let
beta (App (Let binds expr) arg) = change $ Let binds (App expr arg)
-- Propagate the application into each of the alternatives
@@
-322,7
+324,7
@@
inlinenonreptop = everywhere ("inlinenonrep", inlinebind ((Monad.liftM not) . is
inlinetoplevel, inlinetopleveltop :: Transform
-- Any system name is candidate for inlining. Never inline user-defined
inlinetoplevel, inlinetopleveltop :: Transform
-- Any system name is candidate for inlining. Never inline user-defined
--- functions, to preserve
r
structure.
+-- functions, to preserve 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
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