diff options
author | nineonine <mail4chemik@gmail.com> | 2019-07-13 00:11:46 -0700 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-07-26 00:57:39 -0400 |
commit | aae0457f412aa40dd192ca2cbea565ea60b182ec (patch) | |
tree | fd58e2a399fd70e0aeaa9e6c9eb7415877776ba3 /compiler | |
parent | 30b6f391801d58e364f79df5da2cf9f02be2ba5f (diff) | |
download | haskell-aae0457f412aa40dd192ca2cbea565ea60b182ec.tar.gz |
Change behaviour of -ddump-cmm-verbose to dump each Cmm pass output to a separate file and add -ddump-cmm-verbose-by-proc to keep old behaviour (#16930)
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/cmm/CmmPipeline.hs | 13 | ||||
-rw-r--r-- | compiler/main/DynFlags.hs | 9 | ||||
-rw-r--r-- | compiler/main/HscMain.hs | 2 |
3 files changed, 15 insertions, 9 deletions
diff --git a/compiler/cmm/CmmPipeline.hs b/compiler/cmm/CmmPipeline.hs index b8ae2b57ab..a6d981a7f9 100644 --- a/compiler/cmm/CmmPipeline.hs +++ b/compiler/cmm/CmmPipeline.hs @@ -353,9 +353,10 @@ dumpGraph dflags flag name g = do dumpWith :: DynFlags -> DumpFlag -> String -> SDoc -> IO () dumpWith dflags flag txt sdoc = do - -- ToDo: No easy way of say "dump all the cmm, *and* split - -- them into files." Also, -ddump-cmm-verbose doesn't play - -- nicely with -ddump-to-file, since the headers get omitted. - dumpIfSet_dyn dflags flag txt sdoc - when (not (dopt flag dflags)) $ - dumpIfSet_dyn dflags Opt_D_dump_cmm_verbose txt sdoc + dumpIfSet_dyn dflags flag txt sdoc + when (not (dopt flag dflags)) $ + -- If `-ddump-cmm-verbose -ddump-to-file` is specified, + -- dump each Cmm pipeline stage output to a separate file. #16930 + when (dopt Opt_D_dump_cmm_verbose dflags) + $ dumpSDoc dflags alwaysQualify flag txt sdoc + dumpIfSet_dyn dflags Opt_D_dump_cmm_verbose_by_proc txt sdoc diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 24c6caaf4d..5d0b09a602 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -407,10 +407,13 @@ data DumpFlag = Opt_D_dump_cmm | Opt_D_dump_cmm_from_stg | Opt_D_dump_cmm_raw - | Opt_D_dump_cmm_verbose + | Opt_D_dump_cmm_verbose_by_proc -- All of the cmm subflags (there are a lot!) automatically - -- enabled if you run -ddump-cmm-verbose + -- enabled if you run -ddump-cmm-verbose-by-proc -- Each flag corresponds to exact stage of Cmm pipeline. + | Opt_D_dump_cmm_verbose + -- same as -ddump-cmm-verbose-by-proc but writes each stage + -- to a separate file (if used with -ddump-to-file) | Opt_D_dump_cmm_cfg | Opt_D_dump_cmm_cbe | Opt_D_dump_cmm_switch @@ -3302,6 +3305,8 @@ dynamic_flags_deps = [ (setDumpFlag Opt_D_dump_cmm_raw) , make_ord_flag defGhcFlag "ddump-cmm-verbose" (setDumpFlag Opt_D_dump_cmm_verbose) + , make_ord_flag defGhcFlag "ddump-cmm-verbose-by-proc" + (setDumpFlag Opt_D_dump_cmm_verbose_by_proc) , make_ord_flag defGhcFlag "ddump-cmm-cfg" (setDumpFlag Opt_D_dump_cmm_cfg) , make_ord_flag defGhcFlag "ddump-cmm-cbe" diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs index aaf9a3c285..52501ec15f 100644 --- a/compiler/main/HscMain.hs +++ b/compiler/main/HscMain.hs @@ -1472,7 +1472,7 @@ hscCompileCmmFile hsc_env filename output_filename = runHsc hsc_env $ do let dflags = hsc_dflags hsc_env cmm <- ioMsgMaybe $ parseCmmFile dflags filename liftIO $ do - dumpIfSet_dyn dflags Opt_D_dump_cmm_verbose "Parsed Cmm" (ppr cmm) + dumpIfSet_dyn dflags Opt_D_dump_cmm_verbose_by_proc "Parsed Cmm" (ppr cmm) let -- Make up a module name to give the NCG. We can't pass bottom here -- lest we reproduce #11784. mod_name = mkModuleName $ "Cmm$" ++ FilePath.takeFileName filename |