Add PrimCall to the STG layer and update Core -> STG translation
[ghc-hetmet.git] / compiler / coreSyn / CoreTidy.lhs
index 5acee51..11e45b1 100644 (file)
@@ -11,12 +11,10 @@ module CoreTidy (
        tidyExpr, tidyVarOcc, tidyRule, tidyRules 
     ) where
 
--- XXX This define is a bit of a hack, and should be done more nicely
-#define FAST_STRING_NOT_NEEDED 1
 #include "HsVersions.h"
 
 import CoreSyn
-import CoreUtils
+import CoreArity
 import Id
 import IdInfo
 import Type
@@ -178,15 +176,21 @@ tidyIdBndr env@(tidy_env, var_env) id
        -- 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}