summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÖmer Sinan Ağacan <omeragacan@gmail.com>2015-12-02 14:36:56 -0600
committerAustin Seipp <austin@well-typed.com>2015-12-02 14:37:52 -0600
commitc75948b9dcf5a2761223f4ef3777042982c33cc8 (patch)
tree4bf0b584ed705a1d66a62174cda091caa3753432
parent1caff20fad1e533d7dfb4215e69ce8678def943b (diff)
downloadhaskell-c75948b9dcf5a2761223f4ef3777042982c33cc8.tar.gz
Move Stg-specific code from DynFlags to SimplStg
Reviewed By: bgamari, austin Differential Revision: https://phabricator.haskell.org/D1552
-rw-r--r--compiler/main/DynFlags.hs26
-rw-r--r--compiler/simplStg/SimplStg.hs22
2 files changed, 22 insertions, 26 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 98c61e7659..77797320a9 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -113,10 +113,6 @@ module DynFlags (
-- ** DynFlags C compiler options
picCCOpts, picPOpts,
- -- * Configuration of the stg-to-stg passes
- StgToDo(..),
- getStgToDo,
-
-- * Compiler configuration suitable for display to the user
compilerInfo,
@@ -2028,28 +2024,6 @@ updOptLevel n dfs
extra_gopts = [ f | (ns,f) <- optLevelFlags, final_n `elem` ns ]
remove_gopts = [ f | (ns,f) <- optLevelFlags, final_n `notElem` ns ]
--- -----------------------------------------------------------------------------
--- StgToDo: abstraction of stg-to-stg passes to run.
-
-data StgToDo
- = StgDoMassageForProfiling -- should be (next to) last
- -- There's also setStgVarInfo, but its absolute "lastness"
- -- is so critical that it is hardwired in (no flag).
- | D_stg_stats
-
-getStgToDo :: DynFlags -> [StgToDo]
-getStgToDo dflags
- = todo2
- where
- stg_stats = gopt Opt_StgStats dflags
-
- todo1 = if stg_stats then [D_stg_stats] else []
-
- todo2 | WayProf `elem` ways dflags
- = StgDoMassageForProfiling : todo1
- | otherwise
- = todo1
-
{- **********************************************************************
%* *
DynFlags parser
diff --git a/compiler/simplStg/SimplStg.hs b/compiler/simplStg/SimplStg.hs
index b8804a47dd..b8491fcbbe 100644
--- a/compiler/simplStg/SimplStg.hs
+++ b/compiler/simplStg/SimplStg.hs
@@ -87,3 +87,25 @@ stg2stg dflags module_name binds
-- UniqueSupply for the next guy to use
-- cost-centres to be declared/registered (specialised)
-- add to description of what's happened (reverse order)
+
+-- -----------------------------------------------------------------------------
+-- StgToDo: abstraction of stg-to-stg passes to run.
+
+-- | Optional Stg-to-Stg passes.
+data StgToDo
+ = StgDoMassageForProfiling -- should be (next to) last
+ | D_stg_stats
+
+-- | Which optional Stg-to-Stg passes to run. Depends on flags, ways etc.
+getStgToDo :: DynFlags -> [StgToDo]
+getStgToDo dflags
+ = todo2
+ where
+ stg_stats = gopt Opt_StgStats dflags
+
+ todo1 = if stg_stats then [D_stg_stats] else []
+
+ todo2 | WayProf `elem` ways dflags
+ = StgDoMassageForProfiling : todo1
+ | otherwise
+ = todo1