[project @ 2000-12-19 12:36:12 by sewardj]
[ghc-hetmet.git] / ghc / compiler / main / CmdLineOpts.lhs
index 1466775..5d2338c 100644 (file)
@@ -10,9 +10,11 @@ module CmdLineOpts (
        SimplifierSwitch(..), isAmongSimpl,
        StgToDo(..),
        SwitchResult(..),
+
        HscLang(..),
        DynFlag(..),    -- needed non-abstractly by DriverFlags
        DynFlags(..),
+       defaultDynFlags,
 
        v_Static_hsc_opts,
 
@@ -49,6 +51,7 @@ module CmdLineOpts (
        opt_NumbersStrict,
        opt_Parallel,
        opt_SMP,
+       opt_NoMonomorphismRestriction,
 
        -- optimisation opts
        opt_DoSemiTagging,
@@ -91,8 +94,7 @@ module CmdLineOpts (
        opt_NoPruneTyDecls,
        opt_NoPruneDecls,
        opt_Static,
-       opt_Unregisterised,
-       opt_Verbose
+       opt_Unregisterised
     ) where
 
 #include "HsVersions.h"
@@ -103,6 +105,7 @@ import IOExts       ( IORef, readIORef )
 import Constants       -- Default values for some flags
 import Util
 import FastTypes
+import Config
 
 import Maybes          ( firstJust )
 import Panic           ( panic )
@@ -187,9 +190,7 @@ data CoreToDo               -- These are diff core-to-core passes,
 
 \begin{code}
 data StgToDo
-  = StgDoStaticArgs
-  | StgDoLambdaLift
-  | StgDoMassageForProfiling  -- should be (next to) last
+  = StgDoMassageForProfiling  -- should be (next to) last
   -- There's also setStgVarInfo, but its absolute "lastness"
   -- is so critical that it is hardwired in (no flag).
   | D_stg_stats
@@ -214,9 +215,7 @@ data SimplifierSwitch
 data DynFlag
 
    -- debugging flags
-   = Opt_D_dump_all
-   | Opt_D_dump_most
-   | Opt_D_dump_absC
+   = Opt_D_dump_absC
    | Opt_D_dump_asm
    | Opt_D_dump_cpranal
    | Opt_D_dump_deriv
@@ -231,6 +230,7 @@ data DynFlag
    | Opt_D_dump_simpl
    | Opt_D_dump_simpl_iterations
    | Opt_D_dump_spec
+   | Opt_D_dump_sat
    | Opt_D_dump_stg
    | Opt_D_dump_stranal
    | Opt_D_dump_tc
@@ -239,11 +239,11 @@ data DynFlag
    | Opt_D_dump_usagesp
    | Opt_D_dump_cse
    | Opt_D_dump_worker_wrapper
-   | Opt_D_show_passes
    | Opt_D_dump_rn_trace
    | Opt_D_dump_rn_stats
    | Opt_D_dump_stix
    | Opt_D_dump_simpl_stats
+   | Opt_D_dump_BCOs
    | Opt_D_source_stats
    | Opt_D_verbose_core2core
    | Opt_D_verbose_stg2stg
@@ -285,9 +285,27 @@ data DynFlags = DynFlags {
   stgToDo    :: [StgToDo],
   hscLang    :: HscLang,
   hscOutName :: String,  -- name of the file in which to place output
+  verbosity  :: Int,    -- verbosity level
   flags      :: [DynFlag]
  }
 
+defaultDynFlags = DynFlags {
+  coreToDo = [], stgToDo = [], 
+  hscLang = HscC, hscOutName = "", 
+  verbosity = 0, flags = []
+  }
+
+{- 
+    Verbosity levels:
+       
+    0  |   print errors & warnings only
+    1   |   minimal verbosity: print "compiling M ... done." for each module.
+    2   |   equivalent to -dshow-passes
+    3   |   equivalent to existing "ghc -v"
+    4   |   "ghc -v -ddump-most"
+    5   |   "ghc -v -ddump-all"
+-}
+
 dopt :: DynFlag -> DynFlags -> Bool
 dopt f dflags  = f `elem` (flags dflags)
 
@@ -388,6 +406,7 @@ opt_DoTickyProfiling                = lookUp  SLIT("-fticky-ticky")
 
 -- language opts
 opt_AllStrict                  = lookUp  SLIT("-fall-strict")
+opt_NoMonomorphismRestriction  = lookUp  SLIT("-fno-monomorphism-restriction")
 opt_DictsStrict                        = lookUp  SLIT("-fdicts-strict")
 opt_IrrefutableTuples          = lookUp  SLIT("-firrefutable-tuples")
 opt_MaxContextReductionDepth   = lookup_def_int "-fcontext-stack" mAX_CONTEXT_REDUCTION_DEPTH
@@ -416,7 +435,7 @@ opt_InPackage                       = case lookup_str "-inpackage=" of
 opt_EmitCExternDecls           = lookUp  SLIT("-femit-extern-decls")
 opt_EnsureSplittableC          = lookUp  SLIT("-fglobalise-toplev-names")
 opt_GranMacros                 = lookUp  SLIT("-fgransim")
-opt_HiVersion                  = lookup_def_int "-fhi-version=" 0 -- what version we're compiling.
+opt_HiVersion                  = read cProjectVersionInt :: Int
 opt_HistorySize                        = lookup_def_int "-fhistory-size" 20
 opt_IgnoreAsserts               = lookUp  SLIT("-fignore-asserts")
 opt_IgnoreIfacePragmas         = lookUp  SLIT("-fignore-interface-pragmas")
@@ -450,7 +469,6 @@ opt_NoPruneDecls            = lookUp SLIT("-fno-prune-decls")
 opt_NoPruneTyDecls             = lookUp SLIT("-fno-prune-tydecls")
 opt_Static                     = lookUp SLIT("-static")
 opt_Unregisterised             = lookUp SLIT("-funregisterised")
-opt_Verbose                    = lookUp SLIT("-v")
 \end{code}
 
 %************************************************************************
@@ -486,7 +504,6 @@ isStaticHscFlag f =
        "fignore-asserts",
        "fignore-interface-pragmas",
        "fno-hi-version-check",
-       "fno-implicit-prelude",
        "dno-black-holing",
        "fomit-interface-pragmas",
        "fno-pre-inlining",
@@ -501,12 +518,11 @@ isStaticHscFlag f =
        "fno-prune-decls",
        "fno-prune-tydecls",
        "static",
-       "funregisterised",
-       "v" ]
+       "funregisterised"
+       ]
   || any (flip prefixMatch f) [
        "fcontext-stack",
        "fliberate-case-threshold",
-       "fhi-version=",
        "fhistory-size",
        "funfolding-interface-threshold",
        "funfolding-creation-threshold",