#include "HsVersions.h"
-import Module ( Module, mkModule )
+import Module ( Module, mkModuleName, mkModule )
+import PackageConfig
import PrelNames ( mAIN )
-import StaticFlags ( opt_Static, opt_PIC,
- WayName(..), v_Ways, v_Build_tag, v_RTS_Build_tag )
+#ifdef i386_TARGET_ARCH
+import StaticFlags ( opt_Static )
+#endif
+import StaticFlags ( opt_PIC, WayName(..), v_Ways, v_Build_tag,
+ v_RTS_Build_tag )
import {-# SOURCE #-} Packages (PackageState)
import DriverPhases ( Phase(..), phaseInputExt )
import Config
| Opt_AllowUndecidableInstances
| Opt_AllowIncoherentInstances
| Opt_MonomorphismRestriction
+ | Opt_MonoPatBinds
| Opt_GlasgowExts
| Opt_FFI
| Opt_PArr -- syntactic support for parallel arrays
| Opt_DoEtaReduction
| Opt_CaseMerge
| Opt_UnboxStrictFields
+ | Opt_DictsCheap
-- misc opts
| Opt_Cpp
importPaths :: [FilePath],
mainModIs :: Module,
mainFunIs :: Maybe String,
+ thisPackage :: PackageId,
-- ways
wayNames :: [WayName], -- way flags from the cmd line
importPaths = ["."],
mainModIs = mAIN,
mainFunIs = Nothing,
+ thisPackage = mainPackageId,
wayNames = panic "ways",
buildTag = panic "buildTag",
Opt_RecompChecking,
Opt_ReadUserPackageConf,
+ Opt_MonoPatBinds, -- Experimentally, I'm making this non-standard
+ -- behaviour the default, to see if anyone notices
+ -- SLPJ July 06
+
Opt_ImplicitPrelude,
Opt_MonomorphismRestriction,
Opt_Strictness,
-- Similarly, don't apply any rules until after full
-- laziness. Notably, list fusion can prevent floating.
- NoCaseOfCase,
- -- Don't do case-of-case transformations.
- -- This makes full laziness work better
+ NoCaseOfCase, -- Don't do case-of-case transformations.
+ -- This makes full laziness work better
MaxSimplifierIterations max_iter
],
-- Case-liberation for -O2. This should be after
-- strictness analysis and the simplification which follows it.
- case rule_check of { Just pat -> CoreDoRuleCheck 0 pat; Nothing -> CoreDoNothing },
+ case rule_check of { Just pat -> CoreDoRuleCheck 0 pat; Nothing -> CoreDoNothing }
+ ]
- if opt_level >= 2 then
- CoreLiberateCase
- else
- CoreDoNothing,
- if opt_level >= 2 then
- CoreDoSpecConstr
- else
- CoreDoNothing,
+ ++
+
+ (if opt_level >= 2 then
+ [ CoreLiberateCase,
+ CoreDoSimplify (SimplPhase 0) [
+ MaxSimplifierIterations max_iter
+ ], -- Run the simplifier after LiberateCase to vastly
+ -- reduce the possiblility of shadowing
+ -- Reason: see Note [Shadowing] in SpecConstr.lhs
+ CoreDoSpecConstr
+ ]
+ else
+ [])
+
+ ++
-- Final clean-up simplification:
- CoreDoSimplify (SimplPhase 0) [
+ [ CoreDoSimplify (SimplPhase 0) [
MaxSimplifierIterations max_iter
]
]
------- Packages ----------------------------------------------------
, ( "package-conf" , HasArg extraPkgConf_ )
, ( "no-user-package-conf", NoArg (unSetDynFlag Opt_ReadUserPackageConf) )
- , ( "package-name" , HasArg ignorePackage ) -- for compatibility
+ , ( "package-name" , HasArg setPackageName )
, ( "package" , HasArg exposePackage )
, ( "hide-package" , HasArg hidePackage )
, ( "hide-all-packages", NoArg (setDynFlag Opt_HideAllPackages) )
( "scoped-type-variables", Opt_ScopedTypeVariables ),
( "bang-patterns", Opt_BangPatterns ),
( "monomorphism-restriction", Opt_MonomorphismRestriction ),
+ ( "mono-pat-binds", Opt_MonoPatBinds ),
( "implicit-params", Opt_ImplicitParams ),
( "allow-overlapping-instances", Opt_AllowOverlappingInstances ),
( "allow-undecidable-instances", Opt_AllowUndecidableInstances ),
( "do-eta-reduction", Opt_DoEtaReduction ),
( "case-merge", Opt_CaseMerge ),
( "unbox-strict-fields", Opt_UnboxStrictFields ),
+ ( "dicts-cheap", Opt_DictsCheap ),
( "excess-precision", Opt_ExcessPrecision ),
( "asm-mangling", Opt_DoAsmMangling )
]
upd (\s -> s{ packageFlags = HidePackage p : packageFlags s })
ignorePackage p =
upd (\s -> s{ packageFlags = IgnorePackage p : packageFlags s })
+setPackageName p
+ | Nothing <- unpackPackageId pid
+ = throwDyn (CmdLineError ("cannot parse \'" ++ p ++ "\' as a package identifier"))
+ | otherwise
+ = upd (\s -> s{ thisPackage = pid })
+ where
+ pid = stringToPackageId p
-- we can only switch between HscC, HscAsmm, and HscILX with dynamic flags
-- (-fvia-C, -fasm, -filx respectively).
setMainIs arg
| not (null main_fn) -- The arg looked like "Foo.baz"
= upd $ \d -> d{ mainFunIs = Just main_fn,
- mainModIs = mkModule main_mod }
+ mainModIs = mkModule mainPackageId (mkModuleName main_mod) }
| isUpper (head main_mod) -- The arg looked like "Foo"
- = upd $ \d -> d{ mainModIs = mkModule main_mod }
+ = upd $ \d -> d{ mainModIs = mkModule mainPackageId (mkModuleName main_mod) }
| otherwise -- The arg looked like "baz"
= upd $ \d -> d{ mainFunIs = Just main_mod }
-- -fomit-frame-pointer, so we disable it first here.
"-mno-omit-leaf-frame-pointer",
#endif
+#ifdef HAVE_GCC_HAS_NO_UNIT_AT_A_TIME
+ "-fno-unit-at-a-time",
+ -- unit-at-a-time doesn't do us any good, and screws
+ -- up -split-objs by moving the split markers around.
+ -- It's only turned on with -O2, but put it here just
+ -- in case someone uses -optc-O2.
+#endif
"-fomit-frame-pointer",
-- we want -fno-builtin, because when gcc inlines
-- built-in functions like memcpy() it tends to
-- and get in the way of -split-objs. Another option
-- would be to throw them away in the mangler, but this
-- is easier.
+#ifdef HAVE_GCC_HAS_NO_UNIT_AT_A_TIME
"-fno-unit-at-a-time",
-- unit-at-a-time doesn't do us any good, and screws
-- up -split-objs by moving the split markers around.
-- It's only turned on with -O2, but put it here just
-- in case someone uses -optc-O2.
+#endif
"-fno-builtin"
-- calling builtins like strlen() using the FFI can
-- cause gcc to run out of regs, so use the external