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