From: christiaanb Date: Mon, 7 Jun 2010 20:36:13 +0000 (+0200) Subject: Temporarily disable "inlinenonrepresult" transformation, and apply eta-expansion... X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fmaster-project%2Fc%CE%BBash.git;a=commitdiff_plain;h=d3b0fc8a0ff805488e67881b71f2cf29db0f10fb Temporarily disable "inlinenonrepresult" transformation, and apply eta-expansion transformation to all expressions --- diff --git a/clash/CLasH/Normalize.hs b/clash/CLasH/Normalize.hs index c27e93e..ea171ca 100644 --- a/clash/CLasH/Normalize.hs +++ b/clash/CLasH/Normalize.hs @@ -216,10 +216,15 @@ needsInline f = do -- body consisting of a bunch of nested lambdas containing a -- non-function value (e.g., a complete application). eta :: Transform -eta c expr | is_fun expr && not (is_lam expr) && all (== LambdaBody) c = do - let arg_ty = (fst . Type.splitFunTy . CoreUtils.exprType) expr - id <- Trans.lift $ mkInternalVar "param" arg_ty - change (Lam id (App expr (Var id))) +eta (AppFirst:_) expr = return expr +-- Also don't apply to arguments, since this can cause loops with +-- funextract. This isn't the proper solution, but due to an +-- implementation bug in notappargs, this is how it used to work so far. +eta (AppSecond:_) expr = return expr +eta c expr | is_fun expr && not (is_lam expr) = do + let arg_ty = (fst . Type.splitFunTy . CoreUtils.exprType) expr + id <- Trans.lift $ mkInternalVar "param" arg_ty + change (Lam id (App expr (Var id))) -- Leave all other expressions unchanged eta c e = return e @@ -947,7 +952,7 @@ letmerge c expr = return expr -- What transforms to run? transforms = [ ("inlinedict", inlinedict) , ("inlinetoplevel", inlinetoplevel) - , ("inlinenonrepresult", inlinenonrepresult) + -- , ("inlinenonrepresult", inlinenonrepresult) , ("knowncase", knowncase) , ("classopresolution", classopresolution) , ("argprop", argprop)