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