Ticket #7514: rename-cmmz-flags.patch

File rename-cmmz-flags.patch, 12.9 KB (added by thoughtpolice, 3 years ago)

Patch to rename flags

  • compiler/cmm/CmmPipeline.hs

    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 b cmmPipeline hsc_env topSRT prog = 
    4545     tops <- {-# SCC "tops" #-} mapM (cpsTop hsc_env) prog
    4646
    4747     (topSRT, cmms) <- {-# SCC "doSRTs" #-} doSRTs dflags topSRT tops
    48      dumpIfSet_dyn dflags Opt_D_dump_cps_cmm "Post CPS Cmm" (ppr cmms)
     48     dumpWith dflags Opt_D_dump_cmm_cps "Post CPS Cmm" cmms
    4949
    5050     return (topSRT, cmms)
    5151
    5252
    53 
    5453cpsTop :: HscEnv -> CmmDecl -> IO (CAFEnv, [CmmDecl])
    5554cpsTop _ p@(CmmData {}) = return (mapEmpty, [p])
    5655cpsTop hsc_env proc =
    cpsTop hsc_env proc = 
    6362       --
    6463       CmmProc h l v g <- {-# SCC "cmmCfgOpts(1)" #-}
    6564            return $ cmmCfgOptsProc splitting_proc_points proc
    66        dump Opt_D_dump_cmmz_cfg "Post control-flow optimsations" g
     65       dump Opt_D_dump_cmm_cfg "Post control-flow optimsations" g
    6766
    6867       let !TopInfo {stack_info=StackInfo { arg_space = entry_off
    6968                                          , do_layout = do_layout }} = h
    cpsTop hsc_env proc = 
    7170       ----------- Eliminate common blocks -------------------------------------
    7271       g <- {-# SCC "elimCommonBlocks" #-}
    7372            condPass Opt_CmmElimCommonBlocks elimCommonBlocks g
    74                      Opt_D_dump_cmmz_cbe "Post common block elimination"
     73                     Opt_D_dump_cmm_cbe "Post common block elimination"
    7574
    7675       -- Any work storing block Labels must be performed _after_
    7776       -- elimCommonBlocks
    cpsTop hsc_env proc = 
    8685                  return call_pps
    8786
    8887       let noncall_pps = proc_points `setDifference` call_pps
    89        when (not (setNull noncall_pps) && dopt Opt_D_dump_cmmz dflags) $
     88       when (not (setNull noncall_pps) && dopt Opt_D_dump_cmm dflags) $
    9089         pprTrace "Non-call proc points: " (ppr noncall_pps) $ return ()
    9190
    9291       ----------- Sink and inline assignments *before* stack layout -----------
    9392       {-  Maybe enable this later
    9493       g <- {-# SCC "sink1" #-}
    95             condPass Opt_CmmSink cmmSink g
    96                      Opt_D_dump_cmmz_rewrite "Sink assignments (1)"
     94            condPass Opt_CmmSink (cmmSink dflags) g
     95                     Opt_D_dump_cmm_rewrite "Sink assignments (1)"
    9796       -}
    9897
    9998       ----------- Layout the stack and manifest Sp ----------------------------
    cpsTop hsc_env proc = 
    102101            if do_layout
    103102               then runUniqSM $ cmmLayoutStack dflags proc_points entry_off g
    104103               else return (g, mapEmpty)
    105        dump Opt_D_dump_cmmz_sp "Layout Stack" g
     104       dump Opt_D_dump_cmm_sp "Layout Stack" g
    106105
    107106       ----------- Sink and inline assignments *after* stack layout ------------
    108107       g <- {-# SCC "sink2" #-}
    109108            condPass Opt_CmmSink (cmmSink dflags) g
    110                      Opt_D_dump_cmmz_rewrite "Sink assignments (2)"
     109                     Opt_D_dump_cmm_rewrite "Sink assignments (2)"
    111110
    112111       ------------- CAF analysis ----------------------------------------------
    113112       let cafEnv = {-# SCC "cafAnal" #-} cafAnal g
    114        dumpIfSet_dyn dflags Opt_D_dump_cmmz "CAFEnv" (ppr cafEnv)
     113       dumpIfSet_dyn dflags Opt_D_dump_cmm "CAFEnv" (ppr cafEnv)
    115114
    116115       if splitting_proc_points
    117116          then do
    118117            ------------- Split into separate procedures -----------------------
    119118            pp_map  <- {-# SCC "procPointAnalysis" #-} runUniqSM $
    120119                             procPointAnalysis proc_points g
    121             dumpWith dflags Opt_D_dump_cmmz_procmap "procpoint map" pp_map
     120            dumpWith dflags Opt_D_dump_cmm_procmap "procpoint map" pp_map
    122121            gs <- {-# SCC "splitAtProcPoints" #-} runUniqSM $
    123122                  splitAtProcPoints dflags l call_pps proc_points pp_map
    124123                                    (CmmProc h l v g)
    125             dumps Opt_D_dump_cmmz_split "Post splitting" gs
     124            dumps Opt_D_dump_cmm_split "Post splitting" gs
    126125     
    127126            ------------- Populate info tables with stack info -----------------
    128127            gs <- {-# SCC "setInfoTableStackMap" #-}
    129128                  return $ map (setInfoTableStackMap dflags stackmaps) gs
    130             dumps Opt_D_dump_cmmz_info "after setInfoTableStackMap" gs
     129            dumps Opt_D_dump_cmm_info "after setInfoTableStackMap" gs
    131130     
    132131            ----------- Control-flow optimisations -----------------------------
    133132            gs <- {-# SCC "cmmCfgOpts(2)" #-}
    cpsTop hsc_env proc = 
    136135                             else gs
    137136            gs <- return (map removeUnreachableBlocksProc gs)
    138137                -- Note [unreachable blocks]
    139             dumps Opt_D_dump_cmmz_cfg "Post control-flow optimsations" gs
     138            dumps Opt_D_dump_cmm_cfg "Post control-flow optimsations" gs
    140139
    141140            return (cafEnv, gs)
    142141
    cpsTop hsc_env proc = 
    147146            ------------- Populate info tables with stack info -----------------
    148147            g <- {-# SCC "setInfoTableStackMap" #-}
    149148                  return $ setInfoTableStackMap dflags stackmaps g
    150             dump' Opt_D_dump_cmmz_info "after setInfoTableStackMap" g
     149            dump' Opt_D_dump_cmm_info "after setInfoTableStackMap" g
    151150     
    152151            ----------- Control-flow optimisations -----------------------------
    153152            g <- {-# SCC "cmmCfgOpts(2)" #-}
    cpsTop hsc_env proc = 
    156155                             else g
    157156            g <- return (removeUnreachableBlocksProc g)
    158157                -- Note [unreachable blocks]
    159             dump' Opt_D_dump_cmmz_cfg "Post control-flow optimsations" g
     158            dump' Opt_D_dump_cmm_cfg "Post control-flow optimsations" g
    160159
    161160            return (cafEnv, [g])
    162161
    dumpGraph dflags flag name g = do 
    254253
    255254dumpWith :: Outputable a => DynFlags -> DumpFlag -> String -> a -> IO ()
    256255dumpWith dflags flag txt g = do
    257          -- ToDo: No easy way of say "dump all the cmmz, *and* split
    258          -- them into files."  Also, -ddump-cmmz doesn't play nicely
     256         -- ToDo: No easy way of say "dump all the cmm, *and* split
     257         -- them into files."  Also, -ddump-cmm doesn't play nicely
    259258         -- with -ddump-to-file, since the headers get omitted.
    260259   dumpIfSet_dyn dflags flag txt (ppr g)
    261260   when (not (dopt flag dflags)) $
    262       dumpIfSet_dyn dflags Opt_D_dump_cmmz txt (ppr g)
     261      dumpIfSet_dyn dflags Opt_D_dump_cmm txt (ppr g)
    263262
  • compiler/cmm/CmmProcPoint.hs

    diff --git a/compiler/cmm/CmmProcPoint.hs b/compiler/cmm/CmmProcPoint.hs
    index fb94b95..abf2393 100644
    a b splitAtProcPoints dflags entry_label callPPs procPoints procMap 
    315315                 stack_info = StackInfo { arg_space = 0
    316316                                        , updfr_space =  Nothing
    317317                                        , do_layout = True }
    318                                -- cannot use panic, this is printed by -ddump-cmmz
     318                               -- cannot use panic, this is printed by -ddump-cmm
    319319
    320320         -- References to procpoint IDs can now be replaced with the
    321321         -- infotable's label
  • compiler/main/DynFlags.hs

    diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
    index e314955..9ff0346 100644
    a b data DumpFlag 
    173173
    174174   -- debugging flags
    175175   = Opt_D_dump_cmm
    176    | Opt_D_dump_raw_cmm
    177    | Opt_D_dump_cmmz
    178    -- All of the cmmz subflags (there are a lot!)  Automatically
    179    -- enabled if you run -ddump-cmmz
    180    | Opt_D_dump_cmmz_cfg
    181    | Opt_D_dump_cmmz_cbe
    182    | Opt_D_dump_cmmz_proc
    183    | Opt_D_dump_cmmz_rewrite
    184    | Opt_D_dump_cmmz_sp
    185    | Opt_D_dump_cmmz_procmap
    186    | Opt_D_dump_cmmz_split
    187    | Opt_D_dump_cmmz_info
    188    -- end cmmz subflags
    189    | Opt_D_dump_cps_cmm
     176   | Opt_D_dump_cmm_raw
     177   -- All of the cmm subflags (there are a lot!)  Automatically
     178   -- enabled if you run -ddump-cmm
     179   | Opt_D_dump_cmm_cfg
     180   | Opt_D_dump_cmm_cbe
     181   | Opt_D_dump_cmm_proc
     182   | Opt_D_dump_cmm_rewrite
     183   | Opt_D_dump_cmm_sp
     184   | Opt_D_dump_cmm_procmap
     185   | Opt_D_dump_cmm_split
     186   | Opt_D_dump_cmm_info
     187   | Opt_D_dump_cmm_cps
     188   -- end cmm subflags
    190189   | Opt_D_dump_asm
    191190   | Opt_D_dump_asm_native
    192191   | Opt_D_dump_asm_liveness
    dynamic_flags = [ 
    20652064  , Flag "dstg-stats"     (NoArg (setGeneralFlag Opt_StgStats))
    20662065
    20672066  , Flag "ddump-cmm"               (setDumpFlag Opt_D_dump_cmm)
    2068   , Flag "ddump-raw-cmm"           (setDumpFlag Opt_D_dump_raw_cmm)
    2069   , Flag "ddump-cmmz"              (setDumpFlag Opt_D_dump_cmmz)
    2070   , Flag "ddump-cmmz-cfg"          (setDumpFlag Opt_D_dump_cmmz_cfg)
    2071   , Flag "ddump-cmmz-cbe"          (setDumpFlag Opt_D_dump_cmmz_cbe)
    2072   , Flag "ddump-cmmz-proc"         (setDumpFlag Opt_D_dump_cmmz_proc)
    2073   , Flag "ddump-cmmz-rewrite"      (setDumpFlag Opt_D_dump_cmmz_rewrite)
    2074   , Flag "ddump-cmmz-sp"           (setDumpFlag Opt_D_dump_cmmz_sp)
    2075   , Flag "ddump-cmmz-procmap"      (setDumpFlag Opt_D_dump_cmmz_procmap)
    2076   , Flag "ddump-cmmz-split"        (setDumpFlag Opt_D_dump_cmmz_split)
    2077   , Flag "ddump-cmmz-info"         (setDumpFlag Opt_D_dump_cmmz_info)
     2067  , Flag "ddump-cmm-raw"           (setDumpFlag Opt_D_dump_cmm_raw)
     2068  , Flag "ddump-cmm-cfg"           (setDumpFlag Opt_D_dump_cmm_cfg)
     2069  , Flag "ddump-cmm-cbe"           (setDumpFlag Opt_D_dump_cmm_cbe)
     2070  , Flag "ddump-cmm-proc"          (setDumpFlag Opt_D_dump_cmm_proc)
     2071  , Flag "ddump-cmm-rewrite"       (setDumpFlag Opt_D_dump_cmm_rewrite)
     2072  , Flag "ddump-cmm-sp"            (setDumpFlag Opt_D_dump_cmm_sp)
     2073  , Flag "ddump-cmm-procmap"       (setDumpFlag Opt_D_dump_cmm_procmap)
     2074  , Flag "ddump-cmm-split"         (setDumpFlag Opt_D_dump_cmm_split)
     2075  , Flag "ddump-cmm-info"          (setDumpFlag Opt_D_dump_cmm_info)
     2076  , Flag "ddump-cmm-cps"           (setDumpFlag Opt_D_dump_cmm_cps)
    20782077  , Flag "ddump-core-stats"        (setDumpFlag Opt_D_dump_core_stats)
    2079   , Flag "ddump-cps-cmm"           (setDumpFlag Opt_D_dump_cps_cmm)
    20802078  , Flag "ddump-asm"               (setDumpFlag Opt_D_dump_asm)
    20812079  , Flag "ddump-asm-native"        (setDumpFlag Opt_D_dump_asm_native)
    20822080  , Flag "ddump-asm-liveness"      (setDumpFlag Opt_D_dump_asm_liveness)
  • compiler/main/HscMain.hs

    diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs
    index 5e5bd53..2a83816 100644
    a b hscGenHardCode cgguts mod_summary = do 
    12971297        rawcmms0 <- {-# SCC "cmmToRawCmm" #-}
    12981298                   cmmToRawCmm dflags cmms
    12991299
    1300         let dump a = do dumpIfSet_dyn dflags Opt_D_dump_raw_cmm "Raw Cmm"
     1300        let dump a = do dumpIfSet_dyn dflags Opt_D_dump_cmm_raw "Raw Cmm"
    13011301                           (ppr a)
    13021302                        return a
    13031303            rawcmms1 = Stream.mapM dump rawcmms0
    hscCompileCmmFile hsc_env filename = runHsc hsc_env $ do 
    13561356    liftIO $ do
    13571357        us <- mkSplitUniqSupply 'S'
    13581358        let initTopSRT = initUs_ us emptySRT
    1359         dumpIfSet_dyn dflags Opt_D_dump_cmmz "Parsed Cmm" (ppr cmm)
     1359        dumpIfSet_dyn dflags Opt_D_dump_cmm "Parsed Cmm" (ppr cmm)
    13601360        (_, cmmgroup) <- cmmPipeline hsc_env initTopSRT cmm
    13611361        rawCmms <- cmmToRawCmm dflags (Stream.yield cmmgroup)
    13621362        _ <- codeOutput dflags no_mod no_loc NoStubs [] rawCmms
    tryNewCodeGen hsc_env this_mod data_tycons 
    13911391        -- CmmGroup on input may produce many CmmGroups on output due
    13921392        -- to proc-point splitting).
    13931393
    1394     let dump1 a = do dumpIfSet_dyn dflags Opt_D_dump_cmmz
     1394    let dump1 a = do dumpIfSet_dyn dflags Opt_D_dump_cmm
    13951395                       "Cmm produced by new codegen" (ppr a)
    13961396                     return a
    13971397
    tryNewCodeGen hsc_env this_mod data_tycons 
    14291429                Stream.yield (srtToData topSRT)
    14301430
    14311431    let
    1432         dump2 a = do dumpIfSet_dyn dflags Opt_D_dump_cmmz "Output Cmm" $ ppr a
     1432        dump2 a = do dumpIfSet_dyn dflags Opt_D_dump_cmm "Output Cmm" $ ppr a
    14331433                     return a
    14341434
    14351435        ppr_stream2 = Stream.mapM dump2 pipeline_stream