X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fmain%2FHscMain.lhs;h=9c21d0a52a0d3e19440728fffd2213b822fdcde1;hp=12b12e350c6b95bd623fac0a5e4d84f7573e07e8;hb=2fe38b5fb0957f9428864afd69ad3ccd82fae3d0;hpb=31a9d04804d9cacda35695c5397590516b964964 diff --git a/compiler/main/HscMain.lhs b/compiler/main/HscMain.lhs index 12b12e3..9c21d0a 100644 --- a/compiler/main/HscMain.lhs +++ b/compiler/main/HscMain.lhs @@ -112,10 +112,10 @@ import LazyUniqFM ( emptyUFM ) import UniqSupply ( initUs_ ) import Bag ( unitBag ) import Exception -import MonadUtils +-- import MonadUtils import Control.Monad -import System.IO +-- import System.IO import Data.IORef \end{code} #include "HsVersions.h" @@ -183,7 +183,7 @@ hscParse mod_summary = do Just b -> return b Nothing -> liftIO $ hGetStringBuffer src_filename - let loc = mkSrcLoc (mkFastString src_filename) 1 0 + let loc = mkSrcLoc (mkFastString src_filename) 1 1 case unP parseModule (mkPState buf loc dflags) of PFailed span err -> @@ -216,7 +216,7 @@ hscTypecheck mod_summary rdr_module = do -- exception/signal an error. type RenamedStuff = (Maybe (HsGroup Name, [LImportDecl Name], Maybe [LIE Name], - Maybe (HsDoc Name), HaddockModInfo Name)) + Maybe LHsDocString)) -- | Rename and typecheck a module, additionally returning the renamed syntax hscTypecheckRename :: @@ -229,12 +229,12 @@ hscTypecheckRename mod_summary rdr_module = do <- {-# SCC "Typecheck-Rename" #-} ioMsgMaybe $ tcRnModule hsc_env (ms_hsc_src mod_summary) True rdr_module - let rn_info = do decl <- tcg_rn_decls tc_result - imports <- tcg_rn_imports tc_result - let exports = tcg_rn_exports tc_result - let doc = tcg_doc tc_result - let hmi = tcg_hmi tc_result - return (decl,imports,exports,doc,hmi) + let -- This 'do' is in the Maybe monad! + rn_info = do { decl <- tcg_rn_decls tc_result + ; let imports = tcg_rn_imports tc_result + exports = tcg_rn_exports tc_result + doc_hdr = tcg_doc_hdr tc_result + ; return (decl,imports,exports,doc_hdr) } return (tc_result, rn_info) @@ -773,7 +773,7 @@ hscCmmFile hsc_env filename = do parseCmmFile dflags filename cmms <- liftIO $ optionallyConvertAndOrCPS hsc_env [cmm] rawCmms <- liftIO $ cmmToRawCmm cmms - liftIO $ codeOutput dflags no_mod no_loc NoStubs [] rawCmms + _ <- liftIO $ codeOutput dflags no_mod no_loc NoStubs [] rawCmms return () where no_mod = panic "hscCmmFile: no_mod" @@ -789,11 +789,8 @@ tryNewCodeGen :: HscEnv -> Module -> [TyCon] -> [Module] -> HpcInfo -> IO [Cmm] tryNewCodeGen hsc_env this_mod data_tycons imported_mods - cost_centre_info stg_binds hpc_info - | not (dopt Opt_TryNewCodeGen (hsc_dflags hsc_env)) - = return [] - | otherwise - = do { let dflags = hsc_dflags hsc_env + cost_centre_info stg_binds hpc_info = + do { let dflags = hsc_dflags hsc_env ; prog <- StgCmm.codeGen dflags this_mod data_tycons imported_mods cost_centre_info stg_binds hpc_info ; dumpIfSet_dyn dflags Opt_D_dump_cmmz "Cmm produced by new codegen" @@ -802,8 +799,8 @@ tryNewCodeGen hsc_env this_mod data_tycons imported_mods ; prog <- return $ map (runTx $ runCmmOpts cmmCfgOptsZ) prog -- Control flow optimisation - -- Note: Have to thread the module's SRT through all the procedures - -- because we greedily build it as we go. + -- We are building a single SRT for the entire module, so + -- we must thread it through all the procedures as we cps-convert them. ; us <- mkSplitUniqSupply 'S' ; let topSRT = initUs_ us emptySRT ; (topSRT, prog) <- foldM (protoCmmCPSZ hsc_env) (topSRT, []) prog @@ -987,7 +984,7 @@ hscParseThing parser dflags str buf <- liftIO $ stringToStringBuffer str - let loc = mkSrcLoc (fsLit "") 1 0 + let loc = mkSrcLoc (fsLit "") 1 1 case unP parser (mkPState buf loc dflags) of