Commit b44db6f1 authored by ian@well-typed.com's avatar ian@well-typed.com

Remove some uses of the WORDS_BIGENDIAN CPP symbol

parent 98903b96
......@@ -165,13 +165,11 @@ packHalfWordsCLit :: DynFlags -> StgHalfWord -> StgHalfWord -> CmmLit
-- ToDo: consider using half-word lits instead
-- but be careful: that's vulnerable when reversed
packHalfWordsCLit dflags lower_half_word upper_half_word
#ifdef WORDS_BIGENDIAN
= mkWordCLit dflags ((fromIntegral lower_half_word `shiftL` hALF_WORD_SIZE_IN_BITS)
.|. fromIntegral upper_half_word)
#else
= mkWordCLit dflags ((fromIntegral lower_half_word)
.|. (fromIntegral upper_half_word `shiftL` hALF_WORD_SIZE_IN_BITS))
#endif
= if wORDS_BIGENDIAN dflags
then mkWordCLit dflags ((l `shiftL` hALF_WORD_SIZE_IN_BITS) .|. u)
else mkWordCLit dflags (l .|. (u `shiftL` hALF_WORD_SIZE_IN_BITS))
where l = fromIntegral lower_half_word
u = fromIntegral upper_half_word
---------------------------------------------------
--
......
......@@ -492,13 +492,11 @@ pprStatics dflags (CmmStaticLit (CmmFloat f W64) : rest)
= map pprLit1 (doubleToWords dflags f) ++ pprStatics dflags rest
pprStatics dflags (CmmStaticLit (CmmInt i W64) : rest)
| wordWidth dflags == W32
#ifdef WORDS_BIGENDIAN
= pprStatics dflags (CmmStaticLit (CmmInt q W32) :
CmmStaticLit (CmmInt r W32) : rest)
#else
= pprStatics dflags (CmmStaticLit (CmmInt r W32) :
CmmStaticLit (CmmInt q W32) : rest)
#endif
= if wORDS_BIGENDIAN dflags
then pprStatics dflags (CmmStaticLit (CmmInt q W32) :
CmmStaticLit (CmmInt r W32) : rest)
else pprStatics dflags (CmmStaticLit (CmmInt r W32) :
CmmStaticLit (CmmInt q W32) : rest)
where r = i .&. 0xffffffff
q = i `shiftR` 32
pprStatics dflags (CmmStaticLit (CmmInt _ w) : _)
......
......@@ -293,6 +293,27 @@ enum Mode { Gen_Haskell_Type, Gen_Haskell_Value, Gen_Haskell_Wrappers, Gen_Haske
#define FUN_OFFSET(sym) (OFFSET(Capability,f.sym) - OFFSET(Capability,r))
void constantBool(char *haskellName, int val) {
switch (mode) {
case Gen_Haskell_Type:
printf(" , pc_%s :: Bool\n", haskellName);
break;
case Gen_Haskell_Value:
printf(" , pc_%s = %s\n", haskellName, val ? "True" : "False");
break;
case Gen_Haskell_Wrappers:
printf("%s :: DynFlags -> Bool\n", haskellName);
printf("%s dflags = pc_%s (sPlatformConstants (settings dflags))\n",
haskellName, haskellName);
break;
case Gen_Haskell_Exports:
printf(" %s,\n", haskellName);
break;
case Gen_Header:
break;
}
}
void constantIntC(char *cName, char *haskellName, intptr_t val) {
/* If the value is larger than 2^28 or smaller than -2^28, then fail.
This test is a bit conservative, but if any constants are roughly
......@@ -700,6 +721,14 @@ main(int argc, char *argv[])
// Amount of pointer bits used for semi-tagging constructor closures
constantInt("tAG_BITS", TAG_BITS);
constantBool("wORDS_BIGENDIAN",
#ifdef WORDS_BIGENDIAN
1
#else
0
#endif
);
switch (mode) {
case Gen_Haskell_Type:
printf(" } deriving (Read, Show)\n");
......
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