projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[project @ 2001-02-21 11:04:17 by simonpj]
[ghc-hetmet.git]
/
ghc
/
compiler
/
coreSyn
/
CoreSat.lhs
diff --git
a/ghc/compiler/coreSyn/CoreSat.lhs
b/ghc/compiler/coreSyn/CoreSat.lhs
index
62eda2e
..
c993d48
100644
(file)
--- a/
ghc/compiler/coreSyn/CoreSat.lhs
+++ b/
ghc/compiler/coreSyn/CoreSat.lhs
@@
-41,6
+41,7
@@
MAJOR CONSTRAINT:
So we must not change the arity of any top-level function,
because we've already fixed it and put it out into the interface file.
So we must not change the arity of any top-level function,
because we've already fixed it and put it out into the interface file.
+ Nor must we change a value (e.g. constructor) into a thunk.
It's ok to introduce extra bindings, which don't appear in the
interface file. We don't put arity info on these extra bindings,
It's ok to introduce extra bindings, which don't appear in the
interface file. We don't put arity info on these extra bindings,
@@
-418,6
+419,13
@@
mkBinds binds body
deLam :: CoreExpr -> UniqSM CoreExpr
-- Remove top level lambdas by let-bindinig
deLam :: CoreExpr -> UniqSM CoreExpr
-- Remove top level lambdas by let-bindinig
+
+deLam (Note n expr)
+ = -- You can get things like
+ -- case e of { p -> coerce t (\s -> ...) }
+ deLam expr `thenUs` \ expr' ->
+ returnUs (Note n expr')
+
deLam expr
| null bndrs = returnUs expr
| otherwise = case tryEta bndrs body of
deLam expr
| null bndrs = returnUs expr
| otherwise = case tryEta bndrs body of
@@
-427,6
+435,11
@@
deLam expr
where
(bndrs,body) = collectBinders expr
where
(bndrs,body) = collectBinders expr
+-- Why try eta reduction? Hasn't the simplifier already done eta?
+-- But the simplifier only eta reduces if that leaves something
+-- trivial (like f, or f Int). But for deLam it would be enough to
+-- get to a partial application, like (map f).
+
tryEta bndrs expr@(App _ _)
| ok_to_eta_reduce f &&
n_remaining >= 0 &&
tryEta bndrs expr@(App _ _)
| ok_to_eta_reduce f &&
n_remaining >= 0 &&
@@
-496,3
+509,5
@@
safeDem, onceDem :: RhsDemand
safeDem = RhsDemand False False -- always safe to use this
onceDem = RhsDemand False True -- used at most once
\end{code}
safeDem = RhsDemand False False -- always safe to use this
onceDem = RhsDemand False True -- used at most once
\end{code}
+
+