diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-02-11 09:41:44 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-06-17 16:22:03 -0400 |
commit | 96aa57878fd6e6a7b92e841a0df8b5255a559c97 (patch) | |
tree | da1dabadf29c6b681682a4577b4ca08e29bc44a5 /compiler/GHC/StgToCmm | |
parent | 9f96bc127d6231b5e76bbab442244eb303b08867 (diff) | |
download | haskell-96aa57878fd6e6a7b92e841a0df8b5255a559c97.tar.gz |
Update compiler
Thanks to ghc-bignum, the compiler can be simplified:
* Types and constructors of Integer and Natural can be wired-in. It
means that we don't have to query them from interfaces. It also means
that numeric literals don't have to carry their type with them.
* The same code is used whatever ghc-bignum backend is enabled. In
particular, conversion of bignum literals into final Core expressions
is now much more straightforward. Bignum closure inspection too.
* GHC itself doesn't depend on any integer-* package anymore
* The `integerLibrary` setting is gone.
Diffstat (limited to 'compiler/GHC/StgToCmm')
-rw-r--r-- | compiler/GHC/StgToCmm/DataCon.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/StgToCmm/Utils.hs | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/compiler/GHC/StgToCmm/DataCon.hs b/compiler/GHC/StgToCmm/DataCon.hs index 3f4c94abdd..d319ca7d17 100644 --- a/compiler/GHC/StgToCmm/DataCon.hs +++ b/compiler/GHC/StgToCmm/DataCon.hs @@ -311,7 +311,7 @@ precomputedStaticConInfo_maybe dflags binder con [arg] platform = targetPlatform dflags intClosure = maybeIntLikeCon con charClosure = maybeCharLikeCon con - getClosurePayload (NonVoid (StgLitArg (LitNumber LitNumInt val _))) = Just val + getClosurePayload (NonVoid (StgLitArg (LitNumber LitNumInt val))) = Just val getClosurePayload (NonVoid (StgLitArg (LitChar val))) = Just $ (fromIntegral . ord $ val) getClosurePayload _ = Nothing -- Avoid over/underflow by comparisons at type Integer! diff --git a/compiler/GHC/StgToCmm/Utils.hs b/compiler/GHC/StgToCmm/Utils.hs index 6367f5e839..2814948189 100644 --- a/compiler/GHC/StgToCmm/Utils.hs +++ b/compiler/GHC/StgToCmm/Utils.hs @@ -103,10 +103,10 @@ mkSimpleLit platform = \case (LitChar c) -> CmmInt (fromIntegral (ord c)) (wordWidth platform) LitNullAddr -> zeroCLit platform - (LitNumber LitNumInt i _) -> CmmInt i (wordWidth platform) - (LitNumber LitNumInt64 i _) -> CmmInt i W64 - (LitNumber LitNumWord i _) -> CmmInt i (wordWidth platform) - (LitNumber LitNumWord64 i _) -> CmmInt i W64 + (LitNumber LitNumInt i) -> CmmInt i (wordWidth platform) + (LitNumber LitNumInt64 i) -> CmmInt i W64 + (LitNumber LitNumWord i) -> CmmInt i (wordWidth platform) + (LitNumber LitNumWord64 i) -> CmmInt i W64 (LitFloat r) -> CmmFloat r W32 (LitDouble r) -> CmmFloat r W64 (LitLabel fs ms fod) @@ -495,7 +495,7 @@ emitCmmLitSwitch scrut branches deflt = do -- We find the necessary type information in the literals in the branches let signed = case head branches of - (LitNumber nt _ _, _) -> litNumIsSigned nt + (LitNumber nt _, _) -> litNumIsSigned nt _ -> False let range | signed = (platformMinInt platform, platformMaxInt platform) |