summaryrefslogtreecommitdiff
path: root/compiler/GHC/Iface/Binary.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-03-11 19:14:11 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-03-25 22:42:02 -0400
commit0de03cd78729dc58a846c64b645e71057ec5d24e (patch)
tree4d893f44db3fa94094376cf4fcad9a1a832ee261 /compiler/GHC/Iface/Binary.hs
parent262e42aa34c4d5705c8d011907c351497dd4e862 (diff)
downloadhaskell-0de03cd78729dc58a846c64b645e71057ec5d24e.tar.gz
DynFlags refactoring III
Use Platform instead of DynFlags when possible: * `tARGET_MIN_INT` et al. replaced with `platformMinInt` et al. * no more DynFlags in PreRules: added a new `RuleOpts` datatype * don't use `wORD_SIZE` in the compiler * make `wordAlignment` use `Platform` * make `dOUBLE_SIZE` a constant Metric Decrease: T13035 T1969
Diffstat (limited to 'compiler/GHC/Iface/Binary.hs')
-rw-r--r--compiler/GHC/Iface/Binary.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/GHC/Iface/Binary.hs b/compiler/GHC/Iface/Binary.hs
index c5850f1eaf..c4ddfa2ece 100644
--- a/compiler/GHC/Iface/Binary.hs
+++ b/compiler/GHC/Iface/Binary.hs
@@ -133,9 +133,9 @@ readBinIface_ dflags checkHiWay traceBinIFaceReading hi_path ncu = do
-- should be). Also, the serialisation of value of type "Bin
-- a" used to depend on the word size of the machine, now they
-- are always 32 bits.
- if wORD_SIZE dflags == 4
- then do _ <- Binary.get bh :: IO Word32; return ()
- else do _ <- Binary.get bh :: IO Word64; return ()
+ case platformWordSize (targetPlatform dflags) of
+ PW4 -> do _ <- Binary.get bh :: IO Word32; return ()
+ PW8 -> do _ <- Binary.get bh :: IO Word64; return ()
-- Check the interface file version and ways.
check_ver <- get bh
@@ -191,9 +191,9 @@ writeBinIface dflags hi_path mod_iface = do
-- dummy 32/64-bit field before the version/way for
-- compatibility with older interface file formats.
-- See Note [dummy iface field] above.
- if wORD_SIZE dflags == 4
- then Binary.put_ bh (0 :: Word32)
- else Binary.put_ bh (0 :: Word64)
+ case platformWordSize (targetPlatform dflags) of
+ PW4 -> Binary.put_ bh (0 :: Word32)
+ PW8 -> Binary.put_ bh (0 :: Word64)
-- The version and way descriptor go next
put_ bh (show hiVersion)