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( ...@@ -16,12 +16,14 @@ module CgParallel(
import CgMonad import CgMonad
import CgCallConv import CgCallConv
import DynFlags
import Id import Id
import OldCmm import OldCmm
import StaticFlags
import Outputable import Outputable
import SMRep import SMRep
import Control.Monad
staticParHdr :: [CmmLit] staticParHdr :: [CmmLit]
-- Parallel header words in a static closure -- Parallel header words in a static closure
staticParHdr = [] staticParHdr = []
...@@ -37,8 +39,8 @@ staticGranHdr = [] ...@@ -37,8 +39,8 @@ staticGranHdr = []
doGranAllocate :: CmmExpr -> Code doGranAllocate :: CmmExpr -> Code
-- macro DO_GRAN_ALLOCATE -- macro DO_GRAN_ALLOCATE
doGranAllocate _hp doGranAllocate _hp
| not opt_GranMacros = nopC = do dflags <- getDynFlags
| otherwise = panic "doGranAllocate" when (dopt Opt_GranMacros dflags) $ panic "doGranAllocate"
...@@ -48,11 +50,11 @@ granFetchAndReschedule :: [(Id,GlobalReg)] -- Live registers ...@@ -48,11 +50,11 @@ granFetchAndReschedule :: [(Id,GlobalReg)] -- Live registers
-> Code -> Code
-- Emit code for simulating a fetch and then reschedule. -- Emit code for simulating a fetch and then reschedule.
granFetchAndReschedule regs node_reqd granFetchAndReschedule regs node_reqd
| opt_GranMacros && (node `elem` map snd regs || node_reqd) = do dflags <- getDynFlags
= do { fetch when (dopt Opt_GranMacros dflags &&
; reschedule liveness node_reqd } (node `elem` map snd regs || node_reqd)) $
| otherwise do fetch
= nopC reschedule liveness node_reqd
where where
liveness = mkRegLiveness regs 0 0 liveness = mkRegLiveness regs 0 0
...@@ -87,8 +89,8 @@ granYield :: [(Id,GlobalReg)] -- Live registers ...@@ -87,8 +89,8 @@ granYield :: [(Id,GlobalReg)] -- Live registers
-> Code -> Code
granYield regs node_reqd granYield regs node_reqd
| opt_GranMacros && node_reqd = yield liveness = do dflags <- getDynFlags
| otherwise = nopC when (dopt Opt_GranMacros dflags && node_reqd) $ yield liveness
where where
liveness = mkRegLiveness regs 0 0 liveness = mkRegLiveness regs 0 0
......
...@@ -310,6 +310,7 @@ data DynFlag ...@@ -310,6 +310,7 @@ data DynFlag
| Opt_HelpfulErrors | Opt_HelpfulErrors
| Opt_DeferTypeErrors | Opt_DeferTypeErrors
| Opt_Parallel | Opt_Parallel
| Opt_GranMacros
-- output style opts -- output style opts
| Opt_PprCaseAsLet | Opt_PprCaseAsLet
...@@ -1987,6 +1988,7 @@ fFlags = [ ...@@ -1987,6 +1988,7 @@ fFlags = [
( "helpful-errors", Opt_HelpfulErrors, nop ), ( "helpful-errors", Opt_HelpfulErrors, nop ),
( "defer-type-errors", Opt_DeferTypeErrors, nop ), ( "defer-type-errors", Opt_DeferTypeErrors, nop ),
( "parallel", Opt_Parallel, nop ), ( "parallel", Opt_Parallel, nop ),
( "gransim", Opt_GranMacros, nop ),
( "building-cabal-package", Opt_BuildingCabalPackage, nop ), ( "building-cabal-package", Opt_BuildingCabalPackage, nop ),
( "implicit-import-qualified", Opt_ImplicitImportQualified, nop ), ( "implicit-import-qualified", Opt_ImplicitImportQualified, nop ),
( "prof-count-entries", Opt_ProfCountEntries, nop ), ( "prof-count-entries", Opt_ProfCountEntries, nop ),
......
...@@ -170,7 +170,6 @@ isStaticFlag f = ...@@ -170,7 +170,6 @@ isStaticFlag f =
"fscc-profiling", "fscc-profiling",
"fdicts-strict", "fdicts-strict",
"fspec-inline-join-points", "fspec-inline-join-points",
"fgransim",
"fno-hi-version-check", "fno-hi-version-check",
"dno-black-holing", "dno-black-holing",
"fno-state-hack", "fno-state-hack",
......
...@@ -75,7 +75,6 @@ module StaticFlags ( ...@@ -75,7 +75,6 @@ module StaticFlags (
-- misc opts -- misc opts
opt_ErrorSpans, opt_ErrorSpans,
opt_GranMacros,
opt_HistorySize, opt_HistorySize,
opt_Unregisterised, opt_Unregisterised,
v_Ld_inputs, v_Ld_inputs,
...@@ -275,9 +274,6 @@ opt_CprOff = lookUp (fsLit "-fcpr-off") ...@@ -275,9 +274,6 @@ opt_CprOff = lookUp (fsLit "-fcpr-off")
opt_MaxWorkerArgs :: Int opt_MaxWorkerArgs :: Int
opt_MaxWorkerArgs = lookup_def_int "-fmax-worker-args" (10::Int) opt_MaxWorkerArgs = lookup_def_int "-fmax-worker-args" (10::Int)
opt_GranMacros :: Bool
opt_GranMacros = lookUp (fsLit "-fgransim")
opt_HistorySize :: Int opt_HistorySize :: Int
opt_HistorySize = lookup_def_int "-fhistory-size" 20 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