[project @ 2001-05-28 03:31:19 by sof]
[ghc-hetmet.git] / ghc / compiler / main / DriverState.hs
1 -----------------------------------------------------------------------------
2 -- $Id: DriverState.hs,v 1.40 2001/05/28 03:31:19 sof Exp $
3 --
4 -- Settings for the driver
5 --
6 -- (c) The University of Glasgow 2000
7 --
8 -----------------------------------------------------------------------------
9
10 module DriverState where
11
12 #include "../includes/config.h"
13 #include "HsVersions.h"
14
15 import CmStaticInfo
16 import CmdLineOpts
17 import DriverUtil
18 import Util
19 import Config
20 import Exception
21 import IOExts
22 #ifdef mingw32_TARGET_OS
23 import TmpFiles ( newTempName )
24 import Directory ( removeFile )
25 #endif
26 import Panic
27
28 import List
29 import Char  
30 import Monad
31
32 -----------------------------------------------------------------------------
33 -- non-configured things
34
35 cHaskell1Version = "5" -- i.e., Haskell 98
36
37 -----------------------------------------------------------------------------
38 -- Global compilation flags
39
40 -- location of compiler-related files
41 GLOBAL_VAR(v_TopDir,  error "no TOPDIR", String)
42
43 -- Cpp-related flags
44 v_Hs_source_cpp_opts = global
45         [ "-D__HASKELL1__="++cHaskell1Version
46         , "-D__GLASGOW_HASKELL__="++cProjectVersionInt                          
47         , "-D__HASKELL98__"
48         , "-D__CONCURRENT_HASKELL__"
49         ]
50 {-# NOINLINE v_Hs_source_cpp_opts #-}
51
52 -- Keep output from intermediate phases
53 GLOBAL_VAR(v_Keep_hi_diffs,             False,          Bool)
54 GLOBAL_VAR(v_Keep_hc_files,             False,          Bool)
55 GLOBAL_VAR(v_Keep_s_files,              False,          Bool)
56 GLOBAL_VAR(v_Keep_raw_s_files,          False,          Bool)
57 GLOBAL_VAR(v_Keep_tmp_files,            False,          Bool)
58
59 -- Misc
60 GLOBAL_VAR(v_Scale_sizes_by,            1.0,            Double)
61 GLOBAL_VAR(v_Dry_run,                   False,          Bool)
62 GLOBAL_VAR(v_Static,                    True,           Bool)
63 GLOBAL_VAR(v_NoHsMain,                  False,          Bool)
64 GLOBAL_VAR(v_Recomp,                    True,           Bool)
65 GLOBAL_VAR(v_Collect_ghc_timing,        False,          Bool)
66 GLOBAL_VAR(v_Do_asm_mangling,           True,           Bool)
67 GLOBAL_VAR(v_Excess_precision,          False,          Bool)
68
69 -----------------------------------------------------------------------------
70 -- Splitting object files (for libraries)
71
72 GLOBAL_VAR(v_Split_object_files,        False,          Bool)
73 GLOBAL_VAR(v_Split_prefix,              "",             String)
74 GLOBAL_VAR(v_N_split_files,             0,              Int)
75         
76 can_split :: Bool
77 can_split =  prefixMatch "i386"    cTARGETPLATFORM
78           || prefixMatch "alpha"   cTARGETPLATFORM
79           || prefixMatch "hppa"    cTARGETPLATFORM
80           || prefixMatch "m68k"    cTARGETPLATFORM
81           || prefixMatch "mips"    cTARGETPLATFORM
82           || prefixMatch "powerpc" cTARGETPLATFORM
83           || prefixMatch "rs6000"  cTARGETPLATFORM
84           || prefixMatch "sparc"   cTARGETPLATFORM
85
86 -----------------------------------------------------------------------------
87 -- Compiler output options
88
89 defaultHscLang
90   | cGhcWithNativeCodeGen == "YES" && 
91         (prefixMatch "i386" cTARGETPLATFORM ||
92          prefixMatch "sparc" cTARGETPLATFORM)   =  HscAsm
93   | otherwise                                   =  HscC
94
95 GLOBAL_VAR(v_Output_dir,  Nothing, Maybe String)
96 GLOBAL_VAR(v_Output_file, Nothing, Maybe String)
97 GLOBAL_VAR(v_Output_hi,   Nothing, Maybe String)
98
99 GLOBAL_VAR(v_Object_suf,  Nothing, Maybe String)
100 GLOBAL_VAR(v_HC_suf,      Nothing, Maybe String)
101 GLOBAL_VAR(v_Hi_suf,      "hi",    String)
102
103 GLOBAL_VAR(v_Ld_inputs, [],      [String])
104
105 odir_ify :: String -> IO String
106 odir_ify f = do
107   odir_opt <- readIORef v_Output_dir
108   case odir_opt of
109         Nothing -> return f
110         Just d  -> return (newdir d f)
111
112 osuf_ify :: String -> IO String
113 osuf_ify f = do
114   osuf_opt <- readIORef v_Object_suf
115   case osuf_opt of
116         Nothing -> return f
117         Just s  -> return (newsuf s f)
118
119 -----------------------------------------------------------------------------
120 -- Compiler optimisation options
121
122 GLOBAL_VAR(v_OptLevel, 0, Int)
123
124 setOptLevel :: String -> IO ()
125 setOptLevel ""              = do { writeIORef v_OptLevel 1 }
126 setOptLevel "not"           = writeIORef v_OptLevel 0
127 setOptLevel [c] | isDigit c = do
128    let level = ord c - ord '0'
129    writeIORef v_OptLevel level
130 setOptLevel s = unknownFlagErr ("-O"++s)
131
132 GLOBAL_VAR(v_minus_o2_for_C,            False, Bool)
133 GLOBAL_VAR(v_MaxSimplifierIterations,   4,     Int)
134 GLOBAL_VAR(v_StgStats,                  False, Bool)
135 GLOBAL_VAR(v_UsageSPInf,                False, Bool)  -- Off by default
136 GLOBAL_VAR(v_Strictness,                True,  Bool)
137 GLOBAL_VAR(v_CPR,                       True,  Bool)
138 GLOBAL_VAR(v_CSE,                       True,  Bool)
139
140 -- these are the static flags you get without -O.
141 hsc_minusNoO_flags =
142        [ 
143         "-fignore-interface-pragmas",
144         "-fomit-interface-pragmas",
145         "-fdo-lambda-eta-expansion",    -- This one is important for a tiresome reason:
146                                         -- we want to make sure that the bindings for data 
147                                         -- constructors are eta-expanded.  This is probably
148                                         -- a good thing anyway, but it seems fragile.
149         "-flet-no-escape"
150         ]
151
152 -- these are the static flags you get when -O is on.
153 hsc_minusO_flags =
154   [ 
155         "-fignore-asserts",
156         "-ffoldr-build-on",
157         "-fdo-eta-reduction",
158         "-fdo-lambda-eta-expansion",
159         "-fcase-merge",
160         "-flet-to-case",
161         "-flet-no-escape"
162    ]
163
164 hsc_minusO2_flags = hsc_minusO_flags    -- for now
165
166 getStaticOptimisationFlags 0 = hsc_minusNoO_flags
167 getStaticOptimisationFlags 1 = hsc_minusO_flags
168 getStaticOptimisationFlags n = hsc_minusO2_flags
169
170 buildCoreToDo :: IO [CoreToDo]
171 buildCoreToDo = do
172    opt_level  <- readIORef v_OptLevel
173    max_iter   <- readIORef v_MaxSimplifierIterations
174    usageSP    <- readIORef v_UsageSPInf
175    strictness <- readIORef v_Strictness
176    cpr        <- readIORef v_CPR
177    cse        <- readIORef v_CSE
178
179    if opt_level == 0 then return
180       [
181         CoreDoSimplify (isAmongSimpl [
182             MaxSimplifierIterations max_iter
183         ])
184       ]
185
186     else {- opt_level >= 1 -} return [ 
187
188         -- initial simplify: mk specialiser happy: minimum effort please
189         CoreDoSimplify (isAmongSimpl [
190             SimplInlinePhase 0,
191                         -- Don't inline anything till full laziness has bitten
192                         -- In particular, inlining wrappers inhibits floating
193                         -- e.g. ...(case f x of ...)...
194                         --  ==> ...(case (case x of I# x# -> fw x#) of ...)...
195                         --  ==> ...(case x of I# x# -> case fw x# of ...)...
196                         -- and now the redex (f x) isn't floatable any more
197             DontApplyRules,
198                         -- Similarly, don't apply any rules until after full 
199                         -- laziness.  Notably, list fusion can prevent floating.
200             NoCaseOfCase,
201                         -- Don't do case-of-case transformations.
202                         -- This makes full laziness work better
203             MaxSimplifierIterations max_iter
204         ]),
205
206         -- Specialisation is best done before full laziness
207         -- so that overloaded functions have all their dictionary lambdas manifest
208         CoreDoSpecialising,
209
210         CoreDoFloatOutwards False{-not full-},
211         CoreDoFloatInwards,
212
213         CoreDoSimplify (isAmongSimpl [
214            SimplInlinePhase 1,
215                 -- Want to run with inline phase 1 after the specialiser to give
216                 -- maximum chance for fusion to work before we inline build/augment
217                 -- in phase 2.  This made a difference in 'ansi' where an 
218                 -- overloaded function wasn't inlined till too late.
219            MaxSimplifierIterations max_iter
220         ]),
221
222         -- infer usage information here in case we need it later.
223         -- (add more of these where you need them --KSW 1999-04)
224         if usageSP then CoreDoUSPInf else CoreDoNothing,
225
226         CoreDoSimplify (isAmongSimpl [
227                 -- Need inline-phase2 here so that build/augment get 
228                 -- inlined.  I found that spectral/hartel/genfft lost some useful
229                 -- strictness in the function sumcode' if augment is not inlined
230                 -- before strictness analysis runs
231            SimplInlinePhase 2,
232            MaxSimplifierIterations max_iter
233         ]),
234
235         CoreDoSimplify (isAmongSimpl [
236            MaxSimplifierIterations 2
237                 -- No -finline-phase: allow all Ids to be inlined now
238                 -- This gets foldr inlined before strictness analysis
239         ]),
240
241         if strictness then CoreDoStrictness else CoreDoNothing,
242         if cpr        then CoreDoCPResult   else CoreDoNothing,
243         CoreDoWorkerWrapper,
244         CoreDoGlomBinds,
245
246         CoreDoSimplify (isAmongSimpl [
247            MaxSimplifierIterations max_iter
248                 -- No -finline-phase: allow all Ids to be inlined now
249         ]),
250
251         CoreDoFloatOutwards False{-not full-},
252                 -- nofib/spectral/hartel/wang doubles in speed if you
253                 -- do full laziness late in the day.  It only happens
254                 -- after fusion and other stuff, so the early pass doesn't
255                 -- catch it.  For the record, the redex is 
256                 --        f_el22 (f_el21 r_midblock)
257
258
259 -- Leave out lambda lifting for now
260 --        "-fsimplify", -- Tidy up results of full laziness
261 --          "[", 
262 --                "-fmax-simplifier-iterations2",
263 --          "]",
264 --        "-ffloat-outwards-full",      
265
266         -- We want CSE to follow the final full-laziness pass, because it may
267         -- succeed in commoning up things floated out by full laziness.
268         -- CSE used to rely on the no-shadowing invariant, but it doesn't any more
269
270         if cse then CoreCSE else CoreDoNothing,
271
272         CoreDoFloatInwards,
273
274 -- Case-liberation for -O2.  This should be after
275 -- strictness analysis and the simplification which follows it.
276
277         if opt_level >= 2 then
278            CoreLiberateCase
279         else
280            CoreDoNothing,
281         if opt_level >= 2 then
282            CoreDoSpecConstr
283         else
284            CoreDoNothing,
285
286         -- Final clean-up simplification:
287         CoreDoSimplify (isAmongSimpl [
288           MaxSimplifierIterations max_iter
289                 -- No -finline-phase: allow all Ids to be inlined now
290         ])
291      ]
292
293 buildStgToDo :: IO [ StgToDo ]
294 buildStgToDo = do
295   stg_stats <- readIORef v_StgStats
296   let flags1 | stg_stats = [ D_stg_stats ]
297              | otherwise = [ ]
298
299         -- STG passes
300   ways_ <- readIORef v_Ways
301   let flags2 | WayProf `elem` ways_ = StgDoMassageForProfiling : flags1
302              | otherwise            = flags1
303
304   return flags2
305
306 -----------------------------------------------------------------------------
307 -- Paths & Libraries
308
309 split_marker = ':'   -- not configurable (ToDo)
310
311 v_Import_paths, v_Include_paths, v_Library_paths :: IORef [String]
312 GLOBAL_VAR(v_Import_paths,  ["."], [String])
313 GLOBAL_VAR(v_Include_paths, ["."], [String])
314 GLOBAL_VAR(v_Library_paths, [],  [String])
315
316 GLOBAL_VAR(v_Cmdline_libraries,   [], [String])
317
318 addToDirList :: IORef [String] -> String -> IO ()
319 addToDirList ref path
320   = do paths <- readIORef ref
321        writeIORef ref (paths ++ split split_marker path)
322
323 GLOBAL_VAR(v_HCHeader, "", String)
324
325 -----------------------------------------------------------------------------
326 -- Packages
327
328 GLOBAL_VAR(v_Path_package_config, error "path_package_config", String)
329
330 -- package list is maintained in dependency order
331 GLOBAL_VAR(v_Packages, ("std":"rts":"gmp":[]), [String])
332
333 addPackage :: String -> IO ()
334 addPackage package
335   = do pkg_details <- readIORef v_Package_details
336        case lookupPkg package pkg_details of
337           Nothing -> throwDyn (CmdLineError ("unknown package name: " ++ package))
338           Just details -> do
339             ps <- readIORef v_Packages
340             unless (package `elem` ps) $ do
341                 mapM_ addPackage (package_deps details)
342                 ps <- readIORef v_Packages
343                 writeIORef v_Packages (package:ps)
344
345 getPackageImportPath   :: IO [String]
346 getPackageImportPath = do
347   ps <- getPackageInfo
348   return (nub (concat (map import_dirs ps)))
349
350 getPackageIncludePath   :: IO [String]
351 getPackageIncludePath = do
352   ps <- getPackageInfo
353   return (nub (filter (not.null) (concatMap include_dirs ps)))
354
355         -- includes are in reverse dependency order (i.e. rts first)
356 getPackageCIncludes   :: IO [String]
357 getPackageCIncludes = do
358   ps <- getPackageInfo
359   return (reverse (nub (filter (not.null) (concatMap c_includes ps))))
360
361 getPackageLibraryPath  :: IO [String]
362 getPackageLibraryPath = do
363   ps <- getPackageInfo
364   return (nub (concat (map library_dirs ps)))
365
366 getPackageLibraries    :: IO [String]
367 getPackageLibraries = do
368   ps <- getPackageInfo
369   tag <- readIORef v_Build_tag
370   let suffix = if null tag then "" else '_':tag
371   return (concat (
372         map (\p -> map (++suffix) (hs_libraries p) ++ extra_libraries p) ps
373      ))
374
375 getPackageExtraGhcOpts :: IO [String]
376 getPackageExtraGhcOpts = do
377   ps <- getPackageInfo
378   return (concatMap extra_ghc_opts ps)
379
380 getPackageExtraCcOpts  :: IO [String]
381 getPackageExtraCcOpts = do
382   ps <- getPackageInfo
383   return (concatMap extra_cc_opts ps)
384
385 getPackageExtraLdOpts  :: IO [String]
386 getPackageExtraLdOpts = do
387   ps <- getPackageInfo
388   return (concatMap extra_ld_opts ps)
389
390 getPackageInfo :: IO [PackageConfig]
391 getPackageInfo = do
392   ps <- readIORef v_Packages
393   getPackageDetails ps
394
395 getPackageDetails :: [String] -> IO [PackageConfig]
396 getPackageDetails ps = do
397   pkg_details <- readIORef v_Package_details
398   return [ pkg | p <- ps, Just pkg <- [ lookupPkg p pkg_details ] ]
399
400 GLOBAL_VAR(v_Package_details, (error "package_details"), [PackageConfig])
401
402 lookupPkg :: String -> [PackageConfig] -> Maybe PackageConfig
403 lookupPkg nm ps
404    = case [p | p <- ps, name p == nm] of
405         []    -> Nothing
406         (p:_) -> Just p
407 -----------------------------------------------------------------------------
408 -- Ways
409
410 -- The central concept of a "way" is that all objects in a given
411 -- program must be compiled in the same "way".  Certain options change
412 -- parameters of the virtual machine, eg. profiling adds an extra word
413 -- to the object header, so profiling objects cannot be linked with
414 -- non-profiling objects.
415
416 -- After parsing the command-line options, we determine which "way" we
417 -- are building - this might be a combination way, eg. profiling+ticky-ticky.
418
419 -- We then find the "build-tag" associated with this way, and this
420 -- becomes the suffix used to find .hi files and libraries used in
421 -- this compilation.
422
423 GLOBAL_VAR(v_Build_tag, "", String)
424
425 data WayName
426   = WayProf
427   | WayUnreg
428   | WayTicky
429   | WayPar
430   | WayGran
431   | WaySMP
432   | WayDebug
433   | WayUser_a
434   | WayUser_b
435   | WayUser_c
436   | WayUser_d
437   | WayUser_e
438   | WayUser_f
439   | WayUser_g
440   | WayUser_h
441   | WayUser_i
442   | WayUser_j
443   | WayUser_k
444   | WayUser_l
445   | WayUser_m
446   | WayUser_n
447   | WayUser_o
448   | WayUser_A
449   | WayUser_B
450   deriving (Eq,Ord)
451
452 GLOBAL_VAR(v_Ways, [] ,[WayName])
453
454 allowed_combination way = way `elem` combs
455   where  -- the sub-lists must be ordered according to WayName, 
456          -- because findBuildTag sorts them
457     combs                = [ [WayProf,WayUnreg], [WayProf,WaySMP] ]
458
459 findBuildTag :: IO [String]  -- new options
460 findBuildTag = do
461   way_names <- readIORef v_Ways
462   case sort way_names of
463      []  -> do  -- writeIORef v_Build_tag ""
464                 return []
465
466      [w] -> do let details = lkupWay w
467                writeIORef v_Build_tag (wayTag details)
468                return (wayOpts details)
469
470      ws  -> if not (allowed_combination ws)
471                 then throwDyn (CmdLineError $
472                                 "combination not supported: "  ++
473                                 foldr1 (\a b -> a ++ '/':b) 
474                                 (map (wayName . lkupWay) ws))
475                 else let stuff = map lkupWay ws
476                          tag   = concat (map wayTag stuff)
477                          flags = map wayOpts stuff
478                      in do
479                      writeIORef v_Build_tag tag
480                      return (concat flags)
481
482 lkupWay w = 
483    case lookup w way_details of
484         Nothing -> error "findBuildTag"
485         Just details -> details
486
487 data Way = Way {
488   wayTag   :: String,
489   wayName  :: String,
490   wayOpts  :: [String]
491   }
492
493 way_details :: [ (WayName, Way) ]
494 way_details =
495   [ (WayProf, Way  "p" "Profiling"  
496         [ "-fscc-profiling"
497         , "-DPROFILING"
498         , "-optc-DPROFILING"
499         , "-fvia-C" ]),
500
501     (WayTicky, Way  "t" "Ticky-ticky Profiling"  
502         [ "-fticky-ticky"
503         , "-DTICKY_TICKY"
504         , "-optc-DTICKY_TICKY"
505         , "-fvia-C" ]),
506
507     (WayUnreg, Way  "u" "Unregisterised" 
508         unregFlags ),
509
510     -- optl's below to tell linker where to find the PVM library -- HWL
511     (WayPar, Way  "mp" "Parallel" 
512         [ "-fparallel"
513         , "-D__PARALLEL_HASKELL__"
514         , "-optc-DPAR"
515         , "-package concurrent"
516         , "-optc-w"
517         , "-optl-L${PVM_ROOT}/lib/${PVM_ARCH}"
518         , "-optl-lpvm3"
519         , "-optl-lgpvm3"
520         , "-fvia-C" ]),
521
522     -- at the moment we only change the RTS and could share compiler and libs!
523     (WayPar, Way  "mt" "Parallel ticky profiling" 
524         [ "-fparallel"
525         , "-D__PARALLEL_HASKELL__"
526         , "-optc-DPAR"
527         , "-optc-DPAR_TICKY"
528         , "-package concurrent"
529         , "-optc-w"
530         , "-optl-L${PVM_ROOT}/lib/${PVM_ARCH}"
531         , "-optl-lpvm3"
532         , "-optl-lgpvm3"
533         , "-fvia-C" ]),
534
535     (WayPar, Way  "md" "Distributed" 
536         [ "-fparallel"
537         , "-D__PARALLEL_HASKELL__"
538         , "-D__DISTRIBUTED_HASKELL__"
539         , "-optc-DPAR"
540         , "-optc-DDIST"
541         , "-package concurrent"
542         , "-optc-w"
543         , "-optl-L${PVM_ROOT}/lib/${PVM_ARCH}"
544         , "-optl-lpvm3"
545         , "-optl-lgpvm3"
546         , "-fvia-C" ]),
547
548     (WayGran, Way  "mg" "GranSim" 
549         [ "-fgransim"
550         , "-D__GRANSIM__"
551         , "-optc-DGRAN"
552         , "-package concurrent"
553         , "-fvia-C" ]),
554
555     (WaySMP, Way  "s" "SMP"
556         [ "-fsmp"
557         , "-optc-pthread"
558         , "-optl-pthread"
559         , "-optc-DSMP"
560         , "-fvia-C" ]),
561
562     (WayUser_a,  Way  "a"  "User way 'a'"  ["$WAY_a_REAL_OPTS"]),       
563     (WayUser_b,  Way  "b"  "User way 'b'"  ["$WAY_b_REAL_OPTS"]),       
564     (WayUser_c,  Way  "c"  "User way 'c'"  ["$WAY_c_REAL_OPTS"]),       
565     (WayUser_d,  Way  "d"  "User way 'd'"  ["$WAY_d_REAL_OPTS"]),       
566     (WayUser_e,  Way  "e"  "User way 'e'"  ["$WAY_e_REAL_OPTS"]),       
567     (WayUser_f,  Way  "f"  "User way 'f'"  ["$WAY_f_REAL_OPTS"]),       
568     (WayUser_g,  Way  "g"  "User way 'g'"  ["$WAY_g_REAL_OPTS"]),       
569     (WayUser_h,  Way  "h"  "User way 'h'"  ["$WAY_h_REAL_OPTS"]),       
570     (WayUser_i,  Way  "i"  "User way 'i'"  ["$WAY_i_REAL_OPTS"]),       
571     (WayUser_j,  Way  "j"  "User way 'j'"  ["$WAY_j_REAL_OPTS"]),       
572     (WayUser_k,  Way  "k"  "User way 'k'"  ["$WAY_k_REAL_OPTS"]),       
573     (WayUser_l,  Way  "l"  "User way 'l'"  ["$WAY_l_REAL_OPTS"]),       
574     (WayUser_m,  Way  "m"  "User way 'm'"  ["$WAY_m_REAL_OPTS"]),       
575     (WayUser_n,  Way  "n"  "User way 'n'"  ["$WAY_n_REAL_OPTS"]),       
576     (WayUser_o,  Way  "o"  "User way 'o'"  ["$WAY_o_REAL_OPTS"]),       
577     (WayUser_A,  Way  "A"  "User way 'A'"  ["$WAY_A_REAL_OPTS"]),       
578     (WayUser_B,  Way  "B"  "User way 'B'"  ["$WAY_B_REAL_OPTS"]) 
579   ]
580
581 unregFlags = 
582    [ "-optc-DNO_REGS"
583    , "-optc-DUSE_MINIINTERPRETER"
584    , "-fno-asm-mangling"
585    , "-funregisterised"
586    , "-fvia-C" ]
587
588 -----------------------------------------------------------------------------
589 -- Programs for particular phases
590
591 GLOBAL_VAR(v_Pgm_L,   error "pgm_L", String)
592 GLOBAL_VAR(v_Pgm_P,   cRAWCPP,       String)
593 GLOBAL_VAR(v_Pgm_c,   cGCC,          String)
594 GLOBAL_VAR(v_Pgm_m,   error "pgm_m", String)
595 GLOBAL_VAR(v_Pgm_s,   error "pgm_s", String)
596 GLOBAL_VAR(v_Pgm_a,   cGCC,          String)
597 GLOBAL_VAR(v_Pgm_l,   cGCC,          String)
598 GLOBAL_VAR(v_Pgm_dll, cMkDLL,        String)
599
600 #if defined(mingw32_TARGET_OS) && defined(MINIMAL_UNIX_DEPS)
601 GLOBAL_VAR(v_Pgm_T,   cTOUCH,        String)
602 #endif
603
604 GLOBAL_VAR(v_Opt_dep,    [], [String])
605 GLOBAL_VAR(v_Anti_opt_C, [], [String])
606 GLOBAL_VAR(v_Opt_C,      [], [String])
607 GLOBAL_VAR(v_Opt_l,      [], [String])
608 GLOBAL_VAR(v_Opt_dll,    [], [String])
609
610 getStaticOpts :: IORef [String] -> IO [String]
611 getStaticOpts ref = readIORef ref >>= return . reverse