+ (h_code,c_code,fe_binders) = foreign_stuff
+
+ pit = pcs_PIT pcs_simpl
+
+ mod_name_to_Module :: ModuleName -> Module
+ mod_name_to_Module nm
+ = let str_mi = lookupModuleEnvByName hit nm `orElse`
+ lookupModuleEnvByName pit nm `orElse`
+ pprPanic "mod_name_to_Module: no hst or pst mapping for"
+ (ppr nm)
+ in mi_module str_mi
+
+ ; (maybe_stub_h_filename, maybe_stub_c_filename,
+ maybe_bcos, final_iface )
+ <- if toInterp
+ then do
+ ----------------- Generate byte code ------------------
+ (bcos,itbl_env) <- byteCodeGen dflags binds
+ local_tycons local_classes
+
+ -- Fill in the code-gen info
+ writeIORef cg_info_ref (Just emptyNameEnv)
+
+ ------------------ BUILD THE NEW ModIface ------------
+ final_iface <- _scc_ "MkFinalIface"
+ mkFinalIface ghci_mode dflags location
+ maybe_checked_iface new_iface tidy_details
+
+ return ( Nothing, Nothing,
+ Just (bcos,itbl_env), final_iface )
+
+ else do
+ ----------------- Convert to STG ------------------
+ (stg_binds, cost_centre_info, stg_back_end_info)
+ <- _scc_ "CoreToStg"
+ myCoreToStg dflags this_mod binds
+
+ -- Fill in the code-gen info for the earlier tidyCorePgm
+ writeIORef cg_info_ref (Just stg_back_end_info)
+
+ ------------------ BUILD THE NEW ModIface ------------
+ final_iface <- _scc_ "MkFinalIface"
+ mkFinalIface ghci_mode dflags location
+ maybe_checked_iface new_iface tidy_details
+
+ ------------------ Code generation ------------------
+ abstractC <- _scc_ "CodeGen"
+ codeGen dflags this_mod imported_modules
+ cost_centre_info fe_binders
+ local_tycons stg_binds
+
+ ------------------ Code output -----------------------
+ (maybe_stub_h_name, maybe_stub_c_name)
+ <- codeOutput dflags this_mod local_tycons
+ binds stg_binds
+ c_code h_code abstractC
+
+ return ( maybe_stub_h_name, maybe_stub_c_name,
+ Nothing, final_iface )
+
+ ; let final_details = tidy_details {md_binds = []}