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 =
tops <- {-# SCC "tops" #-} mapM (cpsTop hsc_env) prog
(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)
cpsTop :: HscEnv -> CmmDecl -> IO (CAFEnv, [CmmDecl])
cpsTop _ p@(CmmData {}) = return (mapEmpty, [p])
cpsTop hsc_env proc =
......@@ -63,7 +62,7 @@ cpsTop hsc_env proc =
--
CmmProc h l v g <- {-# SCC "cmmCfgOpts(1)" #-}
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
, do_layout = do_layout }} = h
......@@ -71,7 +70,7 @@ cpsTop hsc_env proc =
----------- Eliminate common blocks -------------------------------------
g <- {-# SCC "elimCommonBlocks" #-}
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_
-- elimCommonBlocks
......@@ -86,14 +85,14 @@ cpsTop hsc_env proc =
return 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 ()
----------- Sink and inline assignments *before* stack layout -----------
{- Maybe enable this later
g <- {-# SCC "sink1" #-}
condPass Opt_CmmSink cmmSink g
Opt_D_dump_cmmz_rewrite "Sink assignments (1)"
condPass Opt_CmmSink (cmmSink dflags) g
Opt_D_dump_cmm_rewrite "Sink assignments (1)"
-}
----------- Layout the stack and manifest Sp ----------------------------
......@@ -102,32 +101,32 @@ cpsTop hsc_env proc =
if do_layout
then runUniqSM $ cmmLayoutStack dflags proc_points entry_off g
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 ------------
g <- {-# SCC "sink2" #-}
condPass Opt_CmmSink (cmmSink dflags) g
Opt_D_dump_cmmz_rewrite "Sink assignments (2)"
Opt_D_dump_cmm_rewrite "Sink assignments (2)"
------------- CAF analysis ----------------------------------------------
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
then do
------------- Split into separate procedures -----------------------
pp_map <- {-# SCC "procPointAnalysis" #-} runUniqSM $
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 $
splitAtProcPoints dflags l call_pps proc_points pp_map
(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 -----------------
gs <- {-# SCC "setInfoTableStackMap" #-}
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 -----------------------------
gs <- {-# SCC "cmmCfgOpts(2)" #-}
......@@ -136,7 +135,7 @@ cpsTop hsc_env proc =
else gs
gs <- return (map removeUnreachableBlocksProc gs)
-- 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)
......@@ -147,7 +146,7 @@ cpsTop hsc_env proc =
------------- Populate info tables with stack info -----------------
g <- {-# SCC "setInfoTableStackMap" #-}
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 -----------------------------
g <- {-# SCC "cmmCfgOpts(2)" #-}
......@@ -156,7 +155,7 @@ cpsTop hsc_env proc =
else g
g <- return (removeUnreachableBlocksProc g)
-- 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])
......@@ -254,10 +253,10 @@ dumpGraph dflags flag name g = do
dumpWith :: Outputable a => DynFlags -> DumpFlag -> String -> a -> IO ()
dumpWith dflags flag txt g = do
-- ToDo: No easy way of say "dump all the cmmz, *and* split
-- them into files." Also, -ddump-cmmz doesn't play nicely
-- ToDo: No easy way of say "dump all the cmm, *and* split
-- them into files." Also, -ddump-cmm doesn't play nicely
-- with -ddump-to-file, since the headers get omitted.
dumpIfSet_dyn dflags flag txt (ppr g)
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
stack_info = StackInfo { arg_space = 0
, updfr_space = Nothing
, 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
-- infotable's label
......
......@@ -173,20 +173,19 @@ data DumpFlag
-- debugging flags
= Opt_D_dump_cmm
| Opt_D_dump_raw_cmm
| Opt_D_dump_cmmz
-- All of the cmmz subflags (there are a lot!) Automatically
-- enabled if you run -ddump-cmmz
| Opt_D_dump_cmmz_cfg
| Opt_D_dump_cmmz_cbe
| Opt_D_dump_cmmz_proc
| Opt_D_dump_cmmz_rewrite
| Opt_D_dump_cmmz_sp
| Opt_D_dump_cmmz_procmap
| Opt_D_dump_cmmz_split
| Opt_D_dump_cmmz_info
-- end cmmz subflags
| Opt_D_dump_cps_cmm
| 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_cfg
| Opt_D_dump_cmm_cbe
| Opt_D_dump_cmm_proc
| Opt_D_dump_cmm_rewrite
| Opt_D_dump_cmm_sp
| Opt_D_dump_cmm_procmap
| Opt_D_dump_cmm_split
| Opt_D_dump_cmm_info
| Opt_D_dump_cmm_cps
-- end cmm subflags
| Opt_D_dump_asm
| Opt_D_dump_asm_native
| Opt_D_dump_asm_liveness
......@@ -2065,18 +2064,17 @@ dynamic_flags = [
, Flag "dstg-stats" (NoArg (setGeneralFlag Opt_StgStats))
, Flag "ddump-cmm" (setDumpFlag Opt_D_dump_cmm)
, Flag "ddump-raw-cmm" (setDumpFlag Opt_D_dump_raw_cmm)
, Flag "ddump-cmmz" (setDumpFlag Opt_D_dump_cmmz)
, Flag "ddump-cmmz-cfg" (setDumpFlag Opt_D_dump_cmmz_cfg)
, Flag "ddump-cmmz-cbe" (setDumpFlag Opt_D_dump_cmmz_cbe)
, Flag "ddump-cmmz-proc" (setDumpFlag Opt_D_dump_cmmz_proc)
, Flag "ddump-cmmz-rewrite" (setDumpFlag Opt_D_dump_cmmz_rewrite)
, Flag "ddump-cmmz-sp" (setDumpFlag Opt_D_dump_cmmz_sp)
, Flag "ddump-cmmz-procmap" (setDumpFlag Opt_D_dump_cmmz_procmap)
, Flag "ddump-cmmz-split" (setDumpFlag Opt_D_dump_cmmz_split)
, Flag "ddump-cmmz-info" (setDumpFlag Opt_D_dump_cmmz_info)
, Flag "ddump-cmm-raw" (setDumpFlag Opt_D_dump_cmm_raw)
, Flag "ddump-cmm-cfg" (setDumpFlag Opt_D_dump_cmm_cfg)
, Flag "ddump-cmm-cbe" (setDumpFlag Opt_D_dump_cmm_cbe)
, Flag "ddump-cmm-proc" (setDumpFlag Opt_D_dump_cmm_proc)
, Flag "ddump-cmm-rewrite" (setDumpFlag Opt_D_dump_cmm_rewrite)
, Flag "ddump-cmm-sp" (setDumpFlag Opt_D_dump_cmm_sp)
, Flag "ddump-cmm-procmap" (setDumpFlag Opt_D_dump_cmm_procmap)
, Flag "ddump-cmm-split" (setDumpFlag Opt_D_dump_cmm_split)
, Flag "ddump-cmm-info" (setDumpFlag Opt_D_dump_cmm_info)
, Flag "ddump-cmm-cps" (setDumpFlag Opt_D_dump_cmm_cps)
, 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-native" (setDumpFlag Opt_D_dump_asm_native)
, Flag "ddump-asm-liveness" (setDumpFlag Opt_D_dump_asm_liveness)
......
......@@ -1297,7 +1297,7 @@ hscGenHardCode cgguts mod_summary = do
rawcmms0 <- {-# SCC "cmmToRawCmm" #-}
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)
return a
rawcmms1 = Stream.mapM dump rawcmms0
......@@ -1356,7 +1356,7 @@ hscCompileCmmFile hsc_env filename = runHsc hsc_env $ do
liftIO $ do
us <- mkSplitUniqSupply 'S'
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
rawCmms <- cmmToRawCmm dflags (Stream.yield cmmgroup)
_ <- codeOutput dflags no_mod no_loc NoStubs [] rawCmms
......@@ -1391,7 +1391,7 @@ tryNewCodeGen 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_cmmz
let dump1 a = do dumpIfSet_dyn dflags Opt_D_dump_cmm
"Cmm produced by new codegen" (ppr a)
return a
......@@ -1429,7 +1429,7 @@ tryNewCodeGen hsc_env this_mod data_tycons
Stream.yield (srtToData topSRT)
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
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