[project @ 1997-08-25 21:35:02 by sof]
[ghc-hetmet.git] / ghc / compiler / nativeGen / NCG.h
1 #ifndef NCG_H
2 #define NCG_H
3 #if 0
4  COMPILING_NCG is used to control the visibility of 
5  relevant information from the GHC header files when
6  compiling the native code generator modules.
7 #endif
8
9 #ifndef COMPILING_NCG
10 #define COMPILING_NCG
11 #endif
12
13 #if 0
14
15 IMPORTANT!  If you put extra tabs/spaces in these macro definitions,
16 you will screw up the layout where they are used in case expressions!
17
18 (This is cpp-dependent, of course)
19
20 ** Convenience macros for writing the native-code generator **
21
22 #endif
23
24 #define FAST_REG_NO FAST_INT
25
26 #include "../../includes/config.h"
27
28 #if 0
29 {-testing only-}
30 #undef sparc_TARGET_ARCH
31 #undef sunos4_TARGET_OS
32 #undef i386_TARGET_ARCH
33 #define i386_TARGET_ARCH 1
34 #undef linuxaout_TARGET_OS
35 #define linuxaout_TARGET_OS 1
36 #endif
37 #if 0
38 {-testing only-}
39 #undef sparc_TARGET_ARCH
40 #undef sunos4_TARGET_OS
41 #undef alpha_TARGET_ARCH
42 #define alpha_TARGET_ARCH 1
43 #endif
44
45 #if i386_TARGET_ARCH
46 # define STOLEN_X86_REGS 4
47 -- HACK: go for the max
48 #endif
49
50 #include "../../includes/MachRegs.h"
51
52 #if alpha_TARGET_ARCH
53 # define BYTES_PER_WORD 8
54 # define BYTES_PER_WORD_STR "8"
55
56 # include "../../includes/alpha-dec-osf1.h"
57 #endif
58
59 #if i386_TARGET_ARCH
60 # define BYTES_PER_WORD 4
61 # define BYTES_PER_WORD_STR "4"
62
63 # if linuxaout_TARGET_OS
64 #  include "../../includes/i386-unknown-linuxaout.h"
65 # endif
66 # if linux_TARGET_OS
67 #  include "../../includes/i386-unknown-linux.h"
68 # endif
69 # if freebsd_TARGET_OS
70 #  include "../../includes/i386-unknown-freebsd.h"
71 # endif
72 # if netbsd_TARGET_OS
73 #  include "../../includes/i386-unknown-netbsd.h"
74 # endif
75 # if bsdi_TARGET_OS
76 #  include "../../includes/i386-unknown-bsdi.h"
77 # endif
78 # if cygwin32_TARGET_OS
79 #  include "../../includes/i386-unknown-cygwin32.h"
80 # endif
81 # if solaris2_TARGET_OS
82 #  include "../../includes/i386-unknown-solaris2.h"
83 # endif
84 #endif
85
86 #if sparc_TARGET_ARCH
87 # define BYTES_PER_WORD 4
88 # define BYTES_PER_WORD_STR "4"
89
90 # if sunos4_TARGET_OS
91 #  include "../../includes/sparc-sun-sunos4.h"
92 # endif
93 # if solaris2_TARGET_OS
94 #  include "../../includes/sparc-sun-solaris2.h"
95 # endif
96 #endif
97
98 ---------------------------------------------
99
100 #if alpha_TARGET_ARCH
101 # define IF_ARCH_alpha(x,y) x
102 #else
103 # define IF_ARCH_alpha(x,y) y
104 #endif
105
106 ---------------------------------------------
107
108 #if i386_TARGET_ARCH
109 # define IF_ARCH_i386(x,y) x
110 #else
111 # define IF_ARCH_i386(x,y) y
112 #endif
113 -- - - - - - - - - - - - - - - - - - - - - - 
114 #if freebsd_TARGET_OS
115 # define IF_OS_freebsd(x,y) x
116 #else
117 # define IF_OS_freebsd(x,y) y
118 #endif
119 -- - - - - - - - - - - - - - - - - - - - - - 
120 #if netbsd_TARGET_OS
121 # define IF_OS_netbsd(x,y) x
122 #else
123 # define IF_OS_netbsd(x,y) y
124 #endif
125 -- - - - - - - - - - - - - - - - - - - - - - 
126 #if linux_TARGET_OS
127 # define IF_OS_linux(x,y) x
128 #else
129 # define IF_OS_linux(x,y) y
130 #endif
131 -- - - - - - - - - - - - - - - - - - - - - - 
132 #if linuxaout_TARGET_OS
133 # define IF_OS_linuxaout(x,y) x
134 #else
135 # define IF_OS_linuxaout(x,y) y
136 #endif
137 -- - - - - - - - - - - - - - - - - - - - - - 
138 #if bsdi_TARGET_OS
139 # define IF_OS_bsdi(x,y) x
140 #else
141 # define IF_OS_bsdi(x,y) y
142 #endif
143 -- - - - - - - - - - - - - - - - - - - - - - 
144 #if cygwin32_TARGET_OS
145 # define IF_OS_cygwin32(x,y) x
146 #else
147 # define IF_OS_cygwin32(x,y) y
148 #endif
149 ---------------------------------------------
150 #if sparc_TARGET_ARCH
151 # define IF_ARCH_sparc(x,y) x
152 #else
153 # define IF_ARCH_sparc(x,y) y
154 #endif
155 -- - - - - - - - - - - - - - - - - - - - - - 
156 #if sunos4_TARGET_OS
157 # define IF_OS_sunos4(x,y) x
158 #else
159 # define IF_OS_sunos4(x,y) y
160 #endif
161 -- - - - - - - - - - - - - - - - - - - - - - 
162 -- NB: this will catch i386-*-solaris2, too
163 #if solaris2_TARGET_OS
164 # define IF_OS_solaris2(x,y) x
165 #else
166 # define IF_OS_solaris2(x,y) y
167 #endif
168 ---------------------------------------------
169 #endif