summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2022-02-06 06:24:09 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2022-02-07 18:40:10 +0000
commit003be086478855278b510b73b2d3785ed34508b8 (patch)
tree221f5ccbce43e55b3e7e04eac008b0fe78a9abc7
parent37d435d263832ffb2808dad0ccd50110c9f0c430 (diff)
downloadhaskell-wip/stg-to-cmm-no-driver-session.tar.gz
StgToCmm: Get rid of GHC.Driver.Session importswip/stg-to-cmm-no-driver-session
`DynFlags` is gone, but let's move a few trivial things around to get rid of its module too.
-rw-r--r--compiler/GHC/CmmToAsm/X86/CodeGen.hs1
-rw-r--r--compiler/GHC/Driver/Session.hs32
-rw-r--r--compiler/GHC/Platform.hs38
-rw-r--r--compiler/GHC/StgToCmm/Bind.hs2
-rw-r--r--compiler/GHC/StgToCmm/Heap.hs1
-rw-r--r--compiler/GHC/StgToCmm/Prim.hs1
-rw-r--r--compiler/GHC/StgToCmm/Prof.hs2
7 files changed, 39 insertions, 38 deletions
diff --git a/compiler/GHC/CmmToAsm/X86/CodeGen.hs b/compiler/GHC/CmmToAsm/X86/CodeGen.hs
index bf799590cd..c7954c9b8b 100644
--- a/compiler/GHC/CmmToAsm/X86/CodeGen.hs
+++ b/compiler/GHC/CmmToAsm/X86/CodeGen.hs
@@ -80,7 +80,6 @@ import GHC.Utils.Constants (debugIsOn)
import GHC.Utils.Panic
import GHC.Utils.Panic.Plain
import GHC.Data.FastString
-import GHC.Driver.Session
import GHC.Utils.Misc
import GHC.Types.Unique.Supply ( getUniqueM )
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs
index 838f0bf3b7..ce61c76af9 100644
--- a/compiler/GHC/Driver/Session.hs
+++ b/compiler/GHC/Driver/Session.hs
@@ -190,8 +190,6 @@ module GHC.Driver.Session (
setUnsafeGlobalDynFlags,
-- * SSE and AVX
- isSseEnabled,
- isSse2Enabled,
isSse4_2Enabled,
isBmiEnabled,
isBmi2Enabled,
@@ -245,7 +243,7 @@ import GHC.Utils.Monad
import GHC.Types.Error (DiagnosticReason(..))
import GHC.Types.SrcLoc
import GHC.Types.SafeHaskell
-import GHC.Types.Basic ( Alignment, alignmentOf, IntWithInf, treatZeroAsInf )
+import GHC.Types.Basic ( IntWithInf, treatZeroAsInf )
import qualified GHC.Types.FieldLabel as FieldLabel
import GHC.Data.FastString
import GHC.Utils.TmpFs
@@ -4665,9 +4663,6 @@ compilerInfo dflags
expandDirectories topd mtoold = expandToolDir useInplaceMinGW mtoold . expandTopDir topd
-wordAlignment :: Platform -> Alignment
-wordAlignment platform = alignmentOf (platformWordSizeInBytes platform)
-
-- | Get target profile
targetProfile :: DynFlags -> Profile
targetProfile dflags = Profile (targetPlatform dflags) (ways dflags)
@@ -4793,31 +4788,6 @@ setUnsafeGlobalDynFlags dflags = do
-- -----------------------------------------------------------------------------
-- SSE and AVX
--- TODO: Instead of using a separate predicate (i.e. isSse2Enabled) to
--- check if SSE is enabled, we might have x86-64 imply the -msse2
--- flag.
-
-isSseEnabled :: Platform -> Bool
-isSseEnabled platform = case platformArch platform of
- ArchX86_64 -> True
- ArchX86 -> True
- _ -> False
-
-isSse2Enabled :: Platform -> Bool
-isSse2Enabled platform = case platformArch platform of
- -- We assume SSE1 and SSE2 operations are available on both
- -- x86 and x86_64. Historically we didn't default to SSE2 and
- -- SSE1 on x86, which results in defacto nondeterminism for how
- -- rounding behaves in the associated x87 floating point instructions
- -- because variations in the spill/fpu stack placement of arguments for
- -- operations would change the precision and final result of what
- -- would otherwise be the same expressions with respect to single or
- -- double precision IEEE floating point computations.
- ArchX86_64 -> True
- ArchX86 -> True
- _ -> False
-
-
isSse4_2Enabled :: DynFlags -> Bool
isSse4_2Enabled dflags = sseVersion dflags >= Just SSE42
diff --git a/compiler/GHC/Platform.hs b/compiler/GHC/Platform.hs
index 0c2e6df5c4..831418dd61 100644
--- a/compiler/GHC/Platform.hs
+++ b/compiler/GHC/Platform.hs
@@ -32,6 +32,10 @@ module GHC.Platform
, PlatformMisc(..)
, SseVersion (..)
, BmiVersion (..)
+ , wordAlignment
+ -- * SSE and AVX
+ , isSseEnabled
+ , isSse2Enabled
-- * Platform constants
, PlatformConstants(..)
, lookupPlatformConstants
@@ -50,6 +54,7 @@ import GHC.Read
import GHC.ByteOrder (ByteOrder(..))
import GHC.Platform.Constants
import GHC.Platform.ArchOS
+import GHC.Types.Basic (Alignment, alignmentOf)
import GHC.Utils.Panic.Plain
import Data.Word
@@ -84,6 +89,39 @@ data Platform = Platform
}
deriving (Read, Show, Eq, Ord)
+wordAlignment :: Platform -> Alignment
+wordAlignment platform = alignmentOf (platformWordSizeInBytes platform)
+
+-- -----------------------------------------------------------------------------
+-- SSE and AVX
+
+-- TODO: Instead of using a separate predicate (i.e. isSse2Enabled) to
+-- check if SSE is enabled, we might have x86-64 imply the -msse2
+-- flag.
+
+isSseEnabled :: Platform -> Bool
+isSseEnabled platform = case platformArch platform of
+ ArchX86_64 -> True
+ ArchX86 -> True
+ _ -> False
+
+isSse2Enabled :: Platform -> Bool
+isSse2Enabled platform = case platformArch platform of
+ -- We assume SSE1 and SSE2 operations are available on both
+ -- x86 and x86_64. Historically we didn't default to SSE2 and
+ -- SSE1 on x86, which results in defacto nondeterminism for how
+ -- rounding behaves in the associated x87 floating point instructions
+ -- because variations in the spill/fpu stack placement of arguments for
+ -- operations would change the precision and final result of what
+ -- would otherwise be the same expressions with respect to single or
+ -- double precision IEEE floating point computations.
+ ArchX86_64 -> True
+ ArchX86 -> True
+ _ -> False
+
+-- -----------------------------------------------------------------------------
+-- Platform Constants
+
platformConstants :: Platform -> PlatformConstants
platformConstants platform = case platform_constants platform of
Nothing -> panic "Platform constants not available!"
diff --git a/compiler/GHC/StgToCmm/Bind.hs b/compiler/GHC/StgToCmm/Bind.hs
index 435f55106b..4fb3fd1fbe 100644
--- a/compiler/GHC/StgToCmm/Bind.hs
+++ b/compiler/GHC/StgToCmm/Bind.hs
@@ -15,8 +15,6 @@ module GHC.StgToCmm.Bind (
import GHC.Prelude hiding ((<*>))
-import GHC.Driver.Session
-
import GHC.Core ( AltCon(..) )
import GHC.Runtime.Heap.Layout
import GHC.Unit.Module
diff --git a/compiler/GHC/StgToCmm/Heap.hs b/compiler/GHC/StgToCmm/Heap.hs
index ec61ef2406..a7e7f23e9d 100644
--- a/compiler/GHC/StgToCmm/Heap.hs
+++ b/compiler/GHC/StgToCmm/Heap.hs
@@ -44,7 +44,6 @@ import GHC.Types.CostCentre
import GHC.Types.Id.Info( CafInfo(..), mayHaveCafRefs )
import GHC.Types.Id ( Id )
import GHC.Unit
-import GHC.Driver.Session
import GHC.Platform
import GHC.Platform.Profile
import GHC.Data.FastString( mkFastString, fsLit )
diff --git a/compiler/GHC/StgToCmm/Prim.hs b/compiler/GHC/StgToCmm/Prim.hs
index 4d7294a3ec..adb870801c 100644
--- a/compiler/GHC/StgToCmm/Prim.hs
+++ b/compiler/GHC/StgToCmm/Prim.hs
@@ -29,7 +29,6 @@ import GHC.StgToCmm.Ticky
import GHC.StgToCmm.Heap
import GHC.StgToCmm.Prof ( costCentreFrom )
-import GHC.Driver.Session
import GHC.Types.Basic
import GHC.Cmm.BlockId
import GHC.Cmm.Graph
diff --git a/compiler/GHC/StgToCmm/Prof.hs b/compiler/GHC/StgToCmm/Prof.hs
index 79e08071fa..478925122c 100644
--- a/compiler/GHC/StgToCmm/Prof.hs
+++ b/compiler/GHC/StgToCmm/Prof.hs
@@ -28,8 +28,6 @@ module GHC.StgToCmm.Prof (
import GHC.Prelude
-import GHC.Driver.Session
-
import GHC.Platform
import GHC.Platform.Profile
import GHC.StgToCmm.Closure