| ... |
... |
@@ -15,6 +15,7 @@ module Flavour |
|
15
|
15
|
, enableProfiledGhc
|
|
16
|
16
|
, disableDynamicGhcPrograms
|
|
17
|
17
|
, disableDynamicLibs
|
|
|
18
|
+ , enableProfiledLibs
|
|
18
|
19
|
, disableProfiledLibs
|
|
19
|
20
|
, enableLinting
|
|
20
|
21
|
, enableHaddock
|
| ... |
... |
@@ -62,6 +63,7 @@ flavourTransformers = M.fromList |
|
62
|
63
|
, "no_dynamic_libs" =: disableDynamicLibs
|
|
63
|
64
|
, "native_bignum" =: useNativeBignum
|
|
64
|
65
|
, "text_simdutf" =: enableTextWithSIMDUTF
|
|
|
66
|
+ , "with_profiled_libs" =: enableProfiledLibs
|
|
65
|
67
|
, "no_profiled_libs" =: disableProfiledLibs
|
|
66
|
68
|
, "omit_pragmas" =: omitPragmas
|
|
67
|
69
|
, "ipe" =: enableIPE
|
| ... |
... |
@@ -308,29 +310,11 @@ enableUBSan = |
|
308
|
310
|
viaLlvmBackend :: Flavour -> Flavour
|
|
309
|
311
|
viaLlvmBackend = addArgs $ notStage0 ? builder Ghc ? arg "-fllvm"
|
|
310
|
312
|
|
|
311
|
|
--- | Build the GHC executable with profiling enabled in stages 2 and later. It
|
|
312
|
|
--- is also recommended that you use this with @'dynamicGhcPrograms' = False@
|
|
313
|
|
--- since GHC does not support loading of profiled libraries with the
|
|
314
|
|
--- dynamically-linker.
|
|
|
313
|
+-- | Build the GHC executable with profiling enabled in stages 2 and
|
|
|
314
|
+-- later.
|
|
315
|
315
|
enableProfiledGhc :: Flavour -> Flavour
|
|
316
|
316
|
enableProfiledGhc flavour =
|
|
317
|
|
- enableLateCCS flavour
|
|
318
|
|
- { rtsWays = do
|
|
319
|
|
- ws <- rtsWays flavour
|
|
320
|
|
- mconcat
|
|
321
|
|
- [ pure ws
|
|
322
|
|
- , buildingCompilerStage' (>= Stage2) ? pure (foldMap profiled_ways ws)
|
|
323
|
|
- ]
|
|
324
|
|
- , libraryWays = mconcat
|
|
325
|
|
- [ libraryWays flavour
|
|
326
|
|
- , buildingCompilerStage' (>= Stage2) ? pure (Set.singleton profiling)
|
|
327
|
|
- ]
|
|
328
|
|
- , ghcProfiled = (>= Stage2)
|
|
329
|
|
- }
|
|
330
|
|
- where
|
|
331
|
|
- profiled_ways w
|
|
332
|
|
- | wayUnit Dynamic w = Set.empty
|
|
333
|
|
- | otherwise = Set.singleton (w <> profiling)
|
|
|
317
|
+ enableLateCCS $ enableProfiledLibs flavour { ghcProfiled = (>= Stage2) }
|
|
334
|
318
|
|
|
335
|
319
|
-- | Disable 'dynamicGhcPrograms'.
|
|
336
|
320
|
disableDynamicGhcPrograms :: Flavour -> Flavour
|
| ... |
... |
@@ -347,6 +331,20 @@ disableDynamicLibs flavour = |
|
347
|
331
|
prune :: Ways -> Ways
|
|
348
|
332
|
prune = fmap $ Set.filter (not . wayUnit Dynamic)
|
|
349
|
333
|
|
|
|
334
|
+-- | Build libraries and the RTS in profiled ways (opposite of
|
|
|
335
|
+-- 'disableProfiledLibs').
|
|
|
336
|
+enableProfiledLibs :: Flavour -> Flavour
|
|
|
337
|
+enableProfiledLibs flavour =
|
|
|
338
|
+ flavour
|
|
|
339
|
+ { libraryWays = addProfilingWays $ libraryWays flavour,
|
|
|
340
|
+ rtsWays = addProfilingWays $ rtsWays flavour
|
|
|
341
|
+ }
|
|
|
342
|
+ where
|
|
|
343
|
+ addProfilingWays :: Ways -> Ways
|
|
|
344
|
+ addProfilingWays ways = do
|
|
|
345
|
+ ws <- ways
|
|
|
346
|
+ buildProfiled <- notStage0
|
|
|
347
|
+ pure $ if buildProfiled then ws <> Set.map (<> profiling) ws else ws
|
|
350
|
348
|
|
|
351
|
349
|
-- | Don't build libraries in profiled 'Way's.
|
|
352
|
350
|
disableProfiledLibs :: Flavour -> Flavour
|