summaryrefslogtreecommitdiff
path: root/compiler/GHC/Driver
diff options
context:
space:
mode:
authordoyougnu <jeffrey.young@iohk.io>2022-02-16 10:15:40 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-03-02 01:15:39 -0500
commitaeea6bd588060108dea88996c19f48b9e50adad2 (patch)
tree553263aa12727ec4ffb49ca3425dc96dcaf65be9 /compiler/GHC/Driver
parent75caafaafca5a1941c276f95017c34f68da8d679 (diff)
downloadhaskell-aeea6bd588060108dea88996c19f48b9e50adad2.tar.gz
StgToCmm.cgTopBinding: no isNCG, use binBlobThresh
This is a one line change. It is a fixup from MR!7325, was pointed out in review of MR!7442, specifically: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/7442#note_406581 The change removes isNCG check from cgTopBinding. Instead it changes the type of binBlobThresh in DynFlags from Word to Maybe Word, where a Just 0 or a Nothing indicates an infinite threshold and thus the disable CmmFileEmbed case in the original check. This improves the cohesion of the module because more NCG related Backend stuff is moved into, and checked in, StgToCmm.Config. Note, that the meaning of a Just 0 or a Nothing in binBlobThresh is indicated in a comment next to its field in GHC.StgToCmm.Config. DynFlags: binBlobThresh: Word -> Maybe Word StgToCmm.Config: binBlobThesh add not ncg check DynFlags.binBlob: move Just 0 check to dflags init StgToCmm.binBlob: only check isNCG, Just 0 check to dflags StgToCmm.Config: strictify binBlobThresh
Diffstat (limited to 'compiler/GHC/Driver')
-rw-r--r--compiler/GHC/Driver/Config/StgToCmm.hs3
-rw-r--r--compiler/GHC/Driver/Session.hs12
2 files changed, 9 insertions, 6 deletions
diff --git a/compiler/GHC/Driver/Config/StgToCmm.hs b/compiler/GHC/Driver/Config/StgToCmm.hs
index 9896fed3bc..1b05884bb7 100644
--- a/compiler/GHC/Driver/Config/StgToCmm.hs
+++ b/compiler/GHC/Driver/Config/StgToCmm.hs
@@ -22,7 +22,7 @@ initStgToCmmConfig dflags mod = StgToCmmConfig
, stgToCmmTmpDir = tmpDir dflags
, stgToCmmContext = initSDocContext dflags defaultDumpStyle
, stgToCmmDebugLevel = debugLevel dflags
- , stgToCmmBinBlobThresh = binBlobThreshold dflags
+ , stgToCmmBinBlobThresh = b_blob
, stgToCmmMaxInlAllocSize = maxInlineAllocSize dflags
-- ticky options
, stgToCmmDoTicky = gopt Opt_Ticky dflags
@@ -63,6 +63,7 @@ initStgToCmmConfig dflags mod = StgToCmmConfig
bk_end = backend dflags
ncg = bk_end == NCG
llvm = bk_end == LLVM
+ b_blob = if not ncg then Nothing else binBlobThreshold dflags
x86ish = case platformArch platform of
ArchX86 -> True
ArchX86_64 -> True
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs
index d4d41accf6..f75a5e0d92 100644
--- a/compiler/GHC/Driver/Session.hs
+++ b/compiler/GHC/Driver/Session.hs
@@ -488,9 +488,10 @@ data DynFlags = DynFlags {
specConstrCount :: Maybe Int, -- ^ Max number of specialisations for any one function
specConstrRecursive :: Int, -- ^ Max number of specialisations for recursive types
-- Not optional; otherwise ForceSpecConstr can diverge.
- binBlobThreshold :: Word, -- ^ Binary literals (e.g. strings) whose size is above
+ binBlobThreshold :: Maybe Word, -- ^ Binary literals (e.g. strings) whose size is above
-- this threshold will be dumped in a binary file
- -- by the assembler code generator (0 to disable)
+ -- by the assembler code generator. 0 and Nothing disables
+ -- this feature. See 'GHC.StgToCmm.Config'.
liberateCaseThreshold :: Maybe Int, -- ^ Threshold for LiberateCase
floatLamArgs :: Maybe Int, -- ^ Arg count for lambda floating
-- See 'GHC.Core.Opt.Monad.FloatOutSwitches'
@@ -1122,7 +1123,7 @@ defaultDynFlags mySettings llvmConfig =
simplPhases = 2,
maxSimplIterations = 4,
ruleCheck = Nothing,
- binBlobThreshold = 500000, -- 500K is a good default (see #16190)
+ binBlobThreshold = Just 500000, -- 500K is a good default (see #16190)
maxRelevantBinds = Just 6,
maxValidHoleFits = Just 6,
maxRefHoleFits = Just 6,
@@ -2699,8 +2700,9 @@ dynamic_flags_deps = [
-- If the number is missing, use 1
, make_ord_flag defFlag "fbinary-blob-threshold"
- (intSuffix (\n d -> d { binBlobThreshold = fromIntegral n }))
-
+ (intSuffix (\n d -> d { binBlobThreshold = case fromIntegral n of
+ 0 -> Nothing
+ x -> Just x}))
, make_ord_flag defFlag "fmax-relevant-binds"
(intSuffix (\n d -> d { maxRelevantBinds = Just n }))
, make_ord_flag defFlag "fno-max-relevant-binds"