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