-all_toplev_ids_visible :: Bool
-all_toplev_ids_visible =
- not opt_OmitInterfacePragmas || -- Pragmas can make them visible
- opt_EnsureSplittableC || -- Splitting requires visiblilty
- opt_AutoSccsOnAllToplevs -- ditto for profiling
- -- (ToDo: fix up the auto-annotation
- -- pass in the desugarer to avoid having
- -- to do this)
-
-\end{code}
-
-
-
-\begin{code}
-classifyOpts :: ([CoreToDo], -- Core-to-Core processing spec
- [StgToDo]) -- STG-to-STG processing spec
-
-classifyOpts = sep argv [] [] -- accumulators...
- where
- sep :: [FAST_STRING] -- cmd-line opts (input)
- -> [CoreToDo] -> [StgToDo] -- to_do accumulators
- -> ([CoreToDo], [StgToDo]) -- result
-
- sep [] core_td stg_td -- all done!
- = (reverse core_td, reverse stg_td)
-
-# define CORE_TD(to_do) sep opts (to_do:core_td) stg_td
-# define STG_TD(to_do) sep opts core_td (to_do:stg_td)
-# define IGNORE_ARG() sep opts core_td stg_td
-
- sep (opt1:opts) core_td stg_td
- =
- case (_UNPK_ opt1) of -- the non-"just match a string" options are at the end...
-
- ',' : _ -> IGNORE_ARG() -- it is for the parser
-
- "-fsimplify" -> -- gather up SimplifierSwitches specially...
- simpl_sep opts defaultSimplSwitches core_td stg_td
-
- "-fcalc-inlinings1"-> CORE_TD(CoreDoCalcInlinings1)
- "-fcalc-inlinings2"-> CORE_TD(CoreDoCalcInlinings2)
- "-ffloat-inwards" -> CORE_TD(CoreDoFloatInwards)
- "-ffull-laziness" -> CORE_TD(CoreDoFullLaziness)
- "-fliberate-case" -> CORE_TD(CoreLiberateCase)
- "-fprint-core" -> CORE_TD(CoreDoPrintCore)
- "-fstatic-args" -> CORE_TD(CoreDoStaticArgs)
- "-fstrictness" -> CORE_TD(CoreDoStrictness)
- "-fspecialise" -> CORE_TD(CoreDoSpecialising)
- "-ffoldr-build-worker-wrapper" -> CORE_TD(CoreDoFoldrBuildWorkerWrapper)
- "-ffoldr-build-ww-anal" -> CORE_TD(CoreDoFoldrBuildWWAnal)
-
- "-fstg-static-args" -> STG_TD(StgDoStaticArgs)
- "-fupdate-analysis" -> STG_TD(StgDoUpdateAnalysis)
- "-dstg-stats" -> STG_TD(D_stg_stats)
- "-flambda-lift" -> STG_TD(StgDoLambdaLift)
- "-fmassage-stg-for-profiling" -> STG_TD(StgDoMassageForProfiling)
-
- _ -> -- NB: the driver is really supposed to handle bad options
- IGNORE_ARG()
-
- ----------------
-
- simpl_sep :: [FAST_STRING] -- cmd-line opts (input)
- -> [SimplifierSwitch] -- simplifier-switch accumulator
- -> [CoreToDo] -> [StgToDo] -- to_do accumulators
- -> ([CoreToDo], [StgToDo]) -- result
-
- -- "simpl_sep" tailcalls "sep" once it's seen one set
- -- of SimplifierSwitches for a CoreDoSimplify.
-
-#ifdef DEBUG
- simpl_sep input@[] simpl_sw core_td stg_td
- = panic "simpl_sep []"
-#endif
-
- -- The SimplifierSwitches should be delimited by "[" and "]".
-
- simpl_sep (opt1:opts) simpl_sw core_td stg_td
- = case (_UNPK_ opt1) of
- "[" -> simpl_sep opts simpl_sw core_td stg_td
- "]" -> let
- this_simpl = CoreDoSimplify (isAmongSimpl simpl_sw)
- in
- sep opts (this_simpl : core_td) stg_td
-
-# define SIMPL_SW(sw) simpl_sep opts (sw:simpl_sw) core_td stg_td
-
- -- the non-"just match a string" options are at the end...
- "-fshow-simplifier-progress" -> SIMPL_SW(ShowSimplifierProgress)
- "-fcode-duplication-ok" -> SIMPL_SW(SimplOkToDupCode)
- "-ffloat-lets-exposing-whnf" -> SIMPL_SW(SimplFloatLetsExposingWHNF)
- "-ffloat-primops-ok" -> SIMPL_SW(SimplOkToFloatPrimOps)
- "-falways-float-lets-from-lets" -> SIMPL_SW(SimplAlwaysFloatLetsFromLets)
- "-fdo-case-elim" -> SIMPL_SW(SimplDoCaseElim)
- "-fdo-lambda-eta-expansion" -> SIMPL_SW(SimplDoLambdaEtaExpansion)
- "-fdo-foldr-build" -> SIMPL_SW(SimplDoFoldrBuild)
- "-fdo-not-fold-back-append" -> SIMPL_SW(SimplDontFoldBackAppend)
- "-fdo-arity-expand" -> SIMPL_SW(SimplDoArityExpand)
- "-fdo-inline-foldr-build" -> SIMPL_SW(SimplDoInlineFoldrBuild)
- "-freuse-con" -> SIMPL_SW(SimplReuseCon)
- "-fcase-of-case" -> SIMPL_SW(SimplCaseOfCase)
- "-fcase-merge" -> SIMPL_SW(SimplCaseMerge)
- "-flet-to-case" -> SIMPL_SW(SimplLetToCase)
- "-fpedantic-bottoms" -> SIMPL_SW(SimplPedanticBottoms)
- "-fkeep-spec-pragma-ids" -> SIMPL_SW(KeepSpecPragmaIds)
- "-fkeep-unused-bindings" -> SIMPL_SW(KeepUnusedBindings)
- "-fmay-delete-conjurable-ids" -> SIMPL_SW(SimplMayDeleteConjurableIds)
- "-fessential-unfoldings-only" -> SIMPL_SW(EssentialUnfoldingsOnly)
- "-fignore-inline-pragma" -> SIMPL_SW(IgnoreINLINEPragma)
- "-fno-let-from-case" -> SIMPL_SW(SimplNoLetFromCase)
- "-fno-let-from-app" -> SIMPL_SW(SimplNoLetFromApp)
- "-fno-let-from-strict-let" -> SIMPL_SW(SimplNoLetFromStrictLet)
-
- o | starts_with_msi -> SIMPL_SW(MaxSimplifierIterations (read after_msi))
- where
- maybe_msi = startsWith "-fmax-simplifier-iterations" o
- starts_with_msi = maybeToBool maybe_msi
- (Just after_msi) = maybe_msi
-
- _ -> -- NB: the driver is really supposed to handle bad options
- simpl_sep opts simpl_sw core_td stg_td
+isStaticHscFlag f =
+ f `elem` [
+ "fauto-sccs-on-all-toplevs",
+ "fauto-sccs-on-exported-toplevs",
+ "fauto-sccs-on-individual-cafs",
+ "fauto-sccs-on-dicts",
+ "fscc-profiling",
+ "fticky-ticky",
+ "fall-strict",
+ "fdicts-strict",
+ "firrefutable-tuples",
+ "fnumbers-strict",
+ "fparallel",
+ "fsmp",
+ "fsemi-tagging",
+ "ffoldr-build-on",
+ "flet-no-escape",
+ "funfold-casms-in-hi-file",
+ "fusagesp-on",
+ "funbox-strict-fields",
+ "femit-extern-decls",
+ "fglobalise-toplev-names",
+ "fgransim",
+ "fignore-asserts",
+ "fignore-interface-pragmas",
+ "fno-hi-version-check",
+ "dno-black-holing",
+ "fno-method-sharing",
+ "fno-monomorphism-restriction",
+ "fomit-interface-pragmas",
+ "fkeep-stg-types",
+ "fno-pre-inlining",
+ "fdo-eta-reduction",
+ "fdo-lambda-eta-expansion",
+ "fcase-merge",
+ "fexcess-precision",
+ "funfolding-update-in-place",
+ "fno-prune-decls",
+ "fno-prune-tydecls",
+ "static",
+ "funregisterised"
+ ]
+ || any (flip prefixMatch f) [
+ "fcontext-stack",
+ "fliberate-case-threshold",
+ "fhistory-size",
+ "funfolding-interface-threshold",
+ "funfolding-creation-threshold",
+ "funfolding-use-threshold",
+ "funfolding-fun-discount",
+ "funfolding-keeness-factor"
+ ]