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