diff options
Diffstat (limited to 'compiler/codeGen/StgCmm.hs')
-rw-r--r-- | compiler/codeGen/StgCmm.hs | 38 |
1 files changed, 5 insertions, 33 deletions
diff --git a/compiler/codeGen/StgCmm.hs b/compiler/codeGen/StgCmm.hs index ff63b555ac..6cdb14880a 100644 --- a/compiler/codeGen/StgCmm.hs +++ b/compiler/codeGen/StgCmm.hs @@ -39,7 +39,6 @@ import Id import IdInfo import RepType import DataCon -import Name import TyCon import Module import Outputable @@ -120,17 +119,14 @@ variable. -} cgTopBinding :: DynFlags -> CgStgTopBinding -> FCode () cgTopBinding dflags (StgTopLifted (StgNonRec id rhs)) - = do { id' <- maybeExternaliseId dflags id - ; let (info, fcode) = cgTopRhs dflags NonRecursive id' rhs + = do { let (info, fcode) = cgTopRhs dflags NonRecursive id rhs ; fcode - ; addBindC info -- Add the *un-externalised* Id to the envt, - -- so we find it when we look up occurrences + ; addBindC info } cgTopBinding dflags (StgTopLifted (StgRec pairs)) = do { let (bndrs, rhss) = unzip pairs - ; bndrs' <- Prelude.mapM (maybeExternaliseId dflags) bndrs - ; let pairs' = zip bndrs' rhss + ; let pairs' = zip bndrs rhss r = unzipWith (cgTopRhs dflags Recursive) pairs' (infos, fcodes) = unzip r ; addBindsC infos @@ -138,16 +134,14 @@ cgTopBinding dflags (StgTopLifted (StgRec pairs)) } cgTopBinding dflags (StgTopStringLit id str) - = do { id' <- maybeExternaliseId dflags id - ; let label = mkBytesLabel (idName id') + = do { let label = mkBytesLabel (idName id) ; let (lit, decl) = mkByteStringCLit label str ; emitDecl decl - ; addBindC (litIdInfo dflags id' mkLFStringLit lit) + ; addBindC (litIdInfo dflags id mkLFStringLit lit) } cgTopRhs :: DynFlags -> RecFlag -> Id -> CgStgRhs -> (CgIdInfo, FCode ()) -- The Id is passed along for setting up a binding... - -- It's already been externalised if necessary cgTopRhs dflags _rec bndr (StgRhsCon _cc con args) = cgTopRhsCon dflags bndr con (assertNonVoidStgArgs args) @@ -226,25 +220,3 @@ cgDataCon data_con } -- The case continuation code expects a tagged pointer } - ---------------------------------------------------------------- --- Stuff to support splitting ---------------------------------------------------------------- - -maybeExternaliseId :: DynFlags -> Id -> FCode Id -maybeExternaliseId dflags id - | gopt Opt_SplitObjs dflags, -- See Note [Externalise when splitting] - -- in StgCmmMonad - isInternalName name = do { mod <- getModuleName - ; return (setIdName id (externalise mod)) } - | otherwise = return id - where - externalise mod = mkExternalName uniq mod new_occ loc - name = idName id - uniq = nameUnique name - new_occ = mkLocalOcc uniq (nameOccName name) - loc = nameSrcSpan name - -- We want to conjure up a name that can't clash with any - -- existing name. So we generate - -- Mod_$L243foo - -- where 243 is the unique. |