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