Cheng Shao pushed to branch wip/hadrian-with_profiled_libs at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • hadrian/doc/flavours.md
    ... ... @@ -270,6 +270,10 @@ The supported transformers are listed below:
    270 270
             <td><code>text_simdutf</code></td>
    
    271 271
             <td>Enable building the <code>text</code> package with <code>simdutf</code> support.</td>
    
    272 272
         </tr>
    
    273
    +    <tr>
    
    274
    +        <td><code>with_profiled_libs</code></td>
    
    275
    +        <td>Enables building of libraries and the RTS in profiled build ways (the opposite of <code>no_profiled_libs</code>).</td>
    
    276
    +    </tr>
    
    273 277
         <tr>
    
    274 278
             <td><code>no_profiled_libs</code></td>
    
    275 279
             <td>Disables building of libraries in profiled build ways.</td>
    

  • hadrian/src/Flavour.hs
    ... ... @@ -14,6 +14,7 @@ module Flavour
    14 14
       , enableProfiledGhc
    
    15 15
       , disableDynamicGhcPrograms
    
    16 16
       , disableDynamicLibs
    
    17
    +  , enableProfiledLibs
    
    17 18
       , disableProfiledLibs
    
    18 19
       , enableLinting
    
    19 20
       , enableHaddock
    
    ... ... @@ -59,6 +60,7 @@ flavourTransformers = M.fromList
    59 60
         , "no_dynamic_libs"  =: disableDynamicLibs
    
    60 61
         , "native_bignum"    =: useNativeBignum
    
    61 62
         , "text_simdutf"     =: enableTextWithSIMDUTF
    
    63
    +    , "with_profiled_libs" =: enableProfiledLibs
    
    62 64
         , "no_profiled_libs" =: disableProfiledLibs
    
    63 65
         , "omit_pragmas"     =: omitPragmas
    
    64 66
         , "ipe"              =: enableIPE
    
    ... ... @@ -301,6 +303,17 @@ disableDynamicLibs flavour =
    301 303
         prune :: Ways -> Ways
    
    302 304
         prune = fmap $ Set.filter (not . wayUnit Dynamic)
    
    303 305
     
    
    306
    +-- | Build libraries and the RTS in profiled ways (opposite of
    
    307
    +-- 'disableProfiledLibs').
    
    308
    +enableProfiledLibs :: Flavour -> Flavour
    
    309
    +enableProfiledLibs flavour =
    
    310
    +    flavour
    
    311
    +      { libraryWays = addProfilingWays $ libraryWays flavour
    
    312
    +      , rtsWays     = addProfilingWays $ rtsWays flavour
    
    313
    +      }
    
    314
    +  where
    
    315
    +    addProfilingWays :: Ways -> Ways
    
    316
    +    addProfilingWays ways = fmap (\ws -> ws <> Set.map (<> profiling) ws) ways
    
    304 317
     
    
    305 318
     -- | Don't build libraries in profiled 'Way's.
    
    306 319
     disableProfiledLibs :: Flavour -> Flavour