X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FcoreSyn%2FCoreTidy.lhs;h=37c6cb353b9d43c9fc855c0eb42bbc6977f41f25;hb=7c737416e30137e7053b4bcd0fdd563f07fa43b0;hp=7b80eacf89f5195365f18658e1993844ea971a06;hpb=f94350a049d2a1c2b2f1aa25c62dfe20a541c049;p=ghc-hetmet.git diff --git a/compiler/coreSyn/CoreTidy.lhs b/compiler/coreSyn/CoreTidy.lhs index 7b80eac..37c6cb3 100644 --- a/compiler/coreSyn/CoreTidy.lhs +++ b/compiler/coreSyn/CoreTidy.lhs @@ -1,8 +1,19 @@ % +% (c) The University of Glasgow 2006 % (c) The AQUA Project, Glasgow University, 1996-1998 % +This module contains "tidying" code for *nested* expressions, bindings, rules. +The code for *top-level* bindings is in TidyPgm. + \begin{code} +{-# OPTIONS -w #-} +-- The above warning supression flag is a temporary kludge. +-- While working on this module you are encouraged to remove it and fix +-- any warnings in the module. See +-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings +-- for details + module CoreTidy ( tidyExpr, tidyVarOcc, tidyRule, tidyRules ) where @@ -10,28 +21,21 @@ module CoreTidy ( #include "HsVersions.h" import CoreSyn -import CoreUtils ( exprArity ) -import DataCon ( DataCon ) -import Id ( Id, mkUserLocal, idInfo, setIdInfo, idUnique, - idType, setIdType ) -import IdInfo ( setArityInfo, vanillaIdInfo, - newStrictnessInfo, setAllStrictnessInfo, - newDemandInfo, setNewDemandInfo ) -import Type ( Type, tidyType, tidyTyVarBndr, substTy, mkOpenTvSubst ) -import Var ( Var, TyVar, varName ) +import CoreUtils +import Id +import IdInfo +import Type +import Var import VarEnv -import UniqFM ( lookupUFM ) -import Name ( Name, getOccName ) -import OccName ( tidyOccName ) -import SrcLoc ( noSrcLoc ) -import Maybes ( orElse ) -import Outputable -import Util ( mapAccumL ) -\end{code} +import UniqFM +import Name hiding (tidyNameOcc) +import OccName +import SrcLoc +import Maybes +import Data.List +\end{code} -This module contains "tidying" code for *nested* expressions, bindings, rules. -The code for *top-level* bindings is in TidyPgm. %************************************************************************ %* * @@ -117,7 +121,7 @@ tidyNameOcc :: TidyEnv -> Name -> Name -- Fortunately, we can lookup in the VarEnv with a name tidyNameOcc (_, var_env) n = case lookupUFM var_env n of Nothing -> n - Just v -> varName v + Just v -> idName v tidyVarOcc :: TidyEnv -> Var -> Var tidyVarOcc (_, var_env) v = lookupVarEnv var_env v `orElse` v @@ -150,13 +154,16 @@ tidyLetBndr env (id,rhs) -- CorePrep to turn the let into a case. -- -- Similarly arity info for eta expansion in CorePrep - -- + -- + -- Set inline-prag info so that we preseve it across + -- separate compilation boundaries final_id = new_id `setIdInfo` new_info idinfo = idInfo id new_info = vanillaIdInfo `setArityInfo` exprArity rhs `setAllStrictnessInfo` newStrictnessInfo idinfo `setNewDemandInfo` newDemandInfo idinfo + `setInlinePragInfo` inlinePragInfo idinfo -- Override the env we get back from tidyId with the new IdInfo -- so it gets propagated to the usage sites. @@ -177,7 +184,7 @@ tidyIdBndr env@(tidy_env, var_env) id -- which should save some space. -- But note that tidyLetBndr puts some of it back. ty' = tidyType env (idType id) - id' = mkUserLocal occ' (idUnique id) ty' noSrcLoc + id' = mkUserLocal occ' (idUnique id) ty' noSrcSpan `setIdInfo` vanillaIdInfo var_env' = extendVarEnv var_env id id' in