diff options
author | Simon Marlow <marlowsd@gmail.com> | 2009-10-14 13:06:12 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2009-10-14 13:06:12 +0000 |
commit | 79e9cfa32cc3b94428e1199ce550bb62c50bf8e6 (patch) | |
tree | 1304c1a2fe909f8ac3fc35963e6f8345bceeb8fc /compiler/prelude | |
parent | 2354f96975dc845b1c62b4c72d770be4b638ebba (diff) | |
download | haskell-79e9cfa32cc3b94428e1199ce550bb62c50bf8e6.tar.gz |
Fixes for cross-compiling to a different word size
This patch eliminates a couple of places where we were assuming that
the host word size is the same as the target word size.
Also a little refactoring: Constants now exports the types TargetInt
and TargetWord corresponding to the Int/Word type on the target
platform, and I moved the definitions of tARGET_INT_MAX and friends
from Literal to Constants.
Thanks to Barney Stratford <barney_stratford@fastmail.fm> for helping
track down the problem and fix it. We now know that GHC can
successfully cross-compile from 32-bit to 64-bit.
Diffstat (limited to 'compiler/prelude')
-rw-r--r-- | compiler/prelude/PrelRules.lhs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/prelude/PrelRules.lhs b/compiler/prelude/PrelRules.lhs index 67eb06f9d9..e35d8dbcce 100644 --- a/compiler/prelude/PrelRules.lhs +++ b/compiler/prelude/PrelRules.lhs @@ -45,6 +45,8 @@ import Name ( Name, nameOccName ) import Outputable import FastString import StaticFlags ( opt_SimplExcessPrecision ) +import Constants + import Data.Bits as Bits import Data.Word ( Word ) \end{code} @@ -353,14 +355,14 @@ litEq op_name is_eq -- runtime either, and compilation of completely harmless things like -- ((124076834 :: Word32) + (2147483647 :: Word32)) -- would yield a warning. Instead we simply squash the value into the --- Int range, but not in a way suitable for cross-compiling... :-( +-- *target* Int/Word range. intResult :: Integer -> Maybe CoreExpr intResult result - = Just (mkIntVal (toInteger (fromInteger result :: Int))) + = Just (mkIntVal (toInteger (fromInteger result :: TargetInt))) wordResult :: Integer -> Maybe CoreExpr wordResult result - = Just (mkWordVal (toInteger (fromInteger result :: Word))) + = Just (mkWordVal (toInteger (fromInteger result :: TargetWord))) \end{code} |