Commit f6f881f0 authored by mad.one@gmail.com's avatar mad.one@gmail.com Committed by Simon Peyton Jones

Rename all of the 'cmmz' flags and make them more consistent.

There's only a single compiler backend now, so the 'z' suffix means
nothing. Also, the flags were confusingly named ('cmm-foo' vs
'foo-cmm',) and counter-intuitively, '-ddump-cmm' did not do at all what
you expected since the new backend went live.

Basically, all of the -ddump-cmmz-* flags are now -ddump-cmm-*. Some were
renamed to be more consistent.

This doesn't update the manual; it already mentions '-ddump-cmm' and
that flag implies all the others anyway, which is probably what you
want.
Signed-off-by: mad.one@gmail.com's avatarAustin Seipp <mad.one@gmail.com>
parent 9429d794
...@@ -45,12 +45,11 @@ cmmPipeline hsc_env topSRT prog = ...@@ -45,12 +45,11 @@ cmmPipeline hsc_env topSRT prog =
tops <- {-# SCC "tops" #-} mapM (cpsTop hsc_env) prog tops <- {-# SCC "tops" #-} mapM (cpsTop hsc_env) prog
(topSRT, cmms) <- {-# SCC "doSRTs" #-} doSRTs dflags topSRT tops (topSRT, cmms) <- {-# SCC "doSRTs" #-} doSRTs dflags topSRT tops
dumpIfSet_dyn dflags Opt_D_dump_cps_cmm "Post CPS Cmm" (ppr cmms) dumpWith dflags Opt_D_dump_cmm_cps "Post CPS Cmm" cmms
return (topSRT, cmms) return (topSRT, cmms)
cpsTop :: HscEnv -> CmmDecl -> IO (CAFEnv, [CmmDecl]) cpsTop :: HscEnv -> CmmDecl -> IO (CAFEnv, [CmmDecl])
cpsTop _ p@(CmmData {}) = return (mapEmpty, [p]) cpsTop _ p@(CmmData {}) = return (mapEmpty, [p])
cpsTop hsc_env proc = cpsTop hsc_env proc =
...@@ -63,7 +62,7 @@ cpsTop hsc_env proc = ...@@ -63,7 +62,7 @@ cpsTop hsc_env proc =
-- --
CmmProc h l v g <- {-# SCC "cmmCfgOpts(1)" #-} CmmProc h l v g <- {-# SCC "cmmCfgOpts(1)" #-}
return $ cmmCfgOptsProc splitting_proc_points proc return $ cmmCfgOptsProc splitting_proc_points proc
dump Opt_D_dump_cmmz_cfg "Post control-flow optimsations" g dump Opt_D_dump_cmm_cfg "Post control-flow optimsations" g
let !TopInfo {stack_info=StackInfo { arg_space = entry_off let !TopInfo {stack_info=StackInfo { arg_space = entry_off
, do_layout = do_layout }} = h , do_layout = do_layout }} = h
...@@ -71,7 +70,7 @@ cpsTop hsc_env proc = ...@@ -71,7 +70,7 @@ cpsTop hsc_env proc =
----------- Eliminate common blocks ------------------------------------- ----------- Eliminate common blocks -------------------------------------
g <- {-# SCC "elimCommonBlocks" #-} g <- {-# SCC "elimCommonBlocks" #-}
condPass Opt_CmmElimCommonBlocks elimCommonBlocks g condPass Opt_CmmElimCommonBlocks elimCommonBlocks g
Opt_D_dump_cmmz_cbe "Post common block elimination" Opt_D_dump_cmm_cbe "Post common block elimination"
-- Any work storing block Labels must be performed _after_ -- Any work storing block Labels must be performed _after_
-- elimCommonBlocks -- elimCommonBlocks
...@@ -86,14 +85,14 @@ cpsTop hsc_env proc = ...@@ -86,14 +85,14 @@ cpsTop hsc_env proc =
return call_pps return call_pps
let noncall_pps = proc_points `setDifference` call_pps let noncall_pps = proc_points `setDifference` call_pps
when (not (setNull noncall_pps) && dopt Opt_D_dump_cmmz dflags) $ when (not (setNull noncall_pps) && dopt Opt_D_dump_cmm dflags) $
pprTrace "Non-call proc points: " (ppr noncall_pps) $ return () pprTrace "Non-call proc points: " (ppr noncall_pps) $ return ()
----------- Sink and inline assignments *before* stack layout ----------- ----------- Sink and inline assignments *before* stack layout -----------
{- Maybe enable this later {- Maybe enable this later
g <- {-# SCC "sink1" #-} g <- {-# SCC "sink1" #-}
condPass Opt_CmmSink cmmSink g condPass Opt_CmmSink (cmmSink dflags) g
Opt_D_dump_cmmz_rewrite "Sink assignments (1)" Opt_D_dump_cmm_rewrite "Sink assignments (1)"
-} -}
----------- Layout the stack and manifest Sp ---------------------------- ----------- Layout the stack and manifest Sp ----------------------------
...@@ -102,32 +101,32 @@ cpsTop hsc_env proc = ...@@ -102,32 +101,32 @@ cpsTop hsc_env proc =
if do_layout if do_layout
then runUniqSM $ cmmLayoutStack dflags proc_points entry_off g then runUniqSM $ cmmLayoutStack dflags proc_points entry_off g
else return (g, mapEmpty) else return (g, mapEmpty)
dump Opt_D_dump_cmmz_sp "Layout Stack" g dump Opt_D_dump_cmm_sp "Layout Stack" g
----------- Sink and inline assignments *after* stack layout ------------ ----------- Sink and inline assignments *after* stack layout ------------
g <- {-# SCC "sink2" #-} g <- {-# SCC "sink2" #-}
condPass Opt_CmmSink (cmmSink dflags) g condPass Opt_CmmSink (cmmSink dflags) g
Opt_D_dump_cmmz_rewrite "Sink assignments (2)" Opt_D_dump_cmm_rewrite "Sink assignments (2)"
------------- CAF analysis ---------------------------------------------- ------------- CAF analysis ----------------------------------------------
let cafEnv = {-# SCC "cafAnal" #-} cafAnal g let cafEnv = {-# SCC "cafAnal" #-} cafAnal g
dumpIfSet_dyn dflags Opt_D_dump_cmmz "CAFEnv" (ppr cafEnv) dumpIfSet_dyn dflags Opt_D_dump_cmm "CAFEnv" (ppr cafEnv)
if splitting_proc_points if splitting_proc_points
then do then do
------------- Split into separate procedures ----------------------- ------------- Split into separate procedures -----------------------
pp_map <- {-# SCC "procPointAnalysis" #-} runUniqSM $ pp_map <- {-# SCC "procPointAnalysis" #-} runUniqSM $
procPointAnalysis proc_points g procPointAnalysis proc_points g
dumpWith dflags Opt_D_dump_cmmz_procmap "procpoint map" pp_map dumpWith dflags Opt_D_dump_cmm_procmap "procpoint map" pp_map
gs <- {-# SCC "splitAtProcPoints" #-} runUniqSM $ gs <- {-# SCC "splitAtProcPoints" #-} runUniqSM $
splitAtProcPoints dflags l call_pps proc_points pp_map splitAtProcPoints dflags l call_pps proc_points pp_map
(CmmProc h l v g) (CmmProc h l v g)
dumps Opt_D_dump_cmmz_split "Post splitting" gs dumps Opt_D_dump_cmm_split "Post splitting" gs
------------- Populate info tables with stack info ----------------- ------------- Populate info tables with stack info -----------------
gs <- {-# SCC "setInfoTableStackMap" #-} gs <- {-# SCC "setInfoTableStackMap" #-}
return $ map (setInfoTableStackMap dflags stackmaps) gs return $ map (setInfoTableStackMap dflags stackmaps) gs
dumps Opt_D_dump_cmmz_info "after setInfoTableStackMap" gs dumps Opt_D_dump_cmm_info "after setInfoTableStackMap" gs
----------- Control-flow optimisations ----------------------------- ----------- Control-flow optimisations -----------------------------
gs <- {-# SCC "cmmCfgOpts(2)" #-} gs <- {-# SCC "cmmCfgOpts(2)" #-}
...@@ -136,7 +135,7 @@ cpsTop hsc_env proc = ...@@ -136,7 +135,7 @@ cpsTop hsc_env proc =
else gs else gs
gs <- return (map removeUnreachableBlocksProc gs) gs <- return (map removeUnreachableBlocksProc gs)
-- Note [unreachable blocks] -- Note [unreachable blocks]
dumps Opt_D_dump_cmmz_cfg "Post control-flow optimsations" gs dumps Opt_D_dump_cmm_cfg "Post control-flow optimsations" gs
return (cafEnv, gs) return (cafEnv, gs)
...@@ -147,7 +146,7 @@ cpsTop hsc_env proc = ...@@ -147,7 +146,7 @@ cpsTop hsc_env proc =
------------- Populate info tables with stack info ----------------- ------------- Populate info tables with stack info -----------------
g <- {-# SCC "setInfoTableStackMap" #-} g <- {-# SCC "setInfoTableStackMap" #-}
return $ setInfoTableStackMap dflags stackmaps g return $ setInfoTableStackMap dflags stackmaps g
dump' Opt_D_dump_cmmz_info "after setInfoTableStackMap" g dump' Opt_D_dump_cmm_info "after setInfoTableStackMap" g
----------- Control-flow optimisations ----------------------------- ----------- Control-flow optimisations -----------------------------
g <- {-# SCC "cmmCfgOpts(2)" #-} g <- {-# SCC "cmmCfgOpts(2)" #-}
...@@ -156,7 +155,7 @@ cpsTop hsc_env proc = ...@@ -156,7 +155,7 @@ cpsTop hsc_env proc =
else g else g
g <- return (removeUnreachableBlocksProc g) g <- return (removeUnreachableBlocksProc g)
-- Note [unreachable blocks] -- Note [unreachable blocks]
dump' Opt_D_dump_cmmz_cfg "Post control-flow optimsations" g dump' Opt_D_dump_cmm_cfg "Post control-flow optimsations" g
return (cafEnv, [g]) return (cafEnv, [g])
...@@ -254,10 +253,10 @@ dumpGraph dflags flag name g = do ...@@ -254,10 +253,10 @@ dumpGraph dflags flag name g = do
dumpWith :: Outputable a => DynFlags -> DumpFlag -> String -> a -> IO () dumpWith :: Outputable a => DynFlags -> DumpFlag -> String -> a -> IO ()
dumpWith dflags flag txt g = do dumpWith dflags flag txt g = do
-- ToDo: No easy way of say "dump all the cmmz, *and* split -- ToDo: No easy way of say "dump all the cmm, *and* split
-- them into files." Also, -ddump-cmmz doesn't play nicely -- them into files." Also, -ddump-cmm doesn't play nicely
-- with -ddump-to-file, since the headers get omitted. -- with -ddump-to-file, since the headers get omitted.
dumpIfSet_dyn dflags flag txt (ppr g) dumpIfSet_dyn dflags flag txt (ppr g)
when (not (dopt flag dflags)) $ when (not (dopt flag dflags)) $
dumpIfSet_dyn dflags Opt_D_dump_cmmz txt (ppr g) dumpIfSet_dyn dflags Opt_D_dump_cmm txt (ppr g)
...@@ -315,7 +315,7 @@ splitAtProcPoints dflags entry_label callPPs procPoints procMap ...@@ -315,7 +315,7 @@ splitAtProcPoints dflags entry_label callPPs procPoints procMap
stack_info = StackInfo { arg_space = 0 stack_info = StackInfo { arg_space = 0
, updfr_space = Nothing , updfr_space = Nothing
, do_layout = True } , do_layout = True }
-- cannot use panic, this is printed by -ddump-cmmz -- cannot use panic, this is printed by -ddump-cmm
-- References to procpoint IDs can now be replaced with the -- References to procpoint IDs can now be replaced with the
-- infotable's label -- infotable's label
......
...@@ -173,20 +173,19 @@ data DumpFlag ...@@ -173,20 +173,19 @@ data DumpFlag
-- debugging flags -- debugging flags
= Opt_D_dump_cmm = Opt_D_dump_cmm
| Opt_D_dump_raw_cmm | Opt_D_dump_cmm_raw
| Opt_D_dump_cmmz -- All of the cmm subflags (there are a lot!) Automatically
-- All of the cmmz subflags (there are a lot!) Automatically -- enabled if you run -ddump-cmm
-- enabled if you run -ddump-cmmz | Opt_D_dump_cmm_cfg
| Opt_D_dump_cmmz_cfg | Opt_D_dump_cmm_cbe
| Opt_D_dump_cmmz_cbe | Opt_D_dump_cmm_proc
| Opt_D_dump_cmmz_proc | Opt_D_dump_cmm_rewrite
| Opt_D_dump_cmmz_rewrite | Opt_D_dump_cmm_sp
| Opt_D_dump_cmmz_sp | Opt_D_dump_cmm_procmap
| Opt_D_dump_cmmz_procmap | Opt_D_dump_cmm_split
| Opt_D_dump_cmmz_split | Opt_D_dump_cmm_info
| Opt_D_dump_cmmz_info | Opt_D_dump_cmm_cps
-- end cmmz subflags -- end cmm subflags
| Opt_D_dump_cps_cmm
| Opt_D_dump_asm | Opt_D_dump_asm
| Opt_D_dump_asm_native | Opt_D_dump_asm_native
| Opt_D_dump_asm_liveness | Opt_D_dump_asm_liveness
...@@ -2065,18 +2064,17 @@ dynamic_flags = [ ...@@ -2065,18 +2064,17 @@ dynamic_flags = [
, Flag "dstg-stats" (NoArg (setGeneralFlag Opt_StgStats)) , Flag "dstg-stats" (NoArg (setGeneralFlag Opt_StgStats))
, Flag "ddump-cmm" (setDumpFlag Opt_D_dump_cmm) , Flag "ddump-cmm" (setDumpFlag Opt_D_dump_cmm)
, Flag "ddump-raw-cmm" (setDumpFlag Opt_D_dump_raw_cmm) , Flag "ddump-cmm-raw" (setDumpFlag Opt_D_dump_cmm_raw)
, Flag "ddump-cmmz" (setDumpFlag Opt_D_dump_cmmz) , Flag "ddump-cmm-cfg" (setDumpFlag Opt_D_dump_cmm_cfg)
, Flag "ddump-cmmz-cfg" (setDumpFlag Opt_D_dump_cmmz_cfg) , Flag "ddump-cmm-cbe" (setDumpFlag Opt_D_dump_cmm_cbe)
, Flag "ddump-cmmz-cbe" (setDumpFlag Opt_D_dump_cmmz_cbe) , Flag "ddump-cmm-proc" (setDumpFlag Opt_D_dump_cmm_proc)
, Flag "ddump-cmmz-proc" (setDumpFlag Opt_D_dump_cmmz_proc) , Flag "ddump-cmm-rewrite" (setDumpFlag Opt_D_dump_cmm_rewrite)
, Flag "ddump-cmmz-rewrite" (setDumpFlag Opt_D_dump_cmmz_rewrite) , Flag "ddump-cmm-sp" (setDumpFlag Opt_D_dump_cmm_sp)
, Flag "ddump-cmmz-sp" (setDumpFlag Opt_D_dump_cmmz_sp) , Flag "ddump-cmm-procmap" (setDumpFlag Opt_D_dump_cmm_procmap)
, Flag "ddump-cmmz-procmap" (setDumpFlag Opt_D_dump_cmmz_procmap) , Flag "ddump-cmm-split" (setDumpFlag Opt_D_dump_cmm_split)
, Flag "ddump-cmmz-split" (setDumpFlag Opt_D_dump_cmmz_split) , Flag "ddump-cmm-info" (setDumpFlag Opt_D_dump_cmm_info)
, Flag "ddump-cmmz-info" (setDumpFlag Opt_D_dump_cmmz_info) , Flag "ddump-cmm-cps" (setDumpFlag Opt_D_dump_cmm_cps)
, Flag "ddump-core-stats" (setDumpFlag Opt_D_dump_core_stats) , Flag "ddump-core-stats" (setDumpFlag Opt_D_dump_core_stats)
, Flag "ddump-cps-cmm" (setDumpFlag Opt_D_dump_cps_cmm)
, Flag "ddump-asm" (setDumpFlag Opt_D_dump_asm) , Flag "ddump-asm" (setDumpFlag Opt_D_dump_asm)
, Flag "ddump-asm-native" (setDumpFlag Opt_D_dump_asm_native) , Flag "ddump-asm-native" (setDumpFlag Opt_D_dump_asm_native)
, Flag "ddump-asm-liveness" (setDumpFlag Opt_D_dump_asm_liveness) , Flag "ddump-asm-liveness" (setDumpFlag Opt_D_dump_asm_liveness)
......
...@@ -1297,7 +1297,7 @@ hscGenHardCode cgguts mod_summary = do ...@@ -1297,7 +1297,7 @@ hscGenHardCode cgguts mod_summary = do
rawcmms0 <- {-# SCC "cmmToRawCmm" #-} rawcmms0 <- {-# SCC "cmmToRawCmm" #-}
cmmToRawCmm dflags cmms cmmToRawCmm dflags cmms
let dump a = do dumpIfSet_dyn dflags Opt_D_dump_raw_cmm "Raw Cmm" let dump a = do dumpIfSet_dyn dflags Opt_D_dump_cmm_raw "Raw Cmm"
(ppr a) (ppr a)
return a return a
rawcmms1 = Stream.mapM dump rawcmms0 rawcmms1 = Stream.mapM dump rawcmms0
...@@ -1356,7 +1356,7 @@ hscCompileCmmFile hsc_env filename = runHsc hsc_env $ do ...@@ -1356,7 +1356,7 @@ hscCompileCmmFile hsc_env filename = runHsc hsc_env $ do
liftIO $ do liftIO $ do
us <- mkSplitUniqSupply 'S' us <- mkSplitUniqSupply 'S'
let initTopSRT = initUs_ us emptySRT let initTopSRT = initUs_ us emptySRT
dumpIfSet_dyn dflags Opt_D_dump_cmmz "Parsed Cmm" (ppr cmm) dumpIfSet_dyn dflags Opt_D_dump_cmm "Parsed Cmm" (ppr cmm)
(_, cmmgroup) <- cmmPipeline hsc_env initTopSRT cmm (_, cmmgroup) <- cmmPipeline hsc_env initTopSRT cmm
rawCmms <- cmmToRawCmm dflags (Stream.yield cmmgroup) rawCmms <- cmmToRawCmm dflags (Stream.yield cmmgroup)
_ <- codeOutput dflags no_mod no_loc NoStubs [] rawCmms _ <- codeOutput dflags no_mod no_loc NoStubs [] rawCmms
...@@ -1391,7 +1391,7 @@ tryNewCodeGen hsc_env this_mod data_tycons ...@@ -1391,7 +1391,7 @@ tryNewCodeGen hsc_env this_mod data_tycons
-- CmmGroup on input may produce many CmmGroups on output due -- CmmGroup on input may produce many CmmGroups on output due
-- to proc-point splitting). -- to proc-point splitting).
let dump1 a = do dumpIfSet_dyn dflags Opt_D_dump_cmmz let dump1 a = do dumpIfSet_dyn dflags Opt_D_dump_cmm
"Cmm produced by new codegen" (ppr a) "Cmm produced by new codegen" (ppr a)
return a return a
...@@ -1429,7 +1429,7 @@ tryNewCodeGen hsc_env this_mod data_tycons ...@@ -1429,7 +1429,7 @@ tryNewCodeGen hsc_env this_mod data_tycons
Stream.yield (srtToData topSRT) Stream.yield (srtToData topSRT)
let let
dump2 a = do dumpIfSet_dyn dflags Opt_D_dump_cmmz "Output Cmm" $ ppr a dump2 a = do dumpIfSet_dyn dflags Opt_D_dump_cmm "Output Cmm" $ ppr a
return a return a
ppr_stream2 = Stream.mapM dump2 pipeline_stream ppr_stream2 = Stream.mapM dump2 pipeline_stream
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment