summaryrefslogtreecommitdiff
path: root/compiler/GHC/StgToCmm/ExtCode.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/StgToCmm/ExtCode.hs')
-rw-r--r--compiler/GHC/StgToCmm/ExtCode.hs19
1 files changed, 16 insertions, 3 deletions
diff --git a/compiler/GHC/StgToCmm/ExtCode.hs b/compiler/GHC/StgToCmm/ExtCode.hs
index 05909d4bb5..380e4458e2 100644
--- a/compiler/GHC/StgToCmm/ExtCode.hs
+++ b/compiler/GHC/StgToCmm/ExtCode.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE DeriveFunctor #-}
+{-# LANGUAGE TupleSections #-}
-- | Our extended FCode monad.
-- We add a mapping from names to CmmExpr, to support local variable names in
@@ -32,19 +33,24 @@ module GHC.StgToCmm.ExtCode (
emit, emitLabel, emitAssign, emitStore,
getCode, getCodeR, getCodeScoped,
emitOutOfLine,
- withUpdFrameOff, getUpdFrameOff
+ withUpdFrameOff, getUpdFrameOff,
+ getProfile, getPlatform, getPtrOpts
)
where
import GHC.Prelude
+import GHC.Platform
+import GHC.Platform.Profile
+
import qualified GHC.StgToCmm.Monad as F
import GHC.StgToCmm.Monad (FCode, newUnique)
import GHC.Cmm
import GHC.Cmm.CLabel
import GHC.Cmm.Graph
+import GHC.Cmm.Info
import GHC.Cmm.BlockId
import GHC.Driver.Session
@@ -98,9 +104,16 @@ instance MonadUnique CmmParse where
return (decls, u)
instance HasDynFlags CmmParse where
- getDynFlags = EC (\_ _ d -> do dflags <- getDynFlags
- return (d, dflags))
+ getDynFlags = EC (\_ _ d -> (d,) <$> getDynFlags)
+
+getProfile :: CmmParse Profile
+getProfile = EC (\_ _ d -> (d,) <$> F.getProfile)
+
+getPlatform :: CmmParse Platform
+getPlatform = EC (\_ _ d -> (d,) <$> F.getPlatform)
+getPtrOpts :: CmmParse PtrOpts
+getPtrOpts = EC (\_ _ d -> (d,) <$> F.getPtrOpts)
-- | Takes the variable declarations and imports from the monad
-- and makes an environment, which is looped back into the computation.