2 -- | Bits and pieces on the bottom of the module dependency tree.
3 -- Also import the required constants, so we know what we're using.
5 -- In the interests of cross-compilation, we want to free ourselves
6 -- from the autoconf generated modules like main/Constants
21 import qualified Constants
27 -- On 32 bit SPARC, pointers are 32 bits.
31 wordLengthInBits :: Int
35 -- Size of the available spill area
36 spillAreaLength :: Int
38 = Constants.rESERVED_C_STACK_BYTES
40 -- | We need 8 bytes because our largest registers are 64 bit.
45 -- | We (allegedly) put the first six C-call arguments in registers;
46 -- where do we start putting the rest of them?
47 extraStackArgsHere :: Int
48 extraStackArgsHere = 23
51 {-# SPECIALIZE fits13Bits :: Int -> Bool, Integer -> Bool #-}
52 -- | Check whether an offset is representable with 13 bits.
53 fits13Bits :: Integral a => a -> Bool
54 fits13Bits x = x >= -4096 && x < 4096
56 -- | Check whether an integer will fit in 32 bits.
57 -- A CmmInt is intended to be truncated to the appropriate
58 -- number of bits, so here we truncate it to Int64. This is
59 -- important because e.g. -1 as a CmmInt might be either
60 -- -1 or 18446744073709551615.
62 is32BitInteger :: Integer -> Bool
64 = i64 <= 0x7fffffff && i64 >= -0x80000000
65 where i64 = fromIntegral i :: Int64
69 largeOffsetError :: Integral a => a -> b
71 = panic ("ERROR: SPARC native-code generator cannot handle large offset ("
72 ++ show i ++ ");\nprobably because of large constant data structures;" ++
73 "\nworkaround: use -fvia-C on this module.\n")