Initial revision
[libfirm] / ir / adt / host.h
1 /* Declarations describing the host machine and C compiler.
2    Copyright (C) 1995, 1996 Markus Armbruster
3    All rights reserved.*/
4
5 #ifndef _HOST_H
6 #define _HOST_H
7
8 #include <stddef.h>
9
10
11 /* A size handled efficiently by malloc(), at least 1K.  */
12 #define PREF_MALLOC_SIZE 2048
13
14
15 /* GNU C's __attribute__ */
16
17 /* According to the documentation, the attributes we are interested in
18    work with 2.5, but we encountered trouble before 2.7.  */
19 #if defined (__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 7
20 # define HAVE_ATTRIBUTE 1
21 # define ATTRIBUTE(attrs) __attribute__ (attrs)
22 #else
23 # define ATTRIBUTE(attrs)
24 #endif
25
26
27 /* Alignment */
28
29 /* A type that has most constrained alignment.  */
30 typedef union {
31   long double d;
32   void *p;
33   long l;
34 } aligned_type ATTRIBUTE ((aligned));
35
36 /* Inquiring about the alignment.  */
37 #ifdef __GNUC__
38 # define ALIGNOF(type) __alignof__ (type)
39 #else
40 # define ALIGNOF(type) offsetof (struct { char c; type d; }, d)
41 #endif
42
43 /* Maximal alignment required for any type.  */
44 #define MAX_ALIGN ALIGNOF (aligned_type)
45
46 #endif