-----------------------------------------------------------------------------
--- $Id: DriverState.hs,v 1.16 2000/11/21 14:35:05 simonmar Exp $
+-- $Id: DriverState.hs,v 1.23 2001/01/12 11:04:45 simonmar Exp $
--
-- Settings for the driver
--
import TmpFiles ( newTempName )
import Directory ( removeFile )
#endif
+import Panic
-import System
-import IO
import List
import Char
import Monad
-- Misc
GLOBAL_VAR(v_Scale_sizes_by, 1.0, Double)
GLOBAL_VAR(v_Dry_run, False, Bool)
-#if !defined(HAVE_WIN32_DLL_SUPPORT) || defined(DONT_WANT_WIN32_DLL_SUPPORT)
GLOBAL_VAR(v_Static, True, Bool)
-#else
-GLOBAL_VAR(v_Static, False, Bool)
-#endif
GLOBAL_VAR(v_NoHsMain, False, Bool)
GLOBAL_VAR(v_Recomp, True, Bool)
GLOBAL_VAR(v_Collect_ghc_timing, False, Bool)
GLOBAL_VAR(v_CPR, True, Bool)
GLOBAL_VAR(v_CSE, True, Bool)
-hsc_minusO2_flags = hsc_minusO_flags -- for now
-
+-- these are the static flags you get without -O.
hsc_minusNoO_flags =
[
"-fignore-interface-pragmas",
- "-fomit-interface-pragmas"
+ "-fomit-interface-pragmas",
+ "-flet-no-escape"
]
+-- these are the static flags you get when -O is on.
hsc_minusO_flags =
[
"-ffoldr-build-on",
"-fdo-lambda-eta-expansion",
"-fcase-of-case",
"-fcase-merge",
- "-flet-to-case"
+ "-flet-to-case",
+ "-flet-no-escape"
]
+hsc_minusO2_flags = hsc_minusO_flags -- for now
+
getStaticOptimisationFlags 0 = hsc_minusNoO_flags
getStaticOptimisationFlags 1 = hsc_minusO_flags
getStaticOptimisationFlags n = hsc_minusO2_flags
])
]
- else {- level >= 1 -} return [
+ else {- opt_level >= 1 -} return [
-- initial simplify: mk specialiser happy: minimum effort please
CoreDoSimplify (isAmongSimpl [
-- catch it. For the record, the redex is
-- f_el22 (f_el21 r_midblock)
+
-- Leave out lambda lifting for now
-- "-fsimplify", -- Tidy up results of full laziness
-- "[",
-- We want CSE to follow the final full-laziness pass, because it may
-- succeed in commoning up things floated out by full laziness.
- --
- -- CSE must immediately follow a simplification pass, because it relies
- -- on the no-shadowing invariant. See comments at the top of CSE.lhs
- -- So it must NOT follow float-inwards, which can give rise to shadowing,
- -- even if its input doesn't have shadows. Hence putting it between
- -- the two passes.
+ -- CSE used to rely on the no-shadowing invariant, but it doesn't any more
+
if cse then CoreCSE else CoreDoNothing,
CoreDoFloatInwards,
-- Case-liberation for -O2. This should be after
-- strictness analysis and the simplification which follows it.
--- ( ($OptLevel != 2)
--- ? ""
--- : "-fliberate-case -fsimplify [ $Oopt_FB_Support -ffloat-lets-exposing-whnf -ffloat-primops-ok -fcase-of-case -fdo-case-elim -fcase-merge -fdo-lambda-eta-expansion -freuse-con -flet-to-case $Oopt_PedanticBottoms $Oopt_MaxSimplifierIterations $Oopt_ShowSimplifierProgress ]" ),
---
--- "-fliberate-case",
+ if opt_level >= 2 then
+ CoreLiberateCase
+ else
+ CoreDoNothing,
-- Final clean-up simplification:
CoreDoSimplify (isAmongSimpl [
data WayName
= WayProf
| WayUnreg
- | WayDll
| WayTicky
| WayPar
| WayGran
GLOBAL_VAR(v_Ways, [] ,[WayName])
--- ToDo: allow WayDll with any other allowed combination
-
-allowed_combinations =
- [ [WayProf,WayUnreg],
- [WayProf,WaySMP] -- works???
- ]
+allowed_combination way = way `elem` combs
+ where -- the sub-lists must be ordered according to WayName,
+ -- because findBuildTag sorts them
+ combs = [ [WayProf,WayUnreg], [WayProf,WaySMP] ]
findBuildTag :: IO [String] -- new options
findBuildTag = do
writeIORef v_Build_tag (wayTag details)
return (wayOpts details)
- ws -> if ws `notElem` allowed_combinations
+ ws -> if not (allowed_combination ws)
then throwDyn (OtherError $
"combination not supported: " ++
foldr1 (\a b -> a ++ '/':b)
, "-funregisterised"
, "-fvia-C" ]),
- (WayDll, Way "dll" "DLLized"
- [ ]),
-
(WayPar, Way "mp" "Parallel"
[ "-fparallel"
, "-D__PARALLEL_HASKELL__"
GLOBAL_VAR(v_Pgm_s, error "pgm_s", String)
GLOBAL_VAR(v_Pgm_a, cGCC, String)
GLOBAL_VAR(v_Pgm_l, cGCC, String)
+GLOBAL_VAR(v_Pgm_dll, cMkDLL, String)
GLOBAL_VAR(v_Opt_dep, [], [String])
GLOBAL_VAR(v_Anti_opt_C, [], [String])
-- the fp (%ebp) for our register maps.
= do n_regs <- readState stolen_x86_regs
sta <- readIORef v_Static
- return ( [ if sta then "-DDONT_WANT_WIN32_DLL_SUPPORT" else "" ],
+ return ( [ if sta then "-DDONT_WANT_WIN32_DLL_SUPPORT" else "",
+ if suffixMatch "mingw32" cTARGETPLATFORM then "-mno-cygwin" else "" ],
[ "-fno-defer-pop", "-fomit-frame-pointer",
"-DSTOLEN_X86_REGS="++show n_regs ]
)