Ensure runhaskell is rebuild in stage2
[ghc-hetmet.git] / compiler / main / StaticFlags.hs
1 -----------------------------------------------------------------------------
2 --
3 -- Static flags
4 --
5 -- Static flags can only be set once, on the command-line.  Inside GHC,
6 -- each static flag corresponds to a top-level value, usually of type Bool.
7 --
8 -- (c) The University of Glasgow 2005
9 --
10 -----------------------------------------------------------------------------
11
12 module StaticFlags (
13         parseStaticFlags,
14         staticFlags,
15         initStaticOpts,
16
17         -- Ways
18         WayName(..), v_Ways, v_Build_tag, v_RTS_Build_tag, isRTSWay,
19
20         -- Output style options
21         opt_PprUserLength,
22         opt_SuppressUniques,
23         opt_PprStyle_Debug,
24
25         -- profiling opts
26         opt_AutoSccsOnAllToplevs,
27         opt_AutoSccsOnExportedToplevs,
28         opt_AutoSccsOnIndividualCafs,
29         opt_SccProfilingOn,
30         opt_DoTickyProfiling,
31
32         -- Hpc opts
33         opt_Hpc,
34
35         -- language opts
36         opt_DictsStrict,
37         opt_IrrefutableTuples,
38         opt_Parallel,
39
40         -- optimisation opts
41         opt_NoStateHack,
42         opt_SpecInlineJoinPoints,
43         opt_CprOff,
44         opt_SimplNoPreInlining,
45         opt_SimplExcessPrecision,
46         opt_MaxWorkerArgs,
47
48         -- Unfolding control
49         opt_UF_CreationThreshold,
50         opt_UF_UseThreshold,
51         opt_UF_FunAppDiscount,
52         opt_UF_KeenessFactor,
53         opt_UF_DearOp,
54
55         -- Related to linking
56         opt_PIC,
57         opt_Static,
58
59         -- misc opts
60         opt_IgnoreDotGhci,
61         opt_ErrorSpans,
62         opt_GranMacros,
63         opt_HiVersion,
64         opt_HistorySize,
65         opt_OmitBlackHoling,
66         opt_Unregisterised,
67         opt_EmitExternalCore,
68         v_Ld_inputs,
69         tablesNextToCode
70   ) where
71
72 #include "HsVersions.h"
73
74 import CmdLineParser
75 import Config
76 import FastString
77 import Util
78 import Maybes           ( firstJust )
79 import Panic
80
81 import Control.Exception ( throwDyn )
82 import Data.IORef
83 import System.IO.Unsafe ( unsafePerformIO )
84 import Control.Monad    ( when )
85 import Data.Char        ( isDigit )
86 import Data.List
87
88 -----------------------------------------------------------------------------
89 -- Static flags
90
91 parseStaticFlags :: [String] -> IO [String]
92 parseStaticFlags args = do
93   ready <- readIORef v_opt_C_ready
94   when ready $ throwDyn (ProgramError "Too late for parseStaticFlags: call it before newSession")
95
96   (leftover, errs) <- processArgs static_flags args
97   when (not (null errs)) $ throwDyn (UsageError (unlines errs))
98
99     -- deal with the way flags: the way (eg. prof) gives rise to
100     -- further flags, some of which might be static.
101   way_flags <- findBuildTag
102
103     -- if we're unregisterised, add some more flags
104   let unreg_flags | cGhcUnregisterised == "YES" = unregFlags
105                   | otherwise = []
106
107   (more_leftover, errs) <- processArgs static_flags (unreg_flags ++ way_flags)
108
109     -- see sanity code in staticOpts
110   writeIORef v_opt_C_ready True
111
112     -- TABLES_NEXT_TO_CODE affects the info table layout.
113     -- Be careful to do this *after* all processArgs,
114     -- because evaluating tablesNextToCode involves looking at the global
115     -- static flags.  Those pesky global variables...
116   let cg_flags | tablesNextToCode = ["-optc-DTABLES_NEXT_TO_CODE"]
117                | otherwise        = []
118
119     -- HACK: -fexcess-precision is both a static and a dynamic flag.  If
120     -- the static flag parser has slurped it, we must return it as a 
121     -- leftover too.  ToDo: make -fexcess-precision dynamic only.
122   let excess_prec | opt_SimplExcessPrecision = ["-fexcess-precision"]
123                   | otherwise                = []
124
125   when (not (null errs)) $ ghcError (UsageError (unlines errs))
126   return (excess_prec++cg_flags++more_leftover++leftover)
127
128 initStaticOpts :: IO ()
129 initStaticOpts = writeIORef v_opt_C_ready True
130
131 static_flags :: [(String, OptKind IO)]
132 -- All the static flags should appear in this list.  It describes how each
133 -- static flag should be processed.  Two main purposes:
134 -- (a) if a command-line flag doesn't appear in the list, GHC can complain
135 -- (b) a command-line flag may remove, or add, other flags; e.g. the "-fno-X" things
136 --
137 -- The common (PassFlag addOpt) action puts the static flag into the bunch of
138 -- things that are searched up by the top-level definitions like
139 --      opt_foo = lookUp (fsLit "-dfoo")
140
141 -- Note that ordering is important in the following list: any flag which
142 -- is a prefix flag (i.e. HasArg, Prefix, OptPrefix, AnySuffix) will override
143 -- flags further down the list with the same prefix.
144
145 static_flags = [
146         ------- GHCi -------------------------------------------------------
147      ( "ignore-dot-ghci", PassFlag addOpt )
148   ,  ( "read-dot-ghci"  , NoArg (removeOpt "-ignore-dot-ghci") )
149
150         ------- ways --------------------------------------------------------
151   ,  ( "prof"           , NoArg (addWay WayProf) )
152   ,  ( "ticky"          , NoArg (addWay WayTicky) )
153   ,  ( "parallel"       , NoArg (addWay WayPar) )
154   ,  ( "gransim"        , NoArg (addWay WayGran) )
155   ,  ( "smp"            , NoArg (addWay WayThreaded) ) -- backwards compat.
156   ,  ( "debug"          , NoArg (addWay WayDebug) )
157   ,  ( "ndp"            , NoArg (addWay WayNDP) )
158   ,  ( "threaded"       , NoArg (addWay WayThreaded) )
159         -- ToDo: user ways
160
161         ------ Debugging ----------------------------------------------------
162   ,  ( "dppr-debug",        PassFlag addOpt )
163   ,  ( "dsuppress-uniques", PassFlag addOpt )
164   ,  ( "dppr-user-length",  AnySuffix addOpt )
165       -- rest of the debugging flags are dynamic
166
167         --------- Profiling --------------------------------------------------
168   ,  ( "auto-all"       , NoArg (addOpt "-fauto-sccs-on-all-toplevs") )
169   ,  ( "auto"           , NoArg (addOpt "-fauto-sccs-on-exported-toplevs") )
170   ,  ( "caf-all"        , NoArg (addOpt "-fauto-sccs-on-individual-cafs") )
171          -- "ignore-sccs"  doesn't work  (ToDo)
172
173   ,  ( "no-auto-all"    , NoArg (removeOpt "-fauto-sccs-on-all-toplevs") )
174   ,  ( "no-auto"        , NoArg (removeOpt "-fauto-sccs-on-exported-toplevs") )
175   ,  ( "no-caf-all"     , NoArg (removeOpt "-fauto-sccs-on-individual-cafs") )
176
177         ------- Miscellaneous -----------------------------------------------
178   ,  ( "no-link-chk"    , NoArg (return ()) ) -- ignored for backwards compat
179
180         ----- Linker --------------------------------------------------------
181   ,  ( "static"         , PassFlag addOpt )
182   ,  ( "dynamic"        , NoArg (removeOpt "-static") )
183   ,  ( "rdynamic"       , NoArg (return ()) ) -- ignored for compat w/ gcc
184
185         ----- RTS opts ------------------------------------------------------
186   ,  ( "H"                 , HasArg (setHeapSize . fromIntegral . decodeSize) )
187   ,  ( "Rghc-timing"       , NoArg  (enableTimingStats) )
188
189         ------ Compiler flags -----------------------------------------------
190         -- All other "-fno-<blah>" options cancel out "-f<blah>" on the hsc cmdline
191   ,  ( "fno-",                  PrefixPred (\s -> isStaticFlag ("f"++s))
192                                     (\s -> removeOpt ("-f"++s)) )
193
194         -- Pass all remaining "-f<blah>" options to hsc
195   ,  ( "f",                     AnySuffixPred (isStaticFlag) addOpt )
196   ]
197
198 addOpt :: String -> IO ()
199 addOpt = consIORef v_opt_C
200
201 addWay :: WayName -> IO ()
202 addWay = consIORef v_Ways
203
204 removeOpt :: String -> IO ()
205 removeOpt f = do
206   fs <- readIORef v_opt_C
207   writeIORef v_opt_C $! filter (/= f) fs    
208
209 lookUp           :: FastString -> Bool
210 lookup_def_int   :: String -> Int -> Int
211 lookup_def_float :: String -> Float -> Float
212 lookup_str       :: String -> Maybe String
213
214 -- holds the static opts while they're being collected, before
215 -- being unsafely read by unpacked_static_opts below.
216 GLOBAL_VAR(v_opt_C, defaultStaticOpts, [String])
217 GLOBAL_VAR(v_opt_C_ready, False, Bool)
218
219 staticFlags :: [String]
220 staticFlags = unsafePerformIO $ do
221   ready <- readIORef v_opt_C_ready
222   if (not ready)
223         then panic "Static flags have not been initialised!\n        Please call GHC.newSession or GHC.parseStaticFlags early enough."
224         else readIORef v_opt_C
225
226 -- -static is the default
227 defaultStaticOpts :: [String]
228 defaultStaticOpts = ["-static"]
229
230 packed_static_opts :: [FastString]
231 packed_static_opts   = map mkFastString staticFlags
232
233 lookUp     sw = sw `elem` packed_static_opts
234         
235 -- (lookup_str "foo") looks for the flag -foo=X or -fooX, 
236 -- and returns the string X
237 lookup_str sw 
238    = case firstJust (map (startsWith sw) staticFlags) of
239         Just ('=' : str) -> Just str
240         Just str         -> Just str
241         Nothing          -> Nothing     
242
243 lookup_def_int sw def = case (lookup_str sw) of
244                             Nothing -> def              -- Use default
245                             Just xx -> try_read sw xx
246
247 lookup_def_float sw def = case (lookup_str sw) of
248                             Nothing -> def              -- Use default
249                             Just xx -> try_read sw xx
250
251
252 try_read :: Read a => String -> String -> a
253 -- (try_read sw str) tries to read s; if it fails, it
254 -- bleats about flag sw
255 try_read sw str
256   = case reads str of
257         ((x,_):_) -> x  -- Be forgiving: ignore trailing goop, and alternative parses
258         []        -> ghcError (UsageError ("Malformed argument " ++ str ++ " for flag " ++ sw))
259                         -- ToDo: hack alert. We should really parse the arugments
260                         --       and announce errors in a more civilised way.
261
262
263 {-
264  Putting the compiler options into temporary at-files
265  may turn out to be necessary later on if we turn hsc into
266  a pure Win32 application where I think there's a command-line
267  length limit of 255. unpacked_opts understands the @ option.
268
269 unpacked_opts :: [String]
270 unpacked_opts =
271   concat $
272   map (expandAts) $
273   map unpackFS argv  -- NOT ARGV any more: v_Static_hsc_opts
274   where
275    expandAts ('@':fname) = words (unsafePerformIO (readFile fname))
276    expandAts l = [l]
277 -}
278
279 opt_IgnoreDotGhci :: Bool
280 opt_IgnoreDotGhci               = lookUp (fsLit "-ignore-dot-ghci")
281
282 -- debugging opts
283 opt_SuppressUniques :: Bool
284 opt_SuppressUniques             = lookUp  (fsLit "-dsuppress-uniques")
285 opt_PprStyle_Debug :: Bool
286 opt_PprStyle_Debug              = lookUp  (fsLit "-dppr-debug")
287 opt_PprUserLength :: Int
288 opt_PprUserLength               = lookup_def_int "-dppr-user-length" 5 --ToDo: give this a name
289
290 -- profiling opts
291 opt_AutoSccsOnAllToplevs :: Bool
292 opt_AutoSccsOnAllToplevs        = lookUp  (fsLit "-fauto-sccs-on-all-toplevs")
293 opt_AutoSccsOnExportedToplevs :: Bool
294 opt_AutoSccsOnExportedToplevs   = lookUp  (fsLit "-fauto-sccs-on-exported-toplevs")
295 opt_AutoSccsOnIndividualCafs :: Bool
296 opt_AutoSccsOnIndividualCafs    = lookUp  (fsLit "-fauto-sccs-on-individual-cafs")
297 opt_SccProfilingOn :: Bool
298 opt_SccProfilingOn              = lookUp  (fsLit "-fscc-profiling")
299 opt_DoTickyProfiling :: Bool
300 opt_DoTickyProfiling            = WayTicky `elem` (unsafePerformIO $ readIORef v_Ways)
301
302 -- Hpc opts
303 opt_Hpc :: Bool
304 opt_Hpc                         = lookUp (fsLit "-fhpc")  
305
306 -- language opts
307 opt_DictsStrict :: Bool
308 opt_DictsStrict                 = lookUp  (fsLit "-fdicts-strict")
309 opt_IrrefutableTuples :: Bool
310 opt_IrrefutableTuples           = lookUp  (fsLit "-firrefutable-tuples")
311 opt_Parallel :: Bool
312 opt_Parallel                    = lookUp  (fsLit "-fparallel")
313
314 -- optimisation opts
315 opt_SpecInlineJoinPoints :: Bool
316 opt_SpecInlineJoinPoints        = lookUp  (fsLit "-fspec-inline-join-points")
317 opt_NoStateHack :: Bool
318 opt_NoStateHack                 = lookUp  (fsLit "-fno-state-hack")
319 opt_CprOff :: Bool
320 opt_CprOff                      = lookUp  (fsLit "-fcpr-off")
321         -- Switch off CPR analysis in the new demand analyser
322 opt_MaxWorkerArgs :: Int
323 opt_MaxWorkerArgs               = lookup_def_int "-fmax-worker-args" (10::Int)
324
325 opt_GranMacros :: Bool
326 opt_GranMacros                  = lookUp  (fsLit "-fgransim")
327 opt_HiVersion :: Integer
328 opt_HiVersion                   = read (cProjectVersionInt ++ cProjectPatchLevel) :: Integer
329 opt_HistorySize :: Int
330 opt_HistorySize                 = lookup_def_int "-fhistory-size" 20
331 opt_OmitBlackHoling :: Bool
332 opt_OmitBlackHoling             = lookUp  (fsLit "-dno-black-holing")
333
334 -- Simplifier switches
335 opt_SimplNoPreInlining :: Bool
336 opt_SimplNoPreInlining          = lookUp  (fsLit "-fno-pre-inlining")
337         -- NoPreInlining is there just to see how bad things
338         -- get if you don't do it!
339 opt_SimplExcessPrecision :: Bool
340 opt_SimplExcessPrecision        = lookUp  (fsLit "-fexcess-precision")
341
342 -- Unfolding control
343 opt_UF_CreationThreshold :: Int
344 opt_UF_CreationThreshold        = lookup_def_int "-funfolding-creation-threshold"  (45::Int)
345 opt_UF_UseThreshold :: Int
346 opt_UF_UseThreshold             = lookup_def_int "-funfolding-use-threshold"       (8::Int)     -- Discounts can be big
347 opt_UF_FunAppDiscount :: Int
348 opt_UF_FunAppDiscount           = lookup_def_int "-funfolding-fun-discount"        (6::Int)     -- It's great to inline a fn
349 opt_UF_KeenessFactor :: Float
350 opt_UF_KeenessFactor            = lookup_def_float "-funfolding-keeness-factor"    (1.5::Float)
351
352 opt_UF_DearOp :: Int
353 opt_UF_DearOp   = ( 4 :: Int)
354
355 opt_PIC :: Bool
356 #if darwin_TARGET_OS && x86_64_TARGET_ARCH
357 opt_PIC                         = True
358 #else
359 opt_PIC                         = lookUp (fsLit "-fPIC")
360 #endif
361 opt_Static :: Bool
362 opt_Static                      = lookUp  (fsLit "-static")
363 opt_Unregisterised :: Bool
364 opt_Unregisterised              = lookUp  (fsLit "-funregisterised")
365
366 -- Derived, not a real option.  Determines whether we will be compiling
367 -- info tables that reside just before the entry code, or with an
368 -- indirection to the entry code.  See TABLES_NEXT_TO_CODE in 
369 -- includes/InfoTables.h.
370 tablesNextToCode :: Bool
371 tablesNextToCode                = not opt_Unregisterised
372                                   && cGhcEnableTablesNextToCode == "YES"
373
374 opt_EmitExternalCore :: Bool
375 opt_EmitExternalCore            = lookUp  (fsLit "-fext-core")
376
377 -- Include full span info in error messages, instead of just the start position.
378 opt_ErrorSpans :: Bool
379 opt_ErrorSpans                  = lookUp (fsLit "-ferror-spans")
380
381
382 -- object files and libraries to be linked in are collected here.
383 -- ToDo: perhaps this could be done without a global, it wasn't obvious
384 -- how to do it though --SDM.
385 GLOBAL_VAR(v_Ld_inputs, [],      [String])
386
387 isStaticFlag :: String -> Bool
388 isStaticFlag f =
389   f `elem` [
390         "fauto-sccs-on-all-toplevs",
391         "fauto-sccs-on-exported-toplevs",
392         "fauto-sccs-on-individual-cafs",
393         "fscc-profiling",
394         "fdicts-strict",
395         "fspec-inline-join-points",
396         "firrefutable-tuples",
397         "fparallel",
398         "fgransim",
399         "fno-hi-version-check",
400         "dno-black-holing",
401         "fno-method-sharing",
402         "fno-state-hack",
403         "fruntime-types",
404         "fno-pre-inlining",
405         "fexcess-precision",
406         "static",
407         "fhardwire-lib-paths",
408         "funregisterised",
409         "fext-core",
410         "fcpr-off",
411         "ferror-spans",
412         "fPIC",
413         "fhpc"
414         ]
415   || any (`isPrefixOf` f) [
416         "fliberate-case-threshold",
417         "fmax-worker-args",
418         "fhistory-size",
419         "funfolding-creation-threshold",
420         "funfolding-use-threshold",
421         "funfolding-fun-discount",
422         "funfolding-keeness-factor"
423      ]
424
425
426
427 -- Misc functions for command-line options
428
429 startsWith :: String -> String -> Maybe String
430 -- startsWith pfx (pfx++rest) = Just rest
431
432 startsWith []     str = Just str
433 startsWith (c:cs) (s:ss)
434   = if c /= s then Nothing else startsWith cs ss
435 startsWith  _     []  = Nothing
436
437
438 -----------------------------------------------------------------------------
439 -- convert sizes like "3.5M" into integers
440
441 decodeSize :: String -> Integer
442 decodeSize str
443   | c == ""              = truncate n
444   | c == "K" || c == "k" = truncate (n * 1000)
445   | c == "M" || c == "m" = truncate (n * 1000 * 1000)
446   | c == "G" || c == "g" = truncate (n * 1000 * 1000 * 1000)
447   | otherwise            = throwDyn (CmdLineError ("can't decode size: " ++ str))
448   where (m, c) = span pred str
449         n      = readRational m
450         pred c = isDigit c || c == '.'
451
452
453 -----------------------------------------------------------------------------
454 -- RTS Hooks
455
456 foreign import ccall unsafe "setHeapSize"       setHeapSize       :: Int -> IO ()
457 foreign import ccall unsafe "enableTimingStats" enableTimingStats :: IO ()
458
459 -----------------------------------------------------------------------------
460 -- Ways
461
462 -- The central concept of a "way" is that all objects in a given
463 -- program must be compiled in the same "way".  Certain options change
464 -- parameters of the virtual machine, eg. profiling adds an extra word
465 -- to the object header, so profiling objects cannot be linked with
466 -- non-profiling objects.
467
468 -- After parsing the command-line options, we determine which "way" we
469 -- are building - this might be a combination way, eg. profiling+ticky-ticky.
470
471 -- We then find the "build-tag" associated with this way, and this
472 -- becomes the suffix used to find .hi files and libraries used in
473 -- this compilation.
474
475 GLOBAL_VAR(v_Build_tag, "", String)
476
477 -- The RTS has its own build tag, because there are some ways that
478 -- affect the RTS only.
479 GLOBAL_VAR(v_RTS_Build_tag, "", String)
480
481 data WayName
482   = WayThreaded
483   | WayDebug
484   | WayProf
485   | WayTicky
486   | WayPar
487   | WayGran
488   | WayNDP
489   | WayUser_a
490   | WayUser_b
491   | WayUser_c
492   | WayUser_d
493   | WayUser_e
494   | WayUser_f
495   | WayUser_g
496   | WayUser_h
497   | WayUser_i
498   | WayUser_j
499   | WayUser_k
500   | WayUser_l
501   | WayUser_m
502   | WayUser_n
503   | WayUser_o
504   | WayUser_A
505   | WayUser_B
506   deriving (Eq,Ord)
507
508 GLOBAL_VAR(v_Ways, [] ,[WayName])
509
510 allowed_combination :: [WayName] -> Bool
511 allowed_combination way = and [ x `allowedWith` y 
512                               | x <- way, y <- way, x < y ]
513   where
514         -- Note ordering in these tests: the left argument is
515         -- <= the right argument, according to the Ord instance
516         -- on Way above.
517
518         -- debug is allowed with everything
519         _ `allowedWith` WayDebug                = True
520         WayDebug `allowedWith` _                = True
521
522         WayProf `allowedWith` WayNDP            = True
523         WayThreaded `allowedWith` WayProf       = True
524         _ `allowedWith` _                       = False
525
526
527 findBuildTag :: IO [String]  -- new options
528 findBuildTag = do
529   way_names <- readIORef v_Ways
530   let ws = sort (nub way_names)
531
532   if not (allowed_combination ws)
533       then throwDyn (CmdLineError $
534                     "combination not supported: "  ++
535                     foldr1 (\a b -> a ++ '/':b) 
536                     (map (wayName . lkupWay) ws))
537       else let ways    = map lkupWay ws
538                tag     = mkBuildTag (filter (not.wayRTSOnly) ways)
539                rts_tag = mkBuildTag ways
540                flags   = map wayOpts ways
541            in do
542            writeIORef v_Build_tag tag
543            writeIORef v_RTS_Build_tag rts_tag
544            return (concat flags)
545
546
547
548 mkBuildTag :: [Way] -> String
549 mkBuildTag ways = concat (intersperse "_" (map wayTag ways))
550
551 lkupWay :: WayName -> Way
552 lkupWay w = 
553    case lookup w way_details of
554         Nothing -> error "findBuildTag"
555         Just details -> details
556
557 isRTSWay :: WayName -> Bool
558 isRTSWay = wayRTSOnly . lkupWay 
559
560 data Way = Way {
561   wayTag     :: String,
562   wayRTSOnly :: Bool,
563   wayName    :: String,
564   wayOpts    :: [String]
565   }
566
567 way_details :: [ (WayName, Way) ]
568 way_details =
569   [ (WayThreaded, Way "thr" True "Threaded" [
570 #if defined(freebsd_TARGET_OS)
571 --        "-optc-pthread"
572 --      , "-optl-pthread"
573         -- FreeBSD's default threading library is the KSE-based M:N libpthread,
574         -- which GHC has some problems with.  It's currently not clear whether
575         -- the problems are our fault or theirs, but it seems that using the
576         -- alternative 1:1 threading library libthr works around it:
577           "-optl-lthr"
578 #elif defined(solaris2_TARGET_OS)
579           "-optl-lrt"
580 #endif
581         ] ),
582
583     (WayDebug, Way "debug" True "Debug" [] ),
584
585     (WayProf, Way  "p" False "Profiling"
586         [ "-fscc-profiling"
587         , "-DPROFILING"
588         , "-optc-DPROFILING" ]),
589
590     (WayTicky, Way  "t" True "Ticky-ticky Profiling"  
591         [ "-DTICKY_TICKY"
592         , "-optc-DTICKY_TICKY" ]),
593
594     -- optl's below to tell linker where to find the PVM library -- HWL
595     (WayPar, Way  "mp" False "Parallel" 
596         [ "-fparallel"
597         , "-D__PARALLEL_HASKELL__"
598         , "-optc-DPAR"
599         , "-package concurrent"
600         , "-optc-w"
601         , "-optl-L${PVM_ROOT}/lib/${PVM_ARCH}"
602         , "-optl-lpvm3"
603         , "-optl-lgpvm3" ]),
604
605     -- at the moment we only change the RTS and could share compiler and libs!
606     (WayPar, Way  "mt" False "Parallel ticky profiling" 
607         [ "-fparallel"
608         , "-D__PARALLEL_HASKELL__"
609         , "-optc-DPAR"
610         , "-optc-DPAR_TICKY"
611         , "-package concurrent"
612         , "-optc-w"
613         , "-optl-L${PVM_ROOT}/lib/${PVM_ARCH}"
614         , "-optl-lpvm3"
615         , "-optl-lgpvm3" ]),
616
617     (WayPar, Way  "md" False "Distributed" 
618         [ "-fparallel"
619         , "-D__PARALLEL_HASKELL__"
620         , "-D__DISTRIBUTED_HASKELL__"
621         , "-optc-DPAR"
622         , "-optc-DDIST"
623         , "-package concurrent"
624         , "-optc-w"
625         , "-optl-L${PVM_ROOT}/lib/${PVM_ARCH}"
626         , "-optl-lpvm3"
627         , "-optl-lgpvm3" ]),
628
629     (WayGran, Way  "mg" False "GranSim"
630         [ "-fgransim"
631         , "-D__GRANSIM__"
632         , "-optc-DGRAN"
633         , "-package concurrent" ]),
634
635     (WayNDP, Way  "ndp" False "Nested data parallelism"
636         [ "-fparr"
637         , "-fvectorise"]),
638
639     (WayUser_a,  Way  "a"  False "User way 'a'"  ["$WAY_a_REAL_OPTS"]), 
640     (WayUser_b,  Way  "b"  False "User way 'b'"  ["$WAY_b_REAL_OPTS"]), 
641     (WayUser_c,  Way  "c"  False "User way 'c'"  ["$WAY_c_REAL_OPTS"]), 
642     (WayUser_d,  Way  "d"  False "User way 'd'"  ["$WAY_d_REAL_OPTS"]), 
643     (WayUser_e,  Way  "e"  False "User way 'e'"  ["$WAY_e_REAL_OPTS"]), 
644     (WayUser_f,  Way  "f"  False "User way 'f'"  ["$WAY_f_REAL_OPTS"]), 
645     (WayUser_g,  Way  "g"  False "User way 'g'"  ["$WAY_g_REAL_OPTS"]), 
646     (WayUser_h,  Way  "h"  False "User way 'h'"  ["$WAY_h_REAL_OPTS"]), 
647     (WayUser_i,  Way  "i"  False "User way 'i'"  ["$WAY_i_REAL_OPTS"]), 
648     (WayUser_j,  Way  "j"  False "User way 'j'"  ["$WAY_j_REAL_OPTS"]), 
649     (WayUser_k,  Way  "k"  False "User way 'k'"  ["$WAY_k_REAL_OPTS"]), 
650     (WayUser_l,  Way  "l"  False "User way 'l'"  ["$WAY_l_REAL_OPTS"]), 
651     (WayUser_m,  Way  "m"  False "User way 'm'"  ["$WAY_m_REAL_OPTS"]), 
652     (WayUser_n,  Way  "n"  False "User way 'n'"  ["$WAY_n_REAL_OPTS"]), 
653     (WayUser_o,  Way  "o"  False "User way 'o'"  ["$WAY_o_REAL_OPTS"]), 
654     (WayUser_A,  Way  "A"  False "User way 'A'"  ["$WAY_A_REAL_OPTS"]), 
655     (WayUser_B,  Way  "B"  False "User way 'B'"  ["$WAY_B_REAL_OPTS"]) 
656   ]
657
658 unregFlags :: [String]
659 unregFlags = 
660    [ "-optc-DNO_REGS"
661    , "-optc-DUSE_MINIINTERPRETER"
662    , "-fno-asm-mangling"
663    , "-funregisterised"
664    , "-fvia-C" ]