summaryrefslogtreecommitdiff
path: root/hadrian/src/Flavour.hs
diff options
context:
space:
mode:
Diffstat (limited to 'hadrian/src/Flavour.hs')
-rw-r--r--hadrian/src/Flavour.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/hadrian/src/Flavour.hs b/hadrian/src/Flavour.hs
index 40cce02e51..f31e7667e1 100644
--- a/hadrian/src/Flavour.hs
+++ b/hadrian/src/Flavour.hs
@@ -46,6 +46,7 @@ flavourTransformers = M.fromList
, "omit_pragmas" =: omitPragmas
, "ipe" =: enableIPE
, "fully_static" =: fullyStatic
+ , "collect_timings" =: collectTimings
]
where (=:) = (,)
@@ -246,6 +247,20 @@ fullyStatic flavour =
, builder (Ghc LinkHs) ? pure [ "-optl", "-static" ]
]
+-- | Build stage2 dependencies with options to enable collection of compiler
+-- stats.
+collectTimings :: Flavour -> Flavour
+collectTimings =
+ -- Why both -ddump-timings *and* -v?
+ -- In contrast to -ddump-timings, -v will seq the whole CoreProgram and
+ -- produce less missleading information; otherwise, due to laziness some
+ -- allocations might be attributed to a subsequent pass instead of the pass
+ -- that has been causing the allocation. So we want -v.
+ -- On the other hand, -v doesn't work with -ddump-to-file, so we need
+ -- -ddump-timings.
+ addArgs $ notStage0 ? builder (Ghc CompileHs) ?
+ pure ["-ddump-to-file", "-ddump-timings", "-v"]
+
-- * CLI and <root>/hadrian.settings options