summaryrefslogtreecommitdiff
path: root/compiler/simplStg
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 /compiler/simplStg
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
Diffstat (limited to 'compiler/simplStg')
-rw-r--r--compiler/simplStg/SimplStg.hs22
1 files changed, 22 insertions, 0 deletions
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