summaryrefslogtreecommitdiff
path: root/compiler/main/HscMain.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/main/HscMain.hs')
-rw-r--r--compiler/main/HscMain.hs35
1 files changed, 20 insertions, 15 deletions
diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs
index 016cad9303..7d99c467c1 100644
--- a/compiler/main/HscMain.hs
+++ b/compiler/main/HscMain.hs
@@ -1456,9 +1456,10 @@ hscGenHardCode hsc_env cgguts location output_filename = do
rawcmms0 <- {-# SCC "cmmToRawCmm" #-}
cmmToRawCmm dflags cmms
- let dump a = do dumpIfSet_dyn dflags Opt_D_dump_cmm_raw "Raw Cmm"
- FormatCMM (ppr a)
- return a
+ let dump a = do
+ unless (null a) $
+ dumpIfSet_dyn dflags Opt_D_dump_cmm_raw "Raw Cmm" FormatCMM (ppr a)
+ return a
rawcmms1 = Stream.mapM dump rawcmms0
(output_filename, (_stub_h_exists, stub_c_exists), foreign_fps, ())
@@ -1512,8 +1513,9 @@ hscCompileCmmFile hsc_env filename output_filename = runHsc hsc_env $ do
mod_name = mkModuleName $ "Cmm$" ++ FilePath.takeFileName filename
cmm_mod = mkModule (thisPackage dflags) mod_name
(_, cmmgroup) <- cmmPipeline hsc_env (emptySRT cmm_mod) cmm
- dumpIfSet_dyn dflags Opt_D_dump_cmm "Output Cmm"
- FormatCMM (ppr cmmgroup)
+ unless (null cmmgroup) $
+ dumpIfSet_dyn dflags Opt_D_dump_cmm "Output Cmm"
+ FormatCMM (ppr cmmgroup)
rawCmms <- cmmToRawCmm dflags (Stream.yield cmmgroup)
_ <- codeOutput dflags cmm_mod output_filename no_loc NoStubs [] []
rawCmms
@@ -1550,20 +1552,23 @@ 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_from_stg
- "Cmm produced by codegen" FormatCMM (ppr a)
- return a
+ let dump1 a = do
+ unless (null a) $
+ dumpIfSet_dyn dflags Opt_D_dump_cmm_from_stg
+ "Cmm produced by codegen" FormatCMM (ppr a)
+ return a
ppr_stream1 = Stream.mapM dump1 cmm_stream
- pipeline_stream
- = {-# SCC "cmmPipeline" #-}
- let run_pipeline = cmmPipeline hsc_env
- in void $ Stream.mapAccumL run_pipeline (emptySRT this_mod) ppr_stream1
+ pipeline_stream =
+ {-# SCC "cmmPipeline" #-}
+ let run_pipeline = cmmPipeline hsc_env
+ in void $ Stream.mapAccumL run_pipeline (emptySRT this_mod) ppr_stream1
- dump2 a = do dumpIfSet_dyn dflags Opt_D_dump_cmm
- "Output Cmm" FormatCMM (ppr a)
- return a
+ dump2 a = do
+ unless (null a) $
+ dumpIfSet_dyn dflags Opt_D_dump_cmm "Output Cmm" FormatCMM (ppr a)
+ return a
ppr_stream2 = Stream.mapM dump2 pipeline_stream