From: Matthijs Kooijman Date: Fri, 5 Mar 2010 17:15:49 +0000 (+0100) Subject: Let getNormalized return Nothing on non-normalizeable functions. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=c499e901a25eb7df0bfac03d57ee3401ad6cb7e7;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Let getNormalized return Nothing on non-normalizeable functions. --- diff --git "a/c\316\273ash/CLasH/Normalize.hs" "b/c\316\273ash/CLasH/Normalize.hs" index fa14ef6..82cc89b 100644 --- "a/c\316\273ash/CLasH/Normalize.hs" +++ "b/c\316\273ash/CLasH/Normalize.hs" @@ -734,20 +734,21 @@ getNormalized :: getNormalized bndr = do norm <- getNormalized_maybe bndr return $ Maybe.fromMaybe - (error $ "Normalize.getNormalized: Unknown function requested: " ++ show bndr) + (error $ "Normalize.getNormalized: Unknown or non-representable function requested: " ++ show bndr) norm -- | Returns the normalized version of the given function, or Nothing --- when the binder is not a known global binder. +-- when the binder is not a known global binder or is not normalizeable. getNormalized_maybe :: CoreBndr -- ^ The function to get -> TranslatorSession (Maybe CoreExpr) -- The normalized function body getNormalized_maybe bndr = do expr_maybe <- getGlobalBind bndr - if Maybe.isNothing expr_maybe + normalizeable <- isNormalizeable' bndr + if not normalizeable || Maybe.isNothing expr_maybe then - -- Binder not found + -- Binder not normalizeable or not found return Nothing else if is_poly (Var bndr) then