From e5374a1b3ac11851576f8835e19d9fc92d7735c3 Mon Sep 17 00:00:00 2001 From: Jan Stolarek Date: Tue, 20 Aug 2013 11:53:05 +0100 Subject: Cleanup StgCmm pass This cleanup includes: * removing dead code. This includes forkStatics function, which was in fact one big noop, and global bindings in CgInfoDownwards, * converting functions that used FCode monad only to access DynFlags into functions that take DynFlags as a parameter and don't work in a monad, * addBindC function is now smarter. It extracts Id from CgIdInfo passed to it in the same way addBindsC does. Previously this was done at every call site, which was redundant. --- compiler/codeGen/StgCmmCon.hs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'compiler/codeGen/StgCmmCon.hs') diff --git a/compiler/codeGen/StgCmmCon.hs b/compiler/codeGen/StgCmmCon.hs index 4f12948bcc..57d4759346 100644 --- a/compiler/codeGen/StgCmmCon.hs +++ b/compiler/codeGen/StgCmmCon.hs @@ -50,22 +50,21 @@ import Data.Char -- Top-level constructors --------------------------------------------------------------- -cgTopRhsCon :: Id -- Name of thing bound to this RHS +cgTopRhsCon :: DynFlags + -> Id -- Name of thing bound to this RHS -> DataCon -- Id -> [StgArg] -- Args - -> FCode (CgIdInfo, FCode ()) -cgTopRhsCon id con args - = do dflags <- getDynFlags - let id_info = litIdInfo dflags id (mkConLFInfo con) (CmmLabel closure_label) - return ( id_info, gen_code ) + -> (CgIdInfo, FCode ()) +cgTopRhsCon dflags id con args = + let id_info = litIdInfo dflags id (mkConLFInfo con) (CmmLabel closure_label) + in (id_info, gen_code) where name = idName id caffy = idCafInfo id -- any stgArgHasCafRefs args closure_label = mkClosureLabel name caffy gen_code = - do { dflags <- getDynFlags - ; this_mod <- getModuleName + do { this_mod <- getModuleName ; when (platformOS (targetPlatform dflags) == OSMinGW32) $ -- Windows DLLs have a problem with static cross-DLL refs. ASSERT( not (isDllConApp dflags this_mod con args) ) return () -- cgit v1.2.1