X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fmain%2FDriverPipeline.hs;h=8529d4e3be80cbfb77b0ef384767d10988c74bfd;hb=684de20b363529919ea832b33b680e9ca8af2b28;hp=9a95cdc3a62f039b4e723c5fe8c427f14ce15819;hpb=b141e2b456ec1e3f93bf661aaa07c6c6c174674e;p=ghc-hetmet.git diff --git a/ghc/compiler/main/DriverPipeline.hs b/ghc/compiler/main/DriverPipeline.hs index 9a95cdc..8529d4e 100644 --- a/ghc/compiler/main/DriverPipeline.hs +++ b/ghc/compiler/main/DriverPipeline.hs @@ -1,5 +1,4 @@ ----------------------------------------------------------------------------- --- $Id: DriverPipeline.hs,v 1.97 2001/08/15 00:36:54 sof Exp $ -- -- GHC Driver -- @@ -174,8 +173,11 @@ genPipeline todo stop_flag persistent_output lang (filename,suffix) HscJava | split -> not_valid | otherwise -> error "not implemented: compiling via Java" +#ifdef ILX HscILX | split -> not_valid - | otherwise -> [ Unlit, Cpp, Hsc ] + | otherwise -> [ Unlit, Cpp, Hsc, Ilx2Il, Ilasm ] +#endif + HscNothing -> [ Unlit, Cpp, Hsc ] | cish = [ Cc, As ] @@ -330,8 +332,8 @@ run_phase Unlit _basename _suff input_fn output_fn SysTools.runUnlit (map SysTools.Option unlit_flags ++ [ SysTools.Option "-h" , SysTools.Option input_fn - , SysTools.FileOption input_fn - , SysTools.FileOption output_fn + , SysTools.FileOption "" input_fn + , SysTools.FileOption "" output_fn ]) return (Just output_fn) @@ -367,9 +369,9 @@ run_phase Cpp basename suff input_fn output_fn ++ map SysTools.Option md_c_flags ++ [ SysTools.Option "-x" , SysTools.Option "c" - , SysTools.FileOption input_fn + , SysTools.FileOption "" input_fn , SysTools.Option "-o" - , SysTools.FileOption output_fn + , SysTools.FileOption "" output_fn ]) return (Just output_fn) @@ -469,7 +471,7 @@ run_phase Hsc basename suff input_fn output_fn -- build a ModuleLocation to pass to hscMain. (mod, location') - <- mkHomeModuleLocn mod_name basename (Just (basename ++ '.':suff)) + <- mkHomeModuleLocn mod_name basename (basename ++ '.':suff) -- take -ohi into account if present ohi <- readIORef v_Output_hi @@ -534,13 +536,14 @@ run_phase Hsc basename suff input_fn output_fn HscRecomp pcs details iface stub_h_exists stub_c_exists _maybe_interpreted_code -> do - -- deal with stubs - maybe_stub_o <- compileStub dyn_flags' stub_c_exists - case maybe_stub_o of - Nothing -> return () - Just stub_o -> add v_Ld_inputs stub_o - - return (Just output_fn) + -- deal with stubs + maybe_stub_o <- compileStub dyn_flags' stub_c_exists + case maybe_stub_o of + Nothing -> return () + Just stub_o -> add v_Ld_inputs stub_o + case hscLang dyn_flags of + HscNothing -> return Nothing + _ -> return (Just output_fn) } ----------------------------------------------------------------------------- @@ -580,9 +583,9 @@ run_phase cc_phase basename suff input_fn output_fn excessPrecision <- readIORef v_Excess_precision SysTools.runCc ([ SysTools.Option "-x", SysTools.Option "c" - , SysTools.FileOption input_fn + , SysTools.FileOption "" input_fn , SysTools.Option "-o" - , SysTools.FileOption output_fn + , SysTools.FileOption "" output_fn ] ++ map SysTools.Option ( md_c_flags @@ -612,8 +615,8 @@ run_phase Mangle _basename _suff input_fn output_fn else return [] SysTools.runMangle (map SysTools.Option mangler_opts - ++ [ SysTools.FileOption input_fn - , SysTools.FileOption output_fn + ++ [ SysTools.FileOption "" input_fn + , SysTools.FileOption "" output_fn ] ++ map SysTools.Option machdep_opts) return (Just output_fn) @@ -627,9 +630,9 @@ run_phase SplitMangle _basename _suff input_fn output_fn split_s_prefix <- SysTools.newTempName "split" let n_files_fn = split_s_prefix - SysTools.runSplit [ SysTools.FileOption input_fn - , SysTools.FileOption split_s_prefix - , SysTools.FileOption n_files_fn + SysTools.runSplit [ SysTools.FileOption "" input_fn + , SysTools.FileOption "" split_s_prefix + , SysTools.FileOption "" n_files_fn ] -- Save the number of split files for future references @@ -653,9 +656,9 @@ run_phase As _basename _suff input_fn output_fn SysTools.runAs (map SysTools.Option as_opts ++ [ SysTools.Option ("-I" ++ p) | p <- cmdline_include_paths ] ++ [ SysTools.Option "-c" - , SysTools.FileOption input_fn + , SysTools.FileOption "" input_fn , SysTools.Option "-o" - , SysTools.FileOption output_fn + , SysTools.FileOption "" output_fn ]) return (Just output_fn) @@ -677,13 +680,43 @@ run_phase SplitAs basename _suff _input_fn output_fn SysTools.runAs (map SysTools.Option as_opts ++ [ SysTools.Option "-c" , SysTools.Option "-o" - , SysTools.FileOption real_o - , SysTools.FileOption input_s + , SysTools.FileOption "" real_o + , SysTools.FileOption "" input_s ]) mapM_ assemble_file [1..n] return (Just output_fn) +#ifdef ILX +----------------------------------------------------------------------------- +-- Ilx2Il phase +-- Run ilx2il over the ILX output, getting an IL file + +run_phase Ilx2Il _basename _suff input_fn output_fn + = do ilx2il_opts <- getOpts opt_I + SysTools.runIlx2il (map SysTools.Option ilx2il_opts + ++ [ SysTools.Option "--no-add-suffix-to-assembly", + SysTools.Option "mscorlib", + SysTools.Option "-o", + SysTools.FileOption "" output_fn, + SysTools.FileOption "" input_fn ]) + return (Just output_fn) + +----------------------------------------------------------------------------- +-- Ilasm phase +-- Run ilasm over the IL, getting a DLL + +run_phase Ilasm _basename _suff input_fn output_fn + = do ilasm_opts <- getOpts opt_i + SysTools.runIlasm (map SysTools.Option ilasm_opts + ++ [ SysTools.Option "/QUIET", + SysTools.Option "/DLL", + SysTools.FileOption "/OUT=" output_fn, + SysTools.FileOption "" input_fn ]) + return (Just output_fn) + +#endif -- ILX + ----------------------------------------------------------------------------- -- MoveBinary sort-of-phase -- After having produced a binary, move it somewhere else and generate a @@ -821,7 +854,7 @@ doLink o_files = do (md_c_flags, _) <- machdepCCOpts SysTools.runLink ( [ SysTools.Option verb , SysTools.Option "-o" - , SysTools.FileOption output_fn + , SysTools.FileOption "" output_fn ] ++ map SysTools.Option ( md_c_flags @@ -835,13 +868,8 @@ doLink o_files = do ++ pkg_extra_ld_opts ++ extra_ld_opts ++ if static && not no_hs_main then -#ifdef LEADING_UNDERSCORE - [ "-u", "_PrelMain_mainIO_closure" , - "-u", "___init_PrelMain"] -#else [ "-u", prefixUnderscore "PrelMain_mainIO_closure" , "-u", prefixUnderscore "__init_PrelMain"] -#endif else [])) -- parallel only: move binary to another dir -- HWL @@ -897,7 +925,7 @@ doMkDLL o_files = do SysTools.runMkDLL ([ SysTools.Option verb , SysTools.Option "-o" - , SysTools.FileOption output_fn + , SysTools.FileOption "" output_fn ] ++ map SysTools.Option ( md_c_flags @@ -999,9 +1027,11 @@ compile ghci_mode summary source_unchanged have_object HscC | keep_hc -> return (basename ++ '.':phaseInputExt HCc) | otherwise -> newTempName (phaseInputExt HCc) HscJava -> newTempName "java" -- ToDo - HscILX -> return (basename ++ ".ilx") - -- newTempName "ilx" -- ToDo +#ifdef ILX + HscILX -> return (phaseInputExt Ilx2Il) +#endif HscInterpreted -> return (error "no output file") + HscNothing -> return (error "no output file") let dyn_flags' = dyn_flags { hscOutName = output_fn, hscStubCOutName = basename ++ "_stub.c", @@ -1022,10 +1052,14 @@ compile ghci_mode summary source_unchanged have_object writeIORef v_HCHeader cc_injects + -- -no-recomp should also work with --make + do_recomp <- readIORef v_Recomp + let source_unchanged' = source_unchanged && do_recomp + -- run the compiler hsc_result <- hscMain ghci_mode dyn_flags' (ms_mod summary) location - source_unchanged have_object old_iface hst hit pcs + source_unchanged' have_object old_iface hst hit pcs case hsc_result of HscFail pcs -> return (CompErrs pcs)