From: Matthijs Kooijman Date: Wed, 19 Aug 2009 08:53:53 +0000 (+0200) Subject: Add isUserDefined predicate. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=6d30f971c9d8e08c99ba1ad94349320c323d70f8;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Add isUserDefined predicate. This predicate makes a guess as to which binders are user defined. --- diff --git "a/c\316\273ash/CLasH/Normalize/NormalizeTools.hs" "b/c\316\273ash/CLasH/Normalize/NormalizeTools.hs" index 116c847..e4d22f3 100644 --- "a/c\316\273ash/CLasH/Normalize/NormalizeTools.hs" +++ "b/c\316\273ash/CLasH/Normalize/NormalizeTools.hs" @@ -20,6 +20,8 @@ import Data.Accessor.MonadState as MonadState -- GHC API import CoreSyn +import qualified Name +import qualified Id import qualified CoreSubst import qualified CoreUtils import Outputable ( showSDoc, ppr, nest ) @@ -186,3 +188,11 @@ is_local_var (CoreSyn.Var v) = do bndrs <- getGlobalBinders return $ not $ v `elem` bndrs is_local_var _ = return False + +-- Is the given binder defined by the user? +isUserDefined :: CoreSyn.CoreBndr -> Bool +-- System names are certain to not be user defined +isUserDefined bndr | Name.isSystemName (Id.idName bndr) = False +-- Assume everything else is user defined +isUserDefined bdnr = True +