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
Split off selector case creation code into CoreTools.
[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 8e6926aa7c4d4ac59b3f159e690a1bee58ffb634..8bc2ef0447bea16a77f70b6fa62651cc93e9d4cf 100644
(file)
--- a/
cλash/CLasH/Normalize.hs
+++ b/
cλash/CLasH/Normalize.hs
@@
-358,10
+358,10
@@
needsInline f = do
case norm_maybe of
-- Noth normalizeable
Nothing -> return Nothing
case norm_maybe of
-- Noth normalizeable
Nothing -> return Nothing
- Just norm -> case splitNormalized norm of
+ Just norm -> case splitNormalized
NonRep
norm of
-- The function has just a single binding, so that's simple
-- enough to inline.
-- The function has just a single binding, so that's simple
-- enough to inline.
- (args, [bind], res) -> return $ Just norm
+ (args, [bind],
Var
res) -> return $ Just norm
-- More complicated function, don't inline
_ -> return Nothing
-- More complicated function, don't inline
_ -> return Nothing
@@
-569,12
+569,9
@@
casesimpl c expr@(Case scrut bndr ty alts) | not bndr_used = do
-- inlinenonrep).
if (not wild) && repr
then do
-- inlinenonrep).
if (not wild) && repr
then do
- -- Create on new binder that will actually capture a value in this
+ caseexpr <- Trans.lift $ mkSelCase scrut i
+ -- Create a new binder that will actually capture a value in this
-- case statement, and return it.
-- case statement, and return it.
- let bty = (Id.idType b)
- id <- Trans.lift $ mkInternalVar "sel" bty
- let binders = take i wildbndrs ++ [id] ++ drop (i+1) wildbndrs
- let caseexpr = Case scrut b bty [(con, binders, Var id)]
return (wildbndrs!!i, Just (b, caseexpr))
else
-- Just leave the original binder in place, and don't generate an
return (wildbndrs!!i, Just (b, caseexpr))
else
-- Just leave the original binder in place, and don't generate an