+ expandAts ('@':fname) = words (unsafePerformIO (readFile fname))
+ expandAts l = [l]
+-}
+\end{code}
+
+%************************************************************************
+%* *
+\subsection{Static options}
+%* *
+%************************************************************************
+
+\begin{code}
+-- debugging opts
+opt_PprStyle_NoPrags = lookUp SLIT("-dppr-noprags")
+opt_PprStyle_Debug = lookUp SLIT("-dppr-debug")
+opt_PprStyle_RawTypes = lookUp SLIT("-dppr-rawtypes")
+opt_PprUserLength = lookup_def_int "-dppr-user-length" 5 --ToDo: give this a name
+
+-- profiling opts
+opt_AutoSccsOnAllToplevs = lookUp SLIT("-fauto-sccs-on-all-toplevs")
+opt_AutoSccsOnExportedToplevs = lookUp SLIT("-fauto-sccs-on-exported-toplevs")
+opt_AutoSccsOnIndividualCafs = lookUp SLIT("-fauto-sccs-on-individual-cafs")
+opt_AutoSccsOnDicts = lookUp SLIT("-fauto-sccs-on-dicts")
+opt_SccProfilingOn = lookUp SLIT("-fscc-profiling")
+opt_DoTickyProfiling = lookUp SLIT("-fticky-ticky")
+
+-- language opts
+opt_AllStrict = lookUp SLIT("-fall-strict")
+opt_NoMonomorphismRestriction = lookUp SLIT("-fno-monomorphism-restriction")
+opt_DictsStrict = lookUp SLIT("-fdicts-strict")
+opt_IrrefutableTuples = lookUp SLIT("-firrefutable-tuples")
+opt_MaxContextReductionDepth = lookup_def_int "-fcontext-stack" mAX_CONTEXT_REDUCTION_DEPTH
+opt_NumbersStrict = lookUp SLIT("-fnumbers-strict")
+opt_Parallel = lookUp SLIT("-fparallel")
+opt_SMP = lookUp SLIT("-fsmp")
+
+-- optimisation opts
+opt_NoMethodSharing = lookUp SLIT("-fno-method-sharing")
+opt_DoSemiTagging = lookUp SLIT("-fsemi-tagging")
+opt_FoldrBuildOn = lookUp SLIT("-ffoldr-build-on")
+opt_LiberateCaseThreshold = lookup_def_int "-fliberate-case-threshold" (10::Int)
+opt_StgDoLetNoEscapes = lookUp SLIT("-flet-no-escape")
+opt_UnfoldCasms = lookUp SLIT("-funfold-casms-in-hi-file")
+opt_UsageSPOn = lookUp SLIT("-fusagesp-on")
+opt_UnboxStrictFields = lookUp SLIT("-funbox-strict-fields")
+opt_MaxWorkerArgs = lookup_def_int "-fmax-worker-args" (10::Int)
+
+{-
+ The optional '-inpackage=P' flag tells what package
+ we are compiling this module for.
+ The Prelude, for example is compiled with '-inpackage std'
+-}
+opt_InPackage = case lookup_str "-inpackage=" of
+ Just p -> _PK_ p
+ Nothing -> SLIT("Main") -- The package name if none is specified
+
+opt_EmitCExternDecls = lookUp SLIT("-femit-extern-decls")
+opt_EnsureSplittableC = lookUp SLIT("-fglobalise-toplev-names")
+opt_GranMacros = lookUp SLIT("-fgransim")
+opt_HiVersion = read cProjectVersionInt :: Int
+opt_HistorySize = lookup_def_int "-fhistory-size" 20
+opt_IgnoreAsserts = lookUp SLIT("-fignore-asserts")
+opt_IgnoreIfacePragmas = lookUp SLIT("-fignore-interface-pragmas")
+opt_NoHiCheck = lookUp SLIT("-fno-hi-version-check")
+opt_OmitBlackHoling = lookUp SLIT("-dno-black-holing")
+opt_OmitInterfacePragmas = lookUp SLIT("-fomit-interface-pragmas")
+opt_RuntimeTypes = lookUp SLIT("-fruntime-types")
+
+-- Simplifier switches
+opt_SimplNoPreInlining = lookUp SLIT("-fno-pre-inlining")
+ -- NoPreInlining is there just to see how bad things
+ -- get if you don't do it!
+opt_SimplDoEtaReduction = lookUp SLIT("-fdo-eta-reduction")
+opt_SimplDoLambdaEtaExpansion = lookUp SLIT("-fdo-lambda-eta-expansion")
+opt_SimplCaseMerge = lookUp SLIT("-fcase-merge")
+opt_SimplExcessPrecision = lookUp SLIT("-fexcess-precision")
+
+-- Unfolding control
+opt_UF_CreationThreshold = lookup_def_int "-funfolding-creation-threshold" (45::Int)
+opt_UF_UseThreshold = lookup_def_int "-funfolding-use-threshold" (8::Int) -- Discounts can be big
+opt_UF_FunAppDiscount = lookup_def_int "-funfolding-fun-discount" (6::Int) -- It's great to inline a fn
+opt_UF_KeenessFactor = lookup_def_float "-funfolding-keeness-factor" (1.5::Float)
+opt_UF_UpdateInPlace = lookUp SLIT("-funfolding-update-in-place")
+
+opt_UF_CheapOp = ( 1 :: Int) -- Only one instruction; and the args are charged for
+opt_UF_DearOp = ( 4 :: Int)
+
+opt_NoPruneDecls = lookUp SLIT("-fno-prune-decls")
+opt_NoPruneTyDecls = lookUp SLIT("-fno-prune-tydecls")
+opt_Static = lookUp SLIT("-static")
+opt_Unregisterised = lookUp SLIT("-funregisterised")
+opt_EmitExternalCore = lookUp SLIT("-fext-core")
+\end{code}
+
+%************************************************************************
+%* *
+\subsection{List of static hsc flags}
+%* *
+%************************************************************************
+
+\begin{code}
+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",
+ "fruntime-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",
+ "fext-core",
+ "frule-check"
+ ]
+ || any (flip prefixMatch f) [
+ "fcontext-stack",
+ "fliberate-case-threshold",
+ "fmax-worker-args",
+ "fhistory-size",
+ "funfolding-creation-threshold",
+ "funfolding-use-threshold",
+ "funfolding-fun-discount",
+ "funfolding-keeness-factor"
+ ]