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