Change the last few (F)SLIT's into (f)sLit's
[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_NoMethodSharing, 
42         opt_NoStateHack,
43         opt_SpecInlineJoinPoints,
44         opt_CprOff,
45         opt_SimplNoPreInlining,
46         opt_SimplExcessPrecision,
47         opt_MaxWorkerArgs,
48
49         -- Unfolding control
50         opt_UF_CreationThreshold,
51         opt_UF_UseThreshold,
52         opt_UF_FunAppDiscount,
53         opt_UF_KeenessFactor,
54         opt_UF_DearOp,
55
56         -- Related to linking
57         opt_PIC,
58         opt_Static,
59
60         -- misc opts
61         opt_IgnoreDotGhci,
62         opt_ErrorSpans,
63         opt_GranMacros,
64         opt_HiVersion,
65         opt_HistorySize,
66         opt_OmitBlackHoling,
67         opt_Unregisterised,
68         opt_EmitExternalCore,
69         v_Ld_inputs,
70         tablesNextToCode
71   ) where
72
73 #include "HsVersions.h"
74
75 import CmdLineParser
76 import Config
77 import FastString
78 import Util
79 import Maybes           ( firstJust )
80 import Panic
81
82 import Control.Exception ( throwDyn )
83 import Data.IORef
84 import System.IO.Unsafe ( unsafePerformIO )
85 import Control.Monad    ( when )
86 import Data.Char        ( isDigit )
87 import Data.List
88
89 -----------------------------------------------------------------------------
90 -- Static flags
91
92 parseStaticFlags :: [String] -> IO [String]
93 parseStaticFlags args = do
94   ready <- readIORef v_opt_C_ready
95   when ready $ throwDyn (ProgramError "Too late for parseStaticFlags: call it before newSession")
96
97   (leftover, errs) <- processArgs static_flags args
98   when (not (null errs)) $ throwDyn (UsageError (unlines errs))
99
100     -- deal with the way flags: the way (eg. prof) gives rise to
101     -- further flags, some of which might be static.
102   way_flags <- findBuildTag
103
104     -- if we're unregisterised, add some more flags
105   let unreg_flags | cGhcUnregisterised == "YES" = unregFlags
106                   | otherwise = []
107
108   (more_leftover, errs) <- processArgs static_flags (unreg_flags ++ way_flags)
109
110     -- see sanity code in staticOpts
111   writeIORef v_opt_C_ready True
112
113     -- TABLES_NEXT_TO_CODE affects the info table layout.
114     -- Be careful to do this *after* all processArgs,
115     -- because evaluating tablesNextToCode involves looking at the global
116     -- static flags.  Those pesky global variables...
117   let cg_flags | tablesNextToCode = ["-optc-DTABLES_NEXT_TO_CODE"]
118                | otherwise        = []
119
120     -- HACK: -fexcess-precision is both a static and a dynamic flag.  If
121     -- the static flag parser has slurped it, we must return it as a 
122     -- leftover too.  ToDo: make -fexcess-precision dynamic only.
123   let excess_prec | opt_SimplExcessPrecision = ["-fexcess-precision"]
124                   | otherwise                = []
125
126   when (not (null errs)) $ ghcError (UsageError (unlines errs))
127   return (excess_prec++cg_flags++more_leftover++leftover)
128
129 initStaticOpts :: IO ()
130 initStaticOpts = writeIORef v_opt_C_ready True
131
132 static_flags :: [(String, OptKind IO)]
133 -- All the static flags should appear in this list.  It describes how each
134 -- static flag should be processed.  Two main purposes:
135 -- (a) if a command-line flag doesn't appear in the list, GHC can complain
136 -- (b) a command-line flag may remove, or add, other flags; e.g. the "-fno-X" things
137 --
138 -- The common (PassFlag addOpt) action puts the static flag into the bunch of
139 -- things that are searched up by the top-level definitions like
140 --      opt_foo = lookUp (fsLit "-dfoo")
141
142 -- Note that ordering is important in the following list: any flag which
143 -- is a prefix flag (i.e. HasArg, Prefix, OptPrefix, AnySuffix) will override
144 -- flags further down the list with the same prefix.
145
146 static_flags = [
147         ------- GHCi -------------------------------------------------------
148      ( "ignore-dot-ghci", PassFlag addOpt )
149   ,  ( "read-dot-ghci"  , NoArg (removeOpt "-ignore-dot-ghci") )
150
151         ------- ways --------------------------------------------------------
152   ,  ( "prof"           , NoArg (addWay WayProf) )
153   ,  ( "ticky"          , NoArg (addWay WayTicky) )
154   ,  ( "parallel"       , NoArg (addWay WayPar) )
155   ,  ( "gransim"        , NoArg (addWay WayGran) )
156   ,  ( "smp"            , NoArg (addWay WayThreaded) ) -- backwards compat.
157   ,  ( "debug"          , NoArg (addWay WayDebug) )
158   ,  ( "ndp"            , NoArg (addWay WayNDP) )
159   ,  ( "threaded"       , NoArg (addWay WayThreaded) )
160         -- ToDo: user ways
161
162         ------ Debugging ----------------------------------------------------
163   ,  ( "dppr-debug",        PassFlag addOpt )
164   ,  ( "dsuppress-uniques", PassFlag addOpt )
165   ,  ( "dppr-user-length",  AnySuffix addOpt )
166       -- rest of the debugging flags are dynamic
167
168         --------- Profiling --------------------------------------------------
169   ,  ( "auto-all"       , NoArg (addOpt "-fauto-sccs-on-all-toplevs") )
170   ,  ( "auto"           , NoArg (addOpt "-fauto-sccs-on-exported-toplevs") )
171   ,  ( "caf-all"        , NoArg (addOpt "-fauto-sccs-on-individual-cafs") )
172          -- "ignore-sccs"  doesn't work  (ToDo)
173
174   ,  ( "no-auto-all"    , NoArg (removeOpt "-fauto-sccs-on-all-toplevs") )
175   ,  ( "no-auto"        , NoArg (removeOpt "-fauto-sccs-on-exported-toplevs") )
176   ,  ( "no-caf-all"     , NoArg (removeOpt "-fauto-sccs-on-individual-cafs") )
177
178         ------- Miscellaneous -----------------------------------------------
179   ,  ( "no-link-chk"    , NoArg (return ()) ) -- ignored for backwards compat
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
291 -- profiling opts
292 opt_AutoSccsOnAllToplevs :: Bool
293 opt_AutoSccsOnAllToplevs        = lookUp  FSLIT("-fauto-sccs-on-all-toplevs")
294 opt_AutoSccsOnExportedToplevs :: Bool
295 opt_AutoSccsOnExportedToplevs   = lookUp  FSLIT("-fauto-sccs-on-exported-toplevs")
296 opt_AutoSccsOnIndividualCafs :: Bool
297 opt_AutoSccsOnIndividualCafs    = lookUp  FSLIT("-fauto-sccs-on-individual-cafs")
298 opt_SccProfilingOn :: Bool
299 opt_SccProfilingOn              = lookUp  FSLIT("-fscc-profiling")
300 opt_DoTickyProfiling :: Bool
301 opt_DoTickyProfiling            = WayTicky `elem` (unsafePerformIO $ readIORef v_Ways)
302
303 -- Hpc opts
304 opt_Hpc :: Bool
305 opt_Hpc                         = lookUp FSLIT("-fhpc")  
306
307 -- language opts
308 opt_DictsStrict :: Bool
309 opt_DictsStrict                 = lookUp  FSLIT("-fdicts-strict")
310 opt_IrrefutableTuples :: Bool
311 opt_IrrefutableTuples           = lookUp  FSLIT("-firrefutable-tuples")
312 opt_Parallel :: Bool
313 opt_Parallel                    = lookUp  FSLIT("-fparallel")
314
315 -- optimisation opts
316 opt_SpecInlineJoinPoints :: Bool
317 opt_SpecInlineJoinPoints        = lookUp  FSLIT("-fspec-inline-join-points")
318 opt_NoStateHack :: Bool
319 opt_NoStateHack                 = lookUp  FSLIT("-fno-state-hack")
320 opt_NoMethodSharing :: Bool
321 opt_NoMethodSharing             = lookUp  FSLIT("-fno-method-sharing")
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 opt_PIC :: Bool
359 #if darwin_TARGET_OS && x86_64_TARGET_ARCH
360 opt_PIC                         = True
361 #else
362 opt_PIC                         = lookUp FSLIT("-fPIC")
363 #endif
364 opt_Static :: Bool
365 opt_Static                      = lookUp  FSLIT("-static")
366 opt_Unregisterised :: Bool
367 opt_Unregisterised              = lookUp  FSLIT("-funregisterised")
368
369 -- Derived, not a real option.  Determines whether we will be compiling
370 -- info tables that reside just before the entry code, or with an
371 -- indirection to the entry code.  See TABLES_NEXT_TO_CODE in 
372 -- includes/InfoTables.h.
373 tablesNextToCode :: Bool
374 tablesNextToCode                = not opt_Unregisterised
375                                   && cGhcEnableTablesNextToCode == "YES"
376
377 opt_EmitExternalCore :: Bool
378 opt_EmitExternalCore            = lookUp  FSLIT("-fext-core")
379
380 -- Include full span info in error messages, instead of just the start position.
381 opt_ErrorSpans :: Bool
382 opt_ErrorSpans                  = lookUp FSLIT("-ferror-spans")
383
384
385 -- object files and libraries to be linked in are collected here.
386 -- ToDo: perhaps this could be done without a global, it wasn't obvious
387 -- how to do it though --SDM.
388 GLOBAL_VAR(v_Ld_inputs, [],      [String])
389
390 isStaticFlag :: String -> Bool
391 isStaticFlag f =
392   f `elem` [
393         "fauto-sccs-on-all-toplevs",
394         "fauto-sccs-on-exported-toplevs",
395         "fauto-sccs-on-individual-cafs",
396         "fscc-profiling",
397         "fdicts-strict",
398         "fspec-inline-join-points",
399         "firrefutable-tuples",
400         "fparallel",
401         "fgransim",
402         "fno-hi-version-check",
403         "dno-black-holing",
404         "fno-method-sharing",
405         "fno-state-hack",
406         "fruntime-types",
407         "fno-pre-inlining",
408         "fexcess-precision",
409         "static",
410         "fhardwire-lib-paths",
411         "funregisterised",
412         "fext-core",
413         "fcpr-off",
414         "ferror-spans",
415         "fPIC",
416         "fhpc"
417         ]
418   || any (`isPrefixOf` f) [
419         "fliberate-case-threshold",
420         "fmax-worker-args",
421         "fhistory-size",
422         "funfolding-creation-threshold",
423         "funfolding-use-threshold",
424         "funfolding-fun-discount",
425         "funfolding-keeness-factor"
426      ]
427
428
429
430 -- Misc functions for command-line options
431
432 startsWith :: String -> String -> Maybe String
433 -- startsWith pfx (pfx++rest) = Just rest
434
435 startsWith []     str = Just str
436 startsWith (c:cs) (s:ss)
437   = if c /= s then Nothing else startsWith cs ss
438 startsWith  _     []  = Nothing
439
440
441 -----------------------------------------------------------------------------
442 -- convert sizes like "3.5M" into integers
443
444 decodeSize :: String -> Integer
445 decodeSize str
446   | c == ""              = truncate n
447   | c == "K" || c == "k" = truncate (n * 1000)
448   | c == "M" || c == "m" = truncate (n * 1000 * 1000)
449   | c == "G" || c == "g" = truncate (n * 1000 * 1000 * 1000)
450   | otherwise            = throwDyn (CmdLineError ("can't decode size: " ++ str))
451   where (m, c) = span pred str
452         n      = readRational m
453         pred c = isDigit c || c == '.'
454
455
456 -----------------------------------------------------------------------------
457 -- RTS Hooks
458
459 foreign import ccall unsafe "setHeapSize"       setHeapSize       :: Int -> IO ()
460 foreign import ccall unsafe "enableTimingStats" enableTimingStats :: IO ()
461
462 -----------------------------------------------------------------------------
463 -- Ways
464
465 -- The central concept of a "way" is that all objects in a given
466 -- program must be compiled in the same "way".  Certain options change
467 -- parameters of the virtual machine, eg. profiling adds an extra word
468 -- to the object header, so profiling objects cannot be linked with
469 -- non-profiling objects.
470
471 -- After parsing the command-line options, we determine which "way" we
472 -- are building - this might be a combination way, eg. profiling+ticky-ticky.
473
474 -- We then find the "build-tag" associated with this way, and this
475 -- becomes the suffix used to find .hi files and libraries used in
476 -- this compilation.
477
478 GLOBAL_VAR(v_Build_tag, "", String)
479
480 -- The RTS has its own build tag, because there are some ways that
481 -- affect the RTS only.
482 GLOBAL_VAR(v_RTS_Build_tag, "", String)
483
484 data WayName
485   = WayThreaded
486   | WayDebug
487   | WayProf
488   | WayTicky
489   | WayPar
490   | WayGran
491   | WayNDP
492   | WayUser_a
493   | WayUser_b
494   | WayUser_c
495   | WayUser_d
496   | WayUser_e
497   | WayUser_f
498   | WayUser_g
499   | WayUser_h
500   | WayUser_i
501   | WayUser_j
502   | WayUser_k
503   | WayUser_l
504   | WayUser_m
505   | WayUser_n
506   | WayUser_o
507   | WayUser_A
508   | WayUser_B
509   deriving (Eq,Ord)
510
511 GLOBAL_VAR(v_Ways, [] ,[WayName])
512
513 allowed_combination :: [WayName] -> Bool
514 allowed_combination way = and [ x `allowedWith` y 
515                               | x <- way, y <- way, x < y ]
516   where
517         -- Note ordering in these tests: the left argument is
518         -- <= the right argument, according to the Ord instance
519         -- on Way above.
520
521         -- debug is allowed with everything
522         _ `allowedWith` WayDebug                = True
523         WayDebug `allowedWith` _                = True
524
525         WayProf `allowedWith` WayNDP            = True
526         WayThreaded `allowedWith` WayProf       = True
527         _ `allowedWith` _                       = False
528
529
530 findBuildTag :: IO [String]  -- new options
531 findBuildTag = do
532   way_names <- readIORef v_Ways
533   let ws = sort (nub way_names)
534
535   if not (allowed_combination ws)
536       then throwDyn (CmdLineError $
537                     "combination not supported: "  ++
538                     foldr1 (\a b -> a ++ '/':b) 
539                     (map (wayName . lkupWay) ws))
540       else let ways    = map lkupWay ws
541                tag     = mkBuildTag (filter (not.wayRTSOnly) ways)
542                rts_tag = mkBuildTag ways
543                flags   = map wayOpts ways
544            in do
545            writeIORef v_Build_tag tag
546            writeIORef v_RTS_Build_tag rts_tag
547            return (concat flags)
548
549
550
551 mkBuildTag :: [Way] -> String
552 mkBuildTag ways = concat (intersperse "_" (map wayTag ways))
553
554 lkupWay :: WayName -> Way
555 lkupWay w = 
556    case lookup w way_details of
557         Nothing -> error "findBuildTag"
558         Just details -> details
559
560 isRTSWay :: WayName -> Bool
561 isRTSWay = wayRTSOnly . lkupWay 
562
563 data Way = Way {
564   wayTag     :: String,
565   wayRTSOnly :: Bool,
566   wayName    :: String,
567   wayOpts    :: [String]
568   }
569
570 way_details :: [ (WayName, Way) ]
571 way_details =
572   [ (WayThreaded, Way "thr" True "Threaded" [
573 #if defined(freebsd_TARGET_OS)
574 --        "-optc-pthread"
575 --      , "-optl-pthread"
576         -- FreeBSD's default threading library is the KSE-based M:N libpthread,
577         -- which GHC has some problems with.  It's currently not clear whether
578         -- the problems are our fault or theirs, but it seems that using the
579         -- alternative 1:1 threading library libthr works around it:
580           "-optl-lthr"
581 #elif defined(solaris2_TARGET_OS)
582           "-optl-lrt"
583 #endif
584         ] ),
585
586     (WayDebug, Way "debug" True "Debug" [] ),
587
588     (WayProf, Way  "p" False "Profiling"
589         [ "-fscc-profiling"
590         , "-DPROFILING"
591         , "-optc-DPROFILING" ]),
592
593     (WayTicky, Way  "t" True "Ticky-ticky Profiling"  
594         [ "-DTICKY_TICKY"
595         , "-optc-DTICKY_TICKY" ]),
596
597     -- optl's below to tell linker where to find the PVM library -- HWL
598     (WayPar, Way  "mp" False "Parallel" 
599         [ "-fparallel"
600         , "-D__PARALLEL_HASKELL__"
601         , "-optc-DPAR"
602         , "-package concurrent"
603         , "-optc-w"
604         , "-optl-L${PVM_ROOT}/lib/${PVM_ARCH}"
605         , "-optl-lpvm3"
606         , "-optl-lgpvm3" ]),
607
608     -- at the moment we only change the RTS and could share compiler and libs!
609     (WayPar, Way  "mt" False "Parallel ticky profiling" 
610         [ "-fparallel"
611         , "-D__PARALLEL_HASKELL__"
612         , "-optc-DPAR"
613         , "-optc-DPAR_TICKY"
614         , "-package concurrent"
615         , "-optc-w"
616         , "-optl-L${PVM_ROOT}/lib/${PVM_ARCH}"
617         , "-optl-lpvm3"
618         , "-optl-lgpvm3" ]),
619
620     (WayPar, Way  "md" False "Distributed" 
621         [ "-fparallel"
622         , "-D__PARALLEL_HASKELL__"
623         , "-D__DISTRIBUTED_HASKELL__"
624         , "-optc-DPAR"
625         , "-optc-DDIST"
626         , "-package concurrent"
627         , "-optc-w"
628         , "-optl-L${PVM_ROOT}/lib/${PVM_ARCH}"
629         , "-optl-lpvm3"
630         , "-optl-lgpvm3" ]),
631
632     (WayGran, Way  "mg" False "GranSim"
633         [ "-fgransim"
634         , "-D__GRANSIM__"
635         , "-optc-DGRAN"
636         , "-package concurrent" ]),
637
638     (WayNDP, Way  "ndp" False "Nested data parallelism"
639         [ "-fparr"
640         , "-fvectorise"]),
641
642     (WayUser_a,  Way  "a"  False "User way 'a'"  ["$WAY_a_REAL_OPTS"]), 
643     (WayUser_b,  Way  "b"  False "User way 'b'"  ["$WAY_b_REAL_OPTS"]), 
644     (WayUser_c,  Way  "c"  False "User way 'c'"  ["$WAY_c_REAL_OPTS"]), 
645     (WayUser_d,  Way  "d"  False "User way 'd'"  ["$WAY_d_REAL_OPTS"]), 
646     (WayUser_e,  Way  "e"  False "User way 'e'"  ["$WAY_e_REAL_OPTS"]), 
647     (WayUser_f,  Way  "f"  False "User way 'f'"  ["$WAY_f_REAL_OPTS"]), 
648     (WayUser_g,  Way  "g"  False "User way 'g'"  ["$WAY_g_REAL_OPTS"]), 
649     (WayUser_h,  Way  "h"  False "User way 'h'"  ["$WAY_h_REAL_OPTS"]), 
650     (WayUser_i,  Way  "i"  False "User way 'i'"  ["$WAY_i_REAL_OPTS"]), 
651     (WayUser_j,  Way  "j"  False "User way 'j'"  ["$WAY_j_REAL_OPTS"]), 
652     (WayUser_k,  Way  "k"  False "User way 'k'"  ["$WAY_k_REAL_OPTS"]), 
653     (WayUser_l,  Way  "l"  False "User way 'l'"  ["$WAY_l_REAL_OPTS"]), 
654     (WayUser_m,  Way  "m"  False "User way 'm'"  ["$WAY_m_REAL_OPTS"]), 
655     (WayUser_n,  Way  "n"  False "User way 'n'"  ["$WAY_n_REAL_OPTS"]), 
656     (WayUser_o,  Way  "o"  False "User way 'o'"  ["$WAY_o_REAL_OPTS"]), 
657     (WayUser_A,  Way  "A"  False "User way 'A'"  ["$WAY_A_REAL_OPTS"]), 
658     (WayUser_B,  Way  "B"  False "User way 'B'"  ["$WAY_B_REAL_OPTS"]) 
659   ]
660
661 unregFlags :: [String]
662 unregFlags = 
663    [ "-optc-DNO_REGS"
664    , "-optc-DUSE_MINIINTERPRETER"
665    , "-fno-asm-mangling"
666    , "-funregisterised"
667    , "-fvia-C" ]