diff options
Diffstat (limited to 'compiler/codeGen')
-rw-r--r-- | compiler/codeGen/StgCmm.hs | 35 | ||||
-rw-r--r-- | compiler/codeGen/StgCmmExpr.hs | 11 | ||||
-rw-r--r-- | compiler/codeGen/StgCmmMonad.hs | 10 |
3 files changed, 7 insertions, 49 deletions
diff --git a/compiler/codeGen/StgCmm.hs b/compiler/codeGen/StgCmm.hs index acd2aee5f4..bd488b87d6 100644 --- a/compiler/codeGen/StgCmm.hs +++ b/compiler/codeGen/StgCmm.hs @@ -121,17 +121,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 @@ -139,8 +136,7 @@ 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 (BS.unpack str) ; emitDecl decl ; addBindC (litIdInfo dflags id' mkLFStringLit lit) @@ -148,7 +144,6 @@ cgTopBinding dflags (StgTopStringLit id str) 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) @@ -227,25 +222,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. diff --git a/compiler/codeGen/StgCmmExpr.hs b/compiler/codeGen/StgCmmExpr.hs index ea64e456ce..ccaeb4a0f0 100644 --- a/compiler/codeGen/StgCmmExpr.hs +++ b/compiler/codeGen/StgCmmExpr.hs @@ -740,19 +740,14 @@ cgIdApp fun_id args = do dflags <- getDynFlags fun_info <- getCgIdInfo fun_id self_loop_info <- getSelfLoop - let cg_fun_id = cg_id fun_info - -- NB: use (cg_id fun_info) instead of fun_id, because - -- the former may be externalised for -split-objs. - -- See Note [Externalise when splitting] in StgCmmMonad - - fun_arg = StgVarArg cg_fun_id - fun_name = idName cg_fun_id + let fun_arg = StgVarArg fun_id + fun_name = idName fun_id fun = idInfoToAmode fun_info lf_info = cg_lf fun_info n_args = length args v_args = length $ filter (isVoidTy . stgArgType) args node_points dflags = nodeMustPointToIt dflags lf_info - case getCallMethod dflags fun_name cg_fun_id lf_info n_args v_args (cg_loc fun_info) self_loop_info of + case getCallMethod dflags fun_name fun_id lf_info n_args v_args (cg_loc fun_info) self_loop_info of -- A value in WHNF, so we can just return it. ReturnIt | isVoidTy (idType fun_id) -> emitReturn [] diff --git a/compiler/codeGen/StgCmmMonad.hs b/compiler/codeGen/StgCmmMonad.hs index 9ddd8a3985..b93e0ab6eb 100644 --- a/compiler/codeGen/StgCmmMonad.hs +++ b/compiler/codeGen/StgCmmMonad.hs @@ -174,20 +174,10 @@ type CgBindings = IdEnv CgIdInfo data CgIdInfo = CgIdInfo { cg_id :: Id -- Id that this is the info for - -- Can differ from the Id at occurrence sites by - -- virtue of being externalised, for splittable C - -- See Note [Externalise when splitting] , cg_lf :: LambdaFormInfo , cg_loc :: CgLoc -- CmmExpr for the *tagged* value } --- Note [Externalise when splitting] --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- If we're splitting the object with -fsplit-objs, we need to --- externalise *all* the top-level names, and then make sure we only --- use the externalised one in any C label we use which refers to this --- name. - instance Outputable CgIdInfo where ppr (CgIdInfo { cg_id = id, cg_loc = loc }) = ppr id <+> text "-->" <+> ppr loc |