-simplThenTidy dflags pcs hst this_mod is_exported binds rules
- = do -- Do main Core-language transformations ---------
- -- _scc_ "Core2Core"
- (simplified, orphan_rules)
- <- core2core dflags pcs hst is_exported binds rules
-
- -- Do saturation and convert to A-normal form
- -- NOTE: future passes cannot transform the syntax, only annotate it
- saturated <- coreSatPgm dflags simplified
-
- -- Do the final tidy-up
- (pcs', tidy_binds, tidy_orphan_rules)
- <- tidyCorePgm dflags this_mod pcs saturated orphan_rules
-
- return (pcs', tidy_binds, tidy_orphan_rules)
-
-
-restOfCodeGeneration dflags toInterp this_mod imported_module_names cost_centre_info
- foreign_stuff env_tc stg_binds tidy_binds
- hit pit -- these last two for mapping ModNames to Modules
- | toInterp
- = do (ibinds,itbl_env)
- <- stgBindsToInterpSyn dflags (map fst stg_binds)
- local_tycons local_classes
- return (Nothing, Nothing, Just (ibinds,itbl_env))
-
- | otherwise
- = do -------------------------- Code generation -------------------------------
- -- _scc_ "CodeGen"
- abstractC <- codeGen dflags this_mod imported_modules
- cost_centre_info fe_binders
- local_tycons stg_binds
-
- -------------------------- Code output -------------------------------
- -- _scc_ "CodeOutput"
- (maybe_stub_h_name, maybe_stub_c_name)
- <- codeOutput dflags this_mod local_tycons
- tidy_binds stg_binds
- c_code h_code abstractC
-
- return (maybe_stub_h_name, maybe_stub_c_name, Nothing)
- where
- local_tycons = typeEnvTyCons env_tc
- local_classes = typeEnvClasses env_tc
- imported_modules = map mod_name_to_Module imported_module_names
- (h_code,c_code,fe_binders) = foreign_stuff
-
- mod_name_to_Module :: ModuleName -> Module
- mod_name_to_Module nm
- = let str_mi = case lookupModuleEnvByName hit nm of
- Just mi -> mi
- Nothing -> case lookupModuleEnvByName pit nm of
- Just mi -> mi
- Nothing -> barf nm
- in mi_module str_mi
- barf nm = pprPanic "mod_name_to_Module: no hst or pst mapping for"
- (ppr nm)
-
-
-myCoreToStg dflags this_mod tidy_binds env_tc