a5c5d3ef173853e36a9f23d2ae6ddb915de10404
[ghc-hetmet.git] / ghc / compiler / nativeGen / NCG.h
1 #define COMMA ,
2
3 #ifndef NCG_H
4 #define NCG_H
5 #if 0
6  COMPILING_NCG is used to control the visibility of 
7  relevant information from the GHC header files when
8  compiling the native code generator modules.
9 #endif
10
11 #ifndef COMPILING_NCG
12 #define COMPILING_NCG
13 #endif
14
15 #if 0
16
17 IMPORTANT!  If you put extra tabs/spaces in these macro definitions,
18 you will screw up the layout where they are used in case expressions!
19
20 (This is cpp-dependent, of course)
21
22 ** Convenience macros for writing the native-code generator **
23
24 #endif
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 #include "../includes/NativeDefs.h"
52
53 #if alpha_TARGET_ARCH
54 # define BYTES_PER_WORD 8
55 # define BYTES_PER_WORD_STR "8"
56 #endif
57
58 #if i386_TARGET_ARCH
59 # define BYTES_PER_WORD 4
60 # define BYTES_PER_WORD_STR "4"
61 #endif
62
63 #if sparc_TARGET_ARCH
64 # define BYTES_PER_WORD 4
65 # define BYTES_PER_WORD_STR "4"
66 #endif
67
68 #if powerpc_TARGET_ARCH
69 # define BYTES_PER_WORD 4
70 # define BYTES_PER_WORD_STR "4"
71 #endif
72
73 ---------------------------------------------
74
75 #if alpha_TARGET_ARCH
76 # define IF_ARCH_alpha(x,y) x
77 #else
78 # define IF_ARCH_alpha(x,y) y
79 #endif
80
81 ---------------------------------------------
82
83 #if i386_TARGET_ARCH
84 # define IF_ARCH_i386(x,y) x
85 #else
86 # define IF_ARCH_i386(x,y) y
87 #endif
88 -- - - - - - - - - - - - - - - - - - - - - - 
89 #if freebsd_TARGET_OS
90 # define IF_OS_freebsd(x,y) x
91 #else
92 # define IF_OS_freebsd(x,y) y
93 #endif
94 -- - - - - - - - - - - - - - - - - - - - - - 
95 #if netbsd_TARGET_OS
96 # define IF_OS_netbsd(x,y) x
97 #else
98 # define IF_OS_netbsd(x,y) y
99 #endif
100 -- - - - - - - - - - - - - - - - - - - - - - 
101 #if openbsd_TARGET_OS
102 # define IF_OS_openbsd(x,y) x
103 #else
104 # define IF_OS_openbsd(x,y) y
105 #endif
106 -- - - - - - - - - - - - - - - - - - - - - - 
107 #if linux_TARGET_OS
108 # define IF_OS_linux(x,y) x
109 #else
110 # define IF_OS_linux(x,y) y
111 #endif
112 -- - - - - - - - - - - - - - - - - - - - - - 
113 #if linuxaout_TARGET_OS
114 # define IF_OS_linuxaout(x,y) x
115 #else
116 # define IF_OS_linuxaout(x,y) y
117 #endif
118 -- - - - - - - - - - - - - - - - - - - - - - 
119 #if bsdi_TARGET_OS
120 # define IF_OS_bsdi(x,y) x
121 #else
122 # define IF_OS_bsdi(x,y) y
123 #endif
124 -- - - - - - - - - - - - - - - - - - - - - - 
125 #if cygwin32_TARGET_OS
126 # define IF_OS_cygwin32(x,y) x
127 #else
128 # define IF_OS_cygwin32(x,y) y
129 #endif
130 ---------------------------------------------
131 #if sparc_TARGET_ARCH
132 # define IF_ARCH_sparc(x,y) x
133 #else
134 # define IF_ARCH_sparc(x,y) y
135 #endif
136 -- - - - - - - - - - - - - - - - - - - - - - 
137 #if sunos4_TARGET_OS
138 # define IF_OS_sunos4(x,y) x
139 #else
140 # define IF_OS_sunos4(x,y) y
141 #endif
142 -- - - - - - - - - - - - - - - - - - - - - - 
143 -- NB: this will catch i386-*-solaris2, too
144 #if solaris2_TARGET_OS
145 # define IF_OS_solaris2(x,y) x
146 #else
147 # define IF_OS_solaris2(x,y) y
148 #endif
149 ---------------------------------------------
150 #if powerpc_TARGET_ARCH
151 # define IF_ARCH_powerpc(x,y) x
152 #else
153 # define IF_ARCH_powerpc(x,y) y
154 #endif
155 -- - - - - - - - - - - - - - - - - - - - - - 
156 #if darwin_TARGET_OS
157 # define IF_OS_darwin(x,y) x
158 #else
159 # define IF_OS_darwin(x,y) y
160 #endif
161 ---------------------------------------------
162 #endif