[project @ 1998-01-08 18:03:08 by simonm]
[ghc-hetmet.git] / ghc / compiler / codeGen / CodeGen.lhs
index 016bd99..a9437eb 100644 (file)
@@ -15,11 +15,9 @@ functions drive the mangling of top-level bindings.
 %************************************************************************
 
 \begin{code}
-#include "HsVersions.h"
-
 module CodeGen ( codeGen ) where
 
-import Ubiq{-uitous-}
+#include "HsVersions.h"
 
 import StgSyn
 import CgMonad
@@ -27,16 +25,23 @@ import AbsCSyn
 
 import AbsCUtils       ( mkAbstractCs, mkAbsCStmts )
 import Bag             ( foldBag )
+import CgBindery       ( CgIdInfo )
 import CgClosure       ( cgTopRhsClosure )
 import CgCon           ( cgTopRhsCon )
 import CgConTbls       ( genStaticConBits )
 import ClosureInfo     ( mkClosureLFInfo )
-import CmdLineOpts     ( opt_SccProfilingOn, opt_CompilingPrelude,
-                         opt_EnsureSplittableC, opt_SccGroup
+import CmdLineOpts     ( opt_SccProfilingOn, opt_EnsureSplittableC, 
+                                             opt_SccGroup
                        )
+import CostCentre       ( CostCentre )
 import CStrings                ( modnameToC )
+import FiniteMap       ( FiniteMap )
+import Id               ( Id )
 import Maybes          ( maybeToBool )
+import Name             ( Module )
 import PrimRep         ( getPrimRepSize, PrimRep(..) )
+import Type             ( Type )
+import TyCon            ( TyCon )
 import Util            ( panic, assertPanic )
 \end{code}
 
@@ -54,12 +59,8 @@ codeGen :: FAST_STRING               -- module name
 codeGen mod_name (local_CCs, extern_CCs) import_names gen_tycons tycon_specs stg_pgm
   = let
        doing_profiling   = opt_SccProfilingOn
-       compiling_prelude = opt_CompilingPrelude
-       maybe_split       = if maybeToBool (opt_EnsureSplittableC)
-                           then CSplitMarker
-                           else AbsCNop
-
-       cinfo = MkCompInfo mod_name
+       maybe_split       = if opt_EnsureSplittableC then CSplitMarker else AbsCNop
+       cinfo             = MkCompInfo mod_name
     in
     if not doing_profiling then
        mkAbstractCs [
@@ -76,15 +77,11 @@ codeGen mod_name (local_CCs, extern_CCs) import_names gen_tycons tycon_specs stg
         -- (The local cost-centres involved in this are passed
         -- into the code-generator, as are the imported-modules' names.)
         --
-        -- Note: we don't register/etc if compiling Prelude bits.
-
+        --
        mkAbstractCs [
-               if compiling_prelude
-               then AbsCNop
-               else mkAbstractCs [mkAbstractCs (map (CCostCentreDecl True)  local_CCs),
+               mkAbstractCs [mkAbstractCs (map (CCostCentreDecl True)  local_CCs),
                                   mkAbstractCs (map (CCostCentreDecl False) extern_CCs),
                                   mkCcRegister local_CCs import_names],
-
                genStaticConBits cinfo gen_tycons tycon_specs,
                initC cinfo (cgTopBindings maybe_split stg_pgm) ]
   where
@@ -165,5 +162,5 @@ cgTopRhs name (StgRhsClosure cc bi fvs upd_flag args body)
   = ASSERT(null fvs) -- There should be no free variables
     forkStatics (cgTopRhsClosure name cc bi args body lf_info)
   where
-    lf_info = mkClosureLFInfo True{-top level-} [{-no fvs-}] upd_flag args body
+    lf_info = mkClosureLFInfo True{-top level-} [{-no fvs-}] upd_flag args
 \end{code}