SimplifierSwitch(..), isAmongSimpl,
StgToDo(..),
SwitchResult(..),
+
HscLang(..),
DynFlag(..), -- needed non-abstractly by DriverFlags
DynFlags(..),
+ defaultDynFlags,
v_Static_hsc_opts,
opt_NumbersStrict,
opt_Parallel,
opt_SMP,
+ opt_NoMonomorphismRestriction,
-- optimisation opts
opt_DoSemiTagging,
opt_NoPruneTyDecls,
opt_NoPruneDecls,
opt_Static,
- opt_Unregisterised,
- opt_Verbose
+ opt_Unregisterised
) where
#include "HsVersions.h"
import Constants -- Default values for some flags
import Util
import FastTypes
+import Config
import Maybes ( firstJust )
import Panic ( panic )
\begin{code}
data StgToDo
- = StgDoStaticArgs
- | StgDoLambdaLift
- | StgDoMassageForProfiling -- should be (next to) last
+ = StgDoMassageForProfiling -- should be (next to) last
-- There's also setStgVarInfo, but its absolute "lastness"
-- is so critical that it is hardwired in (no flag).
| D_stg_stats
data DynFlag
-- debugging flags
- = Opt_D_dump_all
- | Opt_D_dump_most
- | Opt_D_dump_absC
+ = Opt_D_dump_absC
| Opt_D_dump_asm
| Opt_D_dump_cpranal
| Opt_D_dump_deriv
| Opt_D_dump_simpl
| Opt_D_dump_simpl_iterations
| Opt_D_dump_spec
+ | Opt_D_dump_sat
| Opt_D_dump_stg
| Opt_D_dump_stranal
| Opt_D_dump_tc
| Opt_D_dump_usagesp
| Opt_D_dump_cse
| Opt_D_dump_worker_wrapper
- | Opt_D_show_passes
| Opt_D_dump_rn_trace
| Opt_D_dump_rn_stats
| Opt_D_dump_stix
| Opt_D_dump_simpl_stats
+ | Opt_D_dump_BCOs
| Opt_D_source_stats
| Opt_D_verbose_core2core
| Opt_D_verbose_stg2stg
stgToDo :: [StgToDo],
hscLang :: HscLang,
hscOutName :: String, -- name of the file in which to place output
+ verbosity :: Int, -- verbosity level
flags :: [DynFlag]
}
+defaultDynFlags = DynFlags {
+ coreToDo = [], stgToDo = [],
+ hscLang = HscC, hscOutName = "",
+ verbosity = 0, flags = []
+ }
+
+{-
+ Verbosity levels:
+
+ 0 | print errors & warnings only
+ 1 | minimal verbosity: print "compiling M ... done." for each module.
+ 2 | equivalent to -dshow-passes
+ 3 | equivalent to existing "ghc -v"
+ 4 | "ghc -v -ddump-most"
+ 5 | "ghc -v -ddump-all"
+-}
+
dopt :: DynFlag -> DynFlags -> Bool
dopt f dflags = f `elem` (flags dflags)
| HscAsm
| HscJava
| HscInterpreted
- deriving Eq
+ deriving (Eq, Show)
dopt_HscLang :: DynFlags -> HscLang
dopt_HscLang = hscLang
-- 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_EmitCExternDecls = lookUp SLIT("-femit-extern-decls")
opt_EnsureSplittableC = lookUp SLIT("-fglobalise-toplev-names")
opt_GranMacros = lookUp SLIT("-fgransim")
-opt_HiVersion = lookup_def_int "-fhi-version=" 0 -- what version we're compiling.
+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_NoPruneTyDecls = lookUp SLIT("-fno-prune-tydecls")
opt_Static = lookUp SLIT("-static")
opt_Unregisterised = lookUp SLIT("-funregisterised")
-opt_Verbose = lookUp SLIT("-v")
\end{code}
%************************************************************************
"fignore-asserts",
"fignore-interface-pragmas",
"fno-hi-version-check",
- "fno-implicit-prelude",
"dno-black-holing",
"fomit-interface-pragmas",
"fno-pre-inlining",
"fno-prune-decls",
"fno-prune-tydecls",
"static",
- "funregisterised",
- "v" ]
+ "funregisterised"
+ ]
|| any (flip prefixMatch f) [
"fcontext-stack",
"fliberate-case-threshold",
- "fhi-version=",
"fhistory-size",
"funfolding-interface-threshold",
"funfolding-creation-threshold",