hscCompileOneShot :: Compiler HscStatus
hscCompileOneShot hsc_env mod_summary =
compiler hsc_env mod_summary
- where mkComp = hscMkCompiler (norecompOneShot HscNoRecomp) oneShotMsg
+ where mkComp = hscMkCompiler norecompOneShot oneShotMsg
-- How to compile nonBoot files.
nonBootComp inp = hscSimplify inp >>= hscNormalIface >>=
hscWriteIface >>= hscOneShot
-- How to compile boot files.
- bootComp inp = hscBootIface inp >>= hscWriteIface >>= hscConst (HscRecomp False)
+ bootComp inp = hscSimpleIface inp >>= hscWriteIface >>= hscConst (HscRecomp False)
compiler
= case ms_hsc_src mod_summary of
ExtCoreFile
hscCompileBatch :: Compiler (HscStatus, ModIface, ModDetails)
hscCompileBatch hsc_env mod_summary
= compiler hsc_env mod_summary
- where mkComp = hscMkCompiler norecompBatch (batchMsg False)
+ where mkComp = hscMkCompiler norecompBatch batchMsg
nonBootComp inp = hscSimplify inp >>= hscNormalIface >>=
hscWriteIface >>= hscBatch
- bootComp inp = hscBootIface inp >>= hscWriteIface >>= hscNothing
+ bootComp inp = hscSimpleIface inp >>= hscWriteIface >>= hscNothing
compiler
= case ms_hsc_src mod_summary of
ExtCoreFile
-> mkComp hscFileFrontEnd bootComp
-- Type-check Haskell, boot and extCore.
+-- Does it make sense to compile extCore to nothing?
hscCompileNothing :: Compiler (HscStatus, ModIface, ModDetails)
hscCompileNothing hsc_env mod_summary
= compiler hsc_env mod_summary
- where mkComp = hscMkCompiler norecompBatch (batchMsg False)
- nonBootComp inp = hscNormalIface inp >>= hscIgnoreIface >>= hscNothing
- bootComp inp = hscBootIface inp >>= hscIgnoreIface >>= hscNothing
+ where mkComp = hscMkCompiler norecompBatch batchMsg
+ pipeline inp = hscSimpleIface inp >>= hscIgnoreIface >>= hscNothing
compiler
= case ms_hsc_src mod_summary of
ExtCoreFile
- -> mkComp hscCoreFrontEnd nonBootComp
+ -> mkComp hscCoreFrontEnd pipeline
HsSrcFile
- -> mkComp hscFileFrontEnd nonBootComp
+ -> mkComp hscFileFrontEnd pipeline
HsBootFile
- -> mkComp hscFileFrontEnd bootComp
+ -> mkComp hscFileFrontEnd pipeline
-- Compile Haskell, extCore to bytecode.
hscCompileInteractive :: Compiler (InteractiveStatus, ModIface, ModDetails)
hscCompileInteractive hsc_env mod_summary =
- hscMkCompiler norecompInteractive (batchMsg True)
+ hscMkCompiler norecompInteractive batchMsg
frontend backend
hsc_env mod_summary
where backend inp = hscSimplify inp >>= hscNormalIface >>= hscIgnoreIface >>= hscInteractive
-- NoRecomp handlers
--------------------------------------------------------------
-norecompOneShot :: a -> NoRecomp a
-norecompOneShot a old_iface
+norecompOneShot :: NoRecomp HscStatus
+norecompOneShot old_iface
= do hsc_env <- gets compHscEnv
liftIO $ do
dumpIfaceStats hsc_env
- return a
+ return HscNoRecomp
norecompBatch :: NoRecomp (HscStatus, ModIface, ModDetails)
norecompBatch = norecompWorker HscNoRecomp False
else compilationProgressMsg (hsc_dflags hsc_env) $
"compilation IS NOT required"
-batchMsg :: Bool -> Maybe (Int,Int) -> Bool -> Comp ()
-batchMsg toInterp mb_mod_index recomp
+batchMsg :: Maybe (Int,Int) -> Bool -> Comp ()
+batchMsg mb_mod_index recomp
= do hsc_env <- gets compHscEnv
mod_summary <- gets compModSummary
let showMsg msg = compilationProgressMsg (hsc_dflags hsc_env) $
(showModuleIndex mb_mod_index ++
- msg ++ showModMsg (not toInterp) mod_summary)
+ msg ++ showModMsg (hscTarget (hsc_dflags hsc_env)) recomp mod_summary)
liftIO $ do
if recomp
then showMsg "Compiling "
-------------------
-- PARSE
-------------------
- inp <- readFile (expectJust "hscCoreFrontEnd" (ms_hspp_file mod_summary))
+ inp <- readFile (ms_hspp_file mod_summary)
case parseCore inp 1 of
FailP s
-> do errorMsg (hsc_dflags hsc_env) (text s{-ToDo: wrong-})
-- PARSE
-------------------
let dflags = hsc_dflags hsc_env
- hspp_file = expectJust "hscFileFrontEnd" (ms_hspp_file mod_summary)
+ hspp_file = ms_hspp_file mod_summary
hspp_buf = ms_hspp_buf mod_summary
maybe_parsed <- myParseModule dflags hspp_file hspp_buf
case maybe_parsed of
-- HACK: we return ModGuts even though we know it's not gonna be used.
-- We do this because the type signature needs to be identical
-- in structure to the type of 'hscNormalIface'.
-hscBootIface :: ModGuts -> Comp (ModIface, Bool, ModDetails, ModGuts)
-hscBootIface ds_result
+hscSimpleIface :: ModGuts -> Comp (ModIface, Bool, ModDetails, ModGuts)
+hscSimpleIface ds_result
= do hsc_env <- gets compHscEnv
mod_summary <- gets compModSummary
maybe_old_iface <- gets compOldIface
mkIface hsc_env maybe_old_iface simpl_result details
-- Emit external core
emitExternalCore (hsc_dflags hsc_env) cg_guts -- Move this? --Lemmih 03/07/2006
+ dumpIfaceStats hsc_env
-------------------
-- Return the prepared code.
-- PARSE
-------------------
; let dflags = hsc_dflags hsc_env
- hspp_file = expectJust "hscFileFrontEnd" (ms_hspp_file mod_summary)
+ hspp_file = ms_hspp_file mod_summary
hspp_buf = ms_hspp_buf mod_summary
; maybe_parsed <- myParseModule dflags hspp_file hspp_buf