PATCH: Rename cmmz flags for consistency

Austin Seipp <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <CAEs96n3BLXsT_6XbDsbTdnEj_Vx7CZ4rakpe3mK8PgUxcNLpEA@mail.gmail.com>
Hi,

The attached patch renames the various '*-cmmz-*' flags to '*-cmm-*'
now that the new backend is live. It also fixes some inconsistencies;
namely, there were flags like -ddump-cmmz-rewrite, vs -ddump-cps-cmm,
etc. Also, since the new backend went live, '-ddump-cmm' was terribly
broken: it was only used when dumping out parsed C--, as the new
pipeline used -ddump-cmmz exclusively.

This patch mostly just makes all the flags consistent and removes the
needless 'z' suffix. It doesn't update the manual; the sub-flags were
never mentioned, and -ddump-cmm implies them all anyway.

-- 
Regards,
Austin

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc
0001-Rename-all-of-the-cmmz-flags-and-make-them-more-cons.patch (application/octet-stream, 12.9 KB)
From 1182b5d9247e1d0de96d869a833fe14aa6676ae2 Mon Sep 17 00:00:00 2001
From: Austin Seipp <[email protected]>
Date: Mon, 17 Dec 2012 04:21:50 -0600
Subject: [PATCH] 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: Austin Seipp <[email protected]>
---
 compiler/cmm/CmmPipeline.hs  | 37 +++++++++++++++++-----------------
 compiler/cmm/CmmProcPoint.hs |  2 +-
 compiler/main/DynFlags.hs    | 48 +++++++++++++++++++++-----------------------
 compiler/main/HscMain.hs     |  8 ++++----
 4 files changed, 46 insertions(+), 49 deletions(-)

diff --git a/compiler/cmm/CmmPipeline.hs b/compiler/cmm/CmmPipeline.hs
index ff69d7e..6093419 100644
--- a/compiler/cmm/CmmPipeline.hs
+++ b/compiler/cmm/CmmPipeline.hs
@@ -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)
 
diff --git a/compiler/cmm/CmmProcPoint.hs b/compiler/cmm/CmmProcPoint.hs
index fb94b95..abf2393 100644
--- a/compiler/cmm/CmmProcPoint.hs
+++ b/compiler/cmm/CmmProcPoint.hs
@@ -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
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index e314955..9ff0346 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -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)
diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs
index 5e5bd53..2a83816 100644
--- a/compiler/main/HscMain.hs
+++ b/compiler/main/HscMain.hs
@@ -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
-- 
1.8.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.