X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FStaticFlags.hs;h=67e8ab58e50c7883c90d045b4ad7fa85158d82b6;hb=d2b7119250068ecbf5f085220663687733bde477;hp=be70daa8bd39a9ecfb93c131369dba0f6999ce35;hpb=5bf1b7f5742ba6405239692f329e8be35491b350;p=ghc-hetmet.git diff --git a/compiler/main/StaticFlags.hs b/compiler/main/StaticFlags.hs index be70daa..67e8ab5 100644 --- a/compiler/main/StaticFlags.hs +++ b/compiler/main/StaticFlags.hs @@ -12,9 +12,10 @@ module StaticFlags ( parseStaticFlags, staticFlags, + initStaticOpts, -- Ways - WayName(..), v_Ways, v_Build_tag, v_RTS_Build_tag, + WayName(..), v_Ways, v_Build_tag, v_RTS_Build_tag, isRTSWay, -- Output style options opt_PprUserLength, @@ -29,7 +30,6 @@ module StaticFlags ( -- Hpc opts opt_Hpc, - opt_Hpc_Tracer, -- language opts opt_DictsStrict, @@ -42,7 +42,6 @@ module StaticFlags ( opt_NoMethodSharing, opt_NoStateHack, opt_CprOff, - opt_RulesOff, opt_SimplNoPreInlining, opt_SimplExcessPrecision, opt_MaxWorkerArgs, @@ -93,6 +92,9 @@ import Data.List ( sort, intersperse, nub ) parseStaticFlags :: [String] -> IO [String] parseStaticFlags args = do + ready <- readIORef v_opt_C_ready + when ready $ throwDyn (ProgramError "Too late for parseStaticFlags: call it before newSession") + (leftover, errs) <- processArgs static_flags args when (not (null errs)) $ throwDyn (UsageError (unlines errs)) @@ -119,6 +121,8 @@ parseStaticFlags args = do when (not (null errs)) $ ghcError (UsageError (unlines errs)) return (cg_flags++more_leftover++leftover) +initStaticOpts :: IO () +initStaticOpts = writeIORef v_opt_C_ready True static_flags :: [(String, OptKind IO)] -- All the static flags should appear in this list. It describes how each @@ -278,14 +282,14 @@ opt_AutoSccsOnAllToplevs = lookUp FSLIT("-fauto-sccs-on-all-toplevs") opt_AutoSccsOnExportedToplevs = lookUp FSLIT("-fauto-sccs-on-exported-toplevs") opt_AutoSccsOnIndividualCafs = lookUp FSLIT("-fauto-sccs-on-individual-cafs") opt_SccProfilingOn = lookUp FSLIT("-fscc-profiling") -opt_DoTickyProfiling = lookUp FSLIT("-fticky-ticky") - - --- Hpc opts +opt_DoTickyProfiling = WayTicky `elem` (unsafePerformIO $ readIORef v_Ways) +-- Hpc opts, only work in a stage2 build +#if GHCI opt_Hpc = lookUp FSLIT("-fhpc") - || opt_Hpc_Tracer -opt_Hpc_Tracer = lookUp FSLIT("-fhpc-tracer") +#else +opt_Hpc = False +#endif -- language opts opt_DictsStrict = lookUp FSLIT("-fdicts-strict") @@ -297,12 +301,11 @@ opt_Flatten = lookUp FSLIT("-fflatten") opt_NoStateHack = lookUp FSLIT("-fno-state-hack") opt_NoMethodSharing = lookUp FSLIT("-fno-method-sharing") opt_CprOff = lookUp FSLIT("-fcpr-off") -opt_RulesOff = lookUp FSLIT("-frules-off") -- Switch off CPR analysis in the new demand analyser opt_MaxWorkerArgs = lookup_def_int "-fmax-worker-args" (10::Int) opt_GranMacros = lookUp FSLIT("-fgransim") -opt_HiVersion = read (cProjectVersionInt ++ cProjectPatchLevel) :: Int +opt_HiVersion = read (cProjectVersionInt ++ cProjectPatchLevel) :: Integer opt_HistorySize = lookup_def_int "-fhistory-size" 20 opt_OmitBlackHoling = lookUp FSLIT("-dno-black-holing") opt_RuntimeTypes = lookUp FSLIT("-fruntime-types") @@ -354,7 +357,6 @@ isStaticFlag f = "fauto-sccs-on-exported-toplevs", "fauto-sccs-on-individual-cafs", "fscc-profiling", - "fticky-ticky", "fdicts-strict", "firrefutable-tuples", "fparallel", @@ -371,7 +373,6 @@ isStaticFlag f = "static", "funregisterised", "fext-core", - "frules-off", "fcpr-off", "ferror-spans", "fPIC" @@ -417,13 +418,8 @@ decodeSize str ----------------------------------------------------------------------------- -- RTS Hooks -#if __GLASGOW_HASKELL__ >= 504 foreign import ccall unsafe "setHeapSize" setHeapSize :: Int -> IO () foreign import ccall unsafe "enableTimingStats" enableTimingStats :: IO () -#else -foreign import "setHeapSize" unsafe setHeapSize :: Int -> IO () -foreign import "enableTimingStats" unsafe enableTimingStats :: IO () -#endif ----------------------------------------------------------------------------- -- Ways @@ -522,6 +518,8 @@ lkupWay w = Nothing -> error "findBuildTag" Just details -> details +isRTSWay = wayRTSOnly . lkupWay + data Way = Way { wayTag :: String, wayRTSOnly :: Bool, @@ -553,8 +551,7 @@ way_details = , "-optc-DPROFILING" ]), (WayTicky, Way "t" True "Ticky-ticky Profiling" - [ "-fticky-ticky" - , "-DTICKY_TICKY" + [ "-DTICKY_TICKY" , "-optc-DTICKY_TICKY" ]), (WayUnreg, Way "u" False "Unregisterised"