implemented Confirm node
[libfirm] / ir / adt / host.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/adt/host.h
4  * Purpose:     Declarations describing the host machine and C compiler.
5  * Author:      Markus Armbruster
6  * Modified by:
7  * Created:     1999 by getting from fiasco
8  * CVS-ID:      $Id$
9  * Copyright:   (c) 1995, 1996 Markus Armbruster
10  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11  */
12
13 #ifndef _HOST_H
14 #define _HOST_H
15
16 #include <stddef.h>
17
18 /**
19  * @file host.h
20  */
21
22 /** A size handled efficiently by malloc(), at least 1K.  */
23 #define PREF_MALLOC_SIZE 2048
24
25
26 /** A wrapper around GNU C's __attribute__ */
27
28 /* According to the documentation, the attributes we are interested in
29    work with 2.5, but we encountered trouble before 2.7.  */
30 #if defined (__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 7
31 # define HAVE_ATTRIBUTE 1
32 # define ATTRIBUTE(attrs) __attribute__ (attrs)
33 #else
34 # define ATTRIBUTE(attrs)
35 #endif
36
37
38 /* Alignment */
39
40 /** A type that has most constrained alignment.  */
41 typedef union {
42   long double d;
43   void *p;
44   long l;
45 } aligned_type ATTRIBUTE ((aligned));
46
47 /** Inquiring about the alignment of a type.  */
48 #ifdef __GNUC__
49 # define ALIGNOF(type) __alignof__ (type)
50 #else
51 # define ALIGNOF(type) offsetof (struct { char c; type d; }, d)
52 #endif
53
54 /** Maximal alignment required for any type.  */
55 #define MAX_ALIGN ALIGNOF (aligned_type)
56
57 #endif