summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-03-12 17:06:09 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-04-01 01:21:27 -0400
commit0002db1bf436cbd32f97b659a52b1eee4e8b21db (patch)
treec42a2a91c5194a8af5c99b189ff1f8b6471ee809 /libraries
parent7627eab5dd882eb6f1567e3ae95c6c770830a5eb (diff)
downloadhaskell-0002db1bf436cbd32f97b659a52b1eee4e8b21db.tar.gz
Kill wORDS_BIGENDIAN and replace it with platformByteOrder (#17957)
Metric Decrease: T13035 T1969
Diffstat (limited to 'libraries')
-rw-r--r--libraries/ghc-boot/GHC/Platform.hs26
-rw-r--r--libraries/ghc-boot/GHC/Settings.hs2
2 files changed, 15 insertions, 13 deletions
diff --git a/libraries/ghc-boot/GHC/Platform.hs b/libraries/ghc-boot/GHC/Platform.hs
index f6a7060b3f..b5091ae8e8 100644
--- a/libraries/ghc-boot/GHC/Platform.hs
+++ b/libraries/ghc-boot/GHC/Platform.hs
@@ -12,6 +12,7 @@ module GHC.Platform (
ArmISAExt(..),
ArmABI(..),
PPC_64ABI(..),
+ ByteOrder(..),
target32Bit,
isARM,
@@ -38,6 +39,7 @@ where
import Prelude -- See Note [Why do we import Prelude here?]
import GHC.Read
+import GHC.ByteOrder (ByteOrder(..))
import Data.Word
import Data.Int
@@ -53,19 +55,17 @@ data PlatformMini
-- | Contains enough information for the native code generator to emit
-- code for this platform.
-data Platform
- = Platform {
- platformMini :: PlatformMini,
- -- Word size in bytes (i.e. normally 4 or 8,
- -- for 32bit and 64bit platforms respectively)
- platformWordSize :: PlatformWordSize,
- platformUnregisterised :: Bool,
- platformHasGnuNonexecStack :: Bool,
- platformHasIdentDirective :: Bool,
- platformHasSubsectionsViaSymbols :: Bool,
- platformIsCrossCompiling :: Bool
- }
- deriving (Read, Show, Eq)
+data Platform = Platform
+ { platformMini :: PlatformMini
+ , platformWordSize :: PlatformWordSize
+ , platformByteOrder :: ByteOrder
+ , platformUnregisterised :: Bool
+ , platformHasGnuNonexecStack :: Bool
+ , platformHasIdentDirective :: Bool
+ , platformHasSubsectionsViaSymbols :: Bool
+ , platformIsCrossCompiling :: Bool
+ }
+ deriving (Read, Show, Eq)
data PlatformWordSize
= PW4 -- ^ A 32-bit platform
diff --git a/libraries/ghc-boot/GHC/Settings.hs b/libraries/ghc-boot/GHC/Settings.hs
index 96680dc58e..fd0a0ef3ad 100644
--- a/libraries/ghc-boot/GHC/Settings.hs
+++ b/libraries/ghc-boot/GHC/Settings.hs
@@ -36,6 +36,7 @@ getTargetPlatform settingsFile mySettings = do
targetArch <- readSetting "target arch"
targetOS <- readSetting "target os"
targetWordSize <- readSetting "target word size"
+ targetWordBigEndian <- getBooleanSetting "target word big endian"
targetUnregisterised <- getBooleanSetting "Unregisterised"
targetHasGnuNonexecStack <- getBooleanSetting "target has GNU nonexec stack"
targetHasIdentDirective <- getBooleanSetting "target has .ident directive"
@@ -48,6 +49,7 @@ getTargetPlatform settingsFile mySettings = do
, platformMini_os = targetOS
}
, platformWordSize = targetWordSize
+ , platformByteOrder = if targetWordBigEndian then BigEndian else LittleEndian
, platformUnregisterised = targetUnregisterised
, platformHasGnuNonexecStack = targetHasGnuNonexecStack
, platformHasIdentDirective = targetHasIdentDirective