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