diff options
Diffstat (limited to 'compiler/GHC/Cmm/Monad.hs')
-rw-r--r-- | compiler/GHC/Cmm/Monad.hs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/compiler/GHC/Cmm/Monad.hs b/compiler/GHC/Cmm/Monad.hs index 310b316e02..edb4c5f9d6 100644 --- a/compiler/GHC/Cmm/Monad.hs +++ b/compiler/GHC/Cmm/Monad.hs @@ -11,10 +11,17 @@ module GHC.Cmm.Monad ( PD(..) , liftP , failMsgPD + , getProfile + , getPlatform + , getPtrOpts ) where import GHC.Prelude +import GHC.Platform +import GHC.Platform.Profile +import GHC.Cmm.Info + import Control.Monad import GHC.Driver.Session @@ -49,3 +56,18 @@ thenPD :: PD a -> (a -> PD b) -> PD b instance HasDynFlags PD where getDynFlags = PD $ \d s -> POk s d + +getProfile :: PD Profile +getProfile = targetProfile <$> getDynFlags + +getPlatform :: PD Platform +getPlatform = profilePlatform <$> getProfile + +getPtrOpts :: PD PtrOpts +getPtrOpts = do + dflags <- getDynFlags + profile <- getProfile + pure $ PtrOpts + { po_profile = profile + , po_align_check = gopt Opt_AlignmentSanitisation dflags + } |