summaryrefslogtreecommitdiff
path: root/ghc/compiler/nativeGen/MachMisc.lhs
diff options
context:
space:
mode:
authorsewardj <unknown>2001-01-31 12:27:25 +0000
committersewardj <unknown>2001-01-31 12:27:25 +0000
commit6142c28fbfb64b800f6a3530b623597eee9bd9be (patch)
treed79dbfb891784e9997b31006083478a3c342bee1 /ghc/compiler/nativeGen/MachMisc.lhs
parente95a551db710952fd25736055ea889eb8d65141a (diff)
downloadhaskell-6142c28fbfb64b800f6a3530b623597eee9bd9be.tar.gz
[project @ 2001-01-31 12:27:24 by sewardj]
Create PrimReps: {Int|Word}{8|16|32}Rep, for use in the native code generator. And change the rep for character ops from Int8Rep to Word8Rep. This fixes a bug in the sparc NCG in which chars loaded from memory were incorrectly sign-extended to 32 bits. This problem appeared when CharRep was turned into a 32-bit quantity, and previous uses of it were replaced with Int8Rep, incorrectly, since Int8Rep is signed. Also undo the kludge in the x86 section which had (unknown to all) kept it working despite the change to Int8Rep. sparc NCG now appears to work; hope the x86 side isn't now broken.
Diffstat (limited to 'ghc/compiler/nativeGen/MachMisc.lhs')
-rw-r--r--ghc/compiler/nativeGen/MachMisc.lhs17
1 files changed, 8 insertions, 9 deletions
diff --git a/ghc/compiler/nativeGen/MachMisc.lhs b/ghc/compiler/nativeGen/MachMisc.lhs
index 7113822dc5..85daf9224e 100644
--- a/ghc/compiler/nativeGen/MachMisc.lhs
+++ b/ghc/compiler/nativeGen/MachMisc.lhs
@@ -102,8 +102,8 @@ sizeOf :: PrimRep -> Integer{-in bytes-}
sizeOf pr = case (primRepToSize pr) of
IF_ARCH_alpha({B -> 1; BU -> 1; {-W -> 2; WU -> 2;-} L -> 4; {-SF -> 4;-} _ -> 8},)
- IF_ARCH_sparc({B -> 1; BU -> 1; {-HW -> 2; HWU -> 2;-} W -> 4; {-D -> 8;-} F -> 4; DF -> 8},)
- IF_ARCH_i386( {B -> 1; {-S -> 2;-} L -> 4; F -> 4; DF -> 8 },)
+ IF_ARCH_sparc({B -> 1; BU -> 1; W -> 4; F -> 4; DF -> 8},)
+ IF_ARCH_i386( {B -> 1; BU -> 1; L -> 4; F -> 4; DF -> 8 },)
\end{code}
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -249,10 +249,9 @@ data Size
| TF -- IEEE double-precision floating pt
#endif
#if i386_TARGET_ARCH
- = B -- byte (lower)
--- | HB -- higher byte **UNUSED**
--- | S -- : UNUSED
- | L
+ = B -- byte (signed, JRS:??lower??)
+ | BU -- byte, unsigned
+ | L -- word32
| F -- IEEE single-precision floating pt
| DF -- IEEE single-precision floating pt
| F80 -- Intel 80-bit internal FP format; only used for spilling
@@ -260,10 +259,7 @@ data Size
#if sparc_TARGET_ARCH
= B -- byte (signed)
| BU -- byte (unsigned)
--- | HW -- halfword, 2 bytes (signed): UNUSED
--- | HWU -- halfword, 2 bytes (unsigned): UNUSED
| W -- word, 4 bytes
--- | D -- doubleword, 8 bytes: UNUSED
| F -- IEEE single-precision floating pt
| DF -- IEEE single-precision floating pt
#endif
@@ -276,7 +272,10 @@ primRepToSize DataPtrRep = IF_ARCH_alpha( Q, IF_ARCH_i386( L, IF_ARCH_sparc(
primRepToSize RetRep = IF_ARCH_alpha( Q, IF_ARCH_i386( L, IF_ARCH_sparc( W ,)))
primRepToSize CostCentreRep = IF_ARCH_alpha( Q, IF_ARCH_i386( L, IF_ARCH_sparc( W ,)))
primRepToSize CharRep = IF_ARCH_alpha( L, IF_ARCH_i386( L, IF_ARCH_sparc( W ,)))
+
primRepToSize Int8Rep = IF_ARCH_alpha( B, IF_ARCH_i386( B, IF_ARCH_sparc( B ,)))
+primRepToSize Word8Rep = IF_ARCH_alpha( B, IF_ARCH_i386( B, IF_ARCH_sparc( BU,)))
+
primRepToSize IntRep = IF_ARCH_alpha( Q, IF_ARCH_i386( L, IF_ARCH_sparc( W ,)))
primRepToSize WordRep = IF_ARCH_alpha( Q, IF_ARCH_i386( L, IF_ARCH_sparc( W ,)))
primRepToSize AddrRep = IF_ARCH_alpha( Q, IF_ARCH_i386( L, IF_ARCH_sparc( W ,)))