summaryrefslogtreecommitdiff
path: root/hadrian
diff options
context:
space:
mode:
authorCheng Shao <terrorjack@type.dance>2022-12-03 21:26:14 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-01-23 04:48:47 -0500
commit1fe806d33b7ef5615bec47bacc76a9e84963dd54 (patch)
treeac7fefc9d417676e805a8a03ae30be2479a859e2 /hadrian
parent14b5982a3aea351e4b01c5804ebd4d4629ba6bab (diff)
downloadhaskell-1fe806d33b7ef5615bec47bacc76a9e84963dd54.tar.gz
hadrian: add hi_core flavour transformer
The hi_core flavour transformer enables -fwrite-if-simplified-core for stage1 libraries, which emit core into interface files to make it possible to restart code generation. Building boot libs with it makes it easier to use GHC API to prototype experimental backends that needs core/stg at link time.
Diffstat (limited to 'hadrian')
-rw-r--r--hadrian/src/Flavour.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/hadrian/src/Flavour.hs b/hadrian/src/Flavour.hs
index 9f8bd1d955..39ef49f11a 100644
--- a/hadrian/src/Flavour.hs
+++ b/hadrian/src/Flavour.hs
@@ -15,6 +15,7 @@ module Flavour
, disableProfiledLibs
, enableLinting
, enableHaddock
+ , enableHiCore
, useNativeBignum
, omitPragmas
@@ -62,6 +63,7 @@ flavourTransformers = M.fromList
, "debug_stage1_ghc" =: debugGhc stage0InTree
, "lint" =: enableLinting
, "haddock" =: enableHaddock
+ , "hi_core" =: enableHiCore
, "late_ccs" =: enableLateCCS
]
where (=:) = (,)
@@ -180,6 +182,13 @@ enableHaddock =
[ arg "-haddock"
]
+-- | Build stage2 dependencies with options to emit Core into
+-- interface files which is sufficient to restart code generation.
+enableHiCore :: Flavour -> Flavour
+enableHiCore = addArgs
+ $ notStage0 ? builder (Ghc CompileHs)
+ ? pure ["-fwrite-if-simplified-core"]
+
-- | Transform the input 'Flavour' so as to build with
-- @-split-sections@ whenever appropriate.
-- Note that this transformer doesn't do anything