X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FHscMain.lhs;h=346e8043eacff7497586574f6838355eb20f9052;hb=1c3d4480c8751665e71e344b71a844ca4191acc5;hp=c86bd48d74407c49df99f9ad80784383c126e72f;hpb=78f4da288f8a189c739766a3107fa80073800ba7;p=ghc-hetmet.git diff --git a/compiler/main/HscMain.lhs b/compiler/main/HscMain.lhs index c86bd48..346e804 100644 --- a/compiler/main/HscMain.lhs +++ b/compiler/main/HscMain.lhs @@ -53,7 +53,7 @@ import HsSyn ( HsModule, LHsBinds, HsGroup, LIE, LImportDecl, HsDoc, HaddockModInfo ) import CoreSyn import SrcLoc ( Located(..) ) -import StringBuffer ( hGetStringBuffer, stringToStringBuffer ) +import StringBuffer import Parser import Lexer import SrcLoc ( mkSrcLoc ) @@ -75,6 +75,8 @@ import Name ( Name, NamedThing(..) ) import SimplStg ( stg2stg ) import CodeGen ( codeGen ) import CmmParse ( parseCmmFile ) +import CmmCPS +import CmmInfo import CodeOutput ( codeOutput ) import NameEnv ( emptyNameEnv ) @@ -474,13 +476,11 @@ hscSimplify :: ModGuts -> Comp ModGuts hscSimplify ds_result = do hsc_env <- gets compHscEnv liftIO $ do - flat_result <- {-# SCC "Flattening" #-} - flatten hsc_env ds_result ------------------- -- SIMPLIFY ------------------- simpl_result <- {-# SCC "Core2Core" #-} - core2core hsc_env flat_result + core2core hsc_env ds_result return simpl_result -------------------------------------------------------------- @@ -603,10 +603,13 @@ hscCompile cgguts codeGen dflags this_mod data_tycons foreign_stubs dir_imps cost_centre_info stg_binds hpc_info + ------------------ Convert to CPS -------------------- + --continuationC <- cmmCPS dflags abstractC >>= cmmToRawCmm + continuationC <- cmmToRawCmm abstractC ------------------ Code output ----------------------- (stub_h_exists,stub_c_exists) <- codeOutput dflags this_mod location foreign_stubs - dependencies abstractC + dependencies continuationC return stub_c_exists hscConst :: b -> a -> Comp b @@ -668,7 +671,7 @@ hscFileCheck hsc_env mod_summary compileToCore = do { -- RENAME and TYPECHECK ------------------- (tc_msgs, maybe_tc_result) - <- _scc_ "Typecheck-Rename" + <- {-# SCC "Typecheck-Rename" #-} tcRnModule hsc_env (ms_hsc_src mod_summary) True{-save renamed syntax-} rdr_module @@ -687,8 +690,7 @@ hscFileCheck hsc_env mod_summary compileToCore = do { md_rules = [panic "no rules"], -- Rules are CoreRules, not the -- RuleDecls we get out of the typechecker - md_vect_info = - panic "HscMain.hscFileCheck: no VectInfo" + md_vect_info = noVectInfo -- VectInfo is added by the Core -- vectorisation pass } @@ -718,7 +720,9 @@ hscCmmFile dflags filename = do case maybe_cmm of Nothing -> return False Just cmm -> do - codeOutput dflags no_mod no_loc NoStubs [] [cmm] + --continuationC <- cmmCPS dflags [cmm] >>= cmmToRawCmm + continuationC <- cmmToRawCmm [cmm] + codeOutput dflags no_mod no_loc NoStubs [] continuationC return True where no_mod = panic "hscCmmFile: no_mod" @@ -727,6 +731,8 @@ hscCmmFile dflags filename = do ml_obj_file = panic "hscCmmFile: no obj file" } +myParseModule :: DynFlags -> FilePath -> Maybe StringBuffer + -> IO (Either ErrMsg (Located (HsModule RdrName))) myParseModule dflags src_filename maybe_src_buf = -------------------------- Parser ---------------- showPass dflags "Parser" >>