projects
/
matthijs
/
master-project
/
cλash.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3d93e9c
)
Switch order of clauses in retvalsimpl to match thesis.
author
Matthijs Kooijman
<matthijs@stdin.nl>
Tue, 6 Apr 2010 14:50:39 +0000
(16:50 +0200)
committer
Matthijs Kooijman
<matthijs@stdin.nl>
Tue, 6 Apr 2010 14:50:39 +0000
(16:50 +0200)
cλash/CLasH/Normalize.hs
patch
|
blob
|
history
diff --git
a/cλash/CLasH/Normalize.hs
b/cλash/CLasH/Normalize.hs
index 36990dffc5e3cb733c12604765739168001ae934..85be0d0ef61ae37050835a9784185a538db04990 100644
(file)
--- a/
cλash/CLasH/Normalize.hs
+++ b/
cλash/CLasH/Normalize.hs
@@
-128,6
+128,16
@@
castsimpltop = everywhere ("castsimpl", castsimpl)
-- transformation ensures that the lambda abstractions always contain a
-- recursive let and that, when the return value is representable, the
-- let contains a local variable reference in its body.
-- transformation ensures that the lambda abstractions always contain a
-- recursive let and that, when the return value is representable, the
-- let contains a local variable reference in its body.
+retvalsimpl c expr | all (== LambdaBody) c && not (is_lam expr) && not (is_let expr) = do
+ local_var <- Trans.lift $ is_local_var expr
+ repr <- isRepr expr
+ if not local_var && repr
+ then do
+ id <- Trans.lift $ mkBinderFor expr "res"
+ change $ Let (Rec [(id, expr)]) (Var id)
+ else
+ return expr
+
retvalsimpl c expr@(Let (Rec binds) body) | all (== LambdaBody) c = do
-- Don't extract values that are already a local variable, to prevent
-- loops with ourselves.
retvalsimpl c expr@(Let (Rec binds) body) | all (== LambdaBody) c = do
-- Don't extract values that are already a local variable, to prevent
-- loops with ourselves.
@@
-142,15
+152,6
@@
retvalsimpl c expr@(Let (Rec binds) body) | all (== LambdaBody) c = do
else
return expr
else
return expr
-retvalsimpl c expr | all (== LambdaBody) c && not (is_lam expr) && not (is_let expr) = do
- local_var <- Trans.lift $ is_local_var expr
- repr <- isRepr expr
- if not local_var && repr
- then do
- id <- Trans.lift $ mkBinderFor expr "res"
- change $ Let (Rec [(id, expr)]) (Var id)
- else
- return expr
-- Leave all other expressions unchanged
retvalsimpl c expr = return expr
-- Leave all other expressions unchanged
retvalsimpl c expr = return expr