]>
Commit | Line | Data |
---|---|---|
1a94ca49 | 1 | /* Definitions of target machine for GNU compiler, for DEC Alpha. |
9ddd9abd | 2 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
cf011243 | 3 | 2000, 2001 Free Software Foundation, Inc. |
1e6c6f11 | 4 | Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) |
1a94ca49 RK |
5 | |
6 | This file is part of GNU CC. | |
7 | ||
8 | GNU CC is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 2, or (at your option) | |
11 | any later version. | |
12 | ||
13 | GNU CC is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with GNU CC; see the file COPYING. If not, write to | |
38ead7f3 RK |
20 | the Free Software Foundation, 59 Temple Place - Suite 330, |
21 | Boston, MA 02111-1307, USA. */ | |
1a94ca49 RK |
22 | |
23 | ||
887af1f2 RO |
24 | /* For C++ we need to ensure that __LANGUAGE_C_PLUS_PLUS is defined independent |
25 | of the source file extension. */ | |
26 | #define CPLUSPLUS_CPP_SPEC "\ | |
27 | -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus \ | |
28 | %(cpp) \ | |
29 | " | |
30 | ||
21798cd8 RK |
31 | /* Write out the correct language type definition for the header files. |
32 | Unless we have assembler language, write out the symbols for C. */ | |
1a94ca49 | 33 | #define CPP_SPEC "\ |
952fc2ed RH |
34 | %{!undef:\ |
35 | %{.S:-D__LANGUAGE_ASSEMBLY__ -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY }}\ | |
952fc2ed | 36 | %{.m:-D__LANGUAGE_OBJECTIVE_C__ -D__LANGUAGE_OBJECTIVE_C }\ |
887af1f2 | 37 | %{!.S:%{!.cc:%{!.cxx:%{!.cpp:%{!.cp:%{!.c++:%{!.C:%{!.m:-D__LANGUAGE_C__ -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C }}}}}}}}}\ |
952fc2ed RH |
38 | %{mieee:-D_IEEE_FP }\ |
39 | %{mieee-with-inexact:-D_IEEE_FP -D_IEEE_FP_INEXACT }}\ | |
40 | %(cpp_cpu) %(cpp_subtarget)" | |
41 | ||
42 | #ifndef CPP_SUBTARGET_SPEC | |
43 | #define CPP_SUBTARGET_SPEC "" | |
44 | #endif | |
1a94ca49 RK |
45 | |
46 | /* Set the spec to use for signed char. The default tests the above macro | |
47 | but DEC's compiler can't handle the conditional in a "constant" | |
48 | operand. */ | |
49 | ||
50 | #define SIGNED_CHAR_SPEC "%{funsigned-char:-D__CHAR_UNSIGNED__}" | |
51 | ||
b890f297 | 52 | #define WORD_SWITCH_TAKES_ARG(STR) \ |
2efe55c1 | 53 | (!strcmp (STR, "rpath") || DEFAULT_WORD_SWITCH_TAKES_ARG(STR)) |
8877eb00 | 54 | |
1a94ca49 RK |
55 | /* Print subsidiary information on the compiler version in use. */ |
56 | #define TARGET_VERSION | |
57 | ||
1a94ca49 RK |
58 | /* Run-time compilation parameters selecting different hardware subsets. */ |
59 | ||
f6f6a13c RK |
60 | /* Which processor to schedule for. The cpu attribute defines a list that |
61 | mirrors this list, so changes to alpha.md must be made at the same time. */ | |
62 | ||
63 | enum processor_type | |
64 | {PROCESSOR_EV4, /* 2106[46]{a,} */ | |
e9a25f70 JL |
65 | PROCESSOR_EV5, /* 21164{a,pc,} */ |
66 | PROCESSOR_EV6}; /* 21264 */ | |
f6f6a13c RK |
67 | |
68 | extern enum processor_type alpha_cpu; | |
69 | ||
2bf6230d RK |
70 | enum alpha_trap_precision |
71 | { | |
72 | ALPHA_TP_PROG, /* No precision (default). */ | |
73 | ALPHA_TP_FUNC, /* Trap contained within originating function. */ | |
74 | ALPHA_TP_INSN /* Instruction accuracy and code is resumption safe. */ | |
75 | }; | |
76 | ||
77 | enum alpha_fp_rounding_mode | |
78 | { | |
79 | ALPHA_FPRM_NORM, /* Normal rounding mode. */ | |
80 | ALPHA_FPRM_MINF, /* Round towards minus-infinity. */ | |
81 | ALPHA_FPRM_CHOP, /* Chopped rounding mode (towards 0). */ | |
82 | ALPHA_FPRM_DYN /* Dynamic rounding mode. */ | |
83 | }; | |
84 | ||
85 | enum alpha_fp_trap_mode | |
86 | { | |
87 | ALPHA_FPTM_N, /* Normal trap mode. */ | |
88 | ALPHA_FPTM_U, /* Underflow traps enabled. */ | |
89 | ALPHA_FPTM_SU, /* Software completion, w/underflow traps */ | |
90 | ALPHA_FPTM_SUI /* Software completion, w/underflow & inexact traps */ | |
91 | }; | |
92 | ||
1a94ca49 RK |
93 | extern int target_flags; |
94 | ||
2bf6230d RK |
95 | extern enum alpha_trap_precision alpha_tp; |
96 | extern enum alpha_fp_rounding_mode alpha_fprm; | |
97 | extern enum alpha_fp_trap_mode alpha_fptm; | |
98 | ||
1a94ca49 RK |
99 | /* This means that floating-point support exists in the target implementation |
100 | of the Alpha architecture. This is usually the default. */ | |
de4abb91 | 101 | #define MASK_FP (1 << 0) |
2bf6230d | 102 | #define TARGET_FP (target_flags & MASK_FP) |
1a94ca49 RK |
103 | |
104 | /* This means that floating-point registers are allowed to be used. Note | |
105 | that Alpha implementations without FP operations are required to | |
106 | provide the FP registers. */ | |
107 | ||
de4abb91 | 108 | #define MASK_FPREGS (1 << 1) |
2bf6230d | 109 | #define TARGET_FPREGS (target_flags & MASK_FPREGS) |
03f8c4cc RK |
110 | |
111 | /* This means that gas is used to process the assembler file. */ | |
112 | ||
de4abb91 | 113 | #define MASK_GAS (1 << 2) |
03f8c4cc | 114 | #define TARGET_GAS (target_flags & MASK_GAS) |
1a94ca49 | 115 | |
2bf6230d RK |
116 | /* This means that we should mark procedures as IEEE conformant. */ |
117 | ||
de4abb91 | 118 | #define MASK_IEEE_CONFORMANT (1 << 3) |
2bf6230d RK |
119 | #define TARGET_IEEE_CONFORMANT (target_flags & MASK_IEEE_CONFORMANT) |
120 | ||
121 | /* This means we should be IEEE-compliant except for inexact. */ | |
122 | ||
de4abb91 | 123 | #define MASK_IEEE (1 << 4) |
2bf6230d RK |
124 | #define TARGET_IEEE (target_flags & MASK_IEEE) |
125 | ||
126 | /* This means we should be fully IEEE-compliant. */ | |
127 | ||
de4abb91 | 128 | #define MASK_IEEE_WITH_INEXACT (1 << 5) |
2bf6230d RK |
129 | #define TARGET_IEEE_WITH_INEXACT (target_flags & MASK_IEEE_WITH_INEXACT) |
130 | ||
803fee69 RK |
131 | /* This means we must construct all constants rather than emitting |
132 | them as literal data. */ | |
133 | ||
de4abb91 | 134 | #define MASK_BUILD_CONSTANTS (1 << 6) |
803fee69 RK |
135 | #define TARGET_BUILD_CONSTANTS (target_flags & MASK_BUILD_CONSTANTS) |
136 | ||
e5958492 RK |
137 | /* This means we handle floating points in VAX F- (float) |
138 | or G- (double) Format. */ | |
139 | ||
de4abb91 | 140 | #define MASK_FLOAT_VAX (1 << 7) |
e5958492 RK |
141 | #define TARGET_FLOAT_VAX (target_flags & MASK_FLOAT_VAX) |
142 | ||
e9a25f70 JL |
143 | /* This means that the processor has byte and half word loads and stores |
144 | (the BWX extension). */ | |
025f3281 | 145 | |
de4abb91 | 146 | #define MASK_BWX (1 << 8) |
e9a25f70 | 147 | #define TARGET_BWX (target_flags & MASK_BWX) |
025f3281 | 148 | |
e9a25f70 | 149 | /* This means that the processor has the MAX extension. */ |
de4abb91 | 150 | #define MASK_MAX (1 << 9) |
e9a25f70 JL |
151 | #define TARGET_MAX (target_flags & MASK_MAX) |
152 | ||
de4abb91 RH |
153 | /* This means that the processor has the FIX extension. */ |
154 | #define MASK_FIX (1 << 10) | |
155 | #define TARGET_FIX (target_flags & MASK_FIX) | |
156 | ||
157 | /* This means that the processor has the CIX extension. */ | |
158 | #define MASK_CIX (1 << 11) | |
159 | #define TARGET_CIX (target_flags & MASK_CIX) | |
160 | ||
a3b815cb JJ |
161 | /* This means that the processor is an EV5, EV56, or PCA56. |
162 | Unlike alpha_cpu this is not affected by -mtune= setting. */ | |
a76c0119 | 163 | #define MASK_CPU_EV5 (1 << 28) |
a3b815cb | 164 | #define TARGET_CPU_EV5 (target_flags & MASK_CPU_EV5) |
e9a25f70 JL |
165 | |
166 | /* Likewise for EV6. */ | |
a76c0119 | 167 | #define MASK_CPU_EV6 (1 << 29) |
a3b815cb | 168 | #define TARGET_CPU_EV6 (target_flags & MASK_CPU_EV6) |
e9a25f70 JL |
169 | |
170 | /* This means we support the .arch directive in the assembler. Only | |
171 | defined in TARGET_CPU_DEFAULT. */ | |
a76c0119 | 172 | #define MASK_SUPPORT_ARCH (1 << 30) |
e9a25f70 | 173 | #define TARGET_SUPPORT_ARCH (target_flags & MASK_SUPPORT_ARCH) |
8f87939b | 174 | |
9ba3994a | 175 | /* These are for target os support and cannot be changed at runtime. */ |
be7b80f4 RH |
176 | #define TARGET_ABI_WINDOWS_NT 0 |
177 | #define TARGET_ABI_OPEN_VMS 0 | |
178 | #define TARGET_ABI_OSF (!TARGET_ABI_WINDOWS_NT && !TARGET_ABI_OPEN_VMS) | |
9ba3994a RH |
179 | |
180 | #ifndef TARGET_AS_CAN_SUBTRACT_LABELS | |
181 | #define TARGET_AS_CAN_SUBTRACT_LABELS TARGET_GAS | |
182 | #endif | |
9c0e94a5 RH |
183 | #ifndef TARGET_CAN_FAULT_IN_PROLOGUE |
184 | #define TARGET_CAN_FAULT_IN_PROLOGUE 0 | |
185 | #endif | |
5495cc55 RH |
186 | #ifndef TARGET_HAS_XFLOATING_LIBS |
187 | #define TARGET_HAS_XFLOATING_LIBS 0 | |
188 | #endif | |
4f1c5cce RH |
189 | #ifndef TARGET_PROFILING_NEEDS_GP |
190 | #define TARGET_PROFILING_NEEDS_GP 0 | |
191 | #endif | |
ccb83cbc RH |
192 | #ifndef TARGET_LD_BUGGY_LDGP |
193 | #define TARGET_LD_BUGGY_LDGP 0 | |
194 | #endif | |
9ba3994a | 195 | |
1a94ca49 RK |
196 | /* Macro to define tables used to set the flags. |
197 | This is a list in braces of pairs in braces, | |
198 | each pair being { "NAME", VALUE } | |
199 | where VALUE is the bits to set or minus the bits to clear. | |
200 | An empty string NAME is used to identify the default VALUE. */ | |
201 | ||
f8e52397 | 202 | #define TARGET_SWITCHES \ |
047142d3 PT |
203 | { {"no-soft-float", MASK_FP, N_("Use hardware fp")}, \ |
204 | {"soft-float", - MASK_FP, N_("Do not use hardware fp")}, \ | |
205 | {"fp-regs", MASK_FPREGS, N_("Use fp registers")}, \ | |
206 | {"no-fp-regs", - (MASK_FP|MASK_FPREGS), \ | |
207 | N_("Do not use fp registers")}, \ | |
208 | {"alpha-as", -MASK_GAS, N_("Do not assume GAS")}, \ | |
209 | {"gas", MASK_GAS, N_("Assume GAS")}, \ | |
f8e52397 | 210 | {"ieee-conformant", MASK_IEEE_CONFORMANT, \ |
047142d3 | 211 | N_("Request IEEE-conformant math library routines (OSF/1)")}, \ |
f8e52397 | 212 | {"ieee", MASK_IEEE|MASK_IEEE_CONFORMANT, \ |
047142d3 | 213 | N_("Emit IEEE-conformant code, without inexact exceptions")}, \ |
f8e52397 | 214 | {"ieee-with-inexact", MASK_IEEE_WITH_INEXACT|MASK_IEEE_CONFORMANT, \ |
047142d3 | 215 | N_("Emit IEEE-conformant code, with inexact exceptions")}, \ |
f8e52397 | 216 | {"build-constants", MASK_BUILD_CONSTANTS, \ |
047142d3 PT |
217 | N_("Do not emit complex integer constants to read-only memory")}, \ |
218 | {"float-vax", MASK_FLOAT_VAX, N_("Use VAX fp")}, \ | |
219 | {"float-ieee", -MASK_FLOAT_VAX, N_("Do not use VAX fp")}, \ | |
220 | {"bwx", MASK_BWX, N_("Emit code for the byte/word ISA extension")}, \ | |
f8e52397 | 221 | {"no-bwx", -MASK_BWX, ""}, \ |
047142d3 PT |
222 | {"max", MASK_MAX, \ |
223 | N_("Emit code for the motion video ISA extension")}, \ | |
f8e52397 | 224 | {"no-max", -MASK_MAX, ""}, \ |
047142d3 PT |
225 | {"fix", MASK_FIX, \ |
226 | N_("Emit code for the fp move and sqrt ISA extension")}, \ | |
de4abb91 | 227 | {"no-fix", -MASK_FIX, ""}, \ |
047142d3 | 228 | {"cix", MASK_CIX, N_("Emit code for the counting ISA extension")}, \ |
de4abb91 | 229 | {"no-cix", -MASK_CIX, ""}, \ |
f8e52397 | 230 | {"", TARGET_DEFAULT | TARGET_CPU_DEFAULT, ""} } |
1a94ca49 | 231 | |
c01b5470 | 232 | #define TARGET_DEFAULT MASK_FP|MASK_FPREGS |
1a94ca49 | 233 | |
88681624 ILT |
234 | #ifndef TARGET_CPU_DEFAULT |
235 | #define TARGET_CPU_DEFAULT 0 | |
236 | #endif | |
237 | ||
2bf6230d RK |
238 | /* This macro is similar to `TARGET_SWITCHES' but defines names of |
239 | command options that have values. Its definition is an initializer | |
240 | with a subgrouping for each command option. | |
241 | ||
242 | Each subgrouping contains a string constant, that defines the fixed | |
243 | part of the option name, and the address of a variable. The | |
244 | variable, type `char *', is set to the variable part of the given | |
245 | option if the fixed part matches. The actual option name is made | |
246 | by appending `-m' to the specified name. | |
247 | ||
248 | Here is an example which defines `-mshort-data-NUMBER'. If the | |
249 | given option is `-mshort-data-512', the variable `m88k_short_data' | |
250 | will be set to the string `"512"'. | |
251 | ||
252 | extern char *m88k_short_data; | |
253 | #define TARGET_OPTIONS { { "short-data-", &m88k_short_data } } */ | |
254 | ||
df45c7ea | 255 | extern const char *alpha_cpu_string; /* For -mcpu= */ |
a3b815cb | 256 | extern const char *alpha_tune_string; /* For -mtune= */ |
df45c7ea KG |
257 | extern const char *alpha_fprm_string; /* For -mfp-rounding-mode=[n|m|c|d] */ |
258 | extern const char *alpha_fptm_string; /* For -mfp-trap-mode=[n|u|su|sui] */ | |
259 | extern const char *alpha_tp_string; /* For -mtrap-precision=[p|f|i] */ | |
260 | extern const char *alpha_mlat_string; /* For -mmemory-latency= */ | |
2bf6230d | 261 | |
f8e52397 RH |
262 | #define TARGET_OPTIONS \ |
263 | { \ | |
264 | {"cpu=", &alpha_cpu_string, \ | |
a3b815cb JJ |
265 | N_("Use features of and schedule given CPU")}, \ |
266 | {"tune=", &alpha_tune_string, \ | |
267 | N_("Schedule given CPU")}, \ | |
f8e52397 | 268 | {"fp-rounding-mode=", &alpha_fprm_string, \ |
047142d3 | 269 | N_("Control the generated fp rounding mode")}, \ |
f8e52397 | 270 | {"fp-trap-mode=", &alpha_fptm_string, \ |
047142d3 | 271 | N_("Control the IEEE trap mode")}, \ |
f8e52397 | 272 | {"trap-precision=", &alpha_tp_string, \ |
047142d3 | 273 | N_("Control the precision given to fp exceptions")}, \ |
f8e52397 | 274 | {"memory-latency=", &alpha_mlat_string, \ |
047142d3 | 275 | N_("Tune expected memory latency")}, \ |
2bf6230d RK |
276 | } |
277 | ||
952fc2ed RH |
278 | /* Attempt to describe CPU characteristics to the preprocessor. */ |
279 | ||
280 | /* Corresponding to amask... */ | |
2b57e919 NB |
281 | #define CPP_AM_BWX_SPEC "-D__alpha_bwx__ -Acpu=bwx" |
282 | #define CPP_AM_MAX_SPEC "-D__alpha_max__ -Acpu=max" | |
283 | #define CPP_AM_FIX_SPEC "-D__alpha_fix__ -Acpu=fix" | |
284 | #define CPP_AM_CIX_SPEC "-D__alpha_cix__ -Acpu=cix" | |
952fc2ed RH |
285 | |
286 | /* Corresponding to implver... */ | |
2b57e919 NB |
287 | #define CPP_IM_EV4_SPEC "-D__alpha_ev4__ -Acpu=ev4" |
288 | #define CPP_IM_EV5_SPEC "-D__alpha_ev5__ -Acpu=ev5" | |
289 | #define CPP_IM_EV6_SPEC "-D__alpha_ev6__ -Acpu=ev6" | |
952fc2ed RH |
290 | |
291 | /* Common combinations. */ | |
292 | #define CPP_CPU_EV4_SPEC "%(cpp_im_ev4)" | |
293 | #define CPP_CPU_EV5_SPEC "%(cpp_im_ev5)" | |
294 | #define CPP_CPU_EV56_SPEC "%(cpp_im_ev5) %(cpp_am_bwx)" | |
295 | #define CPP_CPU_PCA56_SPEC "%(cpp_im_ev5) %(cpp_am_bwx) %(cpp_am_max)" | |
d8ee3e20 RH |
296 | #define CPP_CPU_EV6_SPEC \ |
297 | "%(cpp_im_ev6) %(cpp_am_bwx) %(cpp_am_max) %(cpp_am_fix)" | |
298 | #define CPP_CPU_EV67_SPEC \ | |
299 | "%(cpp_im_ev6) %(cpp_am_bwx) %(cpp_am_max) %(cpp_am_fix) %(cpp_am_cix)" | |
952fc2ed RH |
300 | |
301 | #ifndef CPP_CPU_DEFAULT_SPEC | |
302 | # if TARGET_CPU_DEFAULT & MASK_CPU_EV6 | |
8f4773ea | 303 | # if TARGET_CPU_DEFAULT & MASK_CIX |
d8ee3e20 RH |
304 | # define CPP_CPU_DEFAULT_SPEC CPP_CPU_EV67_SPEC |
305 | # else | |
306 | # define CPP_CPU_DEFAULT_SPEC CPP_CPU_EV6_SPEC | |
307 | # endif | |
952fc2ed RH |
308 | # else |
309 | # if TARGET_CPU_DEFAULT & MASK_CPU_EV5 | |
310 | # if TARGET_CPU_DEFAULT & MASK_MAX | |
311 | # define CPP_CPU_DEFAULT_SPEC CPP_CPU_PCA56_SPEC | |
312 | # else | |
313 | # if TARGET_CPU_DEFAULT & MASK_BWX | |
314 | # define CPP_CPU_DEFAULT_SPEC CPP_CPU_EV56_SPEC | |
315 | # else | |
316 | # define CPP_CPU_DEFAULT_SPEC CPP_CPU_EV5_SPEC | |
317 | # endif | |
318 | # endif | |
319 | # else | |
320 | # define CPP_CPU_DEFAULT_SPEC CPP_CPU_EV4_SPEC | |
321 | # endif | |
322 | # endif | |
323 | #endif /* CPP_CPU_DEFAULT_SPEC */ | |
324 | ||
325 | #ifndef CPP_CPU_SPEC | |
326 | #define CPP_CPU_SPEC "\ | |
2b57e919 | 327 | %{!undef:-Acpu=alpha -Amachine=alpha -D__alpha -D__alpha__ \ |
952fc2ed RH |
328 | %{mcpu=ev4|mcpu=21064:%(cpp_cpu_ev4) }\ |
329 | %{mcpu=ev5|mcpu=21164:%(cpp_cpu_ev5) }\ | |
330 | %{mcpu=ev56|mcpu=21164a:%(cpp_cpu_ev56) }\ | |
331 | %{mcpu=pca56|mcpu=21164pc|mcpu=21164PC:%(cpp_cpu_pca56) }\ | |
332 | %{mcpu=ev6|mcpu=21264:%(cpp_cpu_ev6) }\ | |
d8ee3e20 | 333 | %{mcpu=ev67|mcpu=21264a:%(cpp_cpu_ev67) }\ |
952fc2ed RH |
334 | %{!mcpu*:%(cpp_cpu_default) }}" |
335 | #endif | |
336 | ||
337 | /* This macro defines names of additional specifications to put in the | |
338 | specs that can be used in various specifications like CC1_SPEC. Its | |
339 | definition is an initializer with a subgrouping for each command option. | |
340 | ||
341 | Each subgrouping contains a string constant, that defines the | |
342 | specification name, and a string constant that used by the GNU CC driver | |
343 | program. | |
344 | ||
345 | Do not define this macro if it does not need to do anything. */ | |
346 | ||
347 | #ifndef SUBTARGET_EXTRA_SPECS | |
348 | #define SUBTARGET_EXTRA_SPECS | |
349 | #endif | |
350 | ||
829245be KG |
351 | #define EXTRA_SPECS \ |
352 | { "cpp_am_bwx", CPP_AM_BWX_SPEC }, \ | |
353 | { "cpp_am_max", CPP_AM_MAX_SPEC }, \ | |
de4abb91 | 354 | { "cpp_am_fix", CPP_AM_FIX_SPEC }, \ |
829245be KG |
355 | { "cpp_am_cix", CPP_AM_CIX_SPEC }, \ |
356 | { "cpp_im_ev4", CPP_IM_EV4_SPEC }, \ | |
357 | { "cpp_im_ev5", CPP_IM_EV5_SPEC }, \ | |
358 | { "cpp_im_ev6", CPP_IM_EV6_SPEC }, \ | |
359 | { "cpp_cpu_ev4", CPP_CPU_EV4_SPEC }, \ | |
360 | { "cpp_cpu_ev5", CPP_CPU_EV5_SPEC }, \ | |
361 | { "cpp_cpu_ev56", CPP_CPU_EV56_SPEC }, \ | |
362 | { "cpp_cpu_pca56", CPP_CPU_PCA56_SPEC }, \ | |
363 | { "cpp_cpu_ev6", CPP_CPU_EV6_SPEC }, \ | |
d8ee3e20 | 364 | { "cpp_cpu_ev67", CPP_CPU_EV67_SPEC }, \ |
829245be KG |
365 | { "cpp_cpu_default", CPP_CPU_DEFAULT_SPEC }, \ |
366 | { "cpp_cpu", CPP_CPU_SPEC }, \ | |
367 | { "cpp_subtarget", CPP_SUBTARGET_SPEC }, \ | |
952fc2ed RH |
368 | SUBTARGET_EXTRA_SPECS |
369 | ||
370 | ||
2bf6230d RK |
371 | /* Sometimes certain combinations of command options do not make sense |
372 | on a particular target machine. You can define a macro | |
373 | `OVERRIDE_OPTIONS' to take account of this. This macro, if | |
374 | defined, is executed once just after all the command options have | |
375 | been parsed. | |
376 | ||
377 | On the Alpha, it is used to translate target-option strings into | |
378 | numeric values. */ | |
379 | ||
2bf6230d RK |
380 | #define OVERRIDE_OPTIONS override_options () |
381 | ||
382 | ||
1a94ca49 RK |
383 | /* Define this macro to change register usage conditional on target flags. |
384 | ||
385 | On the Alpha, we use this to disable the floating-point registers when | |
386 | they don't exist. */ | |
387 | ||
e9e4208a WC |
388 | #define CONDITIONAL_REGISTER_USAGE \ |
389 | { \ | |
390 | int i; \ | |
391 | if (! TARGET_FPREGS) \ | |
392 | for (i = 32; i < 63; i++) \ | |
393 | fixed_regs[i] = call_used_regs[i] = 1; \ | |
394 | } | |
395 | ||
1a94ca49 | 396 | |
4f074454 RK |
397 | /* Show we can debug even without a frame pointer. */ |
398 | #define CAN_DEBUG_WITHOUT_FP | |
1a94ca49 RK |
399 | \f |
400 | /* target machine storage layout */ | |
401 | ||
2700ac93 RS |
402 | /* Define to enable software floating point emulation. */ |
403 | #define REAL_ARITHMETIC | |
404 | ||
1a94ca49 RK |
405 | /* Define the size of `int'. The default is the same as the word size. */ |
406 | #define INT_TYPE_SIZE 32 | |
407 | ||
408 | /* Define the size of `long long'. The default is the twice the word size. */ | |
409 | #define LONG_LONG_TYPE_SIZE 64 | |
410 | ||
411 | /* The two floating-point formats we support are S-floating, which is | |
412 | 4 bytes, and T-floating, which is 8 bytes. `float' is S and `double' | |
413 | and `long double' are T. */ | |
414 | ||
415 | #define FLOAT_TYPE_SIZE 32 | |
416 | #define DOUBLE_TYPE_SIZE 64 | |
417 | #define LONG_DOUBLE_TYPE_SIZE 64 | |
418 | ||
5258d7ae RK |
419 | #define WCHAR_TYPE "unsigned int" |
420 | #define WCHAR_TYPE_SIZE 32 | |
1a94ca49 | 421 | |
13d39dbc | 422 | /* Define this macro if it is advisable to hold scalars in registers |
1a94ca49 RK |
423 | in a wider mode than that declared by the program. In such cases, |
424 | the value is constrained to be within the bounds of the declared | |
425 | type, but kept valid in the wider mode. The signedness of the | |
426 | extension may differ from that of the type. | |
427 | ||
428 | For Alpha, we always store objects in a full register. 32-bit objects | |
429 | are always sign-extended, but smaller objects retain their signedness. */ | |
430 | ||
431 | #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \ | |
432 | if (GET_MODE_CLASS (MODE) == MODE_INT \ | |
433 | && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \ | |
434 | { \ | |
435 | if ((MODE) == SImode) \ | |
436 | (UNSIGNEDP) = 0; \ | |
437 | (MODE) = DImode; \ | |
438 | } | |
439 | ||
440 | /* Define this if function arguments should also be promoted using the above | |
441 | procedure. */ | |
442 | ||
443 | #define PROMOTE_FUNCTION_ARGS | |
444 | ||
445 | /* Likewise, if the function return value is promoted. */ | |
446 | ||
447 | #define PROMOTE_FUNCTION_RETURN | |
448 | ||
449 | /* Define this if most significant bit is lowest numbered | |
450 | in instructions that operate on numbered bit-fields. | |
451 | ||
452 | There are no such instructions on the Alpha, but the documentation | |
453 | is little endian. */ | |
454 | #define BITS_BIG_ENDIAN 0 | |
455 | ||
456 | /* Define this if most significant byte of a word is the lowest numbered. | |
457 | This is false on the Alpha. */ | |
458 | #define BYTES_BIG_ENDIAN 0 | |
459 | ||
460 | /* Define this if most significant word of a multiword number is lowest | |
461 | numbered. | |
462 | ||
463 | For Alpha we can decide arbitrarily since there are no machine instructions | |
464 | for them. Might as well be consistent with bytes. */ | |
465 | #define WORDS_BIG_ENDIAN 0 | |
466 | ||
467 | /* number of bits in an addressable storage unit */ | |
468 | #define BITS_PER_UNIT 8 | |
469 | ||
470 | /* Width in bits of a "word", which is the contents of a machine register. | |
471 | Note that this is not necessarily the width of data type `int'; | |
472 | if using 16-bit ints on a 68000, this would still be 32. | |
473 | But on a machine with 16-bit registers, this would be 16. */ | |
474 | #define BITS_PER_WORD 64 | |
475 | ||
476 | /* Width of a word, in units (bytes). */ | |
477 | #define UNITS_PER_WORD 8 | |
478 | ||
479 | /* Width in bits of a pointer. | |
480 | See also the macro `Pmode' defined below. */ | |
481 | #define POINTER_SIZE 64 | |
482 | ||
483 | /* Allocation boundary (in *bits*) for storing arguments in argument list. */ | |
484 | #define PARM_BOUNDARY 64 | |
485 | ||
486 | /* Boundary (in *bits*) on which stack pointer should be aligned. */ | |
487 | #define STACK_BOUNDARY 64 | |
488 | ||
489 | /* Allocation boundary (in *bits*) for the code of a function. */ | |
c176c051 | 490 | #define FUNCTION_BOUNDARY 32 |
1a94ca49 RK |
491 | |
492 | /* Alignment of field after `int : 0' in a structure. */ | |
493 | #define EMPTY_FIELD_BOUNDARY 64 | |
494 | ||
495 | /* Every structure's size must be a multiple of this. */ | |
496 | #define STRUCTURE_SIZE_BOUNDARY 8 | |
497 | ||
498 | /* A bitfield declared as `int' forces `int' alignment for the struct. */ | |
499 | #define PCC_BITFIELD_TYPE_MATTERS 1 | |
500 | ||
1a94ca49 | 501 | /* No data type wants to be aligned rounder than this. */ |
5495cc55 | 502 | #define BIGGEST_ALIGNMENT 128 |
1a94ca49 | 503 | |
d16fe557 RK |
504 | /* For atomic access to objects, must have at least 32-bit alignment |
505 | unless the machine has byte operations. */ | |
13eb1f7f | 506 | #define MINIMUM_ATOMIC_ALIGNMENT ((unsigned int) (TARGET_BWX ? 8 : 32)) |
d16fe557 | 507 | |
442b1685 RK |
508 | /* Align all constants and variables to at least a word boundary so |
509 | we can pick up pieces of them faster. */ | |
6c174fc0 RH |
510 | /* ??? Only if block-move stuff knows about different source/destination |
511 | alignment. */ | |
512 | #if 0 | |
442b1685 RK |
513 | #define CONSTANT_ALIGNMENT(EXP, ALIGN) MAX ((ALIGN), BITS_PER_WORD) |
514 | #define DATA_ALIGNMENT(EXP, ALIGN) MAX ((ALIGN), BITS_PER_WORD) | |
6c174fc0 | 515 | #endif |
1a94ca49 RK |
516 | |
517 | /* Set this non-zero if move instructions will actually fail to work | |
518 | when given unaligned data. | |
519 | ||
520 | Since we get an error message when we do one, call them invalid. */ | |
521 | ||
522 | #define STRICT_ALIGNMENT 1 | |
523 | ||
524 | /* Set this non-zero if unaligned move instructions are extremely slow. | |
525 | ||
526 | On the Alpha, they trap. */ | |
130d2d72 | 527 | |
e1565e65 | 528 | #define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) 1 |
1a94ca49 RK |
529 | \f |
530 | /* Standard register usage. */ | |
531 | ||
532 | /* Number of actual hardware registers. | |
533 | The hardware registers are assigned numbers for the compiler | |
534 | from 0 to just below FIRST_PSEUDO_REGISTER. | |
535 | All registers that the compiler knows about must be given numbers, | |
536 | even those that are not normally considered general registers. | |
537 | ||
538 | We define all 32 integer registers, even though $31 is always zero, | |
539 | and all 32 floating-point registers, even though $f31 is also | |
540 | always zero. We do not bother defining the FP status register and | |
130d2d72 RK |
541 | there are no other registers. |
542 | ||
543 | Since $31 is always zero, we will use register number 31 as the | |
544 | argument pointer. It will never appear in the generated code | |
545 | because we will always be eliminating it in favor of the stack | |
52a69200 RK |
546 | pointer or hardware frame pointer. |
547 | ||
548 | Likewise, we use $f31 for the frame pointer, which will always | |
549 | be eliminated in favor of the hardware frame pointer or the | |
550 | stack pointer. */ | |
1a94ca49 RK |
551 | |
552 | #define FIRST_PSEUDO_REGISTER 64 | |
553 | ||
554 | /* 1 for registers that have pervasive standard uses | |
555 | and are not available for the register allocator. */ | |
556 | ||
557 | #define FIXED_REGISTERS \ | |
558 | {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ | |
559 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, \ | |
560 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ | |
561 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 } | |
562 | ||
563 | /* 1 for registers not available across function calls. | |
564 | These must include the FIXED_REGISTERS and also any | |
565 | registers that can be used without being saved. | |
566 | The latter must include the registers where values are returned | |
567 | and the register where structure-value addresses are passed. | |
568 | Aside from that, you can include as many other registers as you like. */ | |
569 | #define CALL_USED_REGISTERS \ | |
570 | {1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, \ | |
571 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, \ | |
572 | 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \ | |
573 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } | |
574 | ||
575 | /* List the order in which to allocate registers. Each register must be | |
576 | listed once, even those in FIXED_REGISTERS. | |
577 | ||
578 | We allocate in the following order: | |
2c4be73e | 579 | $f10-$f15 (nonsaved floating-point register) |
1a94ca49 RK |
580 | $f22-$f30 (likewise) |
581 | $f21-$f16 (likewise, but input args) | |
582 | $f0 (nonsaved, but return value) | |
2c4be73e | 583 | $f1 (nonsaved, but immediate before saved) |
1a94ca49 RK |
584 | $f2-$f9 (saved floating-point registers) |
585 | $1-$8 (nonsaved integer registers) | |
586 | $22-$25 (likewise) | |
587 | $28 (likewise) | |
588 | $0 (likewise, but return value) | |
589 | $21-$16 (likewise, but input args) | |
0076aa6b | 590 | $27 (procedure value in OSF, nonsaved in NT) |
1a94ca49 RK |
591 | $9-$14 (saved integer registers) |
592 | $26 (return PC) | |
593 | $15 (frame pointer) | |
594 | $29 (global pointer) | |
52a69200 | 595 | $30, $31, $f31 (stack pointer and always zero/ap & fp) */ |
1a94ca49 RK |
596 | |
597 | #define REG_ALLOC_ORDER \ | |
2c4be73e | 598 | {42, 43, 44, 45, 46, 47, \ |
1a94ca49 RK |
599 | 54, 55, 56, 57, 58, 59, 60, 61, 62, \ |
600 | 53, 52, 51, 50, 49, 48, \ | |
2c4be73e | 601 | 32, 33, \ |
1a94ca49 RK |
602 | 34, 35, 36, 37, 38, 39, 40, 41, \ |
603 | 1, 2, 3, 4, 5, 6, 7, 8, \ | |
604 | 22, 23, 24, 25, \ | |
605 | 28, \ | |
606 | 0, \ | |
607 | 21, 20, 19, 18, 17, 16, \ | |
608 | 27, \ | |
609 | 9, 10, 11, 12, 13, 14, \ | |
610 | 26, \ | |
611 | 15, \ | |
612 | 29, \ | |
613 | 30, 31, 63 } | |
614 | ||
615 | /* Return number of consecutive hard regs needed starting at reg REGNO | |
616 | to hold something of mode MODE. | |
617 | This is ordinarily the length in words of a value of mode MODE | |
618 | but can be less for certain modes in special long registers. */ | |
619 | ||
620 | #define HARD_REGNO_NREGS(REGNO, MODE) \ | |
621 | ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) | |
622 | ||
623 | /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. | |
624 | On Alpha, the integer registers can hold any mode. The floating-point | |
625 | registers can hold 32-bit and 64-bit integers as well, but not 16-bit | |
a7adf08e | 626 | or 8-bit values. */ |
1a94ca49 | 627 | |
e6a8ebb4 RH |
628 | #define HARD_REGNO_MODE_OK(REGNO, MODE) \ |
629 | ((REGNO) >= 32 && (REGNO) <= 62 \ | |
630 | ? GET_MODE_UNIT_SIZE (MODE) == 8 || GET_MODE_UNIT_SIZE (MODE) == 4 \ | |
631 | : 1) | |
632 | ||
633 | /* A C expression that is nonzero if a value of mode | |
634 | MODE1 is accessible in mode MODE2 without copying. | |
1a94ca49 | 635 | |
e6a8ebb4 RH |
636 | This asymmetric test is true when MODE1 could be put |
637 | in an FP register but MODE2 could not. */ | |
1a94ca49 | 638 | |
a7adf08e | 639 | #define MODES_TIEABLE_P(MODE1, MODE2) \ |
e6a8ebb4 RH |
640 | (HARD_REGNO_MODE_OK (32, (MODE1)) \ |
641 | ? HARD_REGNO_MODE_OK (32, (MODE2)) \ | |
a7adf08e | 642 | : 1) |
1a94ca49 RK |
643 | |
644 | /* Specify the registers used for certain standard purposes. | |
645 | The values of these macros are register numbers. */ | |
646 | ||
647 | /* Alpha pc isn't overloaded on a register that the compiler knows about. */ | |
648 | /* #define PC_REGNUM */ | |
649 | ||
650 | /* Register to use for pushing function arguments. */ | |
651 | #define STACK_POINTER_REGNUM 30 | |
652 | ||
653 | /* Base register for access to local variables of the function. */ | |
52a69200 | 654 | #define HARD_FRAME_POINTER_REGNUM 15 |
1a94ca49 RK |
655 | |
656 | /* Value should be nonzero if functions must have frame pointers. | |
657 | Zero means the frame pointer need not be set up (and parms | |
658 | may be accessed via the stack pointer) in functions that seem suitable. | |
659 | This is computed in `reload', in reload1.c. */ | |
660 | #define FRAME_POINTER_REQUIRED 0 | |
661 | ||
662 | /* Base register for access to arguments of the function. */ | |
130d2d72 | 663 | #define ARG_POINTER_REGNUM 31 |
1a94ca49 | 664 | |
52a69200 RK |
665 | /* Base register for access to local variables of function. */ |
666 | #define FRAME_POINTER_REGNUM 63 | |
667 | ||
1a94ca49 RK |
668 | /* Register in which static-chain is passed to a function. |
669 | ||
670 | For the Alpha, this is based on an example; the calling sequence | |
671 | doesn't seem to specify this. */ | |
672 | #define STATIC_CHAIN_REGNUM 1 | |
673 | ||
674 | /* Register in which address to store a structure value | |
675 | arrives in the function. On the Alpha, the address is passed | |
676 | as a hidden argument. */ | |
677 | #define STRUCT_VALUE 0 | |
678 | \f | |
679 | /* Define the classes of registers for register constraints in the | |
680 | machine description. Also define ranges of constants. | |
681 | ||
682 | One of the classes must always be named ALL_REGS and include all hard regs. | |
683 | If there is more than one class, another class must be named NO_REGS | |
684 | and contain no registers. | |
685 | ||
686 | The name GENERAL_REGS must be the name of a class (or an alias for | |
687 | another name such as ALL_REGS). This is the class of registers | |
688 | that is allowed by "g" or "r" in a register constraint. | |
689 | Also, registers outside this class are allocated only when | |
690 | instructions express preferences for them. | |
691 | ||
692 | The classes must be numbered in nondecreasing order; that is, | |
693 | a larger-numbered class must never be contained completely | |
694 | in a smaller-numbered class. | |
695 | ||
696 | For any two classes, it is very desirable that there be another | |
697 | class that represents their union. */ | |
698 | ||
93c89ab3 | 699 | enum reg_class { NO_REGS, PV_REG, GENERAL_REGS, FLOAT_REGS, ALL_REGS, |
1a94ca49 RK |
700 | LIM_REG_CLASSES }; |
701 | ||
702 | #define N_REG_CLASSES (int) LIM_REG_CLASSES | |
703 | ||
704 | /* Give names of register classes as strings for dump file. */ | |
705 | ||
706 | #define REG_CLASS_NAMES \ | |
93c89ab3 | 707 | {"NO_REGS", "PV_REG", "GENERAL_REGS", "FLOAT_REGS", "ALL_REGS" } |
1a94ca49 RK |
708 | |
709 | /* Define which registers fit in which classes. | |
710 | This is an initializer for a vector of HARD_REG_SET | |
711 | of length N_REG_CLASSES. */ | |
712 | ||
713 | #define REG_CLASS_CONTENTS \ | |
93c89ab3 | 714 | { {0, 0}, {0x08000000, 0}, {~0, 0x80000000}, {0, 0x7fffffff}, {~0, ~0} } |
1a94ca49 RK |
715 | |
716 | /* The same information, inverted: | |
717 | Return the class number of the smallest class containing | |
718 | reg number REGNO. This could be a conditional expression | |
719 | or could index an array. */ | |
720 | ||
93c89ab3 RH |
721 | #define REGNO_REG_CLASS(REGNO) \ |
722 | ((REGNO) == 27 ? PV_REG \ | |
723 | : (REGNO) >= 32 && (REGNO) <= 62 ? FLOAT_REGS \ | |
724 | : GENERAL_REGS) | |
1a94ca49 RK |
725 | |
726 | /* The class value for index registers, and the one for base regs. */ | |
727 | #define INDEX_REG_CLASS NO_REGS | |
728 | #define BASE_REG_CLASS GENERAL_REGS | |
729 | ||
730 | /* Get reg_class from a letter such as appears in the machine description. */ | |
731 | ||
732 | #define REG_CLASS_FROM_LETTER(C) \ | |
93c89ab3 | 733 | ((C) == 'c' ? PV_REG : (C) == 'f' ? FLOAT_REGS : NO_REGS) |
1a94ca49 RK |
734 | |
735 | /* Define this macro to change register usage conditional on target flags. */ | |
736 | /* #define CONDITIONAL_REGISTER_USAGE */ | |
737 | ||
738 | /* The letters I, J, K, L, M, N, O, and P in a register constraint string | |
739 | can be used to stand for particular ranges of immediate operands. | |
740 | This macro defines what the ranges are. | |
741 | C is the letter, and VALUE is a constant value. | |
742 | Return 1 if VALUE is in the range specified by C. | |
743 | ||
744 | For Alpha: | |
745 | `I' is used for the range of constants most insns can contain. | |
746 | `J' is the constant zero. | |
747 | `K' is used for the constant in an LDA insn. | |
748 | `L' is used for the constant in a LDAH insn. | |
749 | `M' is used for the constants that can be AND'ed with using a ZAP insn. | |
750 | `N' is used for complemented 8-bit constants. | |
751 | `O' is used for negated 8-bit constants. | |
752 | `P' is used for the constants 1, 2 and 3. */ | |
753 | ||
754 | #define CONST_OK_FOR_LETTER_P(VALUE, C) \ | |
755 | ((C) == 'I' ? (unsigned HOST_WIDE_INT) (VALUE) < 0x100 \ | |
756 | : (C) == 'J' ? (VALUE) == 0 \ | |
757 | : (C) == 'K' ? (unsigned HOST_WIDE_INT) ((VALUE) + 0x8000) < 0x10000 \ | |
758 | : (C) == 'L' ? (((VALUE) & 0xffff) == 0 \ | |
c905c108 | 759 | && (((VALUE)) >> 31 == -1 || (VALUE) >> 31 == 0)) \ |
1a94ca49 RK |
760 | : (C) == 'M' ? zap_mask (VALUE) \ |
761 | : (C) == 'N' ? (unsigned HOST_WIDE_INT) (~ (VALUE)) < 0x100 \ | |
762 | : (C) == 'O' ? (unsigned HOST_WIDE_INT) (- (VALUE)) < 0x100 \ | |
763 | : (C) == 'P' ? (VALUE) == 1 || (VALUE) == 2 || (VALUE) == 3 \ | |
764 | : 0) | |
765 | ||
766 | /* Similar, but for floating or large integer constants, and defining letters | |
767 | G and H. Here VALUE is the CONST_DOUBLE rtx itself. | |
768 | ||
769 | For Alpha, `G' is the floating-point constant zero. `H' is a CONST_DOUBLE | |
770 | that is the operand of a ZAP insn. */ | |
771 | ||
772 | #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \ | |
773 | ((C) == 'G' ? (GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_FLOAT \ | |
774 | && (VALUE) == CONST0_RTX (GET_MODE (VALUE))) \ | |
775 | : (C) == 'H' ? (GET_MODE (VALUE) == VOIDmode \ | |
776 | && zap_mask (CONST_DOUBLE_LOW (VALUE)) \ | |
777 | && zap_mask (CONST_DOUBLE_HIGH (VALUE))) \ | |
778 | : 0) | |
779 | ||
e560f226 RK |
780 | /* Optional extra constraints for this machine. |
781 | ||
782 | For the Alpha, `Q' means that this is a memory operand but not a | |
ac030a7b | 783 | reference to an unaligned location. |
9ec36da5 | 784 | |
ac030a7b | 785 | `R' is a SYMBOL_REF that has SYMBOL_REF_FLAG set or is the current |
9ec36da5 JL |
786 | function. |
787 | ||
788 | 'S' is a 6-bit constant (valid for a shift insn). */ | |
e560f226 RK |
789 | |
790 | #define EXTRA_CONSTRAINT(OP, C) \ | |
ab87f8c8 | 791 | ((C) == 'Q' ? normal_memory_operand (OP, VOIDmode) \ |
9ec36da5 JL |
792 | : (C) == 'R' ? current_file_function_operand (OP, Pmode) \ |
793 | : (C) == 'S' ? (GET_CODE (OP) == CONST_INT \ | |
794 | && (unsigned HOST_WIDE_INT) INTVAL (OP) < 64) \ | |
e560f226 RK |
795 | : 0) |
796 | ||
1a94ca49 RK |
797 | /* Given an rtx X being reloaded into a reg required to be |
798 | in class CLASS, return the class of reg to actually use. | |
799 | In general this is just CLASS; but on some machines | |
800 | in some cases it is preferable to use a more restrictive class. | |
801 | ||
802 | On the Alpha, all constants except zero go into a floating-point | |
803 | register via memory. */ | |
804 | ||
805 | #define PREFERRED_RELOAD_CLASS(X, CLASS) \ | |
806 | (CONSTANT_P (X) && (X) != const0_rtx && (X) != CONST0_RTX (GET_MODE (X)) \ | |
a6a503ed | 807 | ? ((CLASS) == FLOAT_REGS || (CLASS) == NO_REGS ? NO_REGS : GENERAL_REGS)\ |
1a94ca49 RK |
808 | : (CLASS)) |
809 | ||
810 | /* Loading and storing HImode or QImode values to and from memory | |
811 | usually requires a scratch register. The exceptions are loading | |
e008606e RK |
812 | QImode and HImode from an aligned address to a general register |
813 | unless byte instructions are permitted. | |
ddd5a7c1 | 814 | We also cannot load an unaligned address or a paradoxical SUBREG into an |
e868b518 | 815 | FP register. */ |
1a94ca49 | 816 | |
3611aef0 RH |
817 | #define SECONDARY_INPUT_RELOAD_CLASS(CLASS,MODE,IN) \ |
818 | secondary_reload_class((CLASS), (MODE), (IN), 1) | |
819 | ||
820 | #define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS,MODE,OUT) \ | |
821 | secondary_reload_class((CLASS), (MODE), (OUT), 0) | |
1a94ca49 RK |
822 | |
823 | /* If we are copying between general and FP registers, we need a memory | |
de4abb91 | 824 | location unless the FIX extension is available. */ |
1a94ca49 | 825 | |
e9a25f70 | 826 | #define SECONDARY_MEMORY_NEEDED(CLASS1,CLASS2,MODE) \ |
de4abb91 | 827 | (! TARGET_FIX && (CLASS1) != (CLASS2)) |
1a94ca49 | 828 | |
acd94aaf RK |
829 | /* Specify the mode to be used for memory when a secondary memory |
830 | location is needed. If MODE is floating-point, use it. Otherwise, | |
831 | widen to a word like the default. This is needed because we always | |
832 | store integers in FP registers in quadword format. This whole | |
833 | area is very tricky! */ | |
834 | #define SECONDARY_MEMORY_NEEDED_MODE(MODE) \ | |
835 | (GET_MODE_CLASS (MODE) == MODE_FLOAT ? (MODE) \ | |
e868b518 | 836 | : GET_MODE_SIZE (MODE) >= 4 ? (MODE) \ |
acd94aaf RK |
837 | : mode_for_size (BITS_PER_WORD, GET_MODE_CLASS (MODE), 0)) |
838 | ||
1a94ca49 RK |
839 | /* Return the maximum number of consecutive registers |
840 | needed to represent mode MODE in a register of class CLASS. */ | |
841 | ||
842 | #define CLASS_MAX_NREGS(CLASS, MODE) \ | |
843 | ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) | |
844 | ||
c31dfe4d | 845 | /* If defined, gives a class of registers that cannot be used as the |
02188693 | 846 | operand of a SUBREG that changes the mode of the object illegally. */ |
c31dfe4d | 847 | |
02188693 RH |
848 | #define CLASS_CANNOT_CHANGE_MODE FLOAT_REGS |
849 | ||
850 | /* Defines illegal mode changes for CLASS_CANNOT_CHANGE_MODE. */ | |
851 | ||
852 | #define CLASS_CANNOT_CHANGE_MODE_P(FROM,TO) \ | |
853 | (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO)) | |
c31dfe4d | 854 | |
1a94ca49 RK |
855 | /* Define the cost of moving between registers of various classes. Moving |
856 | between FLOAT_REGS and anything else except float regs is expensive. | |
857 | In fact, we make it quite expensive because we really don't want to | |
858 | do these moves unless it is clearly worth it. Optimizations may | |
859 | reduce the impact of not being able to allocate a pseudo to a | |
860 | hard register. */ | |
861 | ||
cf011243 | 862 | #define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \ |
71d9b493 RH |
863 | (((CLASS1) == FLOAT_REGS) == ((CLASS2) == FLOAT_REGS) \ |
864 | ? 2 \ | |
de4abb91 | 865 | : TARGET_FIX ? 3 : 4+2*alpha_memory_latency) |
1a94ca49 RK |
866 | |
867 | /* A C expressions returning the cost of moving data of MODE from a register to | |
868 | or from memory. | |
869 | ||
870 | On the Alpha, bump this up a bit. */ | |
871 | ||
bcbbac26 | 872 | extern int alpha_memory_latency; |
cbd5b9a2 | 873 | #define MEMORY_MOVE_COST(MODE,CLASS,IN) (2*alpha_memory_latency) |
1a94ca49 RK |
874 | |
875 | /* Provide the cost of a branch. Exact meaning under development. */ | |
876 | #define BRANCH_COST 5 | |
1a94ca49 RK |
877 | \f |
878 | /* Stack layout; function entry, exit and calling. */ | |
879 | ||
880 | /* Define this if pushing a word on the stack | |
881 | makes the stack pointer a smaller address. */ | |
882 | #define STACK_GROWS_DOWNWARD | |
883 | ||
884 | /* Define this if the nominal address of the stack frame | |
885 | is at the high-address end of the local variables; | |
886 | that is, each additional local variable allocated | |
887 | goes at a more negative offset in the frame. */ | |
130d2d72 | 888 | /* #define FRAME_GROWS_DOWNWARD */ |
1a94ca49 RK |
889 | |
890 | /* Offset within stack frame to start allocating local variables at. | |
891 | If FRAME_GROWS_DOWNWARD, this is the offset to the END of the | |
892 | first local allocated. Otherwise, it is the offset to the BEGINNING | |
893 | of the first local allocated. */ | |
894 | ||
52a69200 | 895 | #define STARTING_FRAME_OFFSET 0 |
1a94ca49 RK |
896 | |
897 | /* If we generate an insn to push BYTES bytes, | |
898 | this says how many the stack pointer really advances by. | |
899 | On Alpha, don't define this because there are no push insns. */ | |
900 | /* #define PUSH_ROUNDING(BYTES) */ | |
901 | ||
e008606e RK |
902 | /* Define this to be nonzero if stack checking is built into the ABI. */ |
903 | #define STACK_CHECK_BUILTIN 1 | |
904 | ||
1a94ca49 RK |
905 | /* Define this if the maximum size of all the outgoing args is to be |
906 | accumulated and pushed during the prologue. The amount can be | |
907 | found in the variable current_function_outgoing_args_size. */ | |
f73ad30e | 908 | #define ACCUMULATE_OUTGOING_ARGS 1 |
1a94ca49 RK |
909 | |
910 | /* Offset of first parameter from the argument pointer register value. */ | |
911 | ||
130d2d72 | 912 | #define FIRST_PARM_OFFSET(FNDECL) 0 |
1a94ca49 RK |
913 | |
914 | /* Definitions for register eliminations. | |
915 | ||
978e8952 | 916 | We have two registers that can be eliminated on the Alpha. First, the |
1a94ca49 | 917 | frame pointer register can often be eliminated in favor of the stack |
130d2d72 RK |
918 | pointer register. Secondly, the argument pointer register can always be |
919 | eliminated; it is replaced with either the stack or frame pointer. */ | |
1a94ca49 RK |
920 | |
921 | /* This is an array of structures. Each structure initializes one pair | |
922 | of eliminable registers. The "from" register number is given first, | |
923 | followed by "to". Eliminations of the same "from" register are listed | |
924 | in order of preference. */ | |
925 | ||
52a69200 RK |
926 | #define ELIMINABLE_REGS \ |
927 | {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ | |
928 | { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ | |
929 | { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ | |
930 | { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}} | |
1a94ca49 RK |
931 | |
932 | /* Given FROM and TO register numbers, say whether this elimination is allowed. | |
933 | Frame pointer elimination is automatically handled. | |
934 | ||
130d2d72 | 935 | All eliminations are valid since the cases where FP can't be |
1a94ca49 RK |
936 | eliminated are already handled. */ |
937 | ||
130d2d72 | 938 | #define CAN_ELIMINATE(FROM, TO) 1 |
1a94ca49 | 939 | |
52a69200 RK |
940 | /* Round up to a multiple of 16 bytes. */ |
941 | #define ALPHA_ROUND(X) (((X) + 15) & ~ 15) | |
942 | ||
1a94ca49 RK |
943 | /* Define the offset between two registers, one to be eliminated, and the other |
944 | its replacement, at the start of a routine. */ | |
945 | #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ | |
52a69200 RK |
946 | { if ((FROM) == FRAME_POINTER_REGNUM) \ |
947 | (OFFSET) = (ALPHA_ROUND (current_function_outgoing_args_size) \ | |
948 | + alpha_sa_size ()); \ | |
949 | else if ((FROM) == ARG_POINTER_REGNUM) \ | |
950 | (OFFSET) = (ALPHA_ROUND (current_function_outgoing_args_size) \ | |
951 | + alpha_sa_size () \ | |
d772039b RK |
952 | + (ALPHA_ROUND (get_frame_size () \ |
953 | + current_function_pretend_args_size) \ | |
954 | - current_function_pretend_args_size)); \ | |
c8d8ed65 RK |
955 | else \ |
956 | abort (); \ | |
1a94ca49 RK |
957 | } |
958 | ||
959 | /* Define this if stack space is still allocated for a parameter passed | |
960 | in a register. */ | |
961 | /* #define REG_PARM_STACK_SPACE */ | |
962 | ||
963 | /* Value is the number of bytes of arguments automatically | |
964 | popped when returning from a subroutine call. | |
8b109b37 | 965 | FUNDECL is the declaration node of the function (as a tree), |
1a94ca49 RK |
966 | FUNTYPE is the data type of the function (as a tree), |
967 | or for a library call it is an identifier node for the subroutine name. | |
968 | SIZE is the number of bytes of arguments passed on the stack. */ | |
969 | ||
8b109b37 | 970 | #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0 |
1a94ca49 RK |
971 | |
972 | /* Define how to find the value returned by a function. | |
973 | VALTYPE is the data type of the value (as a tree). | |
974 | If the precise function being called is known, FUNC is its FUNCTION_DECL; | |
975 | otherwise, FUNC is 0. | |
976 | ||
977 | On Alpha the value is found in $0 for integer functions and | |
978 | $f0 for floating-point functions. */ | |
979 | ||
c5c76735 | 980 | #define FUNCTION_VALUE(VALTYPE, FUNC) \ |
4c020733 | 981 | gen_rtx_REG (((INTEGRAL_TYPE_P (VALTYPE) \ |
c5c76735 JL |
982 | && TYPE_PRECISION (VALTYPE) < BITS_PER_WORD) \ |
983 | || POINTER_TYPE_P (VALTYPE)) \ | |
4c020733 RH |
984 | ? word_mode : TYPE_MODE (VALTYPE), \ |
985 | ((TARGET_FPREGS \ | |
c5c76735 | 986 | && (TREE_CODE (VALTYPE) == REAL_TYPE \ |
4c020733 | 987 | || TREE_CODE (VALTYPE) == COMPLEX_TYPE)) \ |
c5c76735 | 988 | ? 32 : 0)) |
1a94ca49 RK |
989 | |
990 | /* Define how to find the value returned by a library function | |
991 | assuming the value has mode MODE. */ | |
992 | ||
c5c76735 | 993 | #define LIBCALL_VALUE(MODE) \ |
4c020733 | 994 | gen_rtx_REG (MODE, \ |
c5c76735 JL |
995 | (TARGET_FPREGS \ |
996 | && (GET_MODE_CLASS (MODE) == MODE_FLOAT \ | |
4c020733 | 997 | || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) \ |
c5c76735 | 998 | ? 32 : 0)) |
1a94ca49 | 999 | |
130d2d72 RK |
1000 | /* The definition of this macro implies that there are cases where |
1001 | a scalar value cannot be returned in registers. | |
1002 | ||
1003 | For the Alpha, any structure or union type is returned in memory, as | |
1004 | are integers whose size is larger than 64 bits. */ | |
1005 | ||
1006 | #define RETURN_IN_MEMORY(TYPE) \ | |
e14fa9c4 | 1007 | (TYPE_MODE (TYPE) == BLKmode \ |
5495cc55 RH |
1008 | || TYPE_MODE (TYPE) == TFmode \ |
1009 | || TYPE_MODE (TYPE) == TCmode \ | |
130d2d72 RK |
1010 | || (TREE_CODE (TYPE) == INTEGER_TYPE && TYPE_PRECISION (TYPE) > 64)) |
1011 | ||
1a94ca49 RK |
1012 | /* 1 if N is a possible register number for a function value |
1013 | as seen by the caller. */ | |
1014 | ||
e5958492 RK |
1015 | #define FUNCTION_VALUE_REGNO_P(N) \ |
1016 | ((N) == 0 || (N) == 1 || (N) == 32 || (N) == 33) | |
1a94ca49 RK |
1017 | |
1018 | /* 1 if N is a possible register number for function argument passing. | |
1019 | On Alpha, these are $16-$21 and $f16-$f21. */ | |
1020 | ||
1021 | #define FUNCTION_ARG_REGNO_P(N) \ | |
1022 | (((N) >= 16 && (N) <= 21) || ((N) >= 16 + 32 && (N) <= 21 + 32)) | |
1023 | \f | |
1024 | /* Define a data type for recording info about an argument list | |
1025 | during the scan of that argument list. This data type should | |
1026 | hold all necessary information about the function itself | |
1027 | and about the args processed so far, enough to enable macros | |
1028 | such as FUNCTION_ARG to determine where the next arg should go. | |
1029 | ||
1030 | On Alpha, this is a single integer, which is a number of words | |
1031 | of arguments scanned so far. | |
1032 | Thus 6 or more means all following args should go on the stack. */ | |
1033 | ||
1034 | #define CUMULATIVE_ARGS int | |
1035 | ||
1036 | /* Initialize a variable CUM of type CUMULATIVE_ARGS | |
1037 | for a call to a function whose data type is FNTYPE. | |
1038 | For a library call, FNTYPE is 0. */ | |
1039 | ||
2c7ee1a6 | 1040 | #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) (CUM) = 0 |
1a94ca49 RK |
1041 | |
1042 | /* Define intermediate macro to compute the size (in registers) of an argument | |
1043 | for the Alpha. */ | |
1044 | ||
1045 | #define ALPHA_ARG_SIZE(MODE, TYPE, NAMED) \ | |
5495cc55 RH |
1046 | ((MODE) == TFmode || (MODE) == TCmode ? 1 \ |
1047 | : (((MODE) == BLKmode ? int_size_in_bytes (TYPE) : GET_MODE_SIZE (MODE)) \ | |
1048 | + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD) | |
1a94ca49 RK |
1049 | |
1050 | /* Update the data in CUM to advance over an argument | |
1051 | of mode MODE and data type TYPE. | |
1052 | (TYPE is null for libcalls where that information may not be available.) */ | |
1053 | ||
1054 | #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ | |
1055 | if (MUST_PASS_IN_STACK (MODE, TYPE)) \ | |
1056 | (CUM) = 6; \ | |
1057 | else \ | |
1058 | (CUM) += ALPHA_ARG_SIZE (MODE, TYPE, NAMED) | |
1059 | ||
1060 | /* Determine where to put an argument to a function. | |
1061 | Value is zero to push the argument on the stack, | |
1062 | or a hard register in which to store the argument. | |
1063 | ||
1064 | MODE is the argument's machine mode. | |
1065 | TYPE is the data type of the argument (as a tree). | |
1066 | This is null for libcalls where that information may | |
1067 | not be available. | |
1068 | CUM is a variable of type CUMULATIVE_ARGS which gives info about | |
1069 | the preceding args and about the function being called. | |
1070 | NAMED is nonzero if this argument is a named parameter | |
1071 | (otherwise it is an extra parameter matching an ellipsis). | |
1072 | ||
1073 | On Alpha the first 6 words of args are normally in registers | |
1074 | and the rest are pushed. */ | |
1075 | ||
1076 | #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ | |
5495cc55 RH |
1077 | function_arg((CUM), (MODE), (TYPE), (NAMED)) |
1078 | ||
1079 | /* A C expression that indicates when an argument must be passed by | |
1080 | reference. If nonzero for an argument, a copy of that argument is | |
1081 | made in memory and a pointer to the argument is passed instead of | |
1082 | the argument itself. The pointer is passed in whatever way is | |
1083 | appropriate for passing a pointer to that type. */ | |
1084 | ||
1085 | #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \ | |
1086 | ((MODE) == TFmode || (MODE) == TCmode) | |
1a94ca49 | 1087 | |
1a94ca49 RK |
1088 | /* Specify the padding direction of arguments. |
1089 | ||
1090 | On the Alpha, we must pad upwards in order to be able to pass args in | |
1091 | registers. */ | |
1092 | ||
1093 | #define FUNCTION_ARG_PADDING(MODE, TYPE) upward | |
1094 | ||
1095 | /* For an arg passed partly in registers and partly in memory, | |
1096 | this is the number of registers used. | |
1097 | For args passed entirely in registers or entirely in memory, zero. */ | |
1098 | ||
1099 | #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \ | |
1100 | ((CUM) < 6 && 6 < (CUM) + ALPHA_ARG_SIZE (MODE, TYPE, NAMED) \ | |
1101 | ? 6 - (CUM) : 0) | |
1102 | ||
130d2d72 RK |
1103 | /* Perform any needed actions needed for a function that is receiving a |
1104 | variable number of arguments. | |
1105 | ||
1106 | CUM is as above. | |
1107 | ||
1108 | MODE and TYPE are the mode and type of the current parameter. | |
1109 | ||
1110 | PRETEND_SIZE is a variable that should be set to the amount of stack | |
1111 | that must be pushed by the prolog to pretend that our caller pushed | |
1112 | it. | |
1113 | ||
1114 | Normally, this macro will push all remaining incoming registers on the | |
1115 | stack and set PRETEND_SIZE to the length of the registers pushed. | |
1116 | ||
1117 | On the Alpha, we allocate space for all 12 arg registers, but only | |
1118 | push those that are remaining. | |
1119 | ||
1120 | However, if NO registers need to be saved, don't allocate any space. | |
1121 | This is not only because we won't need the space, but because AP includes | |
1122 | the current_pretend_args_size and we don't want to mess up any | |
7a92339b RK |
1123 | ap-relative addresses already made. |
1124 | ||
1125 | If we are not to use the floating-point registers, save the integer | |
1126 | registers where we would put the floating-point registers. This is | |
1127 | not the most efficient way to implement varargs with just one register | |
1128 | class, but it isn't worth doing anything more efficient in this rare | |
1129 | case. */ | |
1130 | ||
130d2d72 RK |
1131 | #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \ |
1132 | { if ((CUM) < 6) \ | |
1133 | { \ | |
1134 | if (! (NO_RTL)) \ | |
1135 | { \ | |
63966b3b RH |
1136 | rtx tmp; int set = get_varargs_alias_set (); \ |
1137 | tmp = gen_rtx_MEM (BLKmode, \ | |
1138 | plus_constant (virtual_incoming_args_rtx, \ | |
1139 | ((CUM) + 6)* UNITS_PER_WORD)); \ | |
1140 | MEM_ALIAS_SET (tmp) = set; \ | |
130d2d72 | 1141 | move_block_from_reg \ |
63966b3b | 1142 | (16 + CUM, tmp, \ |
02892e06 | 1143 | 6 - (CUM), (6 - (CUM)) * UNITS_PER_WORD); \ |
63966b3b RH |
1144 | \ |
1145 | tmp = gen_rtx_MEM (BLKmode, \ | |
1146 | plus_constant (virtual_incoming_args_rtx, \ | |
1147 | (CUM) * UNITS_PER_WORD)); \ | |
1148 | MEM_ALIAS_SET (tmp) = set; \ | |
130d2d72 | 1149 | move_block_from_reg \ |
63966b3b | 1150 | (16 + (TARGET_FPREGS ? 32 : 0) + CUM, tmp, \ |
02892e06 | 1151 | 6 - (CUM), (6 - (CUM)) * UNITS_PER_WORD); \ |
130d2d72 RK |
1152 | } \ |
1153 | PRETEND_SIZE = 12 * UNITS_PER_WORD; \ | |
1154 | } \ | |
1155 | } | |
1156 | ||
7d89dda5 RH |
1157 | /* We do not allow indirect calls to be optimized into sibling calls, nor |
1158 | can we allow a call to a function in a different compilation unit to | |
1159 | be optimized into a sibcall. Except if the function is known not to | |
1160 | return, in which case our caller doesn't care what the gp is. */ | |
1161 | #define FUNCTION_OK_FOR_SIBCALL(DECL) \ | |
1162 | (DECL \ | |
1163 | && ((TREE_ASM_WRITTEN (DECL) && !flag_pic) \ | |
9a1ba437 | 1164 | || ! TREE_PUBLIC (DECL))) |
7d89dda5 | 1165 | |
c8e9adec RK |
1166 | /* Try to output insns to set TARGET equal to the constant C if it can be |
1167 | done in less than N insns. Do all computations in MODE. Returns the place | |
1168 | where the output has been placed if it can be done and the insns have been | |
1169 | emitted. If it would take more than N insns, zero is returned and no | |
1170 | insns and emitted. */ | |
92e40a7a | 1171 | |
1a94ca49 RK |
1172 | /* Define the information needed to generate branch and scc insns. This is |
1173 | stored from the compare operation. Note that we can't use "rtx" here | |
1174 | since it hasn't been defined! */ | |
1175 | ||
6db21c7f RH |
1176 | struct alpha_compare |
1177 | { | |
1178 | struct rtx_def *op0, *op1; | |
1179 | int fp_p; | |
1180 | }; | |
1181 | ||
1182 | extern struct alpha_compare alpha_compare; | |
1a94ca49 | 1183 | |
e5958492 | 1184 | /* Make (or fake) .linkage entry for function call. |
e5958492 | 1185 | IS_LOCAL is 0 if name is used in call, 1 if name is used in definition. */ |
e5958492 | 1186 | |
bcbbac26 RH |
1187 | /* This macro defines the start of an assembly comment. */ |
1188 | ||
1189 | #define ASM_COMMENT_START " #" | |
1190 | ||
acd92049 | 1191 | /* This macro produces the initial definition of a function. */ |
1a94ca49 | 1192 | |
acd92049 RH |
1193 | #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \ |
1194 | alpha_start_function(FILE,NAME,DECL); | |
1a94ca49 | 1195 | |
acd92049 | 1196 | /* This macro closes up a function definition for the assembler. */ |
9c0e94a5 | 1197 | |
acd92049 RH |
1198 | #define ASM_DECLARE_FUNCTION_SIZE(FILE,NAME,DECL) \ |
1199 | alpha_end_function(FILE,NAME,DECL) | |
acd92049 | 1200 | |
acd92049 RH |
1201 | /* Output any profiling code before the prologue. */ |
1202 | ||
1203 | #define PROFILE_BEFORE_PROLOGUE 1 | |
1204 | ||
1a94ca49 | 1205 | /* Output assembler code to FILE to increment profiler label # LABELNO |
e0fb9029 | 1206 | for profiling a function entry. Under OSF/1, profiling is enabled |
ddd5a7c1 | 1207 | by simply passing -pg to the assembler and linker. */ |
85d159a3 | 1208 | |
e0fb9029 | 1209 | #define FUNCTION_PROFILER(FILE, LABELNO) |
85d159a3 RK |
1210 | |
1211 | /* Output assembler code to FILE to initialize this source file's | |
1212 | basic block profiling info, if that has not already been done. | |
1213 | This assumes that __bb_init_func doesn't garble a1-a5. */ | |
1214 | ||
1215 | #define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \ | |
1216 | do { \ | |
1217 | ASM_OUTPUT_REG_PUSH (FILE, 16); \ | |
a62eb16f JW |
1218 | fputs ("\tlda $16,$PBX32\n", (FILE)); \ |
1219 | fputs ("\tldq $26,0($16)\n", (FILE)); \ | |
1220 | fputs ("\tbne $26,1f\n", (FILE)); \ | |
1221 | fputs ("\tlda $27,__bb_init_func\n", (FILE)); \ | |
1222 | fputs ("\tjsr $26,($27),__bb_init_func\n", (FILE)); \ | |
1223 | fputs ("\tldgp $29,0($26)\n", (FILE)); \ | |
1224 | fputs ("1:\n", (FILE)); \ | |
85d159a3 RK |
1225 | ASM_OUTPUT_REG_POP (FILE, 16); \ |
1226 | } while (0); | |
1227 | ||
1228 | /* Output assembler code to FILE to increment the entry-count for | |
1229 | the BLOCKNO'th basic block in this source file. */ | |
1230 | ||
1231 | #define BLOCK_PROFILER(FILE, BLOCKNO) \ | |
1232 | do { \ | |
1233 | int blockn = (BLOCKNO); \ | |
a62eb16f | 1234 | fputs ("\tsubq $30,16,$30\n", (FILE)); \ |
70a76f06 RK |
1235 | fputs ("\tstq $26,0($30)\n", (FILE)); \ |
1236 | fputs ("\tstq $27,8($30)\n", (FILE)); \ | |
1237 | fputs ("\tlda $26,$PBX34\n", (FILE)); \ | |
1238 | fprintf ((FILE), "\tldq $27,%d($26)\n", 8*blockn); \ | |
1239 | fputs ("\taddq $27,1,$27\n", (FILE)); \ | |
1240 | fprintf ((FILE), "\tstq $27,%d($26)\n", 8*blockn); \ | |
1241 | fputs ("\tldq $26,0($30)\n", (FILE)); \ | |
1242 | fputs ("\tldq $27,8($30)\n", (FILE)); \ | |
a62eb16f | 1243 | fputs ("\taddq $30,16,$30\n", (FILE)); \ |
85d159a3 | 1244 | } while (0) |
1a94ca49 | 1245 | |
1a94ca49 RK |
1246 | |
1247 | /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, | |
1248 | the stack pointer does not matter. The value is tested only in | |
1249 | functions that have frame pointers. | |
1250 | No definition is equivalent to always zero. */ | |
1251 | ||
1252 | #define EXIT_IGNORE_STACK 1 | |
c112e233 RH |
1253 | |
1254 | /* Define registers used by the epilogue and return instruction. */ | |
1255 | ||
1256 | #define EPILOGUE_USES(REGNO) ((REGNO) == 26) | |
1a94ca49 RK |
1257 | \f |
1258 | /* Output assembler code for a block containing the constant parts | |
1259 | of a trampoline, leaving space for the variable parts. | |
1260 | ||
1261 | The trampoline should set the static chain pointer to value placed | |
7981384f RK |
1262 | into the trampoline and should branch to the specified routine. |
1263 | Note that $27 has been set to the address of the trampoline, so we can | |
1264 | use it for addressability of the two data items. Trampolines are always | |
1265 | aligned to FUNCTION_BOUNDARY, which is 64 bits. */ | |
1a94ca49 RK |
1266 | |
1267 | #define TRAMPOLINE_TEMPLATE(FILE) \ | |
c714f03d | 1268 | do { \ |
7981384f | 1269 | fprintf (FILE, "\tldq $1,24($27)\n"); \ |
1a94ca49 | 1270 | fprintf (FILE, "\tldq $27,16($27)\n"); \ |
7981384f RK |
1271 | fprintf (FILE, "\tjmp $31,($27),0\n"); \ |
1272 | fprintf (FILE, "\tnop\n"); \ | |
1a94ca49 | 1273 | fprintf (FILE, "\t.quad 0,0\n"); \ |
c714f03d | 1274 | } while (0) |
1a94ca49 | 1275 | |
3a523eeb RS |
1276 | /* Section in which to place the trampoline. On Alpha, instructions |
1277 | may only be placed in a text segment. */ | |
1278 | ||
1279 | #define TRAMPOLINE_SECTION text_section | |
1280 | ||
1a94ca49 RK |
1281 | /* Length in units of the trampoline for entering a nested function. */ |
1282 | ||
7981384f | 1283 | #define TRAMPOLINE_SIZE 32 |
1a94ca49 RK |
1284 | |
1285 | /* Emit RTL insns to initialize the variable parts of a trampoline. | |
1286 | FNADDR is an RTX for the address of the function's pure code. | |
c714f03d | 1287 | CXT is an RTX for the static chain value for the function. */ |
1a94ca49 | 1288 | |
9ec36da5 | 1289 | #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ |
c714f03d | 1290 | alpha_initialize_trampoline (TRAMP, FNADDR, CXT, 16, 24, 8) |
675f0e7c RK |
1291 | |
1292 | /* A C expression whose value is RTL representing the value of the return | |
1293 | address for the frame COUNT steps up from the current frame. | |
1294 | FRAMEADDR is the frame pointer of the COUNT frame, or the frame pointer of | |
952fc2ed | 1295 | the COUNT-1 frame if RETURN_ADDR_IN_PREVIOUS_FRAME is defined. */ |
675f0e7c | 1296 | |
9ecc37f0 | 1297 | #define RETURN_ADDR_RTX alpha_return_addr |
9ecc37f0 | 1298 | |
6abc6f40 RH |
1299 | /* Before the prologue, RA lives in $26. */ |
1300 | #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, 26) | |
8034da37 | 1301 | #define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (26) |
4573b4de RH |
1302 | |
1303 | /* Describe how we implement __builtin_eh_return. */ | |
1304 | #define EH_RETURN_DATA_REGNO(N) ((N) < 4 ? (N) + 16 : INVALID_REGNUM) | |
1305 | #define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, 28) | |
1306 | #define EH_RETURN_HANDLER_RTX \ | |
1307 | gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx, \ | |
1308 | current_function_outgoing_args_size)) | |
675f0e7c | 1309 | \f |
1a94ca49 RK |
1310 | /* Addressing modes, and classification of registers for them. */ |
1311 | ||
940da324 JL |
1312 | /* #define HAVE_POST_INCREMENT 0 */ |
1313 | /* #define HAVE_POST_DECREMENT 0 */ | |
1a94ca49 | 1314 | |
940da324 JL |
1315 | /* #define HAVE_PRE_DECREMENT 0 */ |
1316 | /* #define HAVE_PRE_INCREMENT 0 */ | |
1a94ca49 RK |
1317 | |
1318 | /* Macros to check register numbers against specific register classes. */ | |
1319 | ||
1320 | /* These assume that REGNO is a hard or pseudo reg number. | |
1321 | They give nonzero only if REGNO is a hard reg of the suitable class | |
1322 | or a pseudo reg currently allocated to a suitable hard reg. | |
1323 | Since they use reg_renumber, they are safe only once reg_renumber | |
1324 | has been allocated, which happens in local-alloc.c. */ | |
1325 | ||
1326 | #define REGNO_OK_FOR_INDEX_P(REGNO) 0 | |
1327 | #define REGNO_OK_FOR_BASE_P(REGNO) \ | |
52a69200 RK |
1328 | ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32 \ |
1329 | || (REGNO) == 63 || reg_renumber[REGNO] == 63) | |
1a94ca49 RK |
1330 | \f |
1331 | /* Maximum number of registers that can appear in a valid memory address. */ | |
1332 | #define MAX_REGS_PER_ADDRESS 1 | |
1333 | ||
1334 | /* Recognize any constant value that is a valid address. For the Alpha, | |
1335 | there are only constants none since we want to use LDA to load any | |
1336 | symbolic addresses into registers. */ | |
1337 | ||
1338 | #define CONSTANT_ADDRESS_P(X) \ | |
1339 | (GET_CODE (X) == CONST_INT \ | |
1340 | && (unsigned HOST_WIDE_INT) (INTVAL (X) + 0x8000) < 0x10000) | |
1341 | ||
1342 | /* Include all constant integers and constant doubles, but not | |
1343 | floating-point, except for floating-point zero. */ | |
1344 | ||
1345 | #define LEGITIMATE_CONSTANT_P(X) \ | |
1346 | (GET_MODE_CLASS (GET_MODE (X)) != MODE_FLOAT \ | |
1347 | || (X) == CONST0_RTX (GET_MODE (X))) | |
1348 | ||
1349 | /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx | |
1350 | and check its validity for a certain class. | |
1351 | We have two alternate definitions for each of them. | |
1352 | The usual definition accepts all pseudo regs; the other rejects | |
1353 | them unless they have been allocated suitable hard regs. | |
1354 | The symbol REG_OK_STRICT causes the latter definition to be used. | |
1355 | ||
1356 | Most source files want to accept pseudo regs in the hope that | |
1357 | they will get allocated to the class that the insn wants them to be in. | |
1358 | Source files for reload pass need to be strict. | |
1359 | After reload, it makes no difference, since pseudo regs have | |
1360 | been eliminated by then. */ | |
1361 | ||
1362 | #ifndef REG_OK_STRICT | |
1363 | ||
1364 | /* Nonzero if X is a hard reg that can be used as an index | |
1365 | or if it is a pseudo reg. */ | |
1366 | #define REG_OK_FOR_INDEX_P(X) 0 | |
5d02b6c2 | 1367 | |
1a94ca49 RK |
1368 | /* Nonzero if X is a hard reg that can be used as a base reg |
1369 | or if it is a pseudo reg. */ | |
1370 | #define REG_OK_FOR_BASE_P(X) \ | |
52a69200 | 1371 | (REGNO (X) < 32 || REGNO (X) == 63 || REGNO (X) >= FIRST_PSEUDO_REGISTER) |
1a94ca49 | 1372 | |
5d02b6c2 RH |
1373 | /* ??? Nonzero if X is the frame pointer, or some virtual register |
1374 | that may eliminate to the frame pointer. These will be allowed to | |
1375 | have offsets greater than 32K. This is done because register | |
1376 | elimination offsets will change the hi/lo split, and if we split | |
1377 | before reload, we will require additional instructions. */ | |
1378 | #define REG_OK_FP_BASE_P(X) \ | |
1379 | (REGNO (X) == 31 || REGNO (X) == 63 \ | |
1380 | || (REGNO (X) >= FIRST_PSEUDO_REGISTER \ | |
1381 | && REGNO (X) < LAST_VIRTUAL_REGISTER)) | |
1382 | ||
1a94ca49 RK |
1383 | #else |
1384 | ||
1385 | /* Nonzero if X is a hard reg that can be used as an index. */ | |
1386 | #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X)) | |
5d02b6c2 | 1387 | |
1a94ca49 RK |
1388 | /* Nonzero if X is a hard reg that can be used as a base reg. */ |
1389 | #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X)) | |
1390 | ||
5d02b6c2 RH |
1391 | #define REG_OK_FP_BASE_P(X) 0 |
1392 | ||
1a94ca49 RK |
1393 | #endif |
1394 | \f | |
1395 | /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression | |
1396 | that is a valid memory address for an instruction. | |
1397 | The MODE argument is the machine mode for the MEM expression | |
1398 | that wants to use this address. | |
1399 | ||
1400 | For Alpha, we have either a constant address or the sum of a register | |
1401 | and a constant address, or just a register. For DImode, any of those | |
1402 | forms can be surrounded with an AND that clear the low-order three bits; | |
1403 | this is an "unaligned" access. | |
1404 | ||
1a94ca49 RK |
1405 | First define the basic valid address. */ |
1406 | ||
4c020733 RH |
1407 | #define GO_IF_LEGITIMATE_SIMPLE_ADDRESS(MODE, X, ADDR) \ |
1408 | { \ | |
1409 | rtx tmp = (X); \ | |
1410 | if (GET_CODE (tmp) == SUBREG \ | |
1411 | && (GET_MODE_SIZE (GET_MODE (tmp)) \ | |
1412 | < GET_MODE_SIZE (GET_MODE (SUBREG_REG (tmp))))) \ | |
1413 | tmp = SUBREG_REG (tmp); \ | |
1414 | if (REG_P (tmp) && REG_OK_FOR_BASE_P (tmp)) \ | |
1415 | goto ADDR; \ | |
1416 | if (CONSTANT_ADDRESS_P (X)) \ | |
1417 | goto ADDR; \ | |
1418 | if (GET_CODE (X) == PLUS) \ | |
1419 | { \ | |
1420 | tmp = XEXP (X, 0); \ | |
1421 | if (GET_CODE (tmp) == SUBREG \ | |
1422 | && (GET_MODE_SIZE (GET_MODE (tmp)) \ | |
1423 | < GET_MODE_SIZE (GET_MODE (SUBREG_REG (tmp))))) \ | |
1424 | tmp = SUBREG_REG (tmp); \ | |
1425 | if (REG_P (tmp)) \ | |
1426 | { \ | |
1427 | if (REG_OK_FP_BASE_P (tmp) \ | |
1428 | && GET_CODE (XEXP (X, 1)) == CONST_INT) \ | |
1429 | goto ADDR; \ | |
1430 | if (REG_OK_FOR_BASE_P (tmp) \ | |
1431 | && CONSTANT_ADDRESS_P (XEXP (X, 1))) \ | |
1432 | goto ADDR; \ | |
1433 | } \ | |
0c5912f4 RH |
1434 | else if (GET_CODE (tmp) == ADDRESSOF \ |
1435 | && CONSTANT_ADDRESS_P (XEXP (X, 1))) \ | |
1436 | goto ADDR; \ | |
4c020733 | 1437 | } \ |
1a94ca49 RK |
1438 | } |
1439 | ||
1440 | /* Now accept the simple address, or, for DImode only, an AND of a simple | |
1441 | address that turns off the low three bits. */ | |
1442 | ||
1a94ca49 RK |
1443 | #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ |
1444 | { GO_IF_LEGITIMATE_SIMPLE_ADDRESS (MODE, X, ADDR); \ | |
1445 | if ((MODE) == DImode \ | |
1446 | && GET_CODE (X) == AND \ | |
1447 | && GET_CODE (XEXP (X, 1)) == CONST_INT \ | |
1448 | && INTVAL (XEXP (X, 1)) == -8) \ | |
1449 | GO_IF_LEGITIMATE_SIMPLE_ADDRESS (MODE, XEXP (X, 0), ADDR); \ | |
1a94ca49 RK |
1450 | } |
1451 | ||
1452 | /* Try machine-dependent ways of modifying an illegitimate address | |
1453 | to be legitimate. If we find one, return the new, valid address. | |
1454 | This macro is used in only one place: `memory_address' in explow.c. | |
1455 | ||
1456 | OLDX is the address as it was before break_out_memory_refs was called. | |
1457 | In some cases it is useful to look at this to decide what needs to be done. | |
1458 | ||
1459 | MODE and WIN are passed so that this macro can use | |
1460 | GO_IF_LEGITIMATE_ADDRESS. | |
1461 | ||
1462 | It is always safe for this macro to do nothing. It exists to recognize | |
aead1ca3 RH |
1463 | opportunities to optimize the output. */ |
1464 | ||
1465 | #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \ | |
1466 | do { \ | |
1467 | rtx new_x = alpha_legitimize_address (X, OLDX, MODE); \ | |
1468 | if (new_x) \ | |
1469 | { \ | |
1470 | X = new_x; \ | |
1471 | goto WIN; \ | |
1472 | } \ | |
1473 | } while (0) | |
1a94ca49 | 1474 | |
a9a2595b JR |
1475 | /* Try a machine-dependent way of reloading an illegitimate address |
1476 | operand. If we find one, push the reload and jump to WIN. This | |
aead1ca3 | 1477 | macro is used in only one place: `find_reloads_address' in reload.c. */ |
a9a2595b | 1478 | |
aead1ca3 RH |
1479 | #define LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OPNUM,TYPE,IND_L,WIN) \ |
1480 | do { \ | |
1481 | rtx new_x = alpha_legitimize_reload_address (X, MODE, OPNUM, TYPE, IND_L); \ | |
1482 | if (new_x) \ | |
1483 | { \ | |
1484 | X = new_x; \ | |
1485 | goto WIN; \ | |
1486 | } \ | |
a9a2595b JR |
1487 | } while (0) |
1488 | ||
1a94ca49 RK |
1489 | /* Go to LABEL if ADDR (a legitimate address expression) |
1490 | has an effect that depends on the machine mode it is used for. | |
1491 | On the Alpha this is true only for the unaligned modes. We can | |
1492 | simplify this test since we know that the address must be valid. */ | |
1493 | ||
1494 | #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \ | |
1495 | { if (GET_CODE (ADDR) == AND) goto LABEL; } | |
1496 | ||
1497 | /* Compute the cost of an address. For the Alpha, all valid addresses are | |
1498 | the same cost. */ | |
1499 | ||
1500 | #define ADDRESS_COST(X) 0 | |
1501 | ||
2ea844d3 RH |
1502 | /* Machine-dependent reorg pass. */ |
1503 | #define MACHINE_DEPENDENT_REORG(X) alpha_reorg(X) | |
1a94ca49 RK |
1504 | \f |
1505 | /* Specify the machine mode that this machine uses | |
1506 | for the index in the tablejump instruction. */ | |
1507 | #define CASE_VECTOR_MODE SImode | |
1508 | ||
18543a22 ILT |
1509 | /* Define as C expression which evaluates to nonzero if the tablejump |
1510 | instruction expects the table to contain offsets from the address of the | |
3aa9d5b6 | 1511 | table. |
b0435cf4 | 1512 | |
3aa9d5b6 | 1513 | Do not define this if the table should contain absolute addresses. |
260ced47 RK |
1514 | On the Alpha, the table is really GP-relative, not relative to the PC |
1515 | of the table, but we pretend that it is PC-relative; this should be OK, | |
0076aa6b | 1516 | but we should try to find some better way sometime. */ |
18543a22 | 1517 | #define CASE_VECTOR_PC_RELATIVE 1 |
1a94ca49 RK |
1518 | |
1519 | /* Specify the tree operation to be used to convert reals to integers. */ | |
1520 | #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR | |
1521 | ||
1522 | /* This is the kind of divide that is easiest to do in the general case. */ | |
1523 | #define EASY_DIV_EXPR TRUNC_DIV_EXPR | |
1524 | ||
1525 | /* Define this as 1 if `char' should by default be signed; else as 0. */ | |
1526 | #define DEFAULT_SIGNED_CHAR 1 | |
1527 | ||
1528 | /* This flag, if defined, says the same insns that convert to a signed fixnum | |
1529 | also convert validly to an unsigned one. | |
1530 | ||
1531 | We actually lie a bit here as overflow conditions are different. But | |
1532 | they aren't being checked anyway. */ | |
1533 | ||
1534 | #define FIXUNS_TRUNC_LIKE_FIX_TRUNC | |
1535 | ||
1536 | /* Max number of bytes we can move to or from memory | |
1537 | in one reasonably fast instruction. */ | |
1538 | ||
1539 | #define MOVE_MAX 8 | |
1540 | ||
7e24ffc9 HPN |
1541 | /* If a memory-to-memory move would take MOVE_RATIO or more simple |
1542 | move-instruction pairs, we will do a movstr or libcall instead. | |
1543 | ||
1544 | Without byte/word accesses, we want no more than four instructions; | |
1545 | with, several single byte accesses are better. */ | |
6c174fc0 RH |
1546 | |
1547 | #define MOVE_RATIO (TARGET_BWX ? 7 : 2) | |
1548 | ||
1a94ca49 RK |
1549 | /* Largest number of bytes of an object that can be placed in a register. |
1550 | On the Alpha we have plenty of registers, so use TImode. */ | |
1551 | #define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (TImode) | |
1552 | ||
1553 | /* Nonzero if access to memory by bytes is no faster than for words. | |
1554 | Also non-zero if doing byte operations (specifically shifts) in registers | |
1555 | is undesirable. | |
1556 | ||
1557 | On the Alpha, we want to not use the byte operation and instead use | |
1558 | masking operations to access fields; these will save instructions. */ | |
1559 | ||
1560 | #define SLOW_BYTE_ACCESS 1 | |
1561 | ||
9a63901f RK |
1562 | /* Define if operations between registers always perform the operation |
1563 | on the full register even if a narrower mode is specified. */ | |
1564 | #define WORD_REGISTER_OPERATIONS | |
1565 | ||
1566 | /* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD | |
1567 | will either zero-extend or sign-extend. The value of this macro should | |
1568 | be the code that says which one of the two operations is implicitly | |
1569 | done, NIL if none. */ | |
b7747781 | 1570 | #define LOAD_EXTEND_OP(MODE) ((MODE) == SImode ? SIGN_EXTEND : ZERO_EXTEND) |
1a94ca49 | 1571 | |
225211e2 RK |
1572 | /* Define if loading short immediate values into registers sign extends. */ |
1573 | #define SHORT_IMMEDIATES_SIGN_EXTEND | |
1574 | ||
1a94ca49 RK |
1575 | /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits |
1576 | is done just by pretending it is already truncated. */ | |
1577 | #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 | |
1578 | ||
1579 | /* We assume that the store-condition-codes instructions store 0 for false | |
1580 | and some other value for true. This is the value stored for true. */ | |
1581 | ||
1582 | #define STORE_FLAG_VALUE 1 | |
1583 | ||
1584 | /* Define the value returned by a floating-point comparison instruction. */ | |
1585 | ||
12530dbe RH |
1586 | #define FLOAT_STORE_FLAG_VALUE(MODE) \ |
1587 | REAL_VALUE_ATOF ((TARGET_FLOAT_VAX ? "0.5" : "2.0"), (MODE)) | |
1a94ca49 | 1588 | |
35bb77fd RK |
1589 | /* Canonicalize a comparison from one we don't have to one we do have. */ |
1590 | ||
1591 | #define CANONICALIZE_COMPARISON(CODE,OP0,OP1) \ | |
1592 | do { \ | |
1593 | if (((CODE) == GE || (CODE) == GT || (CODE) == GEU || (CODE) == GTU) \ | |
1594 | && (GET_CODE (OP1) == REG || (OP1) == const0_rtx)) \ | |
1595 | { \ | |
1596 | rtx tem = (OP0); \ | |
1597 | (OP0) = (OP1); \ | |
1598 | (OP1) = tem; \ | |
1599 | (CODE) = swap_condition (CODE); \ | |
1600 | } \ | |
1601 | if (((CODE) == LT || (CODE) == LTU) \ | |
1602 | && GET_CODE (OP1) == CONST_INT && INTVAL (OP1) == 256) \ | |
1603 | { \ | |
1604 | (CODE) = (CODE) == LT ? LE : LEU; \ | |
1605 | (OP1) = GEN_INT (255); \ | |
1606 | } \ | |
1607 | } while (0) | |
1608 | ||
1a94ca49 RK |
1609 | /* Specify the machine mode that pointers have. |
1610 | After generation of rtl, the compiler makes no further distinction | |
1611 | between pointers and any other objects of this machine mode. */ | |
1612 | #define Pmode DImode | |
1613 | ||
1614 | /* Mode of a function address in a call instruction (for indexing purposes). */ | |
1615 | ||
1616 | #define FUNCTION_MODE Pmode | |
1617 | ||
1618 | /* Define this if addresses of constant functions | |
1619 | shouldn't be put through pseudo regs where they can be cse'd. | |
1620 | Desirable on machines where ordinary constants are expensive | |
1621 | but a CALL with constant address is cheap. | |
1622 | ||
1623 | We define this on the Alpha so that gen_call and gen_call_value | |
1624 | get to see the SYMBOL_REF (for the hint field of the jsr). It will | |
1625 | then copy it into a register, thus actually letting the address be | |
1626 | cse'ed. */ | |
1627 | ||
1628 | #define NO_FUNCTION_CSE | |
1629 | ||
d969caf8 | 1630 | /* Define this to be nonzero if shift instructions ignore all but the low-order |
1a94ca49 | 1631 | few bits. */ |
d969caf8 | 1632 | #define SHIFT_COUNT_TRUNCATED 1 |
1a94ca49 RK |
1633 | |
1634 | /* Compute the cost of computing a constant rtl expression RTX | |
1635 | whose rtx-code is CODE. The body of this macro is a portion | |
1636 | of a switch statement. If the code is computed here, | |
1637 | return it with a return statement. Otherwise, break from the switch. | |
1638 | ||
8b7b2e36 RK |
1639 | If this is an 8-bit constant, return zero since it can be used |
1640 | nearly anywhere with no cost. If it is a valid operand for an | |
1641 | ADD or AND, likewise return 0 if we know it will be used in that | |
1642 | context. Otherwise, return 2 since it might be used there later. | |
1643 | All other constants take at least two insns. */ | |
1a94ca49 RK |
1644 | |
1645 | #define CONST_COSTS(RTX,CODE,OUTER_CODE) \ | |
1646 | case CONST_INT: \ | |
06eb8e92 | 1647 | if (INTVAL (RTX) >= 0 && INTVAL (RTX) < 256) \ |
8b7b2e36 | 1648 | return 0; \ |
1a94ca49 | 1649 | case CONST_DOUBLE: \ |
5d02ee66 RH |
1650 | if ((RTX) == CONST0_RTX (GET_MODE (RTX))) \ |
1651 | return 0; \ | |
1652 | else if (((OUTER_CODE) == PLUS && add_operand (RTX, VOIDmode)) \ | |
8b7b2e36 RK |
1653 | || ((OUTER_CODE) == AND && and_operand (RTX, VOIDmode))) \ |
1654 | return 0; \ | |
1655 | else if (add_operand (RTX, VOIDmode) || and_operand (RTX, VOIDmode)) \ | |
1656 | return 2; \ | |
1657 | else \ | |
1658 | return COSTS_N_INSNS (2); \ | |
1a94ca49 RK |
1659 | case CONST: \ |
1660 | case SYMBOL_REF: \ | |
1661 | case LABEL_REF: \ | |
f6f6a13c RK |
1662 | switch (alpha_cpu) \ |
1663 | { \ | |
1664 | case PROCESSOR_EV4: \ | |
1665 | return COSTS_N_INSNS (3); \ | |
1666 | case PROCESSOR_EV5: \ | |
5d02ee66 | 1667 | case PROCESSOR_EV6: \ |
f6f6a13c | 1668 | return COSTS_N_INSNS (2); \ |
5d02ee66 | 1669 | default: abort(); \ |
f6f6a13c | 1670 | } |
1a94ca49 RK |
1671 | |
1672 | /* Provide the costs of a rtl expression. This is in the body of a | |
1673 | switch on CODE. */ | |
1674 | ||
1675 | #define RTX_COSTS(X,CODE,OUTER_CODE) \ | |
3bda6d11 RK |
1676 | case PLUS: case MINUS: \ |
1677 | if (FLOAT_MODE_P (GET_MODE (X))) \ | |
f6f6a13c RK |
1678 | switch (alpha_cpu) \ |
1679 | { \ | |
1680 | case PROCESSOR_EV4: \ | |
1681 | return COSTS_N_INSNS (6); \ | |
1682 | case PROCESSOR_EV5: \ | |
5d02ee66 | 1683 | case PROCESSOR_EV6: \ |
f6f6a13c | 1684 | return COSTS_N_INSNS (4); \ |
5d02ee66 | 1685 | default: abort(); \ |
f6f6a13c | 1686 | } \ |
b49e978e RK |
1687 | else if (GET_CODE (XEXP (X, 0)) == MULT \ |
1688 | && const48_operand (XEXP (XEXP (X, 0), 1), VOIDmode)) \ | |
a5da0afe RK |
1689 | return (2 + rtx_cost (XEXP (XEXP (X, 0), 0), OUTER_CODE) \ |
1690 | + rtx_cost (XEXP (X, 1), OUTER_CODE)); \ | |
1a94ca49 RK |
1691 | break; \ |
1692 | case MULT: \ | |
f6f6a13c RK |
1693 | switch (alpha_cpu) \ |
1694 | { \ | |
1695 | case PROCESSOR_EV4: \ | |
1696 | if (FLOAT_MODE_P (GET_MODE (X))) \ | |
1697 | return COSTS_N_INSNS (6); \ | |
1698 | return COSTS_N_INSNS (23); \ | |
1699 | case PROCESSOR_EV5: \ | |
1700 | if (FLOAT_MODE_P (GET_MODE (X))) \ | |
1701 | return COSTS_N_INSNS (4); \ | |
1702 | else if (GET_MODE (X) == DImode) \ | |
1703 | return COSTS_N_INSNS (12); \ | |
1704 | else \ | |
1705 | return COSTS_N_INSNS (8); \ | |
5d02ee66 RH |
1706 | case PROCESSOR_EV6: \ |
1707 | if (FLOAT_MODE_P (GET_MODE (X))) \ | |
1708 | return COSTS_N_INSNS (4); \ | |
1709 | else \ | |
1710 | return COSTS_N_INSNS (7); \ | |
1711 | default: abort(); \ | |
f6f6a13c | 1712 | } \ |
b49e978e RK |
1713 | case ASHIFT: \ |
1714 | if (GET_CODE (XEXP (X, 1)) == CONST_INT \ | |
1715 | && INTVAL (XEXP (X, 1)) <= 3) \ | |
1716 | break; \ | |
1717 | /* ... fall through ... */ \ | |
5d02ee66 | 1718 | case ASHIFTRT: case LSHIFTRT: \ |
f6f6a13c RK |
1719 | switch (alpha_cpu) \ |
1720 | { \ | |
1721 | case PROCESSOR_EV4: \ | |
1722 | return COSTS_N_INSNS (2); \ | |
1723 | case PROCESSOR_EV5: \ | |
5d02ee66 | 1724 | case PROCESSOR_EV6: \ |
f6f6a13c | 1725 | return COSTS_N_INSNS (1); \ |
5d02ee66 RH |
1726 | default: abort(); \ |
1727 | } \ | |
1728 | case IF_THEN_ELSE: \ | |
1729 | switch (alpha_cpu) \ | |
1730 | { \ | |
1731 | case PROCESSOR_EV4: \ | |
1732 | case PROCESSOR_EV6: \ | |
1733 | return COSTS_N_INSNS (2); \ | |
1734 | case PROCESSOR_EV5: \ | |
1735 | return COSTS_N_INSNS (1); \ | |
1736 | default: abort(); \ | |
f6f6a13c | 1737 | } \ |
3bda6d11 | 1738 | case DIV: case UDIV: case MOD: case UMOD: \ |
f6f6a13c RK |
1739 | switch (alpha_cpu) \ |
1740 | { \ | |
1741 | case PROCESSOR_EV4: \ | |
1742 | if (GET_MODE (X) == SFmode) \ | |
1743 | return COSTS_N_INSNS (34); \ | |
1744 | else if (GET_MODE (X) == DFmode) \ | |
1745 | return COSTS_N_INSNS (63); \ | |
1746 | else \ | |
1747 | return COSTS_N_INSNS (70); \ | |
1748 | case PROCESSOR_EV5: \ | |
1749 | if (GET_MODE (X) == SFmode) \ | |
1750 | return COSTS_N_INSNS (15); \ | |
1751 | else if (GET_MODE (X) == DFmode) \ | |
1752 | return COSTS_N_INSNS (22); \ | |
1753 | else \ | |
5d02ee66 RH |
1754 | return COSTS_N_INSNS (70); /* ??? */ \ |
1755 | case PROCESSOR_EV6: \ | |
1756 | if (GET_MODE (X) == SFmode) \ | |
1757 | return COSTS_N_INSNS (12); \ | |
1758 | else if (GET_MODE (X) == DFmode) \ | |
1759 | return COSTS_N_INSNS (15); \ | |
1760 | else \ | |
1761 | return COSTS_N_INSNS (70); /* ??? */ \ | |
1762 | default: abort(); \ | |
f6f6a13c | 1763 | } \ |
1a94ca49 | 1764 | case MEM: \ |
f6f6a13c RK |
1765 | switch (alpha_cpu) \ |
1766 | { \ | |
1767 | case PROCESSOR_EV4: \ | |
5d02ee66 | 1768 | case PROCESSOR_EV6: \ |
f6f6a13c RK |
1769 | return COSTS_N_INSNS (3); \ |
1770 | case PROCESSOR_EV5: \ | |
1771 | return COSTS_N_INSNS (2); \ | |
5d02ee66 | 1772 | default: abort(); \ |
f6f6a13c RK |
1773 | } \ |
1774 | case NEG: case ABS: \ | |
1775 | if (! FLOAT_MODE_P (GET_MODE (X))) \ | |
1776 | break; \ | |
1777 | /* ... fall through ... */ \ | |
3bda6d11 RK |
1778 | case FLOAT: case UNSIGNED_FLOAT: case FIX: case UNSIGNED_FIX: \ |
1779 | case FLOAT_EXTEND: case FLOAT_TRUNCATE: \ | |
f6f6a13c RK |
1780 | switch (alpha_cpu) \ |
1781 | { \ | |
1782 | case PROCESSOR_EV4: \ | |
1783 | return COSTS_N_INSNS (6); \ | |
1784 | case PROCESSOR_EV5: \ | |
5d02ee66 | 1785 | case PROCESSOR_EV6: \ |
f6f6a13c | 1786 | return COSTS_N_INSNS (4); \ |
5d02ee66 | 1787 | default: abort(); \ |
f6f6a13c | 1788 | } |
1a94ca49 RK |
1789 | \f |
1790 | /* Control the assembler format that we output. */ | |
1791 | ||
1a94ca49 RK |
1792 | /* Output to assembler file text saying following lines |
1793 | may contain character constants, extra white space, comments, etc. */ | |
1794 | ||
1795 | #define ASM_APP_ON "" | |
1796 | ||
1797 | /* Output to assembler file text saying following lines | |
1798 | no longer contain unusual constructs. */ | |
1799 | ||
1800 | #define ASM_APP_OFF "" | |
1801 | ||
93de6f51 | 1802 | #define TEXT_SECTION_ASM_OP "\t.text" |
1a94ca49 RK |
1803 | |
1804 | /* Output before read-only data. */ | |
1805 | ||
93de6f51 | 1806 | #define READONLY_DATA_SECTION_ASM_OP "\t.rdata" |
1a94ca49 RK |
1807 | |
1808 | /* Output before writable data. */ | |
1809 | ||
93de6f51 | 1810 | #define DATA_SECTION_ASM_OP "\t.data" |
1a94ca49 RK |
1811 | |
1812 | /* Define an extra section for read-only data, a routine to enter it, and | |
c0388f29 RK |
1813 | indicate that it is for read-only data. |
1814 | ||
abc95ed3 | 1815 | The first time we enter the readonly data section for a file, we write |
c0388f29 RK |
1816 | eight bytes of zero. This works around a bug in DEC's assembler in |
1817 | some versions of OSF/1 V3.x. */ | |
1a94ca49 RK |
1818 | |
1819 | #define EXTRA_SECTIONS readonly_data | |
1820 | ||
1821 | #define EXTRA_SECTION_FUNCTIONS \ | |
1822 | void \ | |
1823 | literal_section () \ | |
1824 | { \ | |
1825 | if (in_section != readonly_data) \ | |
1826 | { \ | |
c0388f29 RK |
1827 | static int firsttime = 1; \ |
1828 | \ | |
1a94ca49 | 1829 | fprintf (asm_out_file, "%s\n", READONLY_DATA_SECTION_ASM_OP); \ |
c0388f29 RK |
1830 | if (firsttime) \ |
1831 | { \ | |
1832 | firsttime = 0; \ | |
1833 | ASM_OUTPUT_DOUBLE_INT (asm_out_file, const0_rtx); \ | |
1834 | } \ | |
1835 | \ | |
1a94ca49 RK |
1836 | in_section = readonly_data; \ |
1837 | } \ | |
1838 | } \ | |
1839 | ||
1840 | #define READONLY_DATA_SECTION literal_section | |
1841 | ||
ac030a7b RK |
1842 | /* If we are referencing a function that is static, make the SYMBOL_REF |
1843 | special. We use this to see indicate we can branch to this function | |
1844 | without setting PV or restoring GP. */ | |
130d2d72 RK |
1845 | |
1846 | #define ENCODE_SECTION_INFO(DECL) \ | |
ac030a7b | 1847 | if (TREE_CODE (DECL) == FUNCTION_DECL && ! TREE_PUBLIC (DECL)) \ |
130d2d72 RK |
1848 | SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; |
1849 | ||
1a94ca49 RK |
1850 | /* How to refer to registers in assembler output. |
1851 | This sequence is indexed by compiler's hard-register-number (see above). */ | |
1852 | ||
1853 | #define REGISTER_NAMES \ | |
1854 | {"$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \ | |
1855 | "$9", "$10", "$11", "$12", "$13", "$14", "$15", \ | |
1856 | "$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23", \ | |
130d2d72 | 1857 | "$24", "$25", "$26", "$27", "$28", "$29", "$30", "AP", \ |
1a94ca49 RK |
1858 | "$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "$f6", "$f7", "$f8", \ |
1859 | "$f9", "$f10", "$f11", "$f12", "$f13", "$f14", "$f15", \ | |
1860 | "$f16", "$f17", "$f18", "$f19", "$f20", "$f21", "$f22", "$f23",\ | |
52a69200 | 1861 | "$f24", "$f25", "$f26", "$f27", "$f28", "$f29", "$f30", "FP"} |
1a94ca49 RK |
1862 | |
1863 | /* How to renumber registers for dbx and gdb. */ | |
1864 | ||
1865 | #define DBX_REGISTER_NUMBER(REGNO) (REGNO) | |
1866 | ||
1867 | /* This is how to output the definition of a user-level label named NAME, | |
1868 | such as the label on a static function or variable NAME. */ | |
1869 | ||
1870 | #define ASM_OUTPUT_LABEL(FILE,NAME) \ | |
1871 | do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0) | |
1872 | ||
1873 | /* This is how to output a command to make the user-level label named NAME | |
1874 | defined for reference from other files. */ | |
1875 | ||
1876 | #define ASM_GLOBALIZE_LABEL(FILE,NAME) \ | |
1877 | do { fputs ("\t.globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0) | |
1878 | ||
4e0c8ad2 | 1879 | /* The prefix to add to user-visible assembler symbols. */ |
1a94ca49 | 1880 | |
4e0c8ad2 | 1881 | #define USER_LABEL_PREFIX "" |
1a94ca49 RK |
1882 | |
1883 | /* This is how to output an internal numbered label where | |
1884 | PREFIX is the class of label and NUM is the number within the class. */ | |
1885 | ||
1886 | #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ | |
531ea24e | 1887 | fprintf (FILE, "$%s%d:\n", PREFIX, NUM) |
1a94ca49 RK |
1888 | |
1889 | /* This is how to output a label for a jump table. Arguments are the same as | |
1890 | for ASM_OUTPUT_INTERNAL_LABEL, except the insn for the jump table is | |
1891 | passed. */ | |
1892 | ||
1893 | #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \ | |
1894 | { ASM_OUTPUT_ALIGN (FILE, 2); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); } | |
1895 | ||
1896 | /* This is how to store into the string LABEL | |
1897 | the symbol_ref name of an internal numbered label where | |
1898 | PREFIX is the class of label and NUM is the number within the class. | |
1899 | This is suitable for output with `assemble_name'. */ | |
1900 | ||
1901 | #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ | |
d1e6b55b | 1902 | sprintf ((LABEL), "*$%s%ld", (PREFIX), (long)(NUM)) |
1a94ca49 | 1903 | |
e247ca2a RK |
1904 | /* Check a floating-point value for validity for a particular machine mode. */ |
1905 | ||
1906 | #define CHECK_FLOAT_VALUE(MODE, D, OVERFLOW) \ | |
1907 | ((OVERFLOW) = check_float_value (MODE, &D, OVERFLOW)) | |
1908 | ||
5495cc55 RH |
1909 | /* This is how to output an assembler line defining a `long double' |
1910 | constant. */ | |
1911 | ||
1912 | #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \ | |
1913 | do { \ | |
1914 | long t[4]; \ | |
1915 | REAL_VALUE_TO_TARGET_LONG_DOUBLE ((VALUE), t); \ | |
1916 | fprintf (FILE, "\t.quad 0x%lx%08lx,0x%lx%08lx\n", \ | |
1917 | t[1] & 0xffffffff, t[0] & 0xffffffff, \ | |
1918 | t[3] & 0xffffffff, t[2] & 0xffffffff); \ | |
1919 | } while (0) | |
1920 | ||
1a94ca49 RK |
1921 | /* This is how to output an assembler line defining a `double' constant. */ |
1922 | ||
e99300f1 | 1923 | #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \ |
5495cc55 RH |
1924 | do { \ |
1925 | long t[2]; \ | |
1926 | REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \ | |
1927 | fprintf (FILE, "\t.quad 0x%lx%08lx\n", \ | |
1928 | t[1] & 0xffffffff, t[0] & 0xffffffff); \ | |
1929 | } while (0) | |
1a94ca49 RK |
1930 | |
1931 | /* This is how to output an assembler line defining a `float' constant. */ | |
1932 | ||
e247ca2a RK |
1933 | #define ASM_OUTPUT_FLOAT(FILE,VALUE) \ |
1934 | do { \ | |
1935 | long t; \ | |
1936 | REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \ | |
1937 | fprintf (FILE, "\t.long 0x%lx\n", t & 0xffffffff); \ | |
5495cc55 | 1938 | } while (0) |
2700ac93 | 1939 | |
1a94ca49 RK |
1940 | /* This is how to output an assembler line defining an `int' constant. */ |
1941 | ||
1942 | #define ASM_OUTPUT_INT(FILE,VALUE) \ | |
0076aa6b RK |
1943 | ( fprintf (FILE, "\t.long "), \ |
1944 | output_addr_const (FILE, (VALUE)), \ | |
1945 | fprintf (FILE, "\n")) | |
1a94ca49 RK |
1946 | |
1947 | /* This is how to output an assembler line defining a `long' constant. */ | |
1948 | ||
1949 | #define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE) \ | |
1950 | ( fprintf (FILE, "\t.quad "), \ | |
1951 | output_addr_const (FILE, (VALUE)), \ | |
1952 | fprintf (FILE, "\n")) | |
1953 | ||
1954 | /* Likewise for `char' and `short' constants. */ | |
1955 | ||
1956 | #define ASM_OUTPUT_SHORT(FILE,VALUE) \ | |
690ef02f | 1957 | fprintf (FILE, "\t.word %d\n", \ |
3c303f52 | 1958 | (int)(GET_CODE (VALUE) == CONST_INT \ |
45c45e79 | 1959 | ? INTVAL (VALUE) & 0xffff : (abort (), 0))) |
1a94ca49 RK |
1960 | |
1961 | #define ASM_OUTPUT_CHAR(FILE,VALUE) \ | |
45c45e79 | 1962 | fprintf (FILE, "\t.byte %d\n", \ |
3c303f52 | 1963 | (int)(GET_CODE (VALUE) == CONST_INT \ |
45c45e79 | 1964 | ? INTVAL (VALUE) & 0xff : (abort (), 0))) |
1a94ca49 RK |
1965 | |
1966 | /* We use the default ASCII-output routine, except that we don't write more | |
1967 | than 50 characters since the assembler doesn't support very long lines. */ | |
1968 | ||
1969 | #define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \ | |
1970 | do { \ | |
1971 | FILE *_hide_asm_out_file = (MYFILE); \ | |
e03c5670 | 1972 | const unsigned char *_hide_p = (const unsigned char *) (MYSTRING); \ |
1a94ca49 RK |
1973 | int _hide_thissize = (MYLENGTH); \ |
1974 | int _size_so_far = 0; \ | |
1975 | { \ | |
1976 | FILE *asm_out_file = _hide_asm_out_file; \ | |
e03c5670 | 1977 | const unsigned char *p = _hide_p; \ |
1a94ca49 RK |
1978 | int thissize = _hide_thissize; \ |
1979 | int i; \ | |
1980 | fprintf (asm_out_file, "\t.ascii \""); \ | |
1981 | \ | |
1982 | for (i = 0; i < thissize; i++) \ | |
1983 | { \ | |
1984 | register int c = p[i]; \ | |
1985 | \ | |
1986 | if (_size_so_far ++ > 50 && i < thissize - 4) \ | |
1987 | _size_so_far = 0, fprintf (asm_out_file, "\"\n\t.ascii \""); \ | |
1988 | \ | |
1989 | if (c == '\"' || c == '\\') \ | |
1990 | putc ('\\', asm_out_file); \ | |
1991 | if (c >= ' ' && c < 0177) \ | |
1992 | putc (c, asm_out_file); \ | |
1993 | else \ | |
1994 | { \ | |
1995 | fprintf (asm_out_file, "\\%o", c); \ | |
1996 | /* After an octal-escape, if a digit follows, \ | |
1997 | terminate one string constant and start another. \ | |
8aeea6e6 | 1998 | The VAX assembler fails to stop reading the escape \ |
1a94ca49 RK |
1999 | after three digits, so this is the only way we \ |
2000 | can get it to parse the data properly. */ \ | |
2001 | if (i < thissize - 1 \ | |
2002 | && p[i + 1] >= '0' && p[i + 1] <= '9') \ | |
b2d5e311 | 2003 | _size_so_far = 0, fprintf (asm_out_file, "\"\n\t.ascii \""); \ |
1a94ca49 RK |
2004 | } \ |
2005 | } \ | |
2006 | fprintf (asm_out_file, "\"\n"); \ | |
2007 | } \ | |
2008 | } \ | |
2009 | while (0) | |
52a69200 | 2010 | |
6690d24c | 2011 | /* To get unaligned data, we have to turn off auto alignment. */ |
93de6f51 HPN |
2012 | #define UNALIGNED_SHORT_ASM_OP "\t.align 0\n\t.word\t" |
2013 | #define UNALIGNED_INT_ASM_OP "\t.align 0\n\t.long\t" | |
2014 | #define UNALIGNED_DOUBLE_INT_ASM_OP "\t.align 0\n\t.quad\t" | |
6690d24c | 2015 | |
1a94ca49 RK |
2016 | /* This is how to output an insn to push a register on the stack. |
2017 | It need not be very fast code. */ | |
2018 | ||
2019 | #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \ | |
2020 | fprintf (FILE, "\tsubq $30,8,$30\n\tst%s $%s%d,0($30)\n", \ | |
2021 | (REGNO) > 32 ? "t" : "q", (REGNO) > 32 ? "f" : "", \ | |
2022 | (REGNO) & 31); | |
2023 | ||
2024 | /* This is how to output an insn to pop a register from the stack. | |
2025 | It need not be very fast code. */ | |
2026 | ||
2027 | #define ASM_OUTPUT_REG_POP(FILE,REGNO) \ | |
2028 | fprintf (FILE, "\tld%s $%s%d,0($30)\n\taddq $30,8,$30\n", \ | |
2029 | (REGNO) > 32 ? "t" : "q", (REGNO) > 32 ? "f" : "", \ | |
2030 | (REGNO) & 31); | |
2031 | ||
2032 | /* This is how to output an assembler line for a numeric constant byte. */ | |
2033 | ||
2034 | #define ASM_OUTPUT_BYTE(FILE,VALUE) \ | |
3c303f52 | 2035 | fprintf (FILE, "\t.byte 0x%x\n", (int) ((VALUE) & 0xff)) |
1a94ca49 | 2036 | |
260ced47 RK |
2037 | /* This is how to output an element of a case-vector that is absolute. |
2038 | (Alpha does not use such vectors, but we must define this macro anyway.) */ | |
1a94ca49 | 2039 | |
260ced47 | 2040 | #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) abort () |
1a94ca49 | 2041 | |
260ced47 | 2042 | /* This is how to output an element of a case-vector that is relative. */ |
1a94ca49 | 2043 | |
33f7f353 | 2044 | #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ |
be7b80f4 | 2045 | fprintf (FILE, "\t.%s $L%d\n", TARGET_ABI_WINDOWS_NT ? "long" : "gprel32", \ |
8dfe3c62 | 2046 | (VALUE)) |
1a94ca49 RK |
2047 | |
2048 | /* This is how to output an assembler line | |
2049 | that says to advance the location counter | |
2050 | to a multiple of 2**LOG bytes. */ | |
2051 | ||
2052 | #define ASM_OUTPUT_ALIGN(FILE,LOG) \ | |
2053 | if ((LOG) != 0) \ | |
2054 | fprintf (FILE, "\t.align %d\n", LOG); | |
2055 | ||
2056 | /* This is how to advance the location counter by SIZE bytes. */ | |
2057 | ||
2058 | #define ASM_OUTPUT_SKIP(FILE,SIZE) \ | |
2059 | fprintf (FILE, "\t.space %d\n", (SIZE)) | |
2060 | ||
2061 | /* This says how to output an assembler line | |
2062 | to define a global common symbol. */ | |
2063 | ||
2064 | #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ | |
2065 | ( fputs ("\t.comm ", (FILE)), \ | |
2066 | assemble_name ((FILE), (NAME)), \ | |
2067 | fprintf ((FILE), ",%d\n", (SIZE))) | |
2068 | ||
2069 | /* This says how to output an assembler line | |
2070 | to define a local common symbol. */ | |
2071 | ||
2072 | #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \ | |
2073 | ( fputs ("\t.lcomm ", (FILE)), \ | |
2074 | assemble_name ((FILE), (NAME)), \ | |
2075 | fprintf ((FILE), ",%d\n", (SIZE))) | |
2076 | ||
2077 | /* Store in OUTPUT a string (made with alloca) containing | |
2078 | an assembler-name for a local static variable named NAME. | |
2079 | LABELNO is an integer which is different for each call. */ | |
2080 | ||
2081 | #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ | |
2082 | ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \ | |
2083 | sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO))) | |
2084 | ||
60593797 RH |
2085 | /* Output code to add DELTA to the first argument, and then jump to FUNCTION. |
2086 | Used for C++ multiple inheritance. */ | |
f2720858 RH |
2087 | /* ??? This is only used with the v2 ABI, and alpha.c makes assumptions |
2088 | about current_function_is_thunk that are not valid with the v3 ABI. */ | |
2089 | #if 0 | |
60593797 RH |
2090 | #define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \ |
2091 | do { \ | |
e03c5670 | 2092 | const char *fn_name = XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0); \ |
54473ca7 | 2093 | int reg; \ |
60593797 | 2094 | \ |
be7b80f4 | 2095 | if (TARGET_ABI_OSF) \ |
4c646291 JJ |
2096 | fprintf (FILE, "\tldgp $29,0($27)\n"); \ |
2097 | \ | |
acd92049 RH |
2098 | /* Mark end of prologue. */ \ |
2099 | output_end_prologue (FILE); \ | |
60593797 RH |
2100 | \ |
2101 | /* Rely on the assembler to macro expand a large delta. */ \ | |
2eecbd3f | 2102 | fprintf (FILE, "\t.set at\n"); \ |
54473ca7 L |
2103 | reg = aggregate_value_p (TREE_TYPE (TREE_TYPE (FUNCTION))) ? 17 : 16; \ |
2104 | fprintf (FILE, "\tlda $%d,%ld($%d)\n", reg, (long)(DELTA), reg); \ | |
60593797 | 2105 | \ |
b1afd7f4 KG |
2106 | if (current_file_function_operand (XEXP (DECL_RTL (FUNCTION), 0), \ |
2107 | VOIDmode)) \ | |
60593797 RH |
2108 | { \ |
2109 | fprintf (FILE, "\tbr $31,$"); \ | |
2110 | assemble_name (FILE, fn_name); \ | |
2111 | fprintf (FILE, "..ng\n"); \ | |
2112 | } \ | |
2113 | else \ | |
2114 | { \ | |
acd92049 | 2115 | fprintf (FILE, "\tjmp $31,"); \ |
60593797 RH |
2116 | assemble_name (FILE, fn_name); \ |
2117 | fputc ('\n', FILE); \ | |
2118 | } \ | |
2eecbd3f | 2119 | fprintf (FILE, "\t.set noat\n"); \ |
60593797 | 2120 | } while (0) |
f2720858 | 2121 | #endif |
60593797 | 2122 | \f |
9ec36da5 | 2123 | |
1a94ca49 RK |
2124 | /* Print operand X (an rtx) in assembler syntax to file FILE. |
2125 | CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified. | |
2126 | For `%' followed by punctuation, CODE is the punctuation and X is null. */ | |
2127 | ||
2128 | #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE) | |
2129 | ||
2130 | /* Determine which codes are valid without a following integer. These must | |
941cc05a RK |
2131 | not be alphabetic. |
2132 | ||
2133 | ~ Generates the name of the current function. | |
2bf6230d | 2134 | |
be7560ea RH |
2135 | / Generates the instruction suffix. The TRAP_SUFFIX and ROUND_SUFFIX |
2136 | attributes are examined to determine what is appropriate. | |
e5958492 RK |
2137 | |
2138 | , Generates single precision suffix for floating point | |
2139 | instructions (s for IEEE, f for VAX) | |
2140 | ||
2141 | - Generates double precision suffix for floating point | |
2142 | instructions (t for IEEE, g for VAX) | |
2bf6230d | 2143 | */ |
1a94ca49 | 2144 | |
be7560ea RH |
2145 | #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \ |
2146 | ((CODE) == '/' || (CODE) == ',' || (CODE) == '-' || (CODE) == '~') | |
1a94ca49 RK |
2147 | \f |
2148 | /* Print a memory address as an operand to reference that memory location. */ | |
2149 | ||
714b019c RH |
2150 | #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \ |
2151 | print_operand_address((FILE), (ADDR)) | |
2152 | ||
1a94ca49 RK |
2153 | /* Define the codes that are matched by predicates in alpha.c. */ |
2154 | ||
e3208d53 RH |
2155 | #define PREDICATE_CODES \ |
2156 | {"reg_or_0_operand", {SUBREG, REG, CONST_INT}}, \ | |
eb8da868 RH |
2157 | {"reg_or_6bit_operand", {SUBREG, REG, CONST_INT}}, \ |
2158 | {"reg_or_8bit_operand", {SUBREG, REG, CONST_INT}}, \ | |
2159 | {"cint8_operand", {CONST_INT}}, \ | |
2160 | {"reg_or_cint_operand", {SUBREG, REG, CONST_INT}}, \ | |
2161 | {"add_operand", {SUBREG, REG, CONST_INT}}, \ | |
2162 | {"sext_add_operand", {SUBREG, REG, CONST_INT}}, \ | |
e3208d53 | 2163 | {"const48_operand", {CONST_INT}}, \ |
eb8da868 RH |
2164 | {"and_operand", {SUBREG, REG, CONST_INT}}, \ |
2165 | {"or_operand", {SUBREG, REG, CONST_INT}}, \ | |
e3208d53 RH |
2166 | {"mode_mask_operand", {CONST_INT}}, \ |
2167 | {"mul8_operand", {CONST_INT}}, \ | |
2168 | {"mode_width_operand", {CONST_INT}}, \ | |
2169 | {"reg_or_fp0_operand", {SUBREG, REG, CONST_DOUBLE}}, \ | |
2170 | {"alpha_comparison_operator", {EQ, LE, LT, LEU, LTU}}, \ | |
8f4773ea | 2171 | {"alpha_zero_comparison_operator", {EQ, NE, LE, LT, LEU, LTU}}, \ |
e3208d53 RH |
2172 | {"alpha_swapped_comparison_operator", {EQ, GE, GT, GEU, GTU}}, \ |
2173 | {"signed_comparison_operator", {EQ, NE, LE, LT, GE, GT}}, \ | |
1eb8759b | 2174 | {"alpha_fp_comparison_operator", {EQ, LE, LT, UNORDERED}}, \ |
e3208d53 RH |
2175 | {"divmod_operator", {DIV, MOD, UDIV, UMOD}}, \ |
2176 | {"fp0_operand", {CONST_DOUBLE}}, \ | |
2177 | {"current_file_function_operand", {SYMBOL_REF}}, \ | |
2178 | {"call_operand", {REG, SYMBOL_REF}}, \ | |
2179 | {"input_operand", {SUBREG, REG, MEM, CONST_INT, CONST_DOUBLE, \ | |
eb8da868 | 2180 | SYMBOL_REF, CONST, LABEL_REF}}, \ |
e3208d53 | 2181 | {"some_operand", {SUBREG, REG, MEM, CONST_INT, CONST_DOUBLE, \ |
eb8da868 | 2182 | SYMBOL_REF, CONST, LABEL_REF}}, \ |
f711a22b | 2183 | {"some_ni_operand", {SUBREG, REG, MEM}}, \ |
e3208d53 RH |
2184 | {"aligned_memory_operand", {MEM}}, \ |
2185 | {"unaligned_memory_operand", {MEM}}, \ | |
2186 | {"reg_or_unaligned_mem_operand", {SUBREG, REG, MEM}}, \ | |
2187 | {"any_memory_operand", {MEM}}, \ | |
40b80dad | 2188 | {"hard_fp_register_operand", {SUBREG, REG}}, \ |
d2c6a1b6 | 2189 | {"hard_int_register_operand", {SUBREG, REG}}, \ |
67070f5c | 2190 | {"reg_not_elim_operand", {SUBREG, REG}}, \ |
3611aef0 RH |
2191 | {"reg_no_subreg_operand", {REG}}, \ |
2192 | {"addition_operation", {PLUS}}, | |
03f8c4cc | 2193 | \f |
63966b3b RH |
2194 | /* Define the `__builtin_va_list' type for the ABI. */ |
2195 | #define BUILD_VA_LIST_TYPE(VALIST) \ | |
2196 | (VALIST) = alpha_build_va_list () | |
2197 | ||
2198 | /* Implement `va_start' for varargs and stdarg. */ | |
2199 | #define EXPAND_BUILTIN_VA_START(stdarg, valist, nextarg) \ | |
2200 | alpha_va_start (stdarg, valist, nextarg) | |
2201 | ||
2202 | /* Implement `va_arg'. */ | |
2203 | #define EXPAND_BUILTIN_VA_ARG(valist, type) \ | |
2204 | alpha_va_arg (valist, type) | |
2205 | \f | |
34fa88ab RK |
2206 | /* Tell collect that the object format is ECOFF. */ |
2207 | #define OBJECT_FORMAT_COFF | |
2208 | #define EXTENDED_COFF | |
2209 | ||
2210 | /* If we use NM, pass -g to it so it only lists globals. */ | |
2211 | #define NM_FLAGS "-pg" | |
2212 | ||
03f8c4cc RK |
2213 | /* Definitions for debugging. */ |
2214 | ||
2215 | #define SDB_DEBUGGING_INFO /* generate info for mips-tfile */ | |
2216 | #define DBX_DEBUGGING_INFO /* generate embedded stabs */ | |
2217 | #define MIPS_DEBUGGING_INFO /* MIPS specific debugging info */ | |
2218 | ||
2219 | #ifndef PREFERRED_DEBUGGING_TYPE /* assume SDB_DEBUGGING_INFO */ | |
fe0986b4 | 2220 | #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG |
03f8c4cc RK |
2221 | #endif |
2222 | ||
2223 | ||
2224 | /* Correct the offset of automatic variables and arguments. Note that | |
2225 | the Alpha debug format wants all automatic variables and arguments | |
2226 | to be in terms of two different offsets from the virtual frame pointer, | |
2227 | which is the stack pointer before any adjustment in the function. | |
2228 | The offset for the argument pointer is fixed for the native compiler, | |
2229 | it is either zero (for the no arguments case) or large enough to hold | |
2230 | all argument registers. | |
2231 | The offset for the auto pointer is the fourth argument to the .frame | |
2232 | directive (local_offset). | |
2233 | To stay compatible with the native tools we use the same offsets | |
2234 | from the virtual frame pointer and adjust the debugger arg/auto offsets | |
2235 | accordingly. These debugger offsets are set up in output_prolog. */ | |
2236 | ||
9a0b18f2 RK |
2237 | extern long alpha_arg_offset; |
2238 | extern long alpha_auto_offset; | |
03f8c4cc RK |
2239 | #define DEBUGGER_AUTO_OFFSET(X) \ |
2240 | ((GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0) + alpha_auto_offset) | |
2241 | #define DEBUGGER_ARG_OFFSET(OFFSET, X) (OFFSET + alpha_arg_offset) | |
2242 | ||
2243 | ||
2244 | #define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE) \ | |
2245 | alpha_output_lineno (STREAM, LINE) | |
03f8c4cc RK |
2246 | |
2247 | #define ASM_OUTPUT_SOURCE_FILENAME(STREAM, NAME) \ | |
2248 | alpha_output_filename (STREAM, NAME) | |
03f8c4cc | 2249 | |
4330b0e7 JW |
2250 | /* mips-tfile.c limits us to strings of one page. We must underestimate this |
2251 | number, because the real length runs past this up to the next | |
2252 | continuation point. This is really a dbxout.c bug. */ | |
2253 | #define DBX_CONTIN_LENGTH 3000 | |
03f8c4cc RK |
2254 | |
2255 | /* By default, turn on GDB extensions. */ | |
2256 | #define DEFAULT_GDB_EXTENSIONS 1 | |
2257 | ||
7aadc7c2 RK |
2258 | /* Stabs-in-ECOFF can't handle dbxout_function_end(). */ |
2259 | #define NO_DBX_FUNCTION_END 1 | |
2260 | ||
03f8c4cc RK |
2261 | /* If we are smuggling stabs through the ALPHA ECOFF object |
2262 | format, put a comment in front of the .stab<x> operation so | |
2263 | that the ALPHA assembler does not choke. The mips-tfile program | |
2264 | will correctly put the stab into the object file. */ | |
2265 | ||
93de6f51 HPN |
2266 | #define ASM_STABS_OP ((TARGET_GAS) ? "\t.stabs\t" : " #.stabs\t") |
2267 | #define ASM_STABN_OP ((TARGET_GAS) ? "\t.stabn\t" : " #.stabn\t") | |
2268 | #define ASM_STABD_OP ((TARGET_GAS) ? "\t.stabd\t" : " #.stabd\t") | |
03f8c4cc RK |
2269 | |
2270 | /* Forward references to tags are allowed. */ | |
2271 | #define SDB_ALLOW_FORWARD_REFERENCES | |
2272 | ||
2273 | /* Unknown tags are also allowed. */ | |
2274 | #define SDB_ALLOW_UNKNOWN_REFERENCES | |
2275 | ||
2276 | #define PUT_SDB_DEF(a) \ | |
2277 | do { \ | |
2278 | fprintf (asm_out_file, "\t%s.def\t", \ | |
2279 | (TARGET_GAS) ? "" : "#"); \ | |
2280 | ASM_OUTPUT_LABELREF (asm_out_file, a); \ | |
2281 | fputc (';', asm_out_file); \ | |
2282 | } while (0) | |
2283 | ||
2284 | #define PUT_SDB_PLAIN_DEF(a) \ | |
2285 | do { \ | |
2286 | fprintf (asm_out_file, "\t%s.def\t.%s;", \ | |
2287 | (TARGET_GAS) ? "" : "#", (a)); \ | |
2288 | } while (0) | |
2289 | ||
2290 | #define PUT_SDB_TYPE(a) \ | |
2291 | do { \ | |
2292 | fprintf (asm_out_file, "\t.type\t0x%x;", (a)); \ | |
2293 | } while (0) | |
2294 | ||
2295 | /* For block start and end, we create labels, so that | |
2296 | later we can figure out where the correct offset is. | |
2297 | The normal .ent/.end serve well enough for functions, | |
2298 | so those are just commented out. */ | |
2299 | ||
2300 | extern int sdb_label_count; /* block start/end next label # */ | |
2301 | ||
2302 | #define PUT_SDB_BLOCK_START(LINE) \ | |
2303 | do { \ | |
2304 | fprintf (asm_out_file, \ | |
2305 | "$Lb%d:\n\t%s.begin\t$Lb%d\t%d\n", \ | |
2306 | sdb_label_count, \ | |
2307 | (TARGET_GAS) ? "" : "#", \ | |
2308 | sdb_label_count, \ | |
2309 | (LINE)); \ | |
2310 | sdb_label_count++; \ | |
2311 | } while (0) | |
2312 | ||
2313 | #define PUT_SDB_BLOCK_END(LINE) \ | |
2314 | do { \ | |
2315 | fprintf (asm_out_file, \ | |
2316 | "$Le%d:\n\t%s.bend\t$Le%d\t%d\n", \ | |
2317 | sdb_label_count, \ | |
2318 | (TARGET_GAS) ? "" : "#", \ | |
2319 | sdb_label_count, \ | |
2320 | (LINE)); \ | |
2321 | sdb_label_count++; \ | |
2322 | } while (0) | |
2323 | ||
2324 | #define PUT_SDB_FUNCTION_START(LINE) | |
2325 | ||
2326 | #define PUT_SDB_FUNCTION_END(LINE) | |
2327 | ||
3c303f52 | 2328 | #define PUT_SDB_EPILOGUE_END(NAME) ((void)(NAME)) |
03f8c4cc | 2329 | |
03f8c4cc RK |
2330 | /* Macros for mips-tfile.c to encapsulate stabs in ECOFF, and for |
2331 | mips-tdump.c to print them out. | |
2332 | ||
2333 | These must match the corresponding definitions in gdb/mipsread.c. | |
2334 | Unfortunately, gcc and gdb do not currently share any directories. */ | |
2335 | ||
2336 | #define CODE_MASK 0x8F300 | |
2337 | #define MIPS_IS_STAB(sym) (((sym)->index & 0xFFF00) == CODE_MASK) | |
2338 | #define MIPS_MARK_STAB(code) ((code)+CODE_MASK) | |
2339 | #define MIPS_UNMARK_STAB(code) ((code)-CODE_MASK) | |
2340 | ||
2341 | /* Override some mips-tfile definitions. */ | |
2342 | ||
2343 | #define SHASH_SIZE 511 | |
2344 | #define THASH_SIZE 55 | |
1e6c6f11 RK |
2345 | |
2346 | /* Align ecoff symbol tables to avoid OSF1/1.3 nm complaints. */ | |
2347 | ||
2348 | #define ALIGN_SYMTABLE_OFFSET(OFFSET) (((OFFSET) + 7) & ~7) | |
2f55b70b | 2349 | |
b0435cf4 RH |
2350 | /* The system headers under Alpha systems are generally C++-aware. */ |
2351 | #define NO_IMPLICIT_EXTERN_C | |
b517dcd2 RH |
2352 | |
2353 | /* Generate calls to memcpy, etc., not bcopy, etc. */ | |
2354 | #define TARGET_MEM_FUNCTIONS 1 |