Commit 8323847d authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Make -fgransim a dynamic flag

parent ad3d65cd
......@@ -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
......
......@@ -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 ),
......
......@@ -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",
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment