From: Matthijs Kooijman Date: Mon, 13 Jul 2009 07:43:31 +0000 (+0200) Subject: Normalize all used global binders. X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fmaster-project%2Fc%CE%BBash.git;a=commitdiff_plain;h=7762251a1355fbcbb08317926ca232951c146744 Normalize all used global binders. Previously, only function-typed binders were normalized (not necessarily limited to global ones!). --- diff --git a/Adders.hs b/Adders.hs index f0987fd..a281ea6 100644 --- a/Adders.hs +++ b/Adders.hs @@ -181,6 +181,9 @@ xand a b = hwand a b functiontest :: TFVec D3 (TFVec D4 Bit) -> TFVec D12 Bit functiontest = \v -> let r = concat v in r +functiontest2 :: SizedInt D8 -> SizedInt D8 +functiontest2 = \a -> let r = a + 1 in r + xhwnot x = hwnot x maptest :: TFVec D4 Bit -> TFVec D4 Bit diff --git a/Normalize.hs b/Normalize.hs index fe544ed..d5b993a 100644 --- a/Normalize.hs +++ b/Normalize.hs @@ -514,7 +514,8 @@ normalizeBind bndr = -- Find all vars used with a function type. All of these should be global -- binders (i.e., functions used), since any local binders with a function -- type should have been inlined already. - let used_funcs_set = CoreFVs.exprSomeFreeVars (\v -> (Type.isFunTy . snd . Type.splitForAllTys . Id.idType) v) expr' + bndrs <- getGlobalBinders + let used_funcs_set = CoreFVs.exprSomeFreeVars (\v -> not (Id.isDictId v) && v `elem` bndrs) expr' let used_funcs = VarSet.varSetElems used_funcs_set -- Process each of the used functions recursively mapM normalizeBind used_funcs