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