X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fmaster-project%2Fc%CE%BBash.git;a=blobdiff_plain;f=c%CE%BBash%2FCLasH%2FNormalize.hs;h=acb3450fe14ab17711d0ed85ae59ed8dedbf3c06;hp=d6acc13b19dbc82e37ffaa08195421c63e1f4e52;hb=34cf5a129ac161f9d39aa1a7e7449df3fef408e4;hpb=118a85a1ad01d78cf9e4a2e63d0f7b4f35bb8a1f diff --git "a/c\316\273ash/CLasH/Normalize.hs" "b/c\316\273ash/CLasH/Normalize.hs" index d6acc13..acb3450 100644 --- "a/c\316\273ash/CLasH/Normalize.hs" +++ "b/c\316\273ash/CLasH/Normalize.hs" @@ -782,11 +782,11 @@ argproptop = everywhere ("argprop", argprop) -------------------------------- -- Non-representable result inlining -------------------------------- --- This transformation takes a function that has a non-representable --- result (e.g., a tuple containing a function, or an Integer. The --- latter can occur in some cases as the result of the fromIntegerT --- function) and inlines enough of the function to make the result --- representable again. +-- This transformation takes a function (top level binding) that has a +-- non-representable result (e.g., a tuple containing a function, or an +-- Integer. The latter can occur in some cases as the result of the +-- fromIntegerT function) and inlines enough of the function to make the +-- result representable again. -- -- This is done by first normalizing the function and then "inlining" -- the result. Since no unrepresentable let bindings are allowed in @@ -797,6 +797,12 @@ argproptop = everywhere ("argprop", argprop) -- -- The new function result will be a tuple containing all free variables -- of the old result, so the old result can be rebuild at the caller. +-- +-- We take care not to inline dictionary id's, which are top level +-- bindings with a non-representable result type as well, since those +-- will never become VHDL signals directly. There is a separate +-- transformation (inlinedict) that specifically inlines dictionaries +-- only when it is useful. inlinenonrepresult, inlinenonrepresulttop :: Transform -- Apply to any (application of) a reference to a top level function @@ -805,7 +811,7 @@ inlinenonrepresult, inlinenonrepresulttop :: Transform -- expressions are generally left alone and can occur anywhere. inlinenonrepresult context expr | not (is_fun expr) = case collectArgs expr of - (Var f, args) -> do + (Var f, args) | not (Id.isDictId f) -> do repr <- isRepr expr if not repr then do @@ -856,7 +862,8 @@ inlinenonrepresult context expr | not (is_fun expr) = change letexpr_uniqued Nothing -> return expr else - -- Don't touch representable expressions + -- Don't touch representable expressions or (applications of) + -- dictionary ids. return expr -- Not a reference to or application of a top level function _ -> return expr