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