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