diff options
author | Simon Marlow <simonmar@microsoft.com> | 2006-04-07 02:05:11 +0000 |
---|---|---|
committer | Simon Marlow <simonmar@microsoft.com> | 2006-04-07 02:05:11 +0000 |
commit | 0065d5ab628975892cea1ec7303f968c3338cbe1 (patch) | |
tree | 8e2afe0ab48ee33cf95009809d67c9649573ef92 /includes/MachDeps.h | |
parent | 28a464a75e14cece5db40f2765a29348273ff2d2 (diff) | |
download | haskell-0065d5ab628975892cea1ec7303f968c3338cbe1.tar.gz |
Reorganisation of the source tree
Most of the other users of the fptools build system have migrated to
Cabal, and with the move to darcs we can now flatten the source tree
without losing history, so here goes.
The main change is that the ghc/ subdir is gone, and most of what it
contained is now at the top level. The build system now makes no
pretense at being multi-project, it is just the GHC build system.
No doubt this will break many things, and there will be a period of
instability while we fix the dependencies. A straightforward build
should work, but I haven't yet fixed binary/source distributions.
Changes to the Building Guide will follow, too.
Diffstat (limited to 'includes/MachDeps.h')
-rw-r--r-- | includes/MachDeps.h | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/includes/MachDeps.h b/includes/MachDeps.h new file mode 100644 index 0000000000..abe4405d5e --- /dev/null +++ b/includes/MachDeps.h @@ -0,0 +1,108 @@ +/* ----------------------------------------------------------------------------- + * + * (c) The University of Glasgow 2002 + * + * Definitions that characterise machine specific properties of basic + * types (C & Haskell). + * + * NB: Keep in sync with HsFFI.h and StgTypes.h. + * NB: THIS FILE IS INCLUDED IN HASKELL SOURCE! + * ---------------------------------------------------------------------------*/ + +#ifndef MACHDEPS_H +#define MACHDEPS_H + +/* Sizes of C types come from here... */ +#include "ghcautoconf.h" + +/* Sizes of Haskell types follow. These sizes correspond to: + * - the number of bytes in the primitive type (eg. Int#) + * - the number of bytes in the external representation (eg. HsInt) + * - the scale offset used by writeFooOffAddr# + * + * In the heap, the type may take up more space: eg. SIZEOF_INT8 == 1, + * but it takes up SIZEOF_HSWORD (4 or 8) bytes in the heap. + */ + +/* First, check some assumptions.. */ +#if SIZEOF_CHAR != 1 +#error GHC untested on this architecture: sizeof(char) != 1 +#endif + +#if SIZEOF_SHORT != 2 +#error GHC untested on this architecture: sizeof(short) != 2 +#endif + +#if SIZEOF_UNSIGNED_INT != 4 +#error GHC untested on this architecture: sizeof(unsigned int) != 4 +#endif + +#define SIZEOF_HSCHAR SIZEOF_WORD32 +#define ALIGNMENT_HSCHAR ALIGNMENT_WORD32 + +#define SIZEOF_HSINT SIZEOF_VOID_P +#define ALIGNMENT_HSINT ALIGNMENT_VOID_P + +#define SIZEOF_HSWORD SIZEOF_VOID_P +#define ALIGNMENT_HSWORD ALIGNMENT_VOID_P + +#define SIZEOF_HSDOUBLE SIZEOF_DOUBLE +#define ALIGNMENT_HSDOUBLE ALIGNMENT_DOUBLE + +#define SIZEOF_HSFLOAT SIZEOF_FLOAT +#define ALIGNMENT_HSFLOAT ALIGNMENT_FLOAT + +#define SIZEOF_HSPTR SIZEOF_VOID_P +#define ALIGNMENT_HSPTR ALIGNMENT_VOID_P + +#define SIZEOF_HSFUNPTR SIZEOF_VOID_P +#define ALIGNMENT_HSFUNPTR ALIGNMENT_VOID_P + +#define SIZEOF_HSFOREIGNPTR SIZEOF_VOID_P +#define ALIGNMENT_HSFOREIGNPTR ALIGNMENT_VOID_P + +#define SIZEOF_HSSTABLEPTR SIZEOF_VOID_P +#define ALIGNMENT_HSSTABLEPTR ALIGNMENT_VOID_P + +#define SIZEOF_INT8 SIZEOF_CHAR +#define ALIGNMENT_INT8 ALIGNMENT_CHAR + +#define SIZEOF_WORD8 SIZEOF_UNSIGNED_CHAR +#define ALIGNMENT_WORD8 ALIGNMENT_UNSIGNED_CHAR + +#define SIZEOF_INT16 SIZEOF_SHORT +#define ALIGNMENT_INT16 ALIGNMENT_SHORT + +#define SIZEOF_WORD16 SIZEOF_UNSIGNED_SHORT +#define ALIGNMENT_WORD16 ALIGNMENT_UNSIGNED_SHORT + +#define SIZEOF_INT32 SIZEOF_INT +#define ALIGNMENT_INT32 ALIGNMENT_INT + +#define SIZEOF_WORD32 SIZEOF_UNSIGNED_INT +#define ALIGNMENT_WORD32 ALIGNMENT_UNSIGNED_INT + +#if HAVE_LONG_LONG && SIZEOF_VOID_P < 8 +/* assume long long is 64 bits */ +#define SIZEOF_INT64 SIZEOF_LONG_LONG +#define ALIGNMENT_INT64 ALIGNMENT_LONG_LONG +#define SIZEOF_WORD64 SIZEOF_UNSIGNED_LONG_LONG +#define ALIGNMENT_WORD64 ALIGNMENT_UNSIGNED_LONG_LONG +#elif SIZEOF_LONG == 8 +#define SIZEOF_INT64 SIZEOF_LONG +#define ALIGNMENT_INT64 ALIGNMENT_LONG +#define SIZEOF_WORD64 SIZEOF_UNSIGNED_LONG +#define ALIGNMENT_WORD64 ALIGNMENT_UNSIGNED_LONG +#else +#error GHC untested on this architecture: sizeof(void *) < 8 and no long longs. +#endif + +#ifndef WORD_SIZE_IN_BITS +#if SIZEOF_HSWORD == 4 +#define WORD_SIZE_IN_BITS 32 +#else +#define WORD_SIZE_IN_BITS 64 +#endif +#endif + +#endif /* MACHDEPS_H */ |