Commit f21dabc3 authored by ian@well-typed.com's avatar ian@well-typed.com
Browse files

Remove the Target* types from HaskellConstants

parent 10cc4224
......@@ -43,15 +43,15 @@ import Name ( Name, nameOccName )
import Outputable
import FastString
import StaticFlags ( opt_SimplExcessPrecision )
import Constants
import BasicTypes
import DynFlags
import Platform
import Util
import Control.Monad
import Data.Bits as Bits
import Data.Int ( Int64 )
import Data.Word ( Word, Word64 )
import Data.Int
import Data.Word
\end{code}
......@@ -424,12 +424,18 @@ isMaxBound _ = False
-- would yield a warning. Instead we simply squash the value into the
-- *target* Int/Word range.
intResult :: DynFlags -> Integer -> Maybe CoreExpr
intResult dflags result
= Just (mkIntVal dflags (toInteger (fromInteger result :: TargetInt)))
intResult dflags result = Just (mkIntVal dflags result')
where result' = case platformWordSize (targetPlatform dflags) of
4 -> toInteger (fromInteger result :: Int32)
8 -> toInteger (fromInteger result :: Int64)
w -> panic ("intResult: Unknown platformWordSize: " ++ show w)
wordResult :: DynFlags -> Integer -> Maybe CoreExpr
wordResult dflags result
= Just (mkWordVal dflags (toInteger (fromInteger result :: TargetWord)))
wordResult dflags result = Just (mkWordVal dflags result')
where result' = case platformWordSize (targetPlatform dflags) of
4 -> toInteger (fromInteger result :: Word32)
8 -> toInteger (fromInteger result :: Word64)
w -> panic ("wordResult: Unknown platformWordSize: " ++ show w)
inversePrimOp :: PrimOp -> RuleM CoreExpr
inversePrimOp primop = do
......
import Data.Word
import Data.Int
-- This magical #include brings in all the everybody-knows-these magic
......@@ -36,18 +35,6 @@ mAX_CONTEXT_REDUCTION_DEPTH = 200
wORD64_SIZE :: Int
wORD64_SIZE = 8
-- Define a fixed-range integral type equivalent to the target Int/Word
#if SIZEOF_HSWORD == 4
type TargetInt = Int32
type TargetWord = Word32
#elif SIZEOF_HSWORD == 8
type TargetInt = Int64
type TargetWord = Word64
#else
#error unknown SIZEOF_HSWORD
#endif
tARGET_MAX_CHAR :: Int
tARGET_MAX_CHAR = 0x10ffff
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment