summaryrefslogtreecommitdiff
path: root/compiler/main
diff options
context:
space:
mode:
authorVladimir Trubilov <vtrubiloff@gmail.com>2016-07-17 00:13:22 +0200
committerBen Gamari <ben@smart-cactus.org>2016-07-17 00:13:31 +0200
commit1ba79fa4d0e13e61a805fa458bcf2e690710d88b (patch)
tree15027609774083de6437767ce1449f358a0e3d1e /compiler/main
parent0f0cdb6827803015a9a3924fdafaef8dbcde048f (diff)
downloadhaskell-1ba79fa4d0e13e61a805fa458bcf2e690710d88b.tar.gz
CodeGen: Way to dump cmm only once (#11717)
The `-ddump-cmm` put all stages of Cmm processing into one output. This patch changes its behavior and adds two more options to make Cmm dumping flexible. - `-ddump-cmm-from-stg` dumps only initial version of Cmm right after STG->Cmm codegen - `-ddump-cmm` dumps the final result of the Cmm pipeline processing - `-ddump-cmm-verbose` dumps intermediate output of each Cmm pipeline step - `-ddump-cmm-proc` and `-ddump-cmm-caf` seems were lost. Now enabled Test Plan: ./validate Reviewers: thomie, simonmar, austin, bgamari Reviewed By: thomie, simonmar Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2393 GHC Trac Issues: #11717
Diffstat (limited to 'compiler/main')
-rw-r--r--compiler/main/DynFlags.hs20
-rw-r--r--compiler/main/HscMain.hs15
2 files changed, 23 insertions, 12 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 24746d6836..dc29176ddf 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -295,15 +295,19 @@ data DumpFlag
-- debugging flags
= Opt_D_dump_cmm
+ | Opt_D_dump_cmm_from_stg
| Opt_D_dump_cmm_raw
- -- All of the cmm subflags (there are a lot!) Automatically
- -- enabled if you run -ddump-cmm
+ | Opt_D_dump_cmm_verbose
+ -- All of the cmm subflags (there are a lot!) automatically
+ -- enabled if you run -ddump-cmm-verbose
+ -- Each flag corresponds to exact stage of Cmm pipeline.
| Opt_D_dump_cmm_cfg
| Opt_D_dump_cmm_cbe
| Opt_D_dump_cmm_switch
| Opt_D_dump_cmm_proc
- | Opt_D_dump_cmm_sink
| Opt_D_dump_cmm_sp
+ | Opt_D_dump_cmm_sink
+ | Opt_D_dump_cmm_caf
| Opt_D_dump_cmm_procmap
| Opt_D_dump_cmm_split
| Opt_D_dump_cmm_info
@@ -2606,8 +2610,12 @@ dynamic_flags_deps = [
, make_ord_flag defGhcFlag "ddump-cmm"
(setDumpFlag Opt_D_dump_cmm)
+ , make_ord_flag defGhcFlag "ddump-cmm-from-stg"
+ (setDumpFlag Opt_D_dump_cmm_from_stg)
, make_ord_flag defGhcFlag "ddump-cmm-raw"
(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-cfg"
(setDumpFlag Opt_D_dump_cmm_cfg)
, make_ord_flag defGhcFlag "ddump-cmm-cbe"
@@ -2616,10 +2624,12 @@ dynamic_flags_deps = [
(setDumpFlag Opt_D_dump_cmm_switch)
, make_ord_flag defGhcFlag "ddump-cmm-proc"
(setDumpFlag Opt_D_dump_cmm_proc)
- , make_ord_flag defGhcFlag "ddump-cmm-sink"
- (setDumpFlag Opt_D_dump_cmm_sink)
, make_ord_flag defGhcFlag "ddump-cmm-sp"
(setDumpFlag Opt_D_dump_cmm_sp)
+ , make_ord_flag defGhcFlag "ddump-cmm-sink"
+ (setDumpFlag Opt_D_dump_cmm_sink)
+ , make_ord_flag defGhcFlag "ddump-cmm-caf"
+ (setDumpFlag Opt_D_dump_cmm_caf)
, make_ord_flag defGhcFlag "ddump-cmm-procmap"
(setDumpFlag Opt_D_dump_cmm_procmap)
, make_ord_flag defGhcFlag "ddump-cmm-split"
diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs
index 9c510df27b..bd7f8c9cde 100644
--- a/compiler/main/HscMain.hs
+++ b/compiler/main/HscMain.hs
@@ -1337,16 +1337,16 @@ hscCompileCmmFile hsc_env filename output_filename = runHsc hsc_env $ do
liftIO $ do
us <- mkSplitUniqSupply 'S'
let initTopSRT = initUs_ us emptySRT
- dumpIfSet_dyn dflags Opt_D_dump_cmm "Parsed Cmm" (ppr cmm)
+ dumpIfSet_dyn dflags Opt_D_dump_cmm_verbose "Parsed Cmm" (ppr cmm)
(_, cmmgroup) <- cmmPipeline hsc_env initTopSRT cmm
rawCmms <- cmmToRawCmm dflags (Stream.yield cmmgroup)
_ <- codeOutput dflags no_mod output_filename no_loc NoStubs [] rawCmms
return ()
where
- no_mod = panic "hscCmmFile: no_mod"
+ no_mod = panic "hscCompileCmmFile: no_mod"
no_loc = ModLocation{ ml_hs_file = Just filename,
- ml_hi_file = panic "hscCmmFile: no hi file",
- ml_obj_file = panic "hscCmmFile: no obj file" }
+ ml_hi_file = panic "hscCompileCmmFile: no hi file",
+ ml_obj_file = panic "hscCompileCmmFile: no obj file" }
-------------------- Stuff for new code gen ---------------------
@@ -1372,8 +1372,8 @@ doCodeGen hsc_env this_mod data_tycons
-- CmmGroup on input may produce many CmmGroups on output due
-- to proc-point splitting).
- let dump1 a = do dumpIfSet_dyn dflags Opt_D_dump_cmm
- "Cmm produced by new codegen" (ppr a)
+ let dump1 a = do dumpIfSet_dyn dflags Opt_D_dump_cmm_from_stg
+ "Cmm produced by codegen" (ppr a)
return a
ppr_stream1 = Stream.mapM dump1 cmm_stream
@@ -1406,7 +1406,8 @@ doCodeGen hsc_env this_mod data_tycons
Stream.yield (srtToData topSRT)
let
- dump2 a = do dumpIfSet_dyn dflags Opt_D_dump_cmm "Output Cmm" $ ppr a
+ dump2 a = do dumpIfSet_dyn dflags Opt_D_dump_cmm
+ "Output Cmm" (ppr a)
return a
ppr_stream2 = Stream.mapM dump2 pipeline_stream