2 -- Temporary, until rtsIsProfiled is fixed
8 -- (c) The University of Glasgow 2005
11 -- Most flags are dynamic flags, which means they can change from
12 -- compilation to compilation using @OPTIONS_GHC@ pragmas, and in a
13 -- multi-session GHC each session can be using different dynamic
14 -- flags. Dynamic flags can also be set at the prompt in GHCi.
16 -- * Dynamic flags and associated configuration types
20 flattenExtensionFlags,
21 ensureFlattenedExtensionFlags,
26 HscTarget(..), isObjectTarget, defaultObjectTarget,
27 GhcMode(..), isOneShot,
28 GhcLink(..), isNoLink,
32 fFlags, fLangFlags, xFlags,
36 -- ** Manipulating DynFlags
37 defaultDynFlags, -- DynFlags
38 initDynFlags, -- DynFlags -> IO DynFlags
40 getOpts, -- DynFlags -> (DynFlags -> [a]) -> [a]
47 -- ** Parsing DynFlags
49 parseDynamicNoPackageFlags,
52 supportedLanguagesAndExtensions,
54 -- ** DynFlag C compiler options
55 machdepCCOpts, picCCOpts,
57 -- * Configuration of the stg-to-stg passes
61 -- * Compiler configuration suitable for display to the user
63 compilerInfo, rtsIsProfiled
66 #include "HsVersions.h"
68 #ifndef OMIT_NATIVE_CODEGEN
73 import PrelNames ( mAIN )
75 import {-# SOURCE #-} Packages (PackageState)
76 import DriverPhases ( Phase(..), phaseInputExt )
79 import Constants ( mAX_CONTEXT_REDUCTION_DEPTH )
82 import Maybes ( orElse )
87 import Foreign.C ( CInt )
88 import {-# SOURCE #-} ErrUtils ( Severity(..), Message, mkLocMessage )
90 import System.IO.Unsafe ( unsafePerformIO )
92 import Control.Monad ( when )
96 import System.FilePath
97 import System.IO ( stderr, hPutChar )
99 -- -----------------------------------------------------------------------------
102 -- | Enumerates the simple on-or-off dynamic flags
108 | Opt_D_dump_cmmz_pretty
112 | Opt_D_dump_asm_native
113 | Opt_D_dump_asm_liveness
114 | Opt_D_dump_asm_coalesce
115 | Opt_D_dump_asm_regalloc
116 | Opt_D_dump_asm_regalloc_stages
117 | Opt_D_dump_asm_conflicts
118 | Opt_D_dump_asm_stats
119 | Opt_D_dump_asm_expanded
126 | Opt_D_dump_inlinings
127 | Opt_D_dump_rule_firings
128 | Opt_D_dump_occur_anal
132 | Opt_D_dump_simpl_iterations
133 | Opt_D_dump_simpl_phases
142 | Opt_D_dump_worker_wrapper
143 | Opt_D_dump_rn_trace
144 | Opt_D_dump_rn_stats
146 | Opt_D_dump_simpl_stats
147 | Opt_D_dump_tc_trace
148 | Opt_D_dump_if_trace
155 | Opt_D_verbose_core2core
156 | Opt_D_verbose_stg2stg
158 | Opt_D_dump_hi_diffs
159 | Opt_D_dump_minimal_imports
160 | Opt_D_dump_mod_cycles
161 | Opt_D_dump_view_pattern_commoning
162 | Opt_D_faststring_stats
163 | Opt_DumpToFile -- ^ Append dump output to files instead of stdout.
164 | Opt_D_no_debug_output
170 | Opt_WarnIsError -- -Werror; makes warnings fatal
171 | Opt_WarnDuplicateExports
173 | Opt_WarnImplicitPrelude
174 | Opt_WarnIncompletePatterns
175 | Opt_WarnIncompletePatternsRecUpd
176 | Opt_WarnMissingFields
177 | Opt_WarnMissingImportList
178 | Opt_WarnMissingMethods
179 | Opt_WarnMissingSigs
180 | Opt_WarnNameShadowing
181 | Opt_WarnOverlappingPatterns
182 | Opt_WarnSimplePatterns
183 | Opt_WarnTypeDefaults
184 | Opt_WarnMonomorphism
185 | Opt_WarnUnusedBinds
186 | Opt_WarnUnusedImports
187 | Opt_WarnUnusedMatches
188 | Opt_WarnWarningsDeprecations
189 | Opt_WarnDeprecatedFlags
190 | Opt_WarnDodgyExports
191 | Opt_WarnDodgyImports
194 | Opt_WarnUnrecognisedPragmas
195 | Opt_WarnDodgyForeignImports
196 | Opt_WarnLazyUnliftedBindings
197 | Opt_WarnUnusedDoBind
198 | Opt_WarnWrongDoBind
199 | Opt_WarnAlternativeLayoutRuleTransitional
201 | Opt_PrintExplicitForalls
208 | Opt_StaticArgumentTransformation
212 | Opt_DoLambdaEtaExpansion
216 | Opt_UnboxStrictFields
219 | Opt_EnableRewriteRules -- Apply rewrite rules during simplification
221 | Opt_RegsGraph -- do graph coloring register allocation
222 | Opt_RegsIterative -- do iterative coalescing graph coloring register allocation
225 | Opt_IgnoreInterfacePragmas
226 | Opt_OmitInterfacePragmas
227 | Opt_ExposeAllUnfoldings
230 | Opt_AutoSccsOnAllToplevs
231 | Opt_AutoSccsOnExportedToplevs
232 | Opt_AutoSccsOnIndividualCafs
239 | Opt_ExcessPrecision
240 | Opt_EagerBlackHoling
241 | Opt_ReadUserPackageConf
245 | Opt_HideAllPackages
246 | Opt_PrintBindResult
250 | Opt_BreakOnException
252 | Opt_PrintEvldWithShow
253 | Opt_PrintBindContents
256 | Opt_EmitExternalCore
258 | Opt_BuildingCabalPackage
264 | Opt_ConvertToZipCfgAndBack
265 | Opt_AutoLinkPackages
266 | Opt_ImplicitImportQualified
275 | Opt_KeepRawTokenStream
280 data Language = Haskell98 | Haskell2010
284 | Opt_OverlappingInstances
285 | Opt_UndecidableInstances
286 | Opt_IncoherentInstances
287 | Opt_MonomorphismRestriction
290 | Opt_ExtendedDefaultRules -- Use GHC's extended rules for defaulting
291 | Opt_ForeignFunctionInterface
292 | Opt_UnliftedFFITypes
293 | Opt_GHCForeignImportPrim
294 | Opt_PArr -- Syntactic support for parallel arrays
295 | Opt_Arrows -- Arrow-notation syntax
296 | Opt_TemplateHaskell
299 | Opt_Generics -- "Derivable type classes"
300 | Opt_ImplicitPrelude
301 | Opt_ScopedTypeVariables
305 | Opt_OverloadedStrings
306 | Opt_DisambiguateRecordFields
307 | Opt_RecordWildCards
313 | Opt_DoAndIfThenElse
315 | Opt_StandaloneDeriving
316 | Opt_DeriveDataTypeable
318 | Opt_DeriveTraversable
321 | Opt_TypeSynonymInstances
322 | Opt_FlexibleContexts
323 | Opt_FlexibleInstances
324 | Opt_ConstrainedClassMethods
325 | Opt_MultiParamTypeClasses
326 | Opt_FunctionalDependencies
328 | Opt_PolymorphicComponents
329 | Opt_ExistentialQuantification
333 | Opt_ParallelListComp
334 | Opt_TransformListComp
335 | Opt_GeneralizedNewtypeDeriving
338 | Opt_PostfixOperators
341 | Opt_LiberalTypeSynonyms
344 | Opt_ImpredicativeTypes
347 | Opt_NewQualifiedOperators
349 | Opt_AlternativeLayoutRule
350 | Opt_AlternativeLayoutRuleTransitional
351 | Opt_DatatypeContexts
354 -- | Contains not only a collection of 'DynFlag's but also a plethora of
355 -- information relating to the compilation of a single file or GHC session
356 data DynFlags = DynFlags {
359 hscTarget :: HscTarget,
360 hscOutName :: String, -- ^ Name of the output file
361 extCoreName :: String, -- ^ Name of the .hcr output file
362 verbosity :: Int, -- ^ Verbosity level: see Note [Verbosity levels]
363 optLevel :: Int, -- ^ Optimisation level
364 simplPhases :: Int, -- ^ Number of simplifier phases
365 maxSimplIterations :: Int, -- ^ Max simplifier iterations
366 shouldDumpSimplPhase :: Maybe String,
367 ruleCheck :: Maybe String,
368 strictnessBefore :: [Int], -- ^ Additional demand analysis
370 specConstrThreshold :: Maybe Int, -- ^ Threshold for SpecConstr
371 specConstrCount :: Maybe Int, -- ^ Max number of specialisations for any one function
372 liberateCaseThreshold :: Maybe Int, -- ^ Threshold for LiberateCase
374 #ifndef OMIT_NATIVE_CODEGEN
375 targetPlatform :: Platform, -- ^ The platform we're compiling for. Used by the NCG.
377 stolen_x86_regs :: Int,
378 cmdlineHcIncludes :: [String], -- ^ @\-\#includes@
379 importPaths :: [FilePath],
381 mainFunIs :: Maybe String,
382 ctxtStkDepth :: Int, -- ^ Typechecker context stack depth
384 dphBackend :: DPHBackend,
386 thisPackage :: PackageId, -- ^ name of package currently being compiled
389 ways :: [Way], -- ^ Way flags from the command line
390 buildTag :: String, -- ^ The global \"way\" (e.g. \"p\" for prof)
391 rtsBuildTag :: String, -- ^ The RTS \"way\"
393 -- For object splitting
394 splitInfo :: Maybe (String,Int),
397 objectDir :: Maybe String,
398 dylibInstallName :: Maybe String,
399 hiDir :: Maybe String,
400 stubDir :: Maybe String,
406 outputFile :: Maybe String,
407 outputHi :: Maybe String,
408 dynLibLoader :: DynLibLoader,
410 -- | This is set by 'DriverPipeline.runPipeline' based on where
411 -- its output is going.
412 dumpPrefix :: Maybe FilePath,
414 -- | Override the 'dumpPrefix' set by 'DriverPipeline.runPipeline'.
415 -- Set by @-ddump-file-prefix@
416 dumpPrefixForce :: Maybe FilePath,
418 includePaths :: [String],
419 libraryPaths :: [String],
420 frameworkPaths :: [String], -- used on darwin only
421 cmdlineFrameworks :: [String], -- ditto
422 tmpDir :: String, -- no trailing '/'
424 ghcUsagePath :: FilePath, -- Filled in by SysTools
425 ghciUsagePath :: FilePath, -- ditto
426 rtsOpts :: Maybe String,
427 rtsOptsEnabled :: RtsOptsEnabled,
429 hpcDir :: String, -- ^ Path to store the .mix files
431 -- options for particular phases
439 opt_windres :: [String],
440 opt_lo :: [String], -- LLVM: llvm optimiser
441 opt_lc :: [String], -- LLVM: llc static compiler
443 -- commands for particular phases
445 pgm_P :: (String,[Option]),
447 pgm_c :: (String,[Option]),
448 pgm_m :: (String,[Option]),
449 pgm_s :: (String,[Option]),
450 pgm_a :: (String,[Option]),
451 pgm_l :: (String,[Option]),
452 pgm_dll :: (String,[Option]),
454 pgm_sysman :: String,
455 pgm_windres :: String,
456 pgm_lo :: (String,[Option]), -- LLVM: opt llvm optimiser
457 pgm_lc :: (String,[Option]), -- LLVM: llc static compiler
460 depMakefile :: FilePath,
461 depIncludePkgDeps :: Bool,
462 depExcludeMods :: [ModuleName],
463 depSuffixes :: [String],
466 extraPkgConfs :: [FilePath],
467 topDir :: FilePath, -- filled in by SysTools
468 systemPackageConfig :: FilePath, -- ditto
469 -- ^ The @-package-conf@ flags given on the command line, in the order
472 packageFlags :: [PackageFlag],
473 -- ^ The @-package@ and @-hide-package@ flags from the command-line
476 -- NB. do not modify this field, it is calculated by
477 -- Packages.initPackages and Packages.updatePackages.
478 pkgDatabase :: Maybe [PackageConfig],
479 pkgState :: PackageState,
482 -- These have to be IORefs, because the defaultCleanupHandler needs to
483 -- know what to clean when an exception happens
484 filesToClean :: IORef [FilePath],
485 dirsToClean :: IORef (FiniteMap FilePath FilePath),
489 language :: Maybe Language,
490 extensionFlags :: Either [OnOff ExtensionFlag]
493 -- | Message output action: use "ErrUtils" instead of this if you can
494 log_action :: Severity -> SrcSpan -> PprStyle -> Message -> IO (),
496 haddockOptions :: Maybe String
499 wayNames :: DynFlags -> [WayName]
500 wayNames = map wayName . ways
502 -- | The target code type of the compilation (if any).
504 -- Whenever you change the target, also make sure to set 'ghcLink' to
505 -- something sensible.
507 -- 'HscNothing' can be used to avoid generating any output, however, note
510 -- * This will not run the desugaring step, thus no warnings generated in
511 -- this step will be output. In particular, this includes warnings related
512 -- to pattern matching. You can run the desugarer manually using
513 -- 'GHC.desugarModule'.
515 -- * If a program uses Template Haskell the typechecker may try to run code
516 -- from an imported module. This will fail if no code has been generated
517 -- for this module. You can use 'GHC.needsTemplateHaskell' to detect
518 -- whether this might be the case and choose to either switch to a
519 -- different target or avoid typechecking such modules. (The latter may
520 -- preferable for security reasons.)
523 = HscC -- ^ Generate C code.
524 | HscAsm -- ^ Generate assembly using the native code generator.
525 | HscLlvm -- ^ Generate assembly using the llvm code generator.
526 | HscJava -- ^ Generate Java bytecode.
527 | HscInterpreted -- ^ Generate bytecode. (Requires 'LinkInMemory')
528 | HscNothing -- ^ Don't generate any code. See notes above.
531 -- | Will this target result in an object file on the disk?
532 isObjectTarget :: HscTarget -> Bool
533 isObjectTarget HscC = True
534 isObjectTarget HscAsm = True
535 isObjectTarget HscLlvm = True
536 isObjectTarget _ = False
538 -- | The 'GhcMode' tells us whether we're doing multi-module
539 -- compilation (controlled via the "GHC" API) or one-shot
540 -- (single-module) compilation. This makes a difference primarily to
541 -- the "Finder": in one-shot mode we look for interface files for
542 -- imported modules, but in multi-module mode we look for source files
543 -- in order to check whether they need to be recompiled.
545 = CompManager -- ^ @\-\-make@, GHCi, etc.
546 | OneShot -- ^ @ghc -c Foo.hs@
547 | MkDepend -- ^ @ghc -M@, see "Finder" for why we need this
550 instance Outputable GhcMode where
551 ppr CompManager = ptext (sLit "CompManager")
552 ppr OneShot = ptext (sLit "OneShot")
553 ppr MkDepend = ptext (sLit "MkDepend")
555 isOneShot :: GhcMode -> Bool
556 isOneShot OneShot = True
557 isOneShot _other = False
559 -- | What to do in the link step, if there is one.
561 = NoLink -- ^ Don't link at all
562 | LinkBinary -- ^ Link object code into a binary
563 | LinkInMemory -- ^ Use the in-memory dynamic linker (works for both
564 -- bytecode and object code).
565 | LinkDynLib -- ^ Link objects into a dynamic lib (DLL on Windows, DSO on ELF platforms)
568 isNoLink :: GhcLink -> Bool
569 isNoLink NoLink = True
572 -- Is it worth evaluating this Bool and caching it in the DynFlags value
573 -- during initDynFlags?
574 doingTickyProfiling :: DynFlags -> Bool
575 doingTickyProfiling _ = opt_Ticky
576 -- XXX -ticky is a static flag, because it implies -debug which is also
577 -- static. If the way flags were made dynamic, we could fix this.
580 = ExposePackage String
581 | ExposePackageId String
583 | IgnorePackage String
586 defaultHscTarget :: HscTarget
587 defaultHscTarget = defaultObjectTarget
589 -- | The 'HscTarget' value corresponding to the default way to create
590 -- object files on the current platform.
591 defaultObjectTarget :: HscTarget
593 | cGhcWithNativeCodeGen == "YES" = HscAsm
598 | Wrapped (Maybe String)
602 data RtsOptsEnabled = RtsOptsNone | RtsOptsSafeOnly | RtsOptsAll
604 -- | Used by 'GHC.newSession' to partially initialize a new 'DynFlags' value
605 initDynFlags :: DynFlags -> IO DynFlags
606 initDynFlags dflags = do
607 -- someday these will be dynamic flags
608 ways <- readIORef v_Ways
609 refFilesToClean <- newIORef []
610 refDirsToClean <- newIORef emptyFM
613 buildTag = mkBuildTag (filter (not . wayRTSOnly) ways),
614 rtsBuildTag = mkBuildTag ways,
615 filesToClean = refFilesToClean,
616 dirsToClean = refDirsToClean
619 -- | The normal 'DynFlags'. Note that they is not suitable for use in this form
620 -- and must be fully initialized by 'GHC.newSession' first.
621 defaultDynFlags :: DynFlags
624 ghcMode = CompManager,
625 ghcLink = LinkBinary,
626 hscTarget = defaultHscTarget,
632 maxSimplIterations = 4,
633 shouldDumpSimplPhase = Nothing,
635 specConstrThreshold = Just 200,
636 specConstrCount = Just 3,
637 liberateCaseThreshold = Just 200,
638 strictnessBefore = [],
640 #ifndef OMIT_NATIVE_CODEGEN
641 targetPlatform = defaultTargetPlatform,
644 cmdlineHcIncludes = [],
648 ctxtStkDepth = mAX_CONTEXT_REDUCTION_DEPTH,
652 thisPackage = mainPackageId,
655 dylibInstallName = Nothing,
659 objectSuf = phaseInputExt StopLn,
660 hcSuf = phaseInputExt HCc,
663 outputFile = Nothing,
665 dynLibLoader = SystemDependent,
666 dumpPrefix = Nothing,
667 dumpPrefixForce = Nothing,
671 cmdlineFrameworks = [],
672 tmpDir = cDEFAULT_TMPDIR,
674 rtsOptsEnabled = RtsOptsSafeOnly,
680 then ["-D__PIC__", "-U __PIC__"] -- this list is reversed
693 pkgDatabase = Nothing,
694 pkgState = panic "no package state yet: call GHC.setSessionDynFlags",
695 ways = panic "defaultDynFlags: No ways",
696 buildTag = panic "defaultDynFlags: No buildTag",
697 rtsBuildTag = panic "defaultDynFlags: No rtsBuildTag",
699 -- initSysTools fills all these in
700 ghcUsagePath = panic "defaultDynFlags: No ghciUsagePath",
701 ghciUsagePath = panic "defaultDynFlags: No ghciUsagePath",
702 topDir = panic "defaultDynFlags: No topDir",
703 systemPackageConfig = panic "no systemPackageConfig: call GHC.setSessionDynFlags",
704 pgm_L = panic "defaultDynFlags: No pgm_L",
705 pgm_P = panic "defaultDynFlags: No pgm_P",
706 pgm_F = panic "defaultDynFlags: No pgm_F",
707 pgm_c = panic "defaultDynFlags: No pgm_c",
708 pgm_m = panic "defaultDynFlags: No pgm_m",
709 pgm_s = panic "defaultDynFlags: No pgm_s",
710 pgm_a = panic "defaultDynFlags: No pgm_a",
711 pgm_l = panic "defaultDynFlags: No pgm_l",
712 pgm_dll = panic "defaultDynFlags: No pgm_dll",
713 pgm_T = panic "defaultDynFlags: No pgm_T",
714 pgm_sysman = panic "defaultDynFlags: No pgm_sysman",
715 pgm_windres = panic "defaultDynFlags: No pgm_windres",
716 pgm_lo = panic "defaultDynFlags: No pgm_lo",
717 pgm_lc = panic "defaultDynFlags: No pgm_lc",
718 -- end of initSysTools values
720 depMakefile = "Makefile",
721 depIncludePkgDeps = False,
724 -- end of ghc -M values
725 filesToClean = panic "defaultDynFlags: No filesToClean",
726 dirsToClean = panic "defaultDynFlags: No dirsToClean",
727 haddockOptions = Nothing,
729 Opt_AutoLinkPackages,
730 Opt_ReadUserPackageConf,
740 Opt_PrintBindContents
742 ++ [f | (ns,f) <- optLevelFlags, 0 `elem` ns]
743 -- The default -O0 options
747 extensionFlags = Left [],
749 log_action = \severity srcSpan style msg ->
751 SevOutput -> printOutput (msg style)
752 SevInfo -> printErrs (msg style)
753 SevFatal -> printErrs (msg style)
756 printErrs ((mkLocMessage srcSpan msg) style)
757 -- careful (#2302): printErrs prints in UTF-8, whereas
758 -- converting to string first and using hPutStr would
759 -- just emit the low 8 bits of each unicode char.
763 Note [Verbosity levels]
764 ~~~~~~~~~~~~~~~~~~~~~~~
765 0 | print errors & warnings only
766 1 | minimal verbosity: print "compiling M ... done." for each module.
767 2 | equivalent to -dshow-passes
768 3 | equivalent to existing "ghc -v"
769 4 | "ghc -v -ddump-most"
770 5 | "ghc -v -ddump-all"
776 flattenExtensionFlags :: DynFlags -> DynFlags
777 flattenExtensionFlags dflags
778 = case extensionFlags dflags of
781 extensionFlags = Right $ flattenExtensionFlags' (language dflags) onoffs
784 panic "Flattening already-flattened extension flags"
786 ensureFlattenedExtensionFlags :: DynFlags -> DynFlags
787 ensureFlattenedExtensionFlags dflags
788 = case extensionFlags dflags of
791 extensionFlags = Right $ flattenExtensionFlags' (language dflags) onoffs
796 -- OnOffs accumulate in reverse order, so we use foldr in order to
797 -- process them in the right order
798 flattenExtensionFlags' :: Maybe Language -> [OnOff ExtensionFlag]
800 flattenExtensionFlags' ml = foldr f defaultExtensionFlags
801 where f (On f) flags = f : delete f flags
802 f (Off f) flags = delete f flags
803 defaultExtensionFlags = languageExtensions ml
805 languageExtensions :: Maybe Language -> [ExtensionFlag]
806 languageExtensions Nothing
807 = Opt_MonoPatBinds -- Experimentally, I'm making this non-standard
808 -- behaviour the default, to see if anyone notices
810 : languageExtensions (Just Haskell2010)
811 languageExtensions (Just Haskell98)
812 = [Opt_ImplicitPrelude,
813 Opt_MonomorphismRestriction,
815 Opt_DatatypeContexts]
816 languageExtensions (Just Haskell2010)
817 = [Opt_ImplicitPrelude,
818 Opt_MonomorphismRestriction,
819 Opt_DatatypeContexts,
821 Opt_ForeignFunctionInterface,
826 -- The DOpt class is a temporary workaround, to avoid having to do
827 -- a mass-renaming dopt->lopt at the moment
829 dopt :: a -> DynFlags -> Bool
830 dopt_set :: DynFlags -> a -> DynFlags
831 dopt_unset :: DynFlags -> a -> DynFlags
833 instance DOpt DynFlag where
836 dopt_unset = dopt_unset'
838 instance DOpt ExtensionFlag where
841 dopt_unset = lopt_unset
843 -- | Test whether a 'DynFlag' is set
844 dopt' :: DynFlag -> DynFlags -> Bool
845 dopt' f dflags = f `elem` (flags dflags)
848 dopt_set' :: DynFlags -> DynFlag -> DynFlags
849 dopt_set' dfs f = dfs{ flags = f : flags dfs }
851 -- | Unset a 'DynFlag'
852 dopt_unset' :: DynFlags -> DynFlag -> DynFlags
853 dopt_unset' dfs f = dfs{ flags = filter (/= f) (flags dfs) }
855 -- | Test whether a 'ExtensionFlag' is set
856 lopt :: ExtensionFlag -> DynFlags -> Bool
857 lopt f dflags = case extensionFlags dflags of
858 Left _ -> panic ("Testing for extension flag " ++ show f ++ " before flattening")
859 Right flags -> f `elem` flags
861 -- | Set a 'ExtensionFlag'
862 lopt_set :: DynFlags -> ExtensionFlag -> DynFlags
863 lopt_set dfs f = case extensionFlags dfs of
864 Left onoffs -> dfs { extensionFlags = Left (On f : onoffs) }
865 Right _ -> panic ("Setting extension flag " ++ show f ++ " after flattening")
867 -- | Set a 'ExtensionFlag'
868 lopt_set_flattened :: DynFlags -> ExtensionFlag -> DynFlags
869 lopt_set_flattened dfs f = case extensionFlags dfs of
871 panic ("Setting extension flag " ++ show f ++ " before flattening, but expected flattened")
873 dfs { extensionFlags = Right (f : delete f flags) }
875 -- | Unset a 'ExtensionFlag'
876 lopt_unset :: DynFlags -> ExtensionFlag -> DynFlags
877 lopt_unset dfs f = case extensionFlags dfs of
878 Left onoffs -> dfs { extensionFlags = Left (Off f : onoffs) }
879 Right _ -> panic ("Unsetting extension flag " ++ show f ++ " after flattening")
881 -- | Unset a 'ExtensionFlag'
882 lopt_unset_flattened :: DynFlags -> ExtensionFlag -> DynFlags
883 lopt_unset_flattened dfs f = case extensionFlags dfs of
885 panic ("Unsetting extension flag " ++ show f ++ " before flattening, but expected flattened")
887 dfs { extensionFlags = Right (delete f flags) }
889 -- | Retrieve the options corresponding to a particular @opt_*@ field in the correct order
890 getOpts :: DynFlags -- ^ 'DynFlags' to retrieve the options from
891 -> (DynFlags -> [a]) -- ^ Relevant record accessor: one of the @opt_*@ accessors
892 -> [a] -- ^ Correctly ordered extracted options
893 getOpts dflags opts = reverse (opts dflags)
894 -- We add to the options from the front, so we need to reverse the list
896 -- | Gets the verbosity flag for the current verbosity level. This is fed to
897 -- other tools, so GHC-specific verbosity flags like @-ddump-most@ are not included
898 getVerbFlag :: DynFlags -> String
900 | verbosity dflags >= 3 = "-v"
903 setObjectDir, setHiDir, setStubDir, setOutputDir, setDylibInstallName,
904 setObjectSuf, setHiSuf, setHcSuf, parseDynLibLoaderMode,
905 setPgmP, addOptl, addOptP,
906 addCmdlineFramework, addHaddockOpts
907 :: String -> DynFlags -> DynFlags
908 setOutputFile, setOutputHi, setDumpPrefixForce
909 :: Maybe String -> DynFlags -> DynFlags
911 setObjectDir f d = d{ objectDir = Just f}
912 setHiDir f d = d{ hiDir = Just f}
913 setStubDir f d = d{ stubDir = Just f, includePaths = f : includePaths d }
914 -- -stubdir D adds an implicit -I D, so that gcc can find the _stub.h file
915 -- \#included from the .hc file when compiling with -fvia-C.
916 setOutputDir f = setObjectDir f . setHiDir f . setStubDir f
917 setDylibInstallName f d = d{ dylibInstallName = Just f}
919 setObjectSuf f d = d{ objectSuf = f}
920 setHiSuf f d = d{ hiSuf = f}
921 setHcSuf f d = d{ hcSuf = f}
923 setOutputFile f d = d{ outputFile = f}
924 setOutputHi f d = d{ outputHi = f}
926 parseDynLibLoaderMode f d =
928 ("deploy", "") -> d{ dynLibLoader = Deployable }
929 ("sysdep", "") -> d{ dynLibLoader = SystemDependent }
930 ("wrapped", "") -> d{ dynLibLoader = Wrapped Nothing }
931 ("wrapped:", "hard") -> d{ dynLibLoader = Wrapped Nothing }
932 ("wrapped:", flex) -> d{ dynLibLoader = Wrapped (Just flex) }
933 _ -> ghcError (CmdLineError ("Unknown dynlib loader: " ++ f))
935 setDumpPrefixForce f d = d { dumpPrefixForce = f}
937 -- XXX HACK: Prelude> words "'does not' work" ===> ["'does","not'","work"]
938 -- Config.hs should really use Option.
939 setPgmP f d = let (pgm:args) = words f in d{ pgm_P = (pgm, map Option args)}
940 addOptl f d = d{ opt_l = f : opt_l d}
941 addOptP f d = d{ opt_P = f : opt_P d}
944 setDepMakefile :: FilePath -> DynFlags -> DynFlags
945 setDepMakefile f d = d { depMakefile = deOptDep f }
947 setDepIncludePkgDeps :: Bool -> DynFlags -> DynFlags
948 setDepIncludePkgDeps b d = d { depIncludePkgDeps = b }
950 addDepExcludeMod :: String -> DynFlags -> DynFlags
952 = d { depExcludeMods = mkModuleName (deOptDep m) : depExcludeMods d }
954 addDepSuffix :: FilePath -> DynFlags -> DynFlags
955 addDepSuffix s d = d { depSuffixes = deOptDep s : depSuffixes d }
958 -- We used to use "-optdep-flag -optdeparg", so for legacy applications
959 -- we need to strip the "-optdep" off of the arg
960 deOptDep :: String -> String
961 deOptDep x = case stripPrefix "-optdep" x of
965 addCmdlineFramework f d = d{ cmdlineFrameworks = f : cmdlineFrameworks d}
967 addHaddockOpts f d = d{ haddockOptions = Just f}
969 -- -----------------------------------------------------------------------------
970 -- Command-line options
972 -- | When invoking external tools as part of the compilation pipeline, we
973 -- pass these a sequence of options on the command-line. Rather than
974 -- just using a list of Strings, we use a type that allows us to distinguish
975 -- between filepaths and 'other stuff'. The reason for this is that
976 -- this type gives us a handle on transforming filenames, and filenames only,
977 -- to whatever format they're expected to be on a particular platform.
979 = FileOption -- an entry that _contains_ filename(s) / filepaths.
980 String -- a non-filepath prefix that shouldn't be
981 -- transformed (e.g., "/out=")
982 String -- the filepath/filename portion
985 showOpt :: Option -> String
986 showOpt (FileOption pre f) = pre ++ f
987 showOpt (Option s) = s
989 -----------------------------------------------------------------------------
990 -- Setting the optimisation level
992 updOptLevel :: Int -> DynFlags -> DynFlags
993 -- ^ Sets the 'DynFlags' to be appropriate to the optimisation level
995 = dfs2{ optLevel = final_n }
997 final_n = max 0 (min 2 n) -- Clamp to 0 <= n <= 2
998 dfs1 = foldr (flip dopt_unset) dfs remove_dopts
999 dfs2 = foldr (flip dopt_set) dfs1 extra_dopts
1001 extra_dopts = [ f | (ns,f) <- optLevelFlags, final_n `elem` ns ]
1002 remove_dopts = [ f | (ns,f) <- optLevelFlags, final_n `notElem` ns ]
1004 optLevelFlags :: [([Int], DynFlag)]
1006 = [ ([0], Opt_IgnoreInterfacePragmas)
1007 , ([0], Opt_OmitInterfacePragmas)
1009 , ([1,2], Opt_IgnoreAsserts)
1010 , ([1,2], Opt_EnableRewriteRules) -- Off for -O0; see Note [Scoping for Builtin rules]
1012 , ([1,2], Opt_DoEtaReduction)
1013 , ([1,2], Opt_CaseMerge)
1014 , ([1,2], Opt_Strictness)
1016 , ([1,2], Opt_FullLaziness)
1017 , ([1,2], Opt_Specialise)
1018 , ([1,2], Opt_FloatIn)
1020 , ([2], Opt_LiberateCase)
1021 , ([2], Opt_SpecConstr)
1023 -- , ([2], Opt_StaticArgumentTransformation)
1024 -- Max writes: I think it's probably best not to enable SAT with -O2 for the
1025 -- 6.10 release. The version of SAT in HEAD at the moment doesn't incorporate
1026 -- several improvements to the heuristics, and I'm concerned that without
1027 -- those changes SAT will interfere with some attempts to write "high
1028 -- performance Haskell", as we saw in some posts on Haskell-Cafe earlier
1029 -- this year. In particular, the version in HEAD lacks the tail call
1030 -- criterion, so many things that look like reasonable loops will be
1031 -- turned into functions with extra (unneccesary) thunk creation.
1033 , ([0,1,2], Opt_DoLambdaEtaExpansion)
1034 -- This one is important for a tiresome reason:
1035 -- we want to make sure that the bindings for data
1036 -- constructors are eta-expanded. This is probably
1037 -- a good thing anyway, but it seems fragile.
1040 -- -----------------------------------------------------------------------------
1041 -- Standard sets of warning options
1043 standardWarnings :: [DynFlag]
1045 = [ Opt_WarnWarningsDeprecations,
1046 Opt_WarnDeprecatedFlags,
1047 Opt_WarnUnrecognisedPragmas,
1048 Opt_WarnOverlappingPatterns,
1049 Opt_WarnMissingFields,
1050 Opt_WarnMissingMethods,
1051 Opt_WarnDuplicateExports,
1052 Opt_WarnLazyUnliftedBindings,
1053 Opt_WarnDodgyForeignImports,
1054 Opt_WarnWrongDoBind,
1055 Opt_WarnAlternativeLayoutRuleTransitional
1058 minusWOpts :: [DynFlag]
1060 = standardWarnings ++
1061 [ Opt_WarnUnusedBinds,
1062 Opt_WarnUnusedMatches,
1063 Opt_WarnUnusedImports,
1064 Opt_WarnIncompletePatterns,
1065 Opt_WarnDodgyExports,
1066 Opt_WarnDodgyImports
1069 minusWallOpts :: [DynFlag]
1072 [ Opt_WarnTypeDefaults,
1073 Opt_WarnNameShadowing,
1074 Opt_WarnMissingSigs,
1077 Opt_WarnUnusedDoBind
1080 -- minuswRemovesOpts should be every warning option
1081 minuswRemovesOpts :: [DynFlag]
1084 [Opt_WarnImplicitPrelude,
1085 Opt_WarnIncompletePatternsRecUpd,
1086 Opt_WarnSimplePatterns,
1087 Opt_WarnMonomorphism,
1088 Opt_WarnUnrecognisedPragmas,
1092 -- -----------------------------------------------------------------------------
1093 -- StgToDo: abstraction of stg-to-stg passes to run.
1096 = StgDoMassageForProfiling -- should be (next to) last
1097 -- There's also setStgVarInfo, but its absolute "lastness"
1098 -- is so critical that it is hardwired in (no flag).
1101 getStgToDo :: DynFlags -> [StgToDo]
1105 stg_stats = dopt Opt_StgStats dflags
1107 todo1 = if stg_stats then [D_stg_stats] else []
1109 todo2 | WayProf `elem` wayNames dflags
1110 = StgDoMassageForProfiling : todo1
1114 {- **********************************************************************
1118 %********************************************************************* -}
1120 -- -----------------------------------------------------------------------------
1121 -- Parsing the dynamic flags.
1123 -- | Parse dynamic flags from a list of command line arguments. Returns the
1124 -- the parsed 'DynFlags', the left-over arguments, and a list of warnings.
1125 -- Throws a 'UsageError' if errors occurred during parsing (such as unknown
1126 -- flags or missing arguments).
1127 parseDynamicFlags :: Monad m =>
1128 DynFlags -> [Located String]
1129 -> m (DynFlags, [Located String], [Located String])
1130 -- ^ Updated 'DynFlags', left-over arguments, and
1131 -- list of warnings.
1132 parseDynamicFlags dflags args = parseDynamicFlags_ dflags args True
1134 -- | Like 'parseDynamicFlags' but does not allow the package flags (-package,
1135 -- -hide-package, -ignore-package, -hide-all-packages, -package-conf).
1136 parseDynamicNoPackageFlags :: Monad m =>
1137 DynFlags -> [Located String]
1138 -> m (DynFlags, [Located String], [Located String])
1139 -- ^ Updated 'DynFlags', left-over arguments, and
1140 -- list of warnings.
1141 parseDynamicNoPackageFlags dflags args = parseDynamicFlags_ dflags args False
1143 parseDynamicFlags_ :: Monad m =>
1144 DynFlags -> [Located String] -> Bool
1145 -> m (DynFlags, [Located String], [Located String])
1146 parseDynamicFlags_ dflags0 args pkg_flags = do
1147 -- XXX Legacy support code
1148 -- We used to accept things like
1149 -- optdep-f -optdepdepend
1150 -- optdep-f -optdep depend
1151 -- optdep -f -optdepdepend
1152 -- optdep -f -optdep depend
1153 -- but the spaces trip up proper argument handling. So get rid of them.
1154 let f (L p "-optdep" : L _ x : xs) = (L p ("-optdep" ++ x)) : f xs
1155 f (x : xs) = x : f xs
1159 -- Note: -ignore-package (package_flags) must precede -i* (dynamic_flags)
1160 flag_spec | pkg_flags = package_flags ++ dynamic_flags
1161 | otherwise = dynamic_flags
1163 let ((leftover, errs, warns), dflags1)
1164 = runCmdLine (processArgs flag_spec args') dflags0
1165 when (not (null errs)) $ ghcError $ errorsToGhcException errs
1167 -- Cannot use -fPIC with registerised -fvia-C, because the mangler
1168 -- isn't up to the job. We know that if hscTarget == HscC, then the
1169 -- user has explicitly used -fvia-C, because -fasm is the default,
1170 -- unless there is no NCG on this platform. The latter case is
1171 -- checked when the -fPIC flag is parsed.
1173 let (pic_warns, dflags2)
1174 | opt_PIC && hscTarget dflags1 == HscC && cGhcUnregisterised == "NO"
1175 = ([L noSrcSpan $ "Warning: -fvia-C is incompatible with -fPIC; ignoring -fvia-C"],
1176 dflags1{ hscTarget = HscAsm })
1177 #if !(x86_64_TARGET_ARCH && linux_TARGET_OS)
1178 | (not opt_Static || opt_PIC) && hscTarget dflags1 == HscLlvm
1179 = ([L noSrcSpan $ "Warning: -fllvm is incompatible with -fPIC and -"
1180 ++ "dynamic on this platform;\n ignoring -fllvm"],
1181 dflags1{ hscTarget = HscAsm })
1183 | otherwise = ([], dflags1)
1185 return (dflags2, leftover, pic_warns ++ warns)
1188 {- **********************************************************************
1190 DynFlags specifications
1192 %********************************************************************* -}
1194 allFlags :: [String]
1195 allFlags = map ('-':) $
1196 [ flagName flag | flag <- dynamic_flags, ok (flagOptKind flag) ] ++
1197 map ("fno-"++) flags ++
1198 map ("f"++) flags ++
1199 map ("f"++) flags' ++
1200 map ("X"++) supportedExtensions
1201 where ok (PrefixPred _ _) = False
1203 flags = [ name | (name, _, _) <- fFlags ]
1204 flags' = [ name | (name, _, _) <- fLangFlags ]
1206 --------------- The main flags themselves ------------------
1207 dynamic_flags :: [Flag (CmdLineP DynFlags)]
1209 Flag "n" (NoArg (setDynFlag Opt_DryRun))
1210 , Flag "cpp" (NoArg (setExtensionFlag Opt_Cpp))
1211 , Flag "F" (NoArg (setDynFlag Opt_Pp))
1213 (HasArg (\s -> do { addCmdlineHCInclude s
1214 ; addWarn "-#include and INCLUDE pragmas are deprecated: They no longer have any effect" }))
1215 , Flag "v" (OptIntSuffix setVerbosity)
1217 ------- Specific phases --------------------------------------------
1218 -- need to appear before -pgmL to be parsed as LLVM flags.
1219 , Flag "pgmlo" (hasArg (\f d -> d{ pgm_lo = (f,[])}))
1220 , Flag "pgmlc" (hasArg (\f d -> d{ pgm_lc = (f,[])}))
1221 , Flag "pgmL" (hasArg (\f d -> d{ pgm_L = f}))
1222 , Flag "pgmP" (hasArg setPgmP)
1223 , Flag "pgmF" (hasArg (\f d -> d{ pgm_F = f}))
1224 , Flag "pgmc" (hasArg (\f d -> d{ pgm_c = (f,[])}))
1225 , Flag "pgmm" (hasArg (\f d -> d{ pgm_m = (f,[])}))
1226 , Flag "pgms" (hasArg (\f d -> d{ pgm_s = (f,[])}))
1227 , Flag "pgma" (hasArg (\f d -> d{ pgm_a = (f,[])}))
1228 , Flag "pgml" (hasArg (\f d -> d{ pgm_l = (f,[])}))
1229 , Flag "pgmdll" (hasArg (\f d -> d{ pgm_dll = (f,[])}))
1230 , Flag "pgmwindres" (hasArg (\f d -> d{ pgm_windres = f}))
1232 -- need to appear before -optl/-opta to be parsed as LLVM flags.
1233 , Flag "optlo" (hasArg (\f d -> d{ opt_lo = f : opt_lo d}))
1234 , Flag "optlc" (hasArg (\f d -> d{ opt_lc = f : opt_lc d}))
1235 , Flag "optL" (hasArg (\f d -> d{ opt_L = f : opt_L d}))
1236 , Flag "optP" (hasArg addOptP)
1237 , Flag "optF" (hasArg (\f d -> d{ opt_F = f : opt_F d}))
1238 , Flag "optc" (hasArg (\f d -> d{ opt_c = f : opt_c d}))
1239 , Flag "optm" (hasArg (\f d -> d{ opt_m = f : opt_m d}))
1240 , Flag "opta" (hasArg (\f d -> d{ opt_a = f : opt_a d}))
1241 , Flag "optl" (hasArg addOptl)
1242 , Flag "optwindres" (hasArg (\f d -> d{ opt_windres = f : opt_windres d}))
1245 (NoArg (if can_split
1246 then setDynFlag Opt_SplitObjs
1247 else addWarn "ignoring -fsplit-objs"))
1249 -------- ghc -M -----------------------------------------------------
1250 , Flag "dep-suffix" (hasArg addDepSuffix)
1251 , Flag "optdep-s" (hasArgDF addDepSuffix "Use -dep-suffix instead")
1252 , Flag "dep-makefile" (hasArg setDepMakefile)
1253 , Flag "optdep-f" (hasArgDF setDepMakefile "Use -dep-makefile instead")
1254 , Flag "optdep-w" (NoArg (deprecate "doesn't do anything"))
1255 , Flag "include-pkg-deps" (noArg (setDepIncludePkgDeps True))
1256 , Flag "optdep--include-prelude" (noArgDF (setDepIncludePkgDeps True) "Use -include-pkg-deps instead")
1257 , Flag "optdep--include-pkg-deps" (noArgDF (setDepIncludePkgDeps True) "Use -include-pkg-deps instead")
1258 , Flag "exclude-module" (hasArg addDepExcludeMod)
1259 , Flag "optdep--exclude-module" (hasArgDF addDepExcludeMod "Use -exclude-module instead")
1260 , Flag "optdep-x" (hasArgDF addDepExcludeMod "Use -exclude-module instead")
1262 -------- Linking ----------------------------------------------------
1263 , Flag "no-link" (noArg (\d -> d{ ghcLink=NoLink }))
1264 , Flag "shared" (noArg (\d -> d{ ghcLink=LinkDynLib }))
1265 , Flag "dynload" (hasArg parseDynLibLoaderMode)
1266 , Flag "dylib-install-name" (hasArg setDylibInstallName)
1268 ------- Libraries ---------------------------------------------------
1269 , Flag "L" (Prefix addLibraryPath)
1270 , Flag "l" (AnySuffix (upd . addOptl))
1272 ------- Frameworks --------------------------------------------------
1273 -- -framework-path should really be -F ...
1274 , Flag "framework-path" (HasArg addFrameworkPath)
1275 , Flag "framework" (hasArg addCmdlineFramework)
1277 ------- Output Redirection ------------------------------------------
1278 , Flag "odir" (hasArg setObjectDir)
1279 , Flag "o" (SepArg (upd . setOutputFile . Just))
1280 , Flag "ohi" (hasArg (setOutputHi . Just ))
1281 , Flag "osuf" (hasArg setObjectSuf)
1282 , Flag "hcsuf" (hasArg setHcSuf)
1283 , Flag "hisuf" (hasArg setHiSuf)
1284 , Flag "hidir" (hasArg setHiDir)
1285 , Flag "tmpdir" (hasArg setTmpDir)
1286 , Flag "stubdir" (hasArg setStubDir)
1287 , Flag "outputdir" (hasArg setOutputDir)
1288 , Flag "ddump-file-prefix" (hasArg (setDumpPrefixForce . Just))
1290 ------- Keeping temporary files -------------------------------------
1291 -- These can be singular (think ghc -c) or plural (think ghc --make)
1292 , Flag "keep-hc-file" (NoArg (setDynFlag Opt_KeepHcFiles))
1293 , Flag "keep-hc-files" (NoArg (setDynFlag Opt_KeepHcFiles))
1294 , Flag "keep-s-file" (NoArg (setDynFlag Opt_KeepSFiles))
1295 , Flag "keep-s-files" (NoArg (setDynFlag Opt_KeepSFiles))
1296 , Flag "keep-raw-s-file" (NoArg (setDynFlag Opt_KeepRawSFiles))
1297 , Flag "keep-raw-s-files" (NoArg (setDynFlag Opt_KeepRawSFiles))
1298 , Flag "keep-llvm-file" (NoArg (setDynFlag Opt_KeepLlvmFiles))
1299 , Flag "keep-llvm-files" (NoArg (setDynFlag Opt_KeepLlvmFiles))
1300 -- This only makes sense as plural
1301 , Flag "keep-tmp-files" (NoArg (setDynFlag Opt_KeepTmpFiles))
1303 ------- Miscellaneous ----------------------------------------------
1304 , Flag "no-auto-link-packages" (NoArg (unSetDynFlag Opt_AutoLinkPackages))
1305 , Flag "no-hs-main" (NoArg (setDynFlag Opt_NoHsMain))
1306 , Flag "with-rtsopts" (HasArg setRtsOpts)
1307 , Flag "rtsopts" (NoArg (setRtsOptsEnabled RtsOptsAll))
1308 , Flag "rtsopts=all" (NoArg (setRtsOptsEnabled RtsOptsAll))
1309 , Flag "rtsopts=some" (NoArg (setRtsOptsEnabled RtsOptsSafeOnly))
1310 , Flag "rtsopts=none" (NoArg (setRtsOptsEnabled RtsOptsNone))
1311 , Flag "no-rtsopts" (NoArg (setRtsOptsEnabled RtsOptsNone))
1312 , Flag "main-is" (SepArg setMainIs)
1313 , Flag "haddock" (NoArg (setDynFlag Opt_Haddock))
1314 , Flag "haddock-opts" (hasArg addHaddockOpts)
1315 , Flag "hpcdir" (SepArg setOptHpcDir)
1317 ------- recompilation checker --------------------------------------
1318 , Flag "recomp" (NoArg (do { unSetDynFlag Opt_ForceRecomp
1319 ; deprecate "Use -fno-force-recomp instead" }))
1320 , Flag "no-recomp" (NoArg (do { setDynFlag Opt_ForceRecomp
1321 ; deprecate "Use -fforce-recomp instead" }))
1323 ------ HsCpp opts ---------------------------------------------------
1324 , Flag "D" (AnySuffix (upd . addOptP))
1325 , Flag "U" (AnySuffix (upd . addOptP))
1327 ------- Include/Import Paths ----------------------------------------
1328 , Flag "I" (Prefix addIncludePath)
1329 , Flag "i" (OptPrefix addImportPath)
1331 ------ Debugging ----------------------------------------------------
1332 , Flag "dstg-stats" (NoArg (setDynFlag Opt_StgStats))
1334 , Flag "ddump-cmm" (setDumpFlag Opt_D_dump_cmm)
1335 , Flag "ddump-cmmz" (setDumpFlag Opt_D_dump_cmmz)
1336 , Flag "ddump-cmmz-pretty" (setDumpFlag Opt_D_dump_cmmz_pretty)
1337 , Flag "ddump-cps-cmm" (setDumpFlag Opt_D_dump_cps_cmm)
1338 , Flag "ddump-cvt-cmm" (setDumpFlag Opt_D_dump_cvt_cmm)
1339 , Flag "ddump-asm" (setDumpFlag Opt_D_dump_asm)
1340 , Flag "ddump-asm-native" (setDumpFlag Opt_D_dump_asm_native)
1341 , Flag "ddump-asm-liveness" (setDumpFlag Opt_D_dump_asm_liveness)
1342 , Flag "ddump-asm-coalesce" (setDumpFlag Opt_D_dump_asm_coalesce)
1343 , Flag "ddump-asm-regalloc" (setDumpFlag Opt_D_dump_asm_regalloc)
1344 , Flag "ddump-asm-conflicts" (setDumpFlag Opt_D_dump_asm_conflicts)
1345 , Flag "ddump-asm-regalloc-stages" (setDumpFlag Opt_D_dump_asm_regalloc_stages)
1346 , Flag "ddump-asm-stats" (setDumpFlag Opt_D_dump_asm_stats)
1347 , Flag "ddump-asm-expanded" (setDumpFlag Opt_D_dump_asm_expanded)
1348 , Flag "ddump-llvm" (NoArg (do { setObjTarget HscLlvm
1349 ; setDumpFlag' Opt_D_dump_llvm}))
1350 , Flag "ddump-cpranal" (setDumpFlag Opt_D_dump_cpranal)
1351 , Flag "ddump-deriv" (setDumpFlag Opt_D_dump_deriv)
1352 , Flag "ddump-ds" (setDumpFlag Opt_D_dump_ds)
1353 , Flag "ddump-flatC" (setDumpFlag Opt_D_dump_flatC)
1354 , Flag "ddump-foreign" (setDumpFlag Opt_D_dump_foreign)
1355 , Flag "ddump-inlinings" (setDumpFlag Opt_D_dump_inlinings)
1356 , Flag "ddump-rule-firings" (setDumpFlag Opt_D_dump_rule_firings)
1357 , Flag "ddump-occur-anal" (setDumpFlag Opt_D_dump_occur_anal)
1358 , Flag "ddump-parsed" (setDumpFlag Opt_D_dump_parsed)
1359 , Flag "ddump-rn" (setDumpFlag Opt_D_dump_rn)
1360 , Flag "ddump-simpl" (setDumpFlag Opt_D_dump_simpl)
1361 , Flag "ddump-simpl-iterations" (setDumpFlag Opt_D_dump_simpl_iterations)
1362 , Flag "ddump-simpl-phases" (OptPrefix setDumpSimplPhases)
1363 , Flag "ddump-spec" (setDumpFlag Opt_D_dump_spec)
1364 , Flag "ddump-prep" (setDumpFlag Opt_D_dump_prep)
1365 , Flag "ddump-stg" (setDumpFlag Opt_D_dump_stg)
1366 , Flag "ddump-stranal" (setDumpFlag Opt_D_dump_stranal)
1367 , Flag "ddump-tc" (setDumpFlag Opt_D_dump_tc)
1368 , Flag "ddump-types" (setDumpFlag Opt_D_dump_types)
1369 , Flag "ddump-rules" (setDumpFlag Opt_D_dump_rules)
1370 , Flag "ddump-cse" (setDumpFlag Opt_D_dump_cse)
1371 , Flag "ddump-worker-wrapper" (setDumpFlag Opt_D_dump_worker_wrapper)
1372 , Flag "ddump-rn-trace" (setDumpFlag Opt_D_dump_rn_trace)
1373 , Flag "ddump-if-trace" (setDumpFlag Opt_D_dump_if_trace)
1374 , Flag "ddump-tc-trace" (setDumpFlag Opt_D_dump_tc_trace)
1375 , Flag "ddump-splices" (setDumpFlag Opt_D_dump_splices)
1376 , Flag "ddump-rn-stats" (setDumpFlag Opt_D_dump_rn_stats)
1377 , Flag "ddump-opt-cmm" (setDumpFlag Opt_D_dump_opt_cmm)
1378 , Flag "ddump-simpl-stats" (setDumpFlag Opt_D_dump_simpl_stats)
1379 , Flag "ddump-bcos" (setDumpFlag Opt_D_dump_BCOs)
1380 , Flag "dsource-stats" (setDumpFlag Opt_D_source_stats)
1381 , Flag "dverbose-core2core" (NoArg (do { setVerbosity (Just 2)
1382 ; setVerboseCore2Core }))
1383 , Flag "dverbose-stg2stg" (setDumpFlag Opt_D_verbose_stg2stg)
1384 , Flag "ddump-hi" (setDumpFlag Opt_D_dump_hi)
1385 , Flag "ddump-minimal-imports" (setDumpFlag Opt_D_dump_minimal_imports)
1386 , Flag "ddump-vect" (setDumpFlag Opt_D_dump_vect)
1387 , Flag "ddump-hpc" (setDumpFlag Opt_D_dump_hpc)
1388 , Flag "ddump-mod-cycles" (setDumpFlag Opt_D_dump_mod_cycles)
1389 , Flag "ddump-view-pattern-commoning" (setDumpFlag Opt_D_dump_view_pattern_commoning)
1390 , Flag "ddump-to-file" (setDumpFlag Opt_DumpToFile)
1391 , Flag "ddump-hi-diffs" (setDumpFlag Opt_D_dump_hi_diffs)
1392 , Flag "ddump-rtti" (setDumpFlag Opt_D_dump_rtti)
1393 , Flag "dcore-lint" (NoArg (setDynFlag Opt_DoCoreLinting))
1394 , Flag "dstg-lint" (NoArg (setDynFlag Opt_DoStgLinting))
1395 , Flag "dcmm-lint" (NoArg (setDynFlag Opt_DoCmmLinting))
1396 , Flag "dasm-lint" (NoArg (setDynFlag Opt_DoAsmLinting))
1397 , Flag "dshow-passes" (NoArg (do forceRecompile
1398 setVerbosity (Just 2)))
1399 , Flag "dfaststring-stats" (NoArg (setDynFlag Opt_D_faststring_stats))
1401 ------ Machine dependant (-m<blah>) stuff ---------------------------
1403 , Flag "monly-2-regs" (noArg (\s -> s{stolen_x86_regs = 2}))
1404 , Flag "monly-3-regs" (noArg (\s -> s{stolen_x86_regs = 3}))
1405 , Flag "monly-4-regs" (noArg (\s -> s{stolen_x86_regs = 4}))
1406 , Flag "msse2" (NoArg (setDynFlag Opt_SSE2))
1408 ------ Warning opts -------------------------------------------------
1409 , Flag "W" (NoArg (mapM_ setDynFlag minusWOpts))
1410 , Flag "Werror" (NoArg (setDynFlag Opt_WarnIsError))
1411 , Flag "Wwarn" (NoArg (unSetDynFlag Opt_WarnIsError))
1412 , Flag "Wall" (NoArg (mapM_ setDynFlag minusWallOpts))
1413 , Flag "Wnot" (NoArg (do { mapM_ unSetDynFlag minusWallOpts
1414 ; deprecate "Use -w instead" }))
1415 , Flag "w" (NoArg (mapM_ unSetDynFlag minuswRemovesOpts))
1417 ------ Optimisation flags ------------------------------------------
1418 , Flag "O" (noArg (setOptLevel 1))
1419 , Flag "Onot" (noArgDF (setOptLevel 0) "Use -O0 instead")
1420 , Flag "Odph" (noArg setDPHOpt)
1421 , Flag "O" (OptIntSuffix (\mb_n -> upd (setOptLevel (mb_n `orElse` 1))))
1422 -- If the number is missing, use 1
1424 , Flag "fsimplifier-phases" (intSuffix (\n d -> d{ simplPhases = n }))
1425 , Flag "fmax-simplifier-iterations" (intSuffix (\n d -> d{ maxSimplIterations = n }))
1426 , Flag "fspec-constr-threshold" (intSuffix (\n d -> d{ specConstrThreshold = Just n }))
1427 , Flag "fno-spec-constr-threshold" (noArg (\d -> d{ specConstrThreshold = Nothing }))
1428 , Flag "fspec-constr-count" (intSuffix (\n d -> d{ specConstrCount = Just n }))
1429 , Flag "fno-spec-constr-count" (noArg (\d -> d{ specConstrCount = Nothing }))
1430 , Flag "fliberate-case-threshold" (intSuffix (\n d -> d{ liberateCaseThreshold = Just n }))
1431 , Flag "fno-liberate-case-threshold" (noArg (\d -> d{ liberateCaseThreshold = Nothing }))
1432 , Flag "frule-check" (SepArg (\s -> upd (\d -> d{ ruleCheck = Just s })))
1433 , Flag "fcontext-stack" (intSuffix (\n d -> d{ ctxtStkDepth = n }))
1434 , Flag "fstrictness-before" (intSuffix (\n d -> d{ strictnessBefore = n : strictnessBefore d }))
1436 ------ Profiling ----------------------------------------------------
1438 -- XXX Should the -f* flags be deprecated?
1439 -- They don't seem to be documented
1440 , Flag "fauto-sccs-on-all-toplevs" (NoArg (setDynFlag Opt_AutoSccsOnAllToplevs))
1441 , Flag "auto-all" (NoArg (setDynFlag Opt_AutoSccsOnAllToplevs))
1442 , Flag "no-auto-all" (NoArg (unSetDynFlag Opt_AutoSccsOnAllToplevs))
1443 , Flag "fauto-sccs-on-exported-toplevs" (NoArg (setDynFlag Opt_AutoSccsOnExportedToplevs))
1444 , Flag "auto" (NoArg (setDynFlag Opt_AutoSccsOnExportedToplevs))
1445 , Flag "no-auto" (NoArg (unSetDynFlag Opt_AutoSccsOnExportedToplevs))
1446 , Flag "fauto-sccs-on-individual-cafs" (NoArg (setDynFlag Opt_AutoSccsOnIndividualCafs))
1447 , Flag "caf-all" (NoArg (setDynFlag Opt_AutoSccsOnIndividualCafs))
1448 , Flag "no-caf-all" (NoArg (unSetDynFlag Opt_AutoSccsOnIndividualCafs))
1450 ------ DPH flags ----------------------------------------------------
1452 , Flag "fdph-seq" (NoArg (setDPHBackend DPHSeq))
1453 , Flag "fdph-par" (NoArg (setDPHBackend DPHPar))
1454 , Flag "fdph-this" (NoArg (setDPHBackend DPHThis))
1456 ------ Compiler flags -----------------------------------------------
1458 , Flag "fasm" (NoArg (setObjTarget HscAsm))
1459 , Flag "fvia-c" (NoArg (setObjTarget HscC >>
1460 (addWarn "The -fvia-c flag will be removed in a future GHC release")))
1461 , Flag "fvia-C" (NoArg (setObjTarget HscC >>
1462 (addWarn "The -fvia-C flag will be removed in a future GHC release")))
1463 , Flag "fllvm" (NoArg (setObjTarget HscLlvm))
1465 , Flag "fno-code" (NoArg (do upd $ \d -> d{ ghcLink=NoLink }
1466 setTarget HscNothing))
1467 , Flag "fbyte-code" (NoArg (setTarget HscInterpreted))
1468 , Flag "fobject-code" (NoArg (setTarget defaultHscTarget))
1469 , Flag "fglasgow-exts" (NoArg enableGlasgowExts)
1470 , Flag "fno-glasgow-exts" (NoArg disableGlasgowExts)
1472 ++ map (mkFlag True "f" setDynFlag ) fFlags
1473 ++ map (mkFlag False "fno-" unSetDynFlag) fFlags
1474 ++ map (mkFlag True "f" setExtensionFlag ) fLangFlags
1475 ++ map (mkFlag False "fno-" unSetExtensionFlag) fLangFlags
1476 ++ map (mkFlag True "X" setExtensionFlag ) xFlags
1477 ++ map (mkFlag False "XNo" unSetExtensionFlag) xFlags
1478 ++ map (mkFlag True "X" setLanguage) languageFlags
1480 package_flags :: [Flag (CmdLineP DynFlags)]
1482 ------- Packages ----------------------------------------------------
1483 Flag "package-conf" (HasArg extraPkgConf_)
1484 , Flag "no-user-package-conf" (NoArg (unSetDynFlag Opt_ReadUserPackageConf))
1485 , Flag "package-name" (hasArg setPackageName)
1486 , Flag "package-id" (HasArg exposePackageId)
1487 , Flag "package" (HasArg exposePackage)
1488 , Flag "hide-package" (HasArg hidePackage)
1489 , Flag "hide-all-packages" (NoArg (setDynFlag Opt_HideAllPackages))
1490 , Flag "ignore-package" (HasArg ignorePackage)
1491 , Flag "syslib" (HasArg (\s -> do { exposePackage s
1492 ; deprecate "Use -package instead" }))
1496 = ( String -- Flag in string form
1497 , flag -- Flag in internal form
1498 , Bool -> DynP ()) -- Extra action to run when the flag is found
1499 -- Typically, emit a warning or error
1500 -- True <=> we are turning the flag on
1501 -- False <=> we are turning the flag on
1504 mkFlag :: Bool -- ^ True <=> it should be turned on
1505 -> String -- ^ The flag prefix
1506 -> (flag -> DynP ()) -- ^ What to do when the flag is found
1507 -> FlagSpec flag -- ^ Specification of this particular flag
1508 -> Flag (CmdLineP DynFlags)
1509 mkFlag turnOn flagPrefix f (name, flag, extra_action)
1510 = Flag (flagPrefix ++ name) (NoArg (f flag >> extra_action turnOn))
1512 deprecatedForExtension :: String -> Bool -> DynP ()
1513 deprecatedForExtension lang turn_on
1514 = deprecate ("use -X" ++ flag ++ " or pragma {-# LANGUAGE " ++ flag ++ " #-} instead")
1516 flag | turn_on = lang
1517 | otherwise = "No"++lang
1519 useInstead :: String -> Bool -> DynP ()
1520 useInstead flag turn_on
1521 = deprecate ("Use -f" ++ no ++ flag ++ " instead")
1523 no = if turn_on then "" else "no-"
1525 nop :: Bool -> DynP ()
1528 -- | These @-f\<blah\>@ flags can all be reversed with @-fno-\<blah\>@
1529 fFlags :: [FlagSpec DynFlag]
1531 ( "warn-dodgy-foreign-imports", Opt_WarnDodgyForeignImports, nop ),
1532 ( "warn-dodgy-exports", Opt_WarnDodgyExports, nop ),
1533 ( "warn-dodgy-imports", Opt_WarnDodgyImports, nop ),
1534 ( "warn-duplicate-exports", Opt_WarnDuplicateExports, nop ),
1535 ( "warn-hi-shadowing", Opt_WarnHiShadows, nop ),
1536 ( "warn-implicit-prelude", Opt_WarnImplicitPrelude, nop ),
1537 ( "warn-incomplete-patterns", Opt_WarnIncompletePatterns, nop ),
1538 ( "warn-incomplete-record-updates", Opt_WarnIncompletePatternsRecUpd, nop ),
1539 ( "warn-missing-fields", Opt_WarnMissingFields, nop ),
1540 ( "warn-missing-import-lists", Opt_WarnMissingImportList, nop ),
1541 ( "warn-missing-methods", Opt_WarnMissingMethods, nop ),
1542 ( "warn-missing-signatures", Opt_WarnMissingSigs, nop ),
1543 ( "warn-name-shadowing", Opt_WarnNameShadowing, nop ),
1544 ( "warn-overlapping-patterns", Opt_WarnOverlappingPatterns, nop ),
1545 ( "warn-simple-patterns", Opt_WarnSimplePatterns, nop ),
1546 ( "warn-type-defaults", Opt_WarnTypeDefaults, nop ),
1547 ( "warn-monomorphism-restriction", Opt_WarnMonomorphism, nop ),
1548 ( "warn-unused-binds", Opt_WarnUnusedBinds, nop ),
1549 ( "warn-unused-imports", Opt_WarnUnusedImports, nop ),
1550 ( "warn-unused-matches", Opt_WarnUnusedMatches, nop ),
1551 ( "warn-warnings-deprecations", Opt_WarnWarningsDeprecations, nop ),
1552 ( "warn-deprecations", Opt_WarnWarningsDeprecations, nop ),
1553 ( "warn-deprecated-flags", Opt_WarnDeprecatedFlags, nop ),
1554 ( "warn-orphans", Opt_WarnOrphans, nop ),
1555 ( "warn-tabs", Opt_WarnTabs, nop ),
1556 ( "warn-unrecognised-pragmas", Opt_WarnUnrecognisedPragmas, nop ),
1557 ( "warn-lazy-unlifted-bindings", Opt_WarnLazyUnliftedBindings,
1558 \_ -> deprecate "lazy unlifted bindings will be an error in GHC 6.14, and this flag will no longer exist"),
1559 ( "warn-unused-do-bind", Opt_WarnUnusedDoBind, nop ),
1560 ( "warn-wrong-do-bind", Opt_WarnWrongDoBind, nop ),
1561 ( "warn-alternative-layout-rule-transitional", Opt_WarnAlternativeLayoutRuleTransitional, nop ),
1562 ( "print-explicit-foralls", Opt_PrintExplicitForalls, nop ),
1563 ( "strictness", Opt_Strictness, nop ),
1564 ( "specialise", Opt_Specialise, nop ),
1565 ( "float-in", Opt_FloatIn, nop ),
1566 ( "static-argument-transformation", Opt_StaticArgumentTransformation, nop ),
1567 ( "full-laziness", Opt_FullLaziness, nop ),
1568 ( "liberate-case", Opt_LiberateCase, nop ),
1569 ( "spec-constr", Opt_SpecConstr, nop ),
1570 ( "cse", Opt_CSE, nop ),
1571 ( "ignore-interface-pragmas", Opt_IgnoreInterfacePragmas, nop ),
1572 ( "omit-interface-pragmas", Opt_OmitInterfacePragmas, nop ),
1573 ( "expose-all-unfoldings", Opt_ExposeAllUnfoldings, nop ),
1574 ( "do-lambda-eta-expansion", Opt_DoLambdaEtaExpansion, nop ),
1575 ( "ignore-asserts", Opt_IgnoreAsserts, nop ),
1576 ( "do-eta-reduction", Opt_DoEtaReduction, nop ),
1577 ( "case-merge", Opt_CaseMerge, nop ),
1578 ( "unbox-strict-fields", Opt_UnboxStrictFields, nop ),
1579 ( "method-sharing", Opt_MethodSharing, nop ),
1580 ( "dicts-cheap", Opt_DictsCheap, nop ),
1581 ( "excess-precision", Opt_ExcessPrecision, nop ),
1582 ( "eager-blackholing", Opt_EagerBlackHoling, nop ),
1583 ( "asm-mangling", Opt_DoAsmMangling, nop ),
1584 ( "print-bind-result", Opt_PrintBindResult, nop ),
1585 ( "force-recomp", Opt_ForceRecomp, nop ),
1586 ( "hpc-no-auto", Opt_Hpc_No_Auto, nop ),
1587 ( "rewrite-rules", Opt_EnableRewriteRules, useInstead "enable-rewrite-rules" ),
1588 ( "enable-rewrite-rules", Opt_EnableRewriteRules, nop ),
1589 ( "break-on-exception", Opt_BreakOnException, nop ),
1590 ( "break-on-error", Opt_BreakOnError, nop ),
1591 ( "print-evld-with-show", Opt_PrintEvldWithShow, nop ),
1592 ( "print-bind-contents", Opt_PrintBindContents, nop ),
1593 ( "run-cps", Opt_RunCPS, nop ),
1594 ( "run-cpsz", Opt_RunCPSZ, nop ),
1595 ( "new-codegen", Opt_TryNewCodeGen, nop ),
1596 ( "convert-to-zipper-and-back", Opt_ConvertToZipCfgAndBack, nop ),
1597 ( "vectorise", Opt_Vectorise, nop ),
1598 ( "regs-graph", Opt_RegsGraph, nop ),
1599 ( "regs-iterative", Opt_RegsIterative, nop ),
1600 ( "gen-manifest", Opt_GenManifest, nop ),
1601 ( "embed-manifest", Opt_EmbedManifest, nop ),
1602 ( "ext-core", Opt_EmitExternalCore, nop ),
1603 ( "shared-implib", Opt_SharedImplib, nop ),
1604 ( "building-cabal-package", Opt_BuildingCabalPackage, nop ),
1605 ( "implicit-import-qualified", Opt_ImplicitImportQualified, nop )
1608 -- | These @-f\<blah\>@ flags can all be reversed with @-fno-\<blah\>@
1609 fLangFlags :: [FlagSpec ExtensionFlag]
1611 ( "th", Opt_TemplateHaskell,
1612 deprecatedForExtension "TemplateHaskell" >> checkTemplateHaskellOk ),
1613 ( "fi", Opt_ForeignFunctionInterface,
1614 deprecatedForExtension "ForeignFunctionInterface" ),
1615 ( "ffi", Opt_ForeignFunctionInterface,
1616 deprecatedForExtension "ForeignFunctionInterface" ),
1617 ( "arrows", Opt_Arrows,
1618 deprecatedForExtension "Arrows" ),
1619 ( "generics", Opt_Generics,
1620 deprecatedForExtension "Generics" ),
1621 ( "implicit-prelude", Opt_ImplicitPrelude,
1622 deprecatedForExtension "ImplicitPrelude" ),
1623 ( "bang-patterns", Opt_BangPatterns,
1624 deprecatedForExtension "BangPatterns" ),
1625 ( "monomorphism-restriction", Opt_MonomorphismRestriction,
1626 deprecatedForExtension "MonomorphismRestriction" ),
1627 ( "mono-pat-binds", Opt_MonoPatBinds,
1628 deprecatedForExtension "MonoPatBinds" ),
1629 ( "extended-default-rules", Opt_ExtendedDefaultRules,
1630 deprecatedForExtension "ExtendedDefaultRules" ),
1631 ( "implicit-params", Opt_ImplicitParams,
1632 deprecatedForExtension "ImplicitParams" ),
1633 ( "scoped-type-variables", Opt_ScopedTypeVariables,
1634 deprecatedForExtension "ScopedTypeVariables" ),
1636 deprecatedForExtension "PArr" ),
1637 ( "allow-overlapping-instances", Opt_OverlappingInstances,
1638 deprecatedForExtension "OverlappingInstances" ),
1639 ( "allow-undecidable-instances", Opt_UndecidableInstances,
1640 deprecatedForExtension "UndecidableInstances" ),
1641 ( "allow-incoherent-instances", Opt_IncoherentInstances,
1642 deprecatedForExtension "IncoherentInstances" )
1645 supportedLanguages :: [String]
1646 supportedLanguages = [ name | (name, _, _) <- languageFlags ]
1648 supportedExtensions :: [String]
1649 supportedExtensions = [ name' | (name, _, _) <- xFlags, name' <- [name, "No" ++ name] ]
1651 supportedLanguagesAndExtensions :: [String]
1652 supportedLanguagesAndExtensions = supportedLanguages ++ supportedExtensions
1654 -- | These -X<blah> flags cannot be reversed with -XNo<blah>
1655 languageFlags :: [FlagSpec Language]
1657 ( "Haskell98", Haskell98, nop ),
1658 ( "Haskell2010", Haskell2010, nop )
1661 -- | These -X<blah> flags can all be reversed with -XNo<blah>
1662 xFlags :: [FlagSpec ExtensionFlag]
1664 ( "CPP", Opt_Cpp, nop ),
1665 ( "PostfixOperators", Opt_PostfixOperators, nop ),
1666 ( "TupleSections", Opt_TupleSections, nop ),
1667 ( "PatternGuards", Opt_PatternGuards, nop ),
1668 ( "UnicodeSyntax", Opt_UnicodeSyntax, nop ),
1669 ( "MagicHash", Opt_MagicHash, nop ),
1670 ( "PolymorphicComponents", Opt_PolymorphicComponents, nop ),
1671 ( "ExistentialQuantification", Opt_ExistentialQuantification, nop ),
1672 ( "KindSignatures", Opt_KindSignatures, nop ),
1673 ( "EmptyDataDecls", Opt_EmptyDataDecls, nop ),
1674 ( "ParallelListComp", Opt_ParallelListComp, nop ),
1675 ( "TransformListComp", Opt_TransformListComp, nop ),
1676 ( "ForeignFunctionInterface", Opt_ForeignFunctionInterface, nop ),
1677 ( "UnliftedFFITypes", Opt_UnliftedFFITypes, nop ),
1678 ( "GHCForeignImportPrim", Opt_GHCForeignImportPrim, nop ),
1679 ( "LiberalTypeSynonyms", Opt_LiberalTypeSynonyms, nop ),
1680 ( "Rank2Types", Opt_Rank2Types, nop ),
1681 ( "RankNTypes", Opt_RankNTypes, nop ),
1682 ( "ImpredicativeTypes", Opt_ImpredicativeTypes,
1683 \_ -> deprecate "impredicative polymorphism will be simplified or removed in GHC 6.14" ),
1684 ( "TypeOperators", Opt_TypeOperators, nop ),
1685 ( "RecursiveDo", Opt_RecursiveDo,
1686 deprecatedForExtension "DoRec"),
1687 ( "DoRec", Opt_DoRec, nop ),
1688 ( "Arrows", Opt_Arrows, nop ),
1689 ( "PArr", Opt_PArr, nop ),
1690 ( "TemplateHaskell", Opt_TemplateHaskell, checkTemplateHaskellOk ),
1691 ( "QuasiQuotes", Opt_QuasiQuotes, nop ),
1692 ( "Generics", Opt_Generics, nop ),
1693 ( "ImplicitPrelude", Opt_ImplicitPrelude, nop ),
1694 ( "RecordWildCards", Opt_RecordWildCards, nop ),
1695 ( "NamedFieldPuns", Opt_RecordPuns, nop ),
1696 ( "RecordPuns", Opt_RecordPuns,
1697 deprecatedForExtension "NamedFieldPuns" ),
1698 ( "DisambiguateRecordFields", Opt_DisambiguateRecordFields, nop ),
1699 ( "OverloadedStrings", Opt_OverloadedStrings, nop ),
1700 ( "GADTs", Opt_GADTs, nop ),
1701 ( "ViewPatterns", Opt_ViewPatterns, nop ),
1702 ( "TypeFamilies", Opt_TypeFamilies, nop ),
1703 ( "BangPatterns", Opt_BangPatterns, nop ),
1704 ( "MonomorphismRestriction", Opt_MonomorphismRestriction, nop ),
1705 ( "NPlusKPatterns", Opt_NPlusKPatterns, nop ),
1706 ( "DoAndIfThenElse", Opt_DoAndIfThenElse, nop ),
1707 ( "MonoPatBinds", Opt_MonoPatBinds, nop ),
1708 ( "ExplicitForAll", Opt_ExplicitForAll, nop ),
1709 ( "AlternativeLayoutRule", Opt_AlternativeLayoutRule, nop ),
1710 ( "AlternativeLayoutRuleTransitional",Opt_AlternativeLayoutRuleTransitional, nop ),
1711 ( "DatatypeContexts", Opt_DatatypeContexts, nop ),
1712 ( "MonoLocalBinds", Opt_MonoLocalBinds, nop ),
1713 ( "RelaxedPolyRec", Opt_RelaxedPolyRec, nop ),
1714 ( "ExtendedDefaultRules", Opt_ExtendedDefaultRules, nop ),
1715 ( "ImplicitParams", Opt_ImplicitParams, nop ),
1716 ( "ScopedTypeVariables", Opt_ScopedTypeVariables, nop ),
1718 ( "PatternSignatures", Opt_ScopedTypeVariables,
1719 deprecatedForExtension "ScopedTypeVariables" ),
1721 ( "UnboxedTuples", Opt_UnboxedTuples, nop ),
1722 ( "StandaloneDeriving", Opt_StandaloneDeriving, nop ),
1723 ( "DeriveDataTypeable", Opt_DeriveDataTypeable, nop ),
1724 ( "DeriveFunctor", Opt_DeriveFunctor, nop ),
1725 ( "DeriveTraversable", Opt_DeriveTraversable, nop ),
1726 ( "DeriveFoldable", Opt_DeriveFoldable, nop ),
1727 ( "TypeSynonymInstances", Opt_TypeSynonymInstances, nop ),
1728 ( "FlexibleContexts", Opt_FlexibleContexts, nop ),
1729 ( "FlexibleInstances", Opt_FlexibleInstances, nop ),
1730 ( "ConstrainedClassMethods", Opt_ConstrainedClassMethods, nop ),
1731 ( "MultiParamTypeClasses", Opt_MultiParamTypeClasses, nop ),
1732 ( "FunctionalDependencies", Opt_FunctionalDependencies, nop ),
1733 ( "GeneralizedNewtypeDeriving", Opt_GeneralizedNewtypeDeriving, nop ),
1734 ( "OverlappingInstances", Opt_OverlappingInstances, nop ),
1735 ( "UndecidableInstances", Opt_UndecidableInstances, nop ),
1736 ( "IncoherentInstances", Opt_IncoherentInstances, nop ),
1737 ( "PackageImports", Opt_PackageImports, nop ),
1738 ( "NewQualifiedOperators", Opt_NewQualifiedOperators,
1739 \_ -> deprecate "The new qualified operator syntax was rejected by Haskell'" )
1742 impliedFlags :: [(ExtensionFlag, ExtensionFlag)]
1744 = [ (Opt_RankNTypes, Opt_ExplicitForAll)
1745 , (Opt_Rank2Types, Opt_ExplicitForAll)
1746 , (Opt_ScopedTypeVariables, Opt_ExplicitForAll)
1747 , (Opt_LiberalTypeSynonyms, Opt_ExplicitForAll)
1748 , (Opt_ExistentialQuantification, Opt_ExplicitForAll)
1749 , (Opt_PolymorphicComponents, Opt_ExplicitForAll)
1751 , (Opt_GADTs, Opt_RelaxedPolyRec) -- We want type-sig variables to
1752 -- be completely rigid for GADTs
1754 , (Opt_TypeFamilies, Opt_RelaxedPolyRec) -- Trac #2944 gives a nice example
1755 , (Opt_TypeFamilies, Opt_KindSignatures) -- Type families use kind signatures
1756 -- all over the place
1758 , (Opt_ScopedTypeVariables, Opt_RelaxedPolyRec) -- Ditto for scoped type variables; see
1759 -- Note [Scoped tyvars] in TcBinds
1760 , (Opt_ImpredicativeTypes, Opt_RankNTypes)
1762 -- Record wild-cards implies field disambiguation
1763 -- Otherwise if you write (C {..}) you may well get
1764 -- stuff like " 'a' not in scope ", which is a bit silly
1765 -- if the compiler has just filled in field 'a' of constructor 'C'
1766 , (Opt_RecordWildCards, Opt_DisambiguateRecordFields)
1769 enableGlasgowExts :: DynP ()
1770 enableGlasgowExts = do setDynFlag Opt_PrintExplicitForalls
1771 mapM_ setExtensionFlag glasgowExtsFlags
1773 disableGlasgowExts :: DynP ()
1774 disableGlasgowExts = do unSetDynFlag Opt_PrintExplicitForalls
1775 mapM_ unSetExtensionFlag glasgowExtsFlags
1777 glasgowExtsFlags :: [ExtensionFlag]
1778 glasgowExtsFlags = [
1779 Opt_ForeignFunctionInterface
1780 , Opt_UnliftedFFITypes
1782 , Opt_ImplicitParams
1783 , Opt_ScopedTypeVariables
1785 , Opt_TypeSynonymInstances
1786 , Opt_StandaloneDeriving
1787 , Opt_DeriveDataTypeable
1789 , Opt_DeriveFoldable
1790 , Opt_DeriveTraversable
1791 , Opt_FlexibleContexts
1792 , Opt_FlexibleInstances
1793 , Opt_ConstrainedClassMethods
1794 , Opt_MultiParamTypeClasses
1795 , Opt_FunctionalDependencies
1797 , Opt_PolymorphicComponents
1798 , Opt_ExistentialQuantification
1800 , Opt_PostfixOperators
1802 , Opt_LiberalTypeSynonyms
1806 , Opt_ParallelListComp
1807 , Opt_EmptyDataDecls
1808 , Opt_KindSignatures
1809 , Opt_GeneralizedNewtypeDeriving
1810 , Opt_TypeFamilies ]
1812 -- Consult the RTS to find whether GHC itself has been built profiled
1813 -- If so, you can't use Template Haskell
1814 foreign import ccall unsafe "rts_isProfiled" rtsIsProfiledIO :: IO CInt
1816 rtsIsProfiled :: Bool
1817 rtsIsProfiled = False -- unsafePerformIO rtsIsProfiledIO /= 0
1819 checkTemplateHaskellOk :: Bool -> DynP ()
1820 checkTemplateHaskellOk turn_on
1821 | turn_on && rtsIsProfiled
1822 = addErr "You can't use Template Haskell with a profiled compiler"
1826 {- **********************************************************************
1828 DynFlags constructors
1830 %********************************************************************* -}
1832 type DynP = EwM (CmdLineP DynFlags)
1834 upd :: (DynFlags -> DynFlags) -> DynP ()
1835 upd f = liftEwM (do { dfs <- getCmdLineState
1836 ; putCmdLineState $! (f dfs) })
1838 --------------- Constructor functions for OptKind -----------------
1839 noArg :: (DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
1840 noArg fn = NoArg (upd fn)
1842 noArgDF :: (DynFlags -> DynFlags) -> String -> OptKind (CmdLineP DynFlags)
1843 noArgDF fn deprec = NoArg (upd fn >> deprecate deprec)
1845 hasArg :: (String -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
1846 hasArg fn = HasArg (upd . fn)
1848 hasArgDF :: (String -> DynFlags -> DynFlags) -> String -> OptKind (CmdLineP DynFlags)
1849 hasArgDF fn deprec = HasArg (\s -> do { upd (fn s)
1850 ; deprecate deprec })
1852 intSuffix :: (Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
1853 intSuffix fn = IntSuffix (\n -> upd (fn n))
1855 setDumpFlag :: DynFlag -> OptKind (CmdLineP DynFlags)
1856 setDumpFlag dump_flag = NoArg (setDumpFlag' dump_flag)
1858 --------------------------
1859 setDynFlag, unSetDynFlag :: DynFlag -> DynP ()
1860 setDynFlag f = upd (\dfs -> dopt_set dfs f)
1861 unSetDynFlag f = upd (\dfs -> dopt_unset dfs f)
1863 --------------------------
1864 setLanguage :: Language -> DynP ()
1865 setLanguage l = upd (\dfs -> dfs { language = Just l })
1867 --------------------------
1868 setExtensionFlag, unSetExtensionFlag :: ExtensionFlag -> DynP ()
1869 setExtensionFlag f = do { upd (\dfs -> lopt_set dfs f)
1870 ; mapM_ setExtensionFlag deps }
1872 deps = [ d | (f', d) <- impliedFlags, f' == f ]
1873 -- When you set f, set the ones it implies
1874 -- NB: use setExtensionFlag recursively, in case the implied flags
1875 -- implies further flags
1876 -- When you un-set f, however, we don't un-set the things it implies
1877 -- (except for -fno-glasgow-exts, which is treated specially)
1879 unSetExtensionFlag f = upd (\dfs -> lopt_unset dfs f)
1881 --------------------------
1882 setDumpFlag' :: DynFlag -> DynP ()
1883 setDumpFlag' dump_flag
1884 = do { setDynFlag dump_flag
1885 ; when want_recomp forceRecompile }
1887 -- Certain dumpy-things are really interested in what's going
1888 -- on during recompilation checking, so in those cases we
1889 -- don't want to turn it off.
1890 want_recomp = dump_flag `notElem` [Opt_D_dump_if_trace,
1891 Opt_D_dump_hi_diffs]
1893 forceRecompile :: DynP ()
1894 -- Whenver we -ddump, force recompilation (by switching off the
1895 -- recompilation checker), else you don't see the dump! However,
1896 -- don't switch it off in --make mode, else *everything* gets
1897 -- recompiled which probably isn't what you want
1898 forceRecompile = do { dfs <- liftEwM getCmdLineState
1899 ; when (force_recomp dfs) (setDynFlag Opt_ForceRecomp) }
1901 force_recomp dfs = isOneShot (ghcMode dfs)
1903 setVerboseCore2Core :: DynP ()
1904 setVerboseCore2Core = do forceRecompile
1905 setDynFlag Opt_D_verbose_core2core
1906 upd (\dfs -> dfs { shouldDumpSimplPhase = Nothing })
1909 setDumpSimplPhases :: String -> DynP ()
1910 setDumpSimplPhases s = do forceRecompile
1911 upd (\dfs -> dfs { shouldDumpSimplPhase = Just spec })
1913 spec = case s of { ('=' : s') -> s'; _ -> s }
1915 setVerbosity :: Maybe Int -> DynP ()
1916 setVerbosity mb_n = upd (\dfs -> dfs{ verbosity = mb_n `orElse` 3 })
1918 addCmdlineHCInclude :: String -> DynP ()
1919 addCmdlineHCInclude a = upd (\s -> s{cmdlineHcIncludes = a : cmdlineHcIncludes s})
1921 extraPkgConf_ :: FilePath -> DynP ()
1922 extraPkgConf_ p = upd (\s -> s{ extraPkgConfs = p : extraPkgConfs s })
1924 exposePackage, exposePackageId, hidePackage, ignorePackage :: String -> DynP ()
1926 upd (\s -> s{ packageFlags = ExposePackage p : packageFlags s })
1928 upd (\s -> s{ packageFlags = ExposePackageId p : packageFlags s })
1930 upd (\s -> s{ packageFlags = HidePackage p : packageFlags s })
1932 upd (\s -> s{ packageFlags = IgnorePackage p : packageFlags s })
1934 setPackageName :: String -> DynFlags -> DynFlags
1935 setPackageName p s = s{ thisPackage = stringToPackageId p }
1937 -- If we're linking a binary, then only targets that produce object
1938 -- code are allowed (requests for other target types are ignored).
1939 setTarget :: HscTarget -> DynP ()
1940 setTarget l = upd set
1943 | ghcLink dfs /= LinkBinary || isObjectTarget l = dfs{ hscTarget = l }
1946 -- Changes the target only if we're compiling object code. This is
1947 -- used by -fasm and -fvia-C, which switch from one to the other, but
1948 -- not from bytecode to object-code. The idea is that -fasm/-fvia-C
1949 -- can be safely used in an OPTIONS_GHC pragma.
1950 setObjTarget :: HscTarget -> DynP ()
1951 setObjTarget l = upd set
1954 | isObjectTarget (hscTarget dfs) = dfs { hscTarget = l }
1957 setOptLevel :: Int -> DynFlags -> DynFlags
1958 setOptLevel n dflags
1959 | hscTarget dflags == HscInterpreted && n > 0
1961 -- not in IO any more, oh well:
1962 -- putStr "warning: -O conflicts with --interactive; -O ignored.\n"
1964 = updOptLevel n dflags
1967 -- -Odph is equivalent to
1969 -- -O2 optimise as much as possible
1970 -- -fno-method-sharing sharing specialisation defeats fusion
1972 -- -fdicts-cheap always inline dictionaries
1973 -- -fmax-simplifier-iterations20 this is necessary sometimes
1974 -- -fsimplifier-phases=3 we use an additional simplifier phase
1976 -- -fno-spec-constr-threshold run SpecConstr even for big loops
1977 -- -fno-spec-constr-count SpecConstr as much as possible
1978 -- -finline-enough-args hack to prevent excessive inlining
1980 setDPHOpt :: DynFlags -> DynFlags
1981 setDPHOpt dflags = setOptLevel 2 (dflags { maxSimplIterations = 20
1983 , specConstrThreshold = Nothing
1984 , specConstrCount = Nothing
1986 `dopt_set` Opt_DictsCheap
1987 `dopt_unset` Opt_MethodSharing
1989 data DPHBackend = DPHPar
1992 deriving(Eq, Ord, Enum, Show)
1994 setDPHBackend :: DPHBackend -> DynP ()
1995 setDPHBackend backend
1997 upd $ \dflags -> dflags { dphBackend = backend }
1998 mapM_ exposePackage (dph_packages backend)
2000 dph_packages DPHThis = []
2001 dph_packages DPHPar = ["dph-prim-par", "dph-par"]
2002 dph_packages DPHSeq = ["dph-prim-seq", "dph-seq"]
2004 dphPackage :: DynFlags -> PackageId
2005 dphPackage dflags = case dphBackend dflags of
2006 DPHPar -> dphParPackageId
2007 DPHSeq -> dphSeqPackageId
2008 DPHThis -> thisPackage dflags
2010 setMainIs :: String -> DynP ()
2012 | not (null main_fn) && isLower (head main_fn)
2013 -- The arg looked like "Foo.Bar.baz"
2014 = upd $ \d -> d{ mainFunIs = Just main_fn,
2015 mainModIs = mkModule mainPackageId (mkModuleName main_mod) }
2017 | isUpper (head arg) -- The arg looked like "Foo" or "Foo.Bar"
2018 = upd $ \d -> d{ mainModIs = mkModule mainPackageId (mkModuleName arg) }
2020 | otherwise -- The arg looked like "baz"
2021 = upd $ \d -> d{ mainFunIs = Just arg }
2023 (main_mod, main_fn) = splitLongestPrefix arg (== '.')
2025 -----------------------------------------------------------------------------
2026 -- Paths & Libraries
2028 addImportPath, addLibraryPath, addIncludePath, addFrameworkPath :: FilePath -> DynP ()
2030 -- -i on its own deletes the import paths
2031 addImportPath "" = upd (\s -> s{importPaths = []})
2032 addImportPath p = upd (\s -> s{importPaths = importPaths s ++ splitPathList p})
2036 upd (\s -> s{libraryPaths = libraryPaths s ++ splitPathList p})
2039 upd (\s -> s{includePaths = includePaths s ++ splitPathList p})
2041 addFrameworkPath p =
2042 upd (\s -> s{frameworkPaths = frameworkPaths s ++ splitPathList p})
2044 #ifndef mingw32_TARGET_OS
2045 split_marker :: Char
2046 split_marker = ':' -- not configurable (ToDo)
2049 splitPathList :: String -> [String]
2050 splitPathList s = filter notNull (splitUp s)
2051 -- empty paths are ignored: there might be a trailing
2052 -- ':' in the initial list, for example. Empty paths can
2053 -- cause confusion when they are translated into -I options
2054 -- for passing to gcc.
2056 #ifndef mingw32_TARGET_OS
2057 splitUp xs = split split_marker xs
2059 -- Windows: 'hybrid' support for DOS-style paths in directory lists.
2061 -- That is, if "foo:bar:baz" is used, this interpreted as
2062 -- consisting of three entries, 'foo', 'bar', 'baz'.
2063 -- However, with "c:/foo:c:\\foo;x:/bar", this is interpreted
2064 -- as 3 elts, "c:/foo", "c:\\foo", "x:/bar"
2066 -- Notice that no attempt is made to fully replace the 'standard'
2067 -- split marker ':' with the Windows / DOS one, ';'. The reason being
2068 -- that this will cause too much breakage for users & ':' will
2069 -- work fine even with DOS paths, if you're not insisting on being silly.
2072 splitUp (x:':':div:xs) | div `elem` dir_markers
2073 = ((x:':':div:p): splitUp rs)
2075 (p,rs) = findNextPath xs
2076 -- we used to check for existence of the path here, but that
2077 -- required the IO monad to be threaded through the command-line
2078 -- parser which is quite inconvenient. The
2079 splitUp xs = cons p (splitUp rs)
2081 (p,rs) = findNextPath xs
2086 -- will be called either when we've consumed nought or the
2087 -- "<Drive>:/" part of a DOS path, so splitting is just a Q of
2088 -- finding the next split marker.
2090 case break (`elem` split_markers) xs of
2091 (p, _:ds) -> (p, ds)
2094 split_markers :: [Char]
2095 split_markers = [':', ';']
2097 dir_markers :: [Char]
2098 dir_markers = ['/', '\\']
2101 -- -----------------------------------------------------------------------------
2102 -- tmpDir, where we store temporary files.
2104 setTmpDir :: FilePath -> DynFlags -> DynFlags
2105 setTmpDir dir dflags = dflags{ tmpDir = normalise dir }
2106 -- we used to fix /cygdrive/c/.. on Windows, but this doesn't
2107 -- seem necessary now --SDM 7/2/2008
2109 -----------------------------------------------------------------------------
2112 setRtsOpts :: String -> DynP ()
2113 setRtsOpts arg = upd $ \ d -> d {rtsOpts = Just arg}
2115 setRtsOptsEnabled :: RtsOptsEnabled -> DynP ()
2116 setRtsOptsEnabled arg = upd $ \ d -> d {rtsOptsEnabled = arg}
2118 -----------------------------------------------------------------------------
2121 setOptHpcDir :: String -> DynP ()
2122 setOptHpcDir arg = upd $ \ d -> d{hpcDir = arg}
2124 -----------------------------------------------------------------------------
2125 -- Via-C compilation stuff
2127 -- There are some options that we need to pass to gcc when compiling
2128 -- Haskell code via C, but are only supported by recent versions of
2129 -- gcc. The configure script decides which of these options we need,
2130 -- and puts them in the file "extra-gcc-opts" in $topdir, which is
2131 -- read before each via-C compilation. The advantage of having these
2132 -- in a separate file is that the file can be created at install-time
2133 -- depending on the available gcc version, and even re-generated later
2134 -- if gcc is upgraded.
2136 -- The options below are not dependent on the version of gcc, only the
2139 machdepCCOpts :: DynFlags -> ([String], -- flags for all C compilations
2140 [String]) -- for registerised HC compilations
2141 machdepCCOpts _dflags
2142 #if alpha_TARGET_ARCH
2144 #ifdef HAVE_THREADED_RTS_SUPPORT
2148 -- For now, to suppress the gcc warning "call-clobbered
2149 -- register used for global register variable", we simply
2150 -- disable all warnings altogether using the -w flag. Oh well.
2152 #elif hppa_TARGET_ARCH
2153 -- ___HPUX_SOURCE, not _HPUX_SOURCE, is #defined if -ansi!
2154 -- (very nice, but too bad the HP /usr/include files don't agree.)
2155 = ( ["-D_HPUX_SOURCE"], [] )
2157 #elif m68k_TARGET_ARCH
2158 -- -fno-defer-pop : for the .hc files, we want all the pushing/
2159 -- popping of args to routines to be explicit; if we let things
2160 -- be deferred 'til after an STGJUMP, imminent death is certain!
2162 -- -fomit-frame-pointer : *don't*
2163 -- It's better to have a6 completely tied up being a frame pointer
2164 -- rather than let GCC pick random things to do with it.
2165 -- (If we want to steal a6, then we would try to do things
2166 -- as on iX86, where we *do* steal the frame pointer [%ebp].)
2167 = ( [], ["-fno-defer-pop", "-fno-omit-frame-pointer"] )
2169 #elif i386_TARGET_ARCH
2170 -- -fno-defer-pop : basically the same game as for m68k
2172 -- -fomit-frame-pointer : *must* in .hc files; because we're stealing
2173 -- the fp (%ebp) for our register maps.
2174 = let n_regs = stolen_x86_regs _dflags
2177 #if darwin_TARGET_OS
2178 -- By default, gcc on OS X will generate SSE
2179 -- instructions, which need things 16-byte aligned,
2180 -- but we don't 16-byte align things. Thus drop
2181 -- back to generic i686 compatibility. Trac #2983.
2183 -- Since Snow Leopard (10.6), gcc defaults to x86_64.
2184 ["-march=i686", "-m32"],
2186 [ if opt_Static then "-DDONT_WANT_WIN32_DLL_SUPPORT" else ""
2190 "-fomit-frame-pointer",
2191 -- we want -fno-builtin, because when gcc inlines
2192 -- built-in functions like memcpy() it tends to
2193 -- run out of registers, requiring -monly-n-regs
2195 "-DSTOLEN_X86_REGS="++show n_regs ]
2198 #elif ia64_TARGET_ARCH
2199 = ( [], ["-fomit-frame-pointer", "-G0"] )
2201 #elif x86_64_TARGET_ARCH
2203 #if darwin_TARGET_OS
2208 ["-fomit-frame-pointer",
2209 "-fno-asynchronous-unwind-tables",
2210 -- the unwind tables are unnecessary for HC code,
2211 -- and get in the way of -split-objs. Another option
2212 -- would be to throw them away in the mangler, but this
2215 -- calling builtins like strlen() using the FFI can
2216 -- cause gcc to run out of regs, so use the external
2220 #elif sparc_TARGET_ARCH
2222 -- For now, to suppress the gcc warning "call-clobbered
2223 -- register used for global register variable", we simply
2224 -- disable all warnings altogether using the -w flag. Oh well.
2226 #elif powerpc_apple_darwin_TARGET
2228 -- Disable Apple's precompiling preprocessor. It's a great thing
2229 -- for "normal" programs, but it doesn't support register variable
2231 = ( [], ["-no-cpp-precomp"] )
2236 picCCOpts :: DynFlags -> [String]
2238 #if darwin_TARGET_OS
2239 -- Apple prefers to do things the other way round.
2240 -- PIC is on by default.
2241 -- -mdynamic-no-pic:
2242 -- Turn off PIC code generation.
2244 -- Don't generate "common" symbols - these are unwanted
2245 -- in dynamic libraries.
2248 = ["-fno-common", "-U __PIC__","-D__PIC__"]
2250 = ["-mdynamic-no-pic"]
2251 #elif mingw32_TARGET_OS
2252 -- no -fPIC for Windows
2254 = ["-U __PIC__","-D__PIC__"]
2258 -- we need -fPIC for C files when we are compiling with -dynamic,
2259 -- otherwise things like stub.c files don't get compiled
2260 -- correctly. They need to reference data in the Haskell
2261 -- objects, but can't without -fPIC. See
2262 -- http://hackage.haskell.org/trac/ghc/wiki/Commentary/PositionIndependentCode
2263 | opt_PIC || not opt_Static
2264 = ["-fPIC", "-U __PIC__", "-D__PIC__"]
2269 -- -----------------------------------------------------------------------------
2273 can_split = cSplitObjs == "YES"
2275 -- -----------------------------------------------------------------------------
2278 data Printable = String String
2279 | FromDynFlags (DynFlags -> String)
2281 compilerInfo :: [(String, Printable)]
2282 compilerInfo = [("Project name", String cProjectName),
2283 ("Project version", String cProjectVersion),
2284 ("Booter version", String cBooterVersion),
2285 ("Stage", String cStage),
2286 ("Build platform", String cBuildPlatform),
2287 ("Host platform", String cHostPlatform),
2288 ("Target platform", String cTargetPlatform),
2289 ("Have interpreter", String cGhcWithInterpreter),
2290 ("Object splitting", String cSplitObjs),
2291 ("Have native code generator", String cGhcWithNativeCodeGen),
2292 ("Have llvm code generator", String cGhcWithLlvmCodeGen),
2293 ("Support SMP", String cGhcWithSMP),
2294 ("Unregisterised", String cGhcUnregisterised),
2295 ("Tables next to code", String cGhcEnableTablesNextToCode),
2296 ("RTS ways", String cGhcRTSWays),
2297 ("Leading underscore", String cLeadingUnderscore),
2298 ("Debug on", String (show debugIsOn)),
2299 ("LibDir", FromDynFlags topDir),
2300 ("Global Package DB", FromDynFlags systemPackageConfig)