Cmm back end upgrades
[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         ------- Miscellaneous -----------------------------------------------
182   ,  ( "no-link-chk"    , NoArg (return ()) ) -- ignored for backwards compat
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
296 -- profiling opts
297 opt_AutoSccsOnAllToplevs :: Bool
298 opt_AutoSccsOnAllToplevs        = lookUp  (fsLit "-fauto-sccs-on-all-toplevs")
299 opt_AutoSccsOnExportedToplevs :: Bool
300 opt_AutoSccsOnExportedToplevs   = lookUp  (fsLit "-fauto-sccs-on-exported-toplevs")
301 opt_AutoSccsOnIndividualCafs :: Bool
302 opt_AutoSccsOnIndividualCafs    = lookUp  (fsLit "-fauto-sccs-on-individual-cafs")
303 opt_SccProfilingOn :: Bool
304 opt_SccProfilingOn              = lookUp  (fsLit "-fscc-profiling")
305 opt_DoTickyProfiling :: Bool
306 opt_DoTickyProfiling            = WayTicky `elem` (unsafePerformIO $ readIORef v_Ways)
307
308 -- Hpc opts
309 opt_Hpc :: Bool
310 opt_Hpc                         = lookUp (fsLit "-fhpc")  
311
312 -- language opts
313 opt_DictsStrict :: Bool
314 opt_DictsStrict                 = lookUp  (fsLit "-fdicts-strict")
315 opt_IrrefutableTuples :: Bool
316 opt_IrrefutableTuples           = lookUp  (fsLit "-firrefutable-tuples")
317 opt_Parallel :: Bool
318 opt_Parallel                    = lookUp  (fsLit "-fparallel")
319
320 -- optimisation opts
321 opt_SpecInlineJoinPoints :: Bool
322 opt_SpecInlineJoinPoints        = lookUp  (fsLit "-fspec-inline-join-points")
323 opt_NoStateHack :: Bool
324 opt_NoStateHack                 = lookUp  (fsLit "-fno-state-hack")
325 opt_CprOff :: Bool
326 opt_CprOff                      = lookUp  (fsLit "-fcpr-off")
327         -- Switch off CPR analysis in the new demand analyser
328 opt_MaxWorkerArgs :: Int
329 opt_MaxWorkerArgs               = lookup_def_int "-fmax-worker-args" (10::Int)
330
331 opt_GranMacros :: Bool
332 opt_GranMacros                  = lookUp  (fsLit "-fgransim")
333 opt_HiVersion :: Integer
334 opt_HiVersion                   = read (cProjectVersionInt ++ cProjectPatchLevel) :: Integer
335 opt_HistorySize :: Int
336 opt_HistorySize                 = lookup_def_int "-fhistory-size" 20
337 opt_OmitBlackHoling :: Bool
338 opt_OmitBlackHoling             = lookUp  (fsLit "-dno-black-holing")
339
340 -- Simplifier switches
341 opt_SimplNoPreInlining :: Bool
342 opt_SimplNoPreInlining          = lookUp  (fsLit "-fno-pre-inlining")
343         -- NoPreInlining is there just to see how bad things
344         -- get if you don't do it!
345 opt_SimplExcessPrecision :: Bool
346 opt_SimplExcessPrecision        = lookUp  (fsLit "-fexcess-precision")
347
348 -- Unfolding control
349 opt_UF_CreationThreshold :: Int
350 opt_UF_CreationThreshold        = lookup_def_int "-funfolding-creation-threshold"  (45::Int)
351 opt_UF_UseThreshold :: Int
352 opt_UF_UseThreshold             = lookup_def_int "-funfolding-use-threshold"       (8::Int)     -- Discounts can be big
353 opt_UF_FunAppDiscount :: Int
354 opt_UF_FunAppDiscount           = lookup_def_int "-funfolding-fun-discount"        (6::Int)     -- It's great to inline a fn
355 opt_UF_KeenessFactor :: Float
356 opt_UF_KeenessFactor            = lookup_def_float "-funfolding-keeness-factor"    (1.5::Float)
357
358 opt_UF_DearOp :: Int
359 opt_UF_DearOp   = ( 4 :: Int)
360
361
362 -- Related to linking
363 opt_PIC :: Bool
364 #if darwin_TARGET_OS && x86_64_TARGET_ARCH
365 opt_PIC                         = True
366 #else
367 opt_PIC                         = lookUp (fsLit "-fPIC")
368 #endif
369 opt_Static :: Bool
370 opt_Static                      = lookUp  (fsLit "-static")
371 opt_Unregisterised :: Bool
372 opt_Unregisterised              = lookUp  (fsLit "-funregisterised")
373
374 -- Derived, not a real option.  Determines whether we will be compiling
375 -- info tables that reside just before the entry code, or with an
376 -- indirection to the entry code.  See TABLES_NEXT_TO_CODE in 
377 -- includes/InfoTables.h.
378 tablesNextToCode :: Bool
379 tablesNextToCode                = not opt_Unregisterised
380                                   && cGhcEnableTablesNextToCode == "YES"
381
382 opt_EmitExternalCore :: Bool
383 opt_EmitExternalCore            = lookUp  (fsLit "-fext-core")
384
385 -- Include full span info in error messages, instead of just the start position.
386 opt_ErrorSpans :: Bool
387 opt_ErrorSpans                  = lookUp (fsLit "-ferror-spans")
388
389
390 -- object files and libraries to be linked in are collected here.
391 -- ToDo: perhaps this could be done without a global, it wasn't obvious
392 -- how to do it though --SDM.
393 GLOBAL_VAR(v_Ld_inputs, [],      [String])
394
395 isStaticFlag :: String -> Bool
396 isStaticFlag f =
397   f `elem` [
398         "fauto-sccs-on-all-toplevs",
399         "fauto-sccs-on-exported-toplevs",
400         "fauto-sccs-on-individual-cafs",
401         "fscc-profiling",
402         "fdicts-strict",
403         "fspec-inline-join-points",
404         "firrefutable-tuples",
405         "fparallel",
406         "fgransim",
407         "fno-hi-version-check",
408         "dno-black-holing",
409         "fno-method-sharing",
410         "fno-state-hack",
411         "fruntime-types",
412         "fno-pre-inlining",
413         "fexcess-precision",
414         "static",
415         "fhardwire-lib-paths",
416         "funregisterised",
417         "fext-core",
418         "fcpr-off",
419         "ferror-spans",
420         "fPIC",
421         "fhpc"
422         ]
423   || any (`isPrefixOf` f) [
424         "fliberate-case-threshold",
425         "fmax-worker-args",
426         "fhistory-size",
427         "funfolding-creation-threshold",
428         "funfolding-use-threshold",
429         "funfolding-fun-discount",
430         "funfolding-keeness-factor"
431      ]
432
433
434
435 -- Misc functions for command-line options
436
437 startsWith :: String -> String -> Maybe String
438 -- startsWith pfx (pfx++rest) = Just rest
439
440 startsWith []     str = Just str
441 startsWith (c:cs) (s:ss)
442   = if c /= s then Nothing else startsWith cs ss
443 startsWith  _     []  = Nothing
444
445
446 -----------------------------------------------------------------------------
447 -- convert sizes like "3.5M" into integers
448
449 decodeSize :: String -> Integer
450 decodeSize str
451   | c == ""              = truncate n
452   | c == "K" || c == "k" = truncate (n * 1000)
453   | c == "M" || c == "m" = truncate (n * 1000 * 1000)
454   | c == "G" || c == "g" = truncate (n * 1000 * 1000 * 1000)
455   | otherwise            = throwDyn (CmdLineError ("can't decode size: " ++ str))
456   where (m, c) = span pred str
457         n      = readRational m
458         pred c = isDigit c || c == '.'
459
460
461 -----------------------------------------------------------------------------
462 -- RTS Hooks
463
464 foreign import ccall unsafe "setHeapSize"       setHeapSize       :: Int -> IO ()
465 foreign import ccall unsafe "enableTimingStats" enableTimingStats :: IO ()
466
467 -----------------------------------------------------------------------------
468 -- Ways
469
470 -- The central concept of a "way" is that all objects in a given
471 -- program must be compiled in the same "way".  Certain options change
472 -- parameters of the virtual machine, eg. profiling adds an extra word
473 -- to the object header, so profiling objects cannot be linked with
474 -- non-profiling objects.
475
476 -- After parsing the command-line options, we determine which "way" we
477 -- are building - this might be a combination way, eg. profiling+ticky-ticky.
478
479 -- We then find the "build-tag" associated with this way, and this
480 -- becomes the suffix used to find .hi files and libraries used in
481 -- this compilation.
482
483 GLOBAL_VAR(v_Build_tag, "", String)
484
485 -- The RTS has its own build tag, because there are some ways that
486 -- affect the RTS only.
487 GLOBAL_VAR(v_RTS_Build_tag, "", String)
488
489 data WayName
490   = WayThreaded
491   | WayDebug
492   | WayProf
493   | WayTicky
494   | WayPar
495   | WayGran
496   | WayNDP
497   | WayUser_a
498   | WayUser_b
499   | WayUser_c
500   | WayUser_d
501   | WayUser_e
502   | WayUser_f
503   | WayUser_g
504   | WayUser_h
505   | WayUser_i
506   | WayUser_j
507   | WayUser_k
508   | WayUser_l
509   | WayUser_m
510   | WayUser_n
511   | WayUser_o
512   | WayUser_A
513   | WayUser_B
514   deriving (Eq,Ord)
515
516 GLOBAL_VAR(v_Ways, [] ,[WayName])
517
518 allowed_combination :: [WayName] -> Bool
519 allowed_combination way = and [ x `allowedWith` y 
520                               | x <- way, y <- way, x < y ]
521   where
522         -- Note ordering in these tests: the left argument is
523         -- <= the right argument, according to the Ord instance
524         -- on Way above.
525
526         -- debug is allowed with everything
527         _ `allowedWith` WayDebug                = True
528         WayDebug `allowedWith` _                = True
529
530         WayProf `allowedWith` WayNDP            = True
531         WayThreaded `allowedWith` WayProf       = True
532         _ `allowedWith` _                       = False
533
534
535 findBuildTag :: IO [String]  -- new options
536 findBuildTag = do
537   way_names <- readIORef v_Ways
538   let ws = sort (nub way_names)
539
540   if not (allowed_combination ws)
541       then throwDyn (CmdLineError $
542                     "combination not supported: "  ++
543                     foldr1 (\a b -> a ++ '/':b) 
544                     (map (wayName . lkupWay) ws))
545       else let ways    = map lkupWay ws
546                tag     = mkBuildTag (filter (not.wayRTSOnly) ways)
547                rts_tag = mkBuildTag ways
548                flags   = map wayOpts ways
549            in do
550            writeIORef v_Build_tag tag
551            writeIORef v_RTS_Build_tag rts_tag
552            return (concat flags)
553
554
555
556 mkBuildTag :: [Way] -> String
557 mkBuildTag ways = concat (intersperse "_" (map wayTag ways))
558
559 lkupWay :: WayName -> Way
560 lkupWay w = 
561    case lookup w way_details of
562         Nothing -> error "findBuildTag"
563         Just details -> details
564
565 isRTSWay :: WayName -> Bool
566 isRTSWay = wayRTSOnly . lkupWay 
567
568 data Way = Way {
569   wayTag     :: String,
570   wayRTSOnly :: Bool,
571   wayName    :: String,
572   wayOpts    :: [String]
573   }
574
575 way_details :: [ (WayName, Way) ]
576 way_details =
577   [ (WayThreaded, Way "thr" True "Threaded" [
578 #if defined(freebsd_TARGET_OS)
579 --        "-optc-pthread"
580 --      , "-optl-pthread"
581         -- FreeBSD's default threading library is the KSE-based M:N libpthread,
582         -- which GHC has some problems with.  It's currently not clear whether
583         -- the problems are our fault or theirs, but it seems that using the
584         -- alternative 1:1 threading library libthr works around it:
585           "-optl-lthr"
586 #elif defined(solaris2_TARGET_OS)
587           "-optl-lrt"
588 #endif
589         ] ),
590
591     (WayDebug, Way "debug" True "Debug" [] ),
592
593     (WayProf, Way  "p" False "Profiling"
594         [ "-fscc-profiling"
595         , "-DPROFILING"
596         , "-optc-DPROFILING" ]),
597
598     (WayTicky, Way  "t" True "Ticky-ticky Profiling"  
599         [ "-DTICKY_TICKY"
600         , "-optc-DTICKY_TICKY" ]),
601
602     -- optl's below to tell linker where to find the PVM library -- HWL
603     (WayPar, Way  "mp" False "Parallel" 
604         [ "-fparallel"
605         , "-D__PARALLEL_HASKELL__"
606         , "-optc-DPAR"
607         , "-package concurrent"
608         , "-optc-w"
609         , "-optl-L${PVM_ROOT}/lib/${PVM_ARCH}"
610         , "-optl-lpvm3"
611         , "-optl-lgpvm3" ]),
612
613     -- at the moment we only change the RTS and could share compiler and libs!
614     (WayPar, Way  "mt" False "Parallel ticky profiling" 
615         [ "-fparallel"
616         , "-D__PARALLEL_HASKELL__"
617         , "-optc-DPAR"
618         , "-optc-DPAR_TICKY"
619         , "-package concurrent"
620         , "-optc-w"
621         , "-optl-L${PVM_ROOT}/lib/${PVM_ARCH}"
622         , "-optl-lpvm3"
623         , "-optl-lgpvm3" ]),
624
625     (WayPar, Way  "md" False "Distributed" 
626         [ "-fparallel"
627         , "-D__PARALLEL_HASKELL__"
628         , "-D__DISTRIBUTED_HASKELL__"
629         , "-optc-DPAR"
630         , "-optc-DDIST"
631         , "-package concurrent"
632         , "-optc-w"
633         , "-optl-L${PVM_ROOT}/lib/${PVM_ARCH}"
634         , "-optl-lpvm3"
635         , "-optl-lgpvm3" ]),
636
637     (WayGran, Way  "mg" False "GranSim"
638         [ "-fgransim"
639         , "-D__GRANSIM__"
640         , "-optc-DGRAN"
641         , "-package concurrent" ]),
642
643     (WayNDP, Way  "ndp" False "Nested data parallelism"
644         [ "-fparr"
645         , "-fvectorise"]),
646
647     (WayUser_a,  Way  "a"  False "User way 'a'"  ["$WAY_a_REAL_OPTS"]), 
648     (WayUser_b,  Way  "b"  False "User way 'b'"  ["$WAY_b_REAL_OPTS"]), 
649     (WayUser_c,  Way  "c"  False "User way 'c'"  ["$WAY_c_REAL_OPTS"]), 
650     (WayUser_d,  Way  "d"  False "User way 'd'"  ["$WAY_d_REAL_OPTS"]), 
651     (WayUser_e,  Way  "e"  False "User way 'e'"  ["$WAY_e_REAL_OPTS"]), 
652     (WayUser_f,  Way  "f"  False "User way 'f'"  ["$WAY_f_REAL_OPTS"]), 
653     (WayUser_g,  Way  "g"  False "User way 'g'"  ["$WAY_g_REAL_OPTS"]), 
654     (WayUser_h,  Way  "h"  False "User way 'h'"  ["$WAY_h_REAL_OPTS"]), 
655     (WayUser_i,  Way  "i"  False "User way 'i'"  ["$WAY_i_REAL_OPTS"]), 
656     (WayUser_j,  Way  "j"  False "User way 'j'"  ["$WAY_j_REAL_OPTS"]), 
657     (WayUser_k,  Way  "k"  False "User way 'k'"  ["$WAY_k_REAL_OPTS"]), 
658     (WayUser_l,  Way  "l"  False "User way 'l'"  ["$WAY_l_REAL_OPTS"]), 
659     (WayUser_m,  Way  "m"  False "User way 'm'"  ["$WAY_m_REAL_OPTS"]), 
660     (WayUser_n,  Way  "n"  False "User way 'n'"  ["$WAY_n_REAL_OPTS"]), 
661     (WayUser_o,  Way  "o"  False "User way 'o'"  ["$WAY_o_REAL_OPTS"]), 
662     (WayUser_A,  Way  "A"  False "User way 'A'"  ["$WAY_A_REAL_OPTS"]), 
663     (WayUser_B,  Way  "B"  False "User way 'B'"  ["$WAY_B_REAL_OPTS"]) 
664   ]
665
666 unregFlags :: [String]
667 unregFlags = 
668    [ "-optc-DNO_REGS"
669    , "-optc-DUSE_MINIINTERPRETER"
670    , "-fno-asm-mangling"
671    , "-funregisterised"
672    , "-fvia-C" ]