#include "HsVersions.h"
import CoreSyn
-import CoreUtils
+import CoreArity
import Id
import IdInfo
import Type
tidyExpr :: TidyEnv -> CoreExpr -> CoreExpr
tidyExpr env (Var v) = Var (tidyVarOcc env v)
tidyExpr env (Type ty) = Type (tidyType env ty)
-tidyExpr env (Lit lit) = Lit lit
+tidyExpr _ (Lit lit) = Lit lit
tidyExpr env (App f a) = App (tidyExpr env f) (tidyExpr env a)
tidyExpr env (Note n e) = Note (tidyNote env n) (tidyExpr env e)
tidyExpr env (Cast e co) = Cast (tidyExpr env e) (tidyType env co)
Lam b (tidyExpr env' e)
------------ Case alternatives --------------
-tidyAlt case_bndr env (con, vs, rhs)
+tidyAlt :: CoreBndr -> TidyEnv -> CoreAlt -> CoreAlt
+tidyAlt _case_bndr env (con, vs, rhs)
= tidyBndrs env vs =: \ (env', vs) ->
(con, vs, tidyExpr env' rhs)
------------ Notes --------------
-tidyNote env note = note
+tidyNote :: TidyEnv -> Note -> Note
+tidyNote _ note = note
------------ Rules --------------
tidyRules :: TidyEnv -> [CoreRule] -> [CoreRule]
-tidyRules env [] = []
+tidyRules _ [] = []
tidyRules env (rule : rules)
= tidyRule env rule =: \ rule ->
tidyRules env rules =: \ rules ->
(rule : rules)
tidyRule :: TidyEnv -> CoreRule -> CoreRule
-tidyRule env rule@(BuiltinRule {}) = rule
+tidyRule _ rule@(BuiltinRule {}) = rule
tidyRule env rule@(Rule { ru_bndrs = bndrs, ru_args = args, ru_rhs = rhs,
ru_fn = fn, ru_rough = mb_ns })
= tidyBndrs env bndrs =: \ (env', bndrs) ->
-- though we could extract it from the Id
--
-- All nested Ids now have the same IdInfo, namely vanillaIdInfo,
- -- which should save some space.
+ -- which should save some space; except that we hang onto dead-ness
+ -- (at the moment, solely to make printing tidy core nicer)
-- But note that tidyLetBndr puts some of it back.
- ty' = tidyType env (idType id)
- id' = mkUserLocal occ' (idUnique id) ty' noSrcSpan
- `setIdInfo` vanillaIdInfo
- var_env' = extendVarEnv var_env id id'
+ ty' = tidyType env (idType id)
+ name' = mkInternalName (idUnique id) occ' noSrcSpan
+ id' = mkLocalIdWithInfo name' ty' new_info
+ var_env' = extendVarEnv var_env id id'
+ new_info | isDeadOcc (idOccInfo id) = deadIdInfo
+ | otherwise = vanillaIdInfo
in
((tidy_env', var_env'), id')
}
+
+deadIdInfo :: IdInfo
+deadIdInfo = vanillaIdInfo `setOccInfo` IAmDead
\end{code}
\begin{code}
+(=:) :: a -> (a -> b) -> b
m =: k = m `seq` k m
\end{code}