-codeGen :: FAST_STRING -- module name
- -> ([CostCentre], -- local cost-centres needing declaring/registering
- [CostCentre]) -- "extern" cost-centres needing declaring
- -> [Module] -- import names
- -> [TyCon] -- tycons with data constructors to convert
- -> FiniteMap TyCon [(Bool, [Maybe Type])]
- -- tycon specialisation info
- -> [StgBinding] -- bindings to convert
- -> AbstractC -- output
-
-codeGen mod_name (local_CCs, extern_CCs) import_names gen_tycons tycon_specs stg_pgm
- = let
- doing_profiling = opt_SccProfilingOn
- maybe_split = if opt_EnsureSplittableC then CSplitMarker else AbsCNop
- cinfo = MkCompInfo mod_name
+
+
+codeGen :: Module -- Module name
+ -> [ModuleName] -- Import names
+ -> ([CostCentre], -- Local cost-centres needing declaring/registering
+ [CostCentre], -- "extern" cost-centres needing declaring
+ [CostCentreStack]) -- Pre-defined "singleton" cost centre stacks
+ -> [Id] -- foreign-exported binders
+ -> [TyCon] -> [Class] -- Local tycons and classes
+ -> [(StgBinding,[Id])] -- Bindings to convert, with SRTs
+ -> IO AbstractC -- Output
+
+codeGen mod_name imported_modules cost_centre_info fe_binders
+ tycons classes stg_binds
+ = mkSplitUniqSupply 'f' >>= \ fl_uniqs -> -- absC flattener
+ let
+ datatype_stuff = genStaticConBits cinfo data_tycons
+ code_stuff = initC cinfo (cgTopBindings maybe_split stg_binds)
+ init_stuff = mkModuleInit fe_binders mod_name imported_modules
+ cost_centre_info
+
+ abstractC = mkAbstractCs [ maybe_split,
+ init_stuff,
+ code_stuff,
+ datatype_stuff]
+ -- Put datatype_stuff after code_stuff, because the
+ -- datatype closure table (for enumeration types)
+ -- to (say) PrelBase_True_closure, which is defined in code_stuff
+
+ flat_abstractC = flattenAbsC fl_uniqs abstractC