hscGenHardCode :: HscEnv -> CgGuts -> ModSummary -> FilePath
               -> IO (FilePath, Maybe FilePath) -- ^ @Just f@ <=> _stub.c is f
hscGenHardCode hsc_env cgguts mod_summary output_filename = do
        let CgGuts{ -- This is the last use of the ModGuts in a compilation.
                    -- From now on, we just use the bits we need.
                    cg_module   = this_mod,
                    cg_binds    = core_binds,
                    cg_tycons   = tycons,
                    cg_foreign  = foreign_stubs,
                    cg_dep_pkgs = _dependencies,
                    cg_hpc_info = hpc_info } = cgguts
            dflags = hsc_dflags hsc_env
            location = ms_location mod_summary
            data_tycons = filter isDataTyCon tycons
            -- cg_tycons includes newtypes, for the benefit of External Core,
            -- but we don't generate any code for newtypes

        -------------------
        -- PREPARE FOR CODE GENERATION
        -- Do saturation and convert to A-normal form
        prepd_binds <- {-# SCC "CorePrep" #-}
                       corePrepPgm hsc_env this_mod location core_binds data_tycons ;
        -----------------  Convert to STG ------------------
        (stg_binds, _cost_centre_info)
            <- {-# SCC "CoreToStg" #-}
               myCoreToStg dflags this_mod prepd_binds

        let modClass = moduleJavaClass this_mod
        modClasses <- codeGen hsc_env this_mod location data_tycons stg_binds hpc_info
                              (lookupStubs modClass foreign_stubs)
        let stubClasses = outputForeignStubs dflags foreign_stubs modClass
            classes = stubClasses ++ modClasses
            jarContents = map (classFilePath &&& classFileBS) classes
        -- createEmptyJar output_filename
        addMultiByteStringsToJar' (gopt Opt_NormalizeJar dflags) output_filename
                                  (compressionMethod dflags) jarContents
        return (output_filename, Nothing)
hscGenHardCode :: HscEnv -> CgGuts -> ModSummary -> FilePath
               -> IO (FilePath, Maybe FilePath)
hscGenHardCode hsc_env cgguts mod_summary output_filename = do
        let CgGuts{ -- This is the last use of the ModGuts in a compilation.
                    -- From now on, we just use the bits we need.
                    cg_module   = this_mod,
                    cg_binds    = core_binds,
                    cg_tycons   = tycons,
                    cg_foreign  = foreign_stubs,
                    cg_dep_pkgs = _dependencies,
                    cg_hpc_info = hpc_info } = cgguts
            dflags = hsc_dflags hsc_env
            location = ms_location mod_summary
            data_tycons = filter isDataTyCon tycons
            -- cg_tycons includes newtypes, for the benefit of External Core,
            -- but we don't generate any code for newtypes

        -------------------
        -- PREPARE FOR CODE GENERATION
        -- Do saturation and convert to A-normal form
        prepd_binds <- {-# SCC "CorePrep" #-}
                       corePrepPgm hsc_env this_mod location core_binds data_tycons ;
        -----------------  Convert to STG ------------------
        (stg_binds, _cost_centre_info)
            <- {-# SCC "CoreToStg" #-}
               myCoreToStg dflags this_mod prepd_binds

        let modClass = moduleJavaClass this_mod
        modClasses <- codeGen hsc_env this_mod location data_tycons stg_binds hpc_info
                              (lookupStubs modClass foreign_stubs)
        let stubClasses = outputForeignStubs dflags foreign_stubs modClass
            classes = stubClasses ++ modClasses
            jarContents = map (classFilePath &&& classFileBS) classes
        -- createEmptyJar output_filename
        addMultiByteStringsToJar' (gopt Opt_NormalizeJar dflags) output_filename
                                  (compressionMethod dflags) jarContents
        return (output_filename, Nothing)
hscGenHardCode hsc_env cgguts mod_summary output_filename = do
        let CgGuts{ -- This is the last use of the ModGuts in a compilation.
                    -- From now on, we just use the bits we need.
                    cg_module   = this_mod,
                    cg_binds    = core_binds,
                    cg_tycons   = tycons,
                    cg_foreign  = foreign_stubs,
                    cg_dep_pkgs = _dependencies,
                    cg_hpc_info = hpc_info } = cgguts
            dflags = hsc_dflags hsc_env
            location = ms_location mod_summary
            data_tycons = filter isDataTyCon tycons
            -- cg_tycons includes newtypes, for the benefit of External Core,
            -- but we don't generate any code for newtypes

        -------------------
        -- PREPARE FOR CODE GENERATION
        -- Do saturation and convert to A-normal form
        prepd_binds <- {-# SCC "CorePrep" #-}
                       corePrepPgm hsc_env this_mod location core_binds data_tycons ;
        -----------------  Convert to STG ------------------
        (stg_binds, _cost_centre_info)
            <- {-# SCC "CoreToStg" #-}
               myCoreToStg dflags this_mod prepd_binds

        let modClass = moduleJavaClass this_mod
        modClasses <- codeGen hsc_env this_mod location data_tycons stg_binds hpc_info
                              (lookupStubs modClass foreign_stubs)
        let stubClasses = outputForeignStubs dflags foreign_stubs modClass
            classes = stubClasses ++ modClasses
            jarContents = map (classFilePath &&& classFileBS) classes
        -- createEmptyJar output_filename
        addMultiByteStringsToJar' (gopt Opt_NormalizeJar dflags) output_filename
                                  (compressionMethod dflags) jarContents
        return (output_filename, Nothing)