diff options
author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2019-08-05 20:44:33 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-08-06 20:26:32 -0400 |
commit | 6f116005a144b3f09381e0a5967a364eb57a5aa5 (patch) | |
tree | e6fa10c5f1f37790d15dff2b9dce7c700b26366a /compiler/main | |
parent | c83e39bf91cfeb17a54ccfd5d01bfdfa1b4a72c9 (diff) | |
download | haskell-6f116005a144b3f09381e0a5967a364eb57a5aa5.tar.gz |
Introduce a type for "platform word size", use it instead of Int
We introduce a PlatformWordSize type and use it in platformWordSize
field.
This removes to panic/error calls called when platform word size is not
32 or 64. We now check for this when reading the platform config.
Diffstat (limited to 'compiler/main')
-rw-r--r-- | compiler/main/DynFlags.hs | 15 | ||||
-rw-r--r-- | compiler/main/StaticPtrTable.hs | 7 |
2 files changed, 10 insertions, 12 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 5d0b09a602..d7f6a2be06 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -5596,19 +5596,16 @@ mAX_PTR_TAG = tAG_MASK tARGET_MIN_INT, tARGET_MAX_INT, tARGET_MAX_WORD :: DynFlags -> Integer tARGET_MIN_INT dflags = case platformWordSize (targetPlatform dflags) of - 4 -> toInteger (minBound :: Int32) - 8 -> toInteger (minBound :: Int64) - w -> panic ("tARGET_MIN_INT: Unknown platformWordSize: " ++ show w) + PW4 -> toInteger (minBound :: Int32) + PW8 -> toInteger (minBound :: Int64) tARGET_MAX_INT dflags = case platformWordSize (targetPlatform dflags) of - 4 -> toInteger (maxBound :: Int32) - 8 -> toInteger (maxBound :: Int64) - w -> panic ("tARGET_MAX_INT: Unknown platformWordSize: " ++ show w) + PW4 -> toInteger (maxBound :: Int32) + PW8 -> toInteger (maxBound :: Int64) tARGET_MAX_WORD dflags = case platformWordSize (targetPlatform dflags) of - 4 -> toInteger (maxBound :: Word32) - 8 -> toInteger (maxBound :: Word64) - w -> panic ("tARGET_MAX_WORD: Unknown platformWordSize: " ++ show w) + PW4 -> toInteger (maxBound :: Word32) + PW8 -> toInteger (maxBound :: Word64) {- ----------------------------------------------------------------------------- diff --git a/compiler/main/StaticPtrTable.hs b/compiler/main/StaticPtrTable.hs index 9f327c90d9..4f67ba0190 100644 --- a/compiler/main/StaticPtrTable.hs +++ b/compiler/main/StaticPtrTable.hs @@ -233,9 +233,10 @@ sptCreateStaticBinds hsc_env this_mod binds -- Choose either 'Word64#' or 'Word#' to represent the arguments of the -- 'Fingerprint' data constructor. - mkWord64LitWordRep dflags - | platformWordSize (targetPlatform dflags) < 8 = mkWord64LitWord64 - | otherwise = mkWordLit dflags . toInteger + mkWord64LitWordRep dflags = + case platformWordSize (targetPlatform dflags) of + PW4 -> mkWord64LitWord64 + PW8 -> mkWordLit dflags . toInteger lookupIdHscEnv :: Name -> IO Id lookupIdHscEnv n = lookupTypeHscEnv hsc_env n >>= |