[commit: ghc] master: Make -fgransim a dynamic flag (8323847)
Ian Lynagh
igloo at earth.li
Wed Jun 20 19:05:17 CEST 2012
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/8323847d588f2dbd13fd698aa2125fe5b90c482c
>---------------------------------------------------------------
commit 8323847d588f2dbd13fd698aa2125fe5b90c482c
Author: Ian Lynagh <igloo at earth.li>
Date: Wed Jun 20 15:42:32 2012 +0100
Make -fgransim a dynamic flag
>---------------------------------------------------------------
compiler/codeGen/CgParallel.hs | 22 ++++++++++++----------
compiler/main/DynFlags.hs | 2 ++
compiler/main/StaticFlagParser.hs | 1 -
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 30771f1..c86ef9e 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 3fffd0e..014b721 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 ba8ac0c..88e92a7 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 4948751..3a4c2da 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
More information about the Cvs-ghc
mailing list