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