summaryrefslogtreecommitdiff
path: root/compiler/types
diff options
context:
space:
mode:
authorMichal Terepeta <michal.terepeta@gmail.com>2018-11-02 14:27:03 -0400
committerBen Gamari <ben@smart-cactus.org>2018-11-02 17:15:01 -0400
commit2c959a1894311e59cd2fd469c1967491c1e488f3 (patch)
treedc396ec23115f4b6a10b8295bfa94b865ff02efb /compiler/types
parent6bb8aaa3b4fcebf8f0de2f81f00dcc20b857c4f5 (diff)
downloadhaskell-2c959a1894311e59cd2fd469c1967491c1e488f3.tar.gz
Add Int8# and Word8#
This is the first step of implementing: https://github.com/ghc-proposals/ghc-proposals/pull/74 The main highlights/changes: primops.txt.pp gets two new sections for two new primitive types for signed and unsigned 8-bit integers (Int8# and Word8 respectively) along with basic arithmetic and comparison operations. PrimRep/RuntimeRep get two new constructors for them. All of the primops translate into the existing MachOPs. For CmmCalls the codegen will now zero-extend the values at call site (so that they can be moved to the right register) and then truncate them back their original width. x86 native codegen needed some updates, since it wasn't able to deal with the new widths, but all the changes are quite localized. LLVM backend seems to just work. This is the second attempt at merging this, after the first attempt in D4475 had to be backed out due to regressions on i386. Bumps binary submodule. Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com> Test Plan: ./validate (on both x86-{32,64}) Reviewers: bgamari, hvr, goldfire, simonmar Subscribers: rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5258
Diffstat (limited to 'compiler/types')
-rw-r--r--compiler/types/TyCon.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/types/TyCon.hs b/compiler/types/TyCon.hs
index eeebf8b9cf..7322a168ab 100644
--- a/compiler/types/TyCon.hs
+++ b/compiler/types/TyCon.hs
@@ -1325,9 +1325,11 @@ data PrimRep
= VoidRep
| LiftedRep
| UnliftedRep -- ^ Unlifted pointer
+ | Int8Rep -- ^ Signed, 8-bit value
| IntRep -- ^ Signed, word-sized value
| WordRep -- ^ Unsigned, word-sized value
| Int64Rep -- ^ Signed, 64 bit value (with 32-bit words only)
+ | Word8Rep -- ^ Unsigned, 8 bit value
| Word64Rep -- ^ Unsigned, 64 bit value (with 32-bit words only)
| AddrRep -- ^ A pointer, but /not/ to a Haskell value (use '(Un)liftedRep')
| FloatRep
@@ -1373,7 +1375,9 @@ isGcPtrRep _ = False
primRepSizeB :: DynFlags -> PrimRep -> Int
primRepSizeB dflags IntRep = wORD_SIZE dflags
primRepSizeB dflags WordRep = wORD_SIZE dflags
+primRepSizeB _ Int8Rep = 1
primRepSizeB _ Int64Rep = wORD64_SIZE
+primRepSizeB _ Word8Rep = 1
primRepSizeB _ Word64Rep = wORD64_SIZE
primRepSizeB _ FloatRep = fLOAT_SIZE
primRepSizeB dflags DoubleRep = dOUBLE_SIZE dflags