hscCompileCore :: HscEnv -> Bool -> SafeHaskellMode -> ModSummary
               -> CoreProgram -> FilePath -> IO ()
hscCompileCore hsc_env simplify safe_mode mod_summary binds output_filename
  = runHsc hsc_env $ do
        guts <- maybe_simplify (mkModGuts (ms_mod mod_summary) safe_mode binds)
        (iface, changed, _details, cgguts) <- hscNormalIface' guts Nothing
        liftIO $ hscWriteIface (hsc_dflags hsc_env) iface changed mod_summary
        _ <- liftIO $ hscGenHardCode hsc_env cgguts mod_summary output_filename
        return ()

  where
    maybe_simplify mod_guts | simplify = hscSimplify' mod_guts
                            | otherwise = return mod_guts

-- Makes a "vanilla" ModGuts.
hscCompileCore :: HscEnv -> Bool -> SafeHaskellMode -> ModSummary
               -> CoreProgram -> FilePath -> IO ()
hscCompileCore hsc_env simplify safe_mode mod_summary binds output_filename
  = runHsc hsc_env $ do
        guts <- maybe_simplify (mkModGuts (ms_mod mod_summary) safe_mode binds)
        (iface, changed, _details, cgguts) <- hscNormalIface' guts Nothing
        liftIO $ hscWriteIface (hsc_dflags hsc_env) iface changed mod_summary
        _ <- liftIO $ hscGenHardCode hsc_env cgguts mod_summary output_filename
        return ()

  where
    maybe_simplify mod_guts | simplify = hscSimplify' mod_guts
                            | otherwise = return mod_guts

-- Makes a "vanilla" ModGuts.
hscCompileCore hsc_env simplify safe_mode mod_summary binds output_filename
  = runHsc hsc_env $ do
        guts <- maybe_simplify (mkModGuts (ms_mod mod_summary) safe_mode binds)
        (iface, changed, _details, cgguts) <- hscNormalIface' guts Nothing
        liftIO $ hscWriteIface (hsc_dflags hsc_env) iface changed mod_summary
        _ <- liftIO $ hscGenHardCode hsc_env cgguts mod_summary output_filename
        return ()

  where
    maybe_simplify mod_guts | simplify = hscSimplify' mod_guts
                            | otherwise = return mod_guts

-- Makes a "vanilla" ModGuts.