diff options
author | Ian Lynagh <igloo@earth.li> | 2012-06-20 15:42:32 +0100 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2012-06-20 15:42:32 +0100 |
commit | 8323847d588f2dbd13fd698aa2125fe5b90c482c (patch) | |
tree | a3083b1f75e9471c651ea3bbb4663aa7600b5f78 | |
parent | ad3d65cd3d3d6e3831e5f842d27bbb6c33539a83 (diff) | |
download | haskell-8323847d588f2dbd13fd698aa2125fe5b90c482c.tar.gz |
Make -fgransim a dynamic flag
-rw-r--r-- | compiler/codeGen/CgParallel.hs | 22 | ||||
-rw-r--r-- | compiler/main/DynFlags.hs | 2 | ||||
-rw-r--r-- | compiler/main/StaticFlagParser.hs | 1 | ||||
-rw-r--r-- | compiler/main/StaticFlags.hs | 4 |
4 files changed, 14 insertions, 15 deletions
diff --git a/compiler/codeGen/CgParallel.hs b/compiler/codeGen/CgParallel.hs index 30771f14de..c86ef9e34a 100644 --- a/compiler/codeGen/CgParallel.hs +++ b/compiler/codeGen/CgParallel.hs @@ -16,12 +16,14 @@ module CgParallel( import CgMonad import CgCallConv +import DynFlags import Id import OldCmm -import StaticFlags import Outputable import SMRep +import Control.Monad + staticParHdr :: [CmmLit] -- Parallel header words in a static closure staticParHdr = [] @@ -37,8 +39,8 @@ staticGranHdr = [] doGranAllocate :: CmmExpr -> Code -- macro DO_GRAN_ALLOCATE doGranAllocate _hp - | not opt_GranMacros = nopC - | otherwise = panic "doGranAllocate" + = do dflags <- getDynFlags + when (dopt Opt_GranMacros dflags) $ panic "doGranAllocate" @@ -48,11 +50,11 @@ granFetchAndReschedule :: [(Id,GlobalReg)] -- Live registers -> Code -- Emit code for simulating a fetch and then reschedule. granFetchAndReschedule regs node_reqd - | opt_GranMacros && (node `elem` map snd regs || node_reqd) - = do { fetch - ; reschedule liveness node_reqd } - | otherwise - = nopC + = do dflags <- getDynFlags + when (dopt Opt_GranMacros dflags && + (node `elem` map snd regs || node_reqd)) $ + do fetch + reschedule liveness node_reqd where liveness = mkRegLiveness regs 0 0 @@ -87,8 +89,8 @@ granYield :: [(Id,GlobalReg)] -- Live registers -> Code granYield regs node_reqd - | opt_GranMacros && node_reqd = yield liveness - | otherwise = nopC + = do dflags <- getDynFlags + when (dopt Opt_GranMacros dflags && node_reqd) $ yield liveness where liveness = mkRegLiveness regs 0 0 diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 3fffd0e032..014b721a1b 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -310,6 +310,7 @@ data DynFlag | Opt_HelpfulErrors | Opt_DeferTypeErrors | Opt_Parallel + | Opt_GranMacros -- output style opts | Opt_PprCaseAsLet @@ -1987,6 +1988,7 @@ fFlags = [ ( "helpful-errors", Opt_HelpfulErrors, nop ), ( "defer-type-errors", Opt_DeferTypeErrors, nop ), ( "parallel", Opt_Parallel, nop ), + ( "gransim", Opt_GranMacros, nop ), ( "building-cabal-package", Opt_BuildingCabalPackage, nop ), ( "implicit-import-qualified", Opt_ImplicitImportQualified, nop ), ( "prof-count-entries", Opt_ProfCountEntries, nop ), diff --git a/compiler/main/StaticFlagParser.hs b/compiler/main/StaticFlagParser.hs index ba8ac0c6f7..88e92a7c03 100644 --- a/compiler/main/StaticFlagParser.hs +++ b/compiler/main/StaticFlagParser.hs @@ -170,7 +170,6 @@ isStaticFlag f = "fscc-profiling", "fdicts-strict", "fspec-inline-join-points", - "fgransim", "fno-hi-version-check", "dno-black-holing", "fno-state-hack", diff --git a/compiler/main/StaticFlags.hs b/compiler/main/StaticFlags.hs index 494875111d..3a4c2da9e4 100644 --- a/compiler/main/StaticFlags.hs +++ b/compiler/main/StaticFlags.hs @@ -75,7 +75,6 @@ module StaticFlags ( -- misc opts opt_ErrorSpans, - opt_GranMacros, opt_HistorySize, opt_Unregisterised, v_Ld_inputs, @@ -275,9 +274,6 @@ opt_CprOff = lookUp (fsLit "-fcpr-off") opt_MaxWorkerArgs :: Int opt_MaxWorkerArgs = lookup_def_int "-fmax-worker-args" (10::Int) -opt_GranMacros :: Bool -opt_GranMacros = lookUp (fsLit "-fgransim") - opt_HistorySize :: Int opt_HistorySize = lookup_def_int "-fhistory-size" 20 |