diff options
author | Ben.Lippmeier@anu.edu.au <unknown> | 2009-02-16 00:09:45 +0000 |
---|---|---|
committer | Ben.Lippmeier@anu.edu.au <unknown> | 2009-02-16 00:09:45 +0000 |
commit | 547bf6827f1fc3f2fb31bc6323cc0d33b445f32a (patch) | |
tree | 04cc974d7213d7c116cc509efcae4f43530baeac /compiler/nativeGen/SPARC/Base.hs | |
parent | 8b94848bae9cabac968d9c86c36a28d3cc7b6a72 (diff) | |
download | haskell-547bf6827f1fc3f2fb31bc6323cc0d33b445f32a.tar.gz |
SPARC NCG: Reorganise Reg and RegInfo
Diffstat (limited to 'compiler/nativeGen/SPARC/Base.hs')
-rw-r--r-- | compiler/nativeGen/SPARC/Base.hs | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/compiler/nativeGen/SPARC/Base.hs b/compiler/nativeGen/SPARC/Base.hs new file mode 100644 index 0000000000..1549ab5a84 --- /dev/null +++ b/compiler/nativeGen/SPARC/Base.hs @@ -0,0 +1,51 @@ + +-- | Bits and pieces on the bottom of the module dependency tree. +-- Also import the required constants, so we know what we're using. +-- +-- In the interests of cross-compilation, we want to free ourselves +-- from the autoconf generated modules like main/Constants +-- +module SPARC.Base ( + wordLength, + wordLengthInBits, + spillAreaLength, + spillSlotSize, + fits13Bits, + largeOffsetError +) + +where + +import qualified Constants +import Panic + +-- On 32 bit SPARC, pointers are 32 bits. +wordLength :: Int +wordLength = 4 + +wordLengthInBits :: Int +wordLengthInBits + = wordLength * 8 + +-- Size of the available spill area +spillAreaLength :: Int +spillAreaLength + = Constants.rESERVED_C_STACK_BYTES + +-- | We need 8 bytes because our largest registers are 64 bit. +spillSlotSize :: Int +spillSlotSize = 8 + + +{-# SPECIALIZE fits13Bits :: Int -> Bool, Integer -> Bool #-} +-- | Check whether an offset is representable with 13 bits. +fits13Bits :: Integral a => a -> Bool +fits13Bits x = x >= -4096 && x < 4096 + + +-- | Sadness. +largeOffsetError :: Integral a => a -> b +largeOffsetError i + = panic ("ERROR: SPARC native-code generator cannot handle large offset (" + ++ show i ++ ");\nprobably because of large constant data structures;" ++ + "\nworkaround: use -fvia-C on this module.\n") |