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