tm.texi (LEGITIMIZE_ADDRESS): Revise documentation.
[official-gcc.git] / gcc / config / sparc / sol2-bi.h
blobb2933f68806eb50da6a3e50bb1b4f26c4a9d7ee9
1 /* Definitions of target machine for GCC, for bi-arch SPARC
2 running Solaris 2 using the system assembler and linker.
4 Copyright (C) 2002, 2003, 2004, 2006, 2007, 2009 Free Software Foundation, Inc.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 3.1, as published by the Free Software Foundation.
22 You should have received a copy of the GNU General Public License and
23 a copy of the GCC Runtime Library Exception along with this program;
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 <http://www.gnu.org/licenses/>. */
27 /* The default code model used to be CM_MEDANY on Solaris
28 but even Sun eventually found it to be quite wasteful
29 and changed it to CM_MEDMID in the Studio 9 compiler. */
30 #undef SPARC_DEFAULT_CMODEL
31 #define SPARC_DEFAULT_CMODEL CM_MEDMID
33 #define AS_SPARC64_FLAG "-xarch=v9"
35 #undef ASM_CPU32_DEFAULT_SPEC
36 #define ASM_CPU32_DEFAULT_SPEC ""
37 #undef ASM_CPU64_DEFAULT_SPEC
38 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG
40 #if TARGET_CPU_DEFAULT == TARGET_CPU_v9
41 #undef CPP_CPU64_DEFAULT_SPEC
42 #define CPP_CPU64_DEFAULT_SPEC ""
43 #undef ASM_CPU32_DEFAULT_SPEC
44 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plus"
45 #endif
47 #if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
48 #undef CPP_CPU64_DEFAULT_SPEC
49 #define CPP_CPU64_DEFAULT_SPEC ""
50 #undef ASM_CPU32_DEFAULT_SPEC
51 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusa"
52 #undef ASM_CPU64_DEFAULT_SPEC
53 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "a"
54 #endif
56 #if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc3
57 #undef CPP_CPU64_DEFAULT_SPEC
58 #define CPP_CPU64_DEFAULT_SPEC ""
59 #undef ASM_CPU32_DEFAULT_SPEC
60 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusb"
61 #undef ASM_CPU64_DEFAULT_SPEC
62 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "b"
63 #endif
65 #if TARGET_CPU_DEFAULT == TARGET_CPU_niagara
66 #undef CPP_CPU64_DEFAULT_SPEC
67 #define CPP_CPU64_DEFAULT_SPEC ""
68 #undef ASM_CPU32_DEFAULT_SPEC
69 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusb"
70 #undef ASM_CPU64_DEFAULT_SPEC
71 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "b"
72 #endif
74 #if TARGET_CPU_DEFAULT == TARGET_CPU_niagara2
75 #undef CPP_CPU64_DEFAULT_SPEC
76 #define CPP_CPU64_DEFAULT_SPEC ""
77 #undef ASM_CPU32_DEFAULT_SPEC
78 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusb"
79 #undef ASM_CPU64_DEFAULT_SPEC
80 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "b"
81 #endif
83 #if DEFAULT_ARCH32_P
84 #define DEF_ARCH32_SPEC(__str) "%{!m64:" __str "}"
85 #define DEF_ARCH64_SPEC(__str) "%{m64:" __str "}"
86 #else
87 #define DEF_ARCH32_SPEC(__str) "%{m32:" __str "}"
88 #define DEF_ARCH64_SPEC(__str) "%{!m32:" __str "}"
89 #endif
91 #undef CPP_CPU_SPEC
92 #define CPP_CPU_SPEC "\
93 %{mcypress:} \
94 %{msparclite|mf930|mf934:-D__sparclite__} \
95 %{mv8:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
96 %{msupersparc:-D__supersparc__ " DEF_ARCH32_SPEC("-D__sparcv8") "} \
97 %{mcpu=sparclet|mcpu=tsc701:-D__sparclet__} \
98 %{mcpu=sparclite|mcpu-f930|mcpu=f934:-D__sparclite__} \
99 %{mcpu=v8:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
100 %{mcpu=supersparc:-D__supersparc__ " DEF_ARCH32_SPEC("-D__sparcv8") "} \
101 %{mcpu=v9|mcpu=ultrasparc|mcpu=ultrasparc3|mcpu=niagara|mcpu=niagara2:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
102 %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(cpp_cpu_default)}}}}}}} \
105 #undef ASM_CPU_SPEC
106 #define ASM_CPU_SPEC "\
107 %{mcpu=v9:" DEF_ARCH32_SPEC("-xarch=v8plus") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "} \
108 %{mcpu=ultrasparc:" DEF_ARCH32_SPEC("-xarch=v8plusa") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "a") "} \
109 %{mcpu=ultrasparc3:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "b") "} \
110 %{mcpu=niagara:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "b") "} \
111 %{mcpu=niagara2:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "b") "} \
112 %{!mcpu=niagara2:%{!mcpu=niagara:%{!mcpu=ultrasparc3:%{!mcpu=ultrasparc:%{!mcpu=v9:%{mcpu*:" DEF_ARCH32_SPEC("-xarch=v8") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "}}}}}} \
113 %{!mcpu*:%(asm_cpu_default)} \
116 #undef CPP_CPU_DEFAULT_SPEC
117 #define CPP_CPU_DEFAULT_SPEC \
118 (DEFAULT_ARCH32_P ? "\
119 %{m64:" CPP_CPU64_DEFAULT_SPEC "} \
120 %{!m64:" CPP_CPU32_DEFAULT_SPEC "} \
121 " : "\
122 %{m32:" CPP_CPU32_DEFAULT_SPEC "} \
123 %{!m32:" CPP_CPU64_DEFAULT_SPEC "} \
126 #undef ASM_CPU_DEFAULT_SPEC
127 #define ASM_CPU_DEFAULT_SPEC \
128 (DEFAULT_ARCH32_P ? "\
129 %{m64:" ASM_CPU64_DEFAULT_SPEC "} \
130 %{!m64:" ASM_CPU32_DEFAULT_SPEC "} \
131 " : "\
132 %{m32:" ASM_CPU32_DEFAULT_SPEC "} \
133 %{!m32:" ASM_CPU64_DEFAULT_SPEC "} \
136 /* wchar_t is called differently in <wchar.h> for 32 and 64-bit
137 compilations. This is called for by SCD 2.4.1, p. 6-83, Figure 6-65
138 (32-bit) and p. 6P-10, Figure 6.38 (64-bit). */
140 #undef WCHAR_TYPE
141 #define WCHAR_TYPE (TARGET_ARCH64 ? "int" : "long int")
143 #undef WCHAR_TYPE_SIZE
144 #define WCHAR_TYPE_SIZE 32
146 /* Same for wint_t. See SCD 2.4.1, p. 6-83, Figure 6-66 (32-bit). There's
147 no corresponding 64-bit definition, but this is what Solaris 8
148 <iso/wchar_iso.h> uses. */
150 #undef WINT_TYPE
151 #define WINT_TYPE (TARGET_ARCH64 ? "int" : "long int")
153 #undef WINT_TYPE_SIZE
154 #define WINT_TYPE_SIZE 32
156 #undef CPP_ARCH32_SPEC
157 #define CPP_ARCH32_SPEC ""
158 #undef CPP_ARCH64_SPEC
159 #define CPP_ARCH64_SPEC "-D__arch64__ -D__sparcv9"
161 #undef CPP_ARCH_SPEC
162 #define CPP_ARCH_SPEC "\
163 %{m32:%(cpp_arch32)} \
164 %{m64:%(cpp_arch64)} \
165 %{!m32:%{!m64:%(cpp_arch_default)}} \
168 #undef ASM_ARCH_SPEC
169 #define ASM_ARCH_SPEC ""
171 #undef ASM_ARCH32_SPEC
172 #define ASM_ARCH32_SPEC ""
174 #undef ASM_ARCH64_SPEC
175 #define ASM_ARCH64_SPEC ""
177 #undef ASM_ARCH_DEFAULT_SPEC
178 #define ASM_ARCH_DEFAULT_SPEC ""
180 #undef SUBTARGET_EXTRA_SPECS
181 #define SUBTARGET_EXTRA_SPECS \
182 { "startfile_arch", STARTFILE_ARCH_SPEC }, \
183 { "link_arch32", LINK_ARCH32_SPEC }, \
184 { "link_arch64", LINK_ARCH64_SPEC }, \
185 { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
186 { "link_arch", LINK_ARCH_SPEC },
189 * This should be the same as in sol2.h, except with "/sparcv9"
190 * appended to the paths and /usr/ccs/lib is no longer necessary
192 #define LINK_ARCH64_SPEC_BASE \
193 "%{mcmodel=medlow:-M /usr/lib/ld/sparcv9/map.below4G} \
194 %{G:-G} \
195 %{YP,*} \
196 %{R*} \
197 %{compat-bsd: \
198 %{!YP,*:%{p|pg:-Y P,%R/usr/ucblib/sparcv9:%R/usr/lib/libp/sparcv9:%R/usr/lib/sparcv9} \
199 %{!p:%{!pg:-Y P,%R/usr/ucblib/sparcv9:%R/usr/lib/sparcv9}}} \
200 -R %R/usr/ucblib/sparcv9} \
201 %{!compat-bsd: \
202 %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp/sparcv9:%R/usr/lib/sparcv9} \
203 %{!p:%{!pg:-Y P,%R/usr/lib/sparcv9}}}}"
205 #define LINK_ARCH64_SPEC LINK_ARCH64_SPEC_BASE
207 #undef LINK_ARCH_SPEC
208 #if DISABLE_MULTILIB
209 #if DEFAULT_ARCH32_P
210 #define LINK_ARCH_SPEC "\
211 %{m32:%(link_arch32)} \
212 %{m64:%edoes not support multilib} \
213 %{!m32:%{!m64:%(link_arch_default)}} \
215 #else
216 #define LINK_ARCH_SPEC "\
217 %{m32:%edoes not support multilib} \
218 %{m64:%(link_arch64)} \
219 %{!m32:%{!m64:%(link_arch_default)}} \
221 #endif
222 #else
223 #define LINK_ARCH_SPEC "\
224 %{m32:%(link_arch32)} \
225 %{m64:%(link_arch64)} \
226 %{!m32:%{!m64:%(link_arch_default)}} \
228 #endif
230 #define LINK_ARCH_DEFAULT_SPEC \
231 (DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC)
233 #undef CC1_SPEC
234 #if DEFAULT_ARCH32_P
235 #define CC1_SPEC "\
236 %{sun4:} %{target:} \
237 %{mcypress:-mcpu=cypress} \
238 %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
239 %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
240 %{m32:%{m64:%emay not use both -m32 and -m64}} \
241 %{m64:-mptr64 -mstack-bias -mno-v8plus \
242 %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8*:%{!msupersparc:-mcpu=v9}}}}}}}} \
244 #else
245 #define CC1_SPEC "\
246 %{sun4:} %{target:} \
247 %{mcypress:-mcpu=cypress} \
248 %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
249 %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
250 %{m32:%{m64:%emay not use both -m32 and -m64}} \
251 %{m32:-mptr32 -mno-stack-bias \
252 %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8*:%{!msupersparc:-mcpu=cypress}}}}}}}} \
253 %{mv8plus:-m32 -mptr32 -mno-stack-bias \
254 %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:-mcpu=v9}}}}}}}} \
256 #endif
258 /* Support for a compile-time default CPU, et cetera. The rules are:
259 --with-cpu is ignored if -mcpu is specified.
260 --with-tune is ignored if -mtune is specified.
261 --with-float is ignored if -mhard-float, -msoft-float, -mfpu, or -mno-fpu
262 are specified.
263 In the SPARC_BI_ARCH compiler we cannot pass %{!mcpu=*:-mcpu=%(VALUE)}
264 here, otherwise say -mcpu=v7 would be passed even when -m64.
265 CC1_SPEC above takes care of this instead. */
266 #undef OPTION_DEFAULT_SPECS
267 #if DEFAULT_ARCH32_P
268 #define OPTION_DEFAULT_SPECS \
269 {"cpu", "%{!m64:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
270 {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
271 {"float", "%{!msoft-float:%{!mhard-float:%{!fpu:%{!no-fpu:-m%(VALUE)-float}}}}" }
272 #else
273 #define OPTION_DEFAULT_SPECS \
274 {"cpu", "%{!m32:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
275 {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
276 {"float", "%{!msoft-float:%{!mhard-float:%{!fpu:%{!no-fpu:-m%(VALUE)-float}}}}" }
277 #endif
279 #if DEFAULT_ARCH32_P
280 #define MULTILIB_DEFAULTS { "m32" }
281 #else
282 #define MULTILIB_DEFAULTS { "m64" }
283 #endif