1 /* Definitions of target machine for GNU compiler, for DEC Alpha.
2 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 2000, 2001, 2002 Free Software Foundation, Inc.
4 Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
23 /* Target CPU builtins. */
24 #define TARGET_CPU_CPP_BUILTINS() \
27 builtin_define ("__alpha"); \
28 builtin_define ("__alpha__"); \
29 builtin_assert ("cpu=alpha"); \
30 builtin_assert ("machine=alpha"); \
33 builtin_define ("__alpha_cix__"); \
34 builtin_assert ("cpu=cix"); \
38 builtin_define ("__alpha_fix__"); \
39 builtin_assert ("cpu=fix"); \
43 builtin_define ("__alpha_bwx__"); \
44 builtin_assert ("cpu=bwx"); \
48 builtin_define ("__alpha_max__"); \
49 builtin_assert ("cpu=max"); \
53 builtin_define ("__alpha_ev6__"); \
54 builtin_assert ("cpu=ev6"); \
56 else if (TARGET_CPU_EV5) \
58 builtin_define ("__alpha_ev5__"); \
59 builtin_assert ("cpu=ev5"); \
61 else /* Presumably ev4. */ \
63 builtin_define ("__alpha_ev4__"); \
64 builtin_assert ("cpu=ev4"); \
66 if (TARGET_IEEE || TARGET_IEEE_WITH_INEXACT) \
67 builtin_define ("_IEEE_FP"); \
68 if (TARGET_IEEE_WITH_INEXACT) \
69 builtin_define ("_IEEE_FP_INEXACT"); \
71 /* Macros dependent on the C dialect. */ \
72 SUBTARGET_LANGUAGE_CPP_BUILTINS(); \
75 #ifndef SUBTARGET_LANGUAGE_CPP_BUILTINS
76 #define SUBTARGET_LANGUAGE_CPP_BUILTINS() \
79 if (preprocessing_asm_p ()) \
80 builtin_define_std ("LANGUAGE_ASSEMBLY"); \
81 else if (c_language == clk_c) \
82 builtin_define_std ("LANGUAGE_C"); \
83 else if (c_language == clk_cplusplus) \
85 builtin_define ("__LANGUAGE_C_PLUS_PLUS"); \
86 builtin_define ("__LANGUAGE_C_PLUS_PLUS__"); \
90 builtin_define ("__LANGUAGE_OBJECTIVE_C"); \
91 builtin_define ("__LANGUAGE_OBJECTIVE_C__"); \
97 #define CPP_SPEC "%(cpp_subtarget)"
99 #ifndef CPP_SUBTARGET_SPEC
100 #define CPP_SUBTARGET_SPEC ""
103 #define WORD_SWITCH_TAKES_ARG(STR) \
104 (!strcmp (STR, "rpath") || DEFAULT_WORD_SWITCH_TAKES_ARG(STR))
106 /* Print subsidiary information on the compiler version in use. */
107 #define TARGET_VERSION
109 /* Run-time compilation parameters selecting different hardware subsets. */
111 /* Which processor to schedule for. The cpu attribute defines a list that
112 mirrors this list, so changes to alpha.md must be made at the same time. */
115 {PROCESSOR_EV4, /* 2106[46]{a,} */
116 PROCESSOR_EV5, /* 21164{a,pc,} */
117 PROCESSOR_EV6}; /* 21264 */
119 extern enum processor_type alpha_cpu;
121 enum alpha_trap_precision
123 ALPHA_TP_PROG, /* No precision (default). */
124 ALPHA_TP_FUNC, /* Trap contained within originating function. */
125 ALPHA_TP_INSN /* Instruction accuracy and code is resumption safe. */
128 enum alpha_fp_rounding_mode
130 ALPHA_FPRM_NORM, /* Normal rounding mode. */
131 ALPHA_FPRM_MINF, /* Round towards minus-infinity. */
132 ALPHA_FPRM_CHOP, /* Chopped rounding mode (towards 0). */
133 ALPHA_FPRM_DYN /* Dynamic rounding mode. */
136 enum alpha_fp_trap_mode
138 ALPHA_FPTM_N, /* Normal trap mode. */
139 ALPHA_FPTM_U, /* Underflow traps enabled. */
140 ALPHA_FPTM_SU, /* Software completion, w/underflow traps */
141 ALPHA_FPTM_SUI /* Software completion, w/underflow & inexact traps */
144 extern int target_flags;
146 extern enum alpha_trap_precision alpha_tp;
147 extern enum alpha_fp_rounding_mode alpha_fprm;
148 extern enum alpha_fp_trap_mode alpha_fptm;
149 extern int alpha_tls_size;
151 /* This means that floating-point support exists in the target implementation
152 of the Alpha architecture. This is usually the default. */
153 #define MASK_FP (1 << 0)
154 #define TARGET_FP (target_flags & MASK_FP)
156 /* This means that floating-point registers are allowed to be used. Note
157 that Alpha implementations without FP operations are required to
158 provide the FP registers. */
160 #define MASK_FPREGS (1 << 1)
161 #define TARGET_FPREGS (target_flags & MASK_FPREGS)
163 /* This means that gas is used to process the assembler file. */
165 #define MASK_GAS (1 << 2)
166 #define TARGET_GAS (target_flags & MASK_GAS)
168 /* This means that we should mark procedures as IEEE conformant. */
170 #define MASK_IEEE_CONFORMANT (1 << 3)
171 #define TARGET_IEEE_CONFORMANT (target_flags & MASK_IEEE_CONFORMANT)
173 /* This means we should be IEEE-compliant except for inexact. */
175 #define MASK_IEEE (1 << 4)
176 #define TARGET_IEEE (target_flags & MASK_IEEE)
178 /* This means we should be fully IEEE-compliant. */
180 #define MASK_IEEE_WITH_INEXACT (1 << 5)
181 #define TARGET_IEEE_WITH_INEXACT (target_flags & MASK_IEEE_WITH_INEXACT)
183 /* This means we must construct all constants rather than emitting
184 them as literal data. */
186 #define MASK_BUILD_CONSTANTS (1 << 6)
187 #define TARGET_BUILD_CONSTANTS (target_flags & MASK_BUILD_CONSTANTS)
189 /* This means we handle floating points in VAX F- (float)
190 or G- (double) Format. */
192 #define MASK_FLOAT_VAX (1 << 7)
193 #define TARGET_FLOAT_VAX (target_flags & MASK_FLOAT_VAX)
195 /* This means that the processor has byte and half word loads and stores
196 (the BWX extension). */
198 #define MASK_BWX (1 << 8)
199 #define TARGET_BWX (target_flags & MASK_BWX)
201 /* This means that the processor has the MAX extension. */
202 #define MASK_MAX (1 << 9)
203 #define TARGET_MAX (target_flags & MASK_MAX)
205 /* This means that the processor has the FIX extension. */
206 #define MASK_FIX (1 << 10)
207 #define TARGET_FIX (target_flags & MASK_FIX)
209 /* This means that the processor has the CIX extension. */
210 #define MASK_CIX (1 << 11)
211 #define TARGET_CIX (target_flags & MASK_CIX)
213 /* This means use !literal style explicit relocations. */
214 #define MASK_EXPLICIT_RELOCS (1 << 12)
215 #define TARGET_EXPLICIT_RELOCS (target_flags & MASK_EXPLICIT_RELOCS)
217 /* This means use 16-bit relocations to .sdata/.sbss. */
218 #define MASK_SMALL_DATA (1 << 13)
219 #define TARGET_SMALL_DATA (target_flags & MASK_SMALL_DATA)
221 /* This means emit thread pointer loads for kernel not user. */
222 #define MASK_TLS_KERNEL (1 << 14)
223 #define TARGET_TLS_KERNEL (target_flags & MASK_TLS_KERNEL)
225 /* This means use direct branches to local functions. */
226 #define MASK_SMALL_TEXT (1 << 15)
227 #define TARGET_SMALL_TEXT (target_flags & MASK_SMALL_TEXT)
229 /* This means that the processor is an EV5, EV56, or PCA56.
230 Unlike alpha_cpu this is not affected by -mtune= setting. */
231 #define MASK_CPU_EV5 (1 << 28)
232 #define TARGET_CPU_EV5 (target_flags & MASK_CPU_EV5)
234 /* Likewise for EV6. */
235 #define MASK_CPU_EV6 (1 << 29)
236 #define TARGET_CPU_EV6 (target_flags & MASK_CPU_EV6)
238 /* This means we support the .arch directive in the assembler. Only
239 defined in TARGET_CPU_DEFAULT. */
240 #define MASK_SUPPORT_ARCH (1 << 30)
241 #define TARGET_SUPPORT_ARCH (target_flags & MASK_SUPPORT_ARCH)
243 /* These are for target os support and cannot be changed at runtime. */
244 #define TARGET_ABI_WINDOWS_NT 0
245 #define TARGET_ABI_OPEN_VMS 0
246 #define TARGET_ABI_UNICOSMK 0
247 #define TARGET_ABI_OSF (!TARGET_ABI_WINDOWS_NT \
248 && !TARGET_ABI_OPEN_VMS \
249 && !TARGET_ABI_UNICOSMK)
251 #ifndef TARGET_AS_CAN_SUBTRACT_LABELS
252 #define TARGET_AS_CAN_SUBTRACT_LABELS TARGET_GAS
254 #ifndef TARGET_AS_SLASH_BEFORE_SUFFIX
255 #define TARGET_AS_SLASH_BEFORE_SUFFIX TARGET_GAS
257 #ifndef TARGET_CAN_FAULT_IN_PROLOGUE
258 #define TARGET_CAN_FAULT_IN_PROLOGUE 0
260 #ifndef TARGET_HAS_XFLOATING_LIBS
261 #define TARGET_HAS_XFLOATING_LIBS 0
263 #ifndef TARGET_PROFILING_NEEDS_GP
264 #define TARGET_PROFILING_NEEDS_GP 0
266 #ifndef TARGET_LD_BUGGY_LDGP
267 #define TARGET_LD_BUGGY_LDGP 0
269 #ifndef TARGET_FIXUP_EV5_PREFETCH
270 #define TARGET_FIXUP_EV5_PREFETCH 0
273 #define HAVE_AS_TLS 0
276 /* Macro to define tables used to set the flags.
277 This is a list in braces of pairs in braces,
278 each pair being { "NAME", VALUE }
279 where VALUE is the bits to set or minus the bits to clear.
280 An empty string NAME is used to identify the default VALUE. */
282 #define TARGET_SWITCHES \
283 { {"no-soft-float", MASK_FP, N_("Use hardware fp")}, \
284 {"soft-float", - MASK_FP, N_("Do not use hardware fp")}, \
285 {"fp-regs", MASK_FPREGS, N_("Use fp registers")}, \
286 {"no-fp-regs", - (MASK_FP|MASK_FPREGS), \
287 N_("Do not use fp registers")}, \
288 {"alpha-as", -MASK_GAS, N_("Do not assume GAS")}, \
289 {"gas", MASK_GAS, N_("Assume GAS")}, \
290 {"ieee-conformant", MASK_IEEE_CONFORMANT, \
291 N_("Request IEEE-conformant math library routines (OSF/1)")}, \
292 {"ieee", MASK_IEEE|MASK_IEEE_CONFORMANT, \
293 N_("Emit IEEE-conformant code, without inexact exceptions")}, \
294 {"ieee-with-inexact", MASK_IEEE_WITH_INEXACT|MASK_IEEE_CONFORMANT, \
295 N_("Emit IEEE-conformant code, with inexact exceptions")}, \
296 {"build-constants", MASK_BUILD_CONSTANTS, \
297 N_("Do not emit complex integer constants to read-only memory")}, \
298 {"float-vax", MASK_FLOAT_VAX, N_("Use VAX fp")}, \
299 {"float-ieee", -MASK_FLOAT_VAX, N_("Do not use VAX fp")}, \
300 {"bwx", MASK_BWX, N_("Emit code for the byte/word ISA extension")}, \
301 {"no-bwx", -MASK_BWX, ""}, \
303 N_("Emit code for the motion video ISA extension")}, \
304 {"no-max", -MASK_MAX, ""}, \
306 N_("Emit code for the fp move and sqrt ISA extension")}, \
307 {"no-fix", -MASK_FIX, ""}, \
308 {"cix", MASK_CIX, N_("Emit code for the counting ISA extension")}, \
309 {"no-cix", -MASK_CIX, ""}, \
310 {"explicit-relocs", MASK_EXPLICIT_RELOCS, \
311 N_("Emit code using explicit relocation directives")}, \
312 {"no-explicit-relocs", -MASK_EXPLICIT_RELOCS, ""}, \
313 {"small-data", MASK_SMALL_DATA, \
314 N_("Emit 16-bit relocations to the small data areas")}, \
315 {"large-data", -MASK_SMALL_DATA, \
316 N_("Emit 32-bit relocations to the small data areas")}, \
317 {"small-text", MASK_SMALL_TEXT, \
318 N_("Emit direct branches to local functions")}, \
319 {"large-text", -MASK_SMALL_TEXT, ""}, \
320 {"tls-kernel", MASK_TLS_KERNEL, \
321 N_("Emit rdval instead of rduniq for thread pointer")}, \
322 {"", TARGET_DEFAULT | TARGET_CPU_DEFAULT \
323 | TARGET_DEFAULT_EXPLICIT_RELOCS, ""} }
325 #define TARGET_DEFAULT MASK_FP|MASK_FPREGS
327 #ifndef TARGET_CPU_DEFAULT
328 #define TARGET_CPU_DEFAULT 0
331 #ifndef TARGET_DEFAULT_EXPLICIT_RELOCS
332 #ifdef HAVE_AS_EXPLICIT_RELOCS
333 #define TARGET_DEFAULT_EXPLICIT_RELOCS MASK_EXPLICIT_RELOCS
335 #define TARGET_DEFAULT_EXPLICIT_RELOCS 0
339 extern const char *alpha_cpu_string; /* For -mcpu= */
340 extern const char *alpha_tune_string; /* For -mtune= */
341 extern const char *alpha_fprm_string; /* For -mfp-rounding-mode=[n|m|c|d] */
342 extern const char *alpha_fptm_string; /* For -mfp-trap-mode=[n|u|su|sui] */
343 extern const char *alpha_tp_string; /* For -mtrap-precision=[p|f|i] */
344 extern const char *alpha_mlat_string; /* For -mmemory-latency= */
345 extern const char *alpha_tls_size_string; /* For -mtls-size= */
347 #define TARGET_OPTIONS \
349 {"cpu=", &alpha_cpu_string, \
350 N_("Use features of and schedule given CPU")}, \
351 {"tune=", &alpha_tune_string, \
352 N_("Schedule given CPU")}, \
353 {"fp-rounding-mode=", &alpha_fprm_string, \
354 N_("Control the generated fp rounding mode")}, \
355 {"fp-trap-mode=", &alpha_fptm_string, \
356 N_("Control the IEEE trap mode")}, \
357 {"trap-precision=", &alpha_tp_string, \
358 N_("Control the precision given to fp exceptions")}, \
359 {"memory-latency=", &alpha_mlat_string, \
360 N_("Tune expected memory latency")}, \
361 {"tls-size=", &alpha_tls_size_string, \
362 N_("Specify bit size of immediate TLS offsets")}, \
365 /* This macro defines names of additional specifications to put in the
366 specs that can be used in various specifications like CC1_SPEC. Its
367 definition is an initializer with a subgrouping for each command option.
369 Each subgrouping contains a string constant, that defines the
370 specification name, and a string constant that used by the GNU CC driver
373 Do not define this macro if it does not need to do anything. */
375 #ifndef SUBTARGET_EXTRA_SPECS
376 #define SUBTARGET_EXTRA_SPECS
379 #define EXTRA_SPECS \
380 { "cpp_subtarget", CPP_SUBTARGET_SPEC }, \
381 SUBTARGET_EXTRA_SPECS
384 /* Sometimes certain combinations of command options do not make sense
385 on a particular target machine. You can define a macro
386 `OVERRIDE_OPTIONS' to take account of this. This macro, if
387 defined, is executed once just after all the command options have
390 On the Alpha, it is used to translate target-option strings into
393 #define OVERRIDE_OPTIONS override_options ()
396 /* Define this macro to change register usage conditional on target flags.
398 On the Alpha, we use this to disable the floating-point registers when
401 #define CONDITIONAL_REGISTER_USAGE \
404 if (! TARGET_FPREGS) \
405 for (i = 32; i < 63; i++) \
406 fixed_regs[i] = call_used_regs[i] = 1; \
410 /* Show we can debug even without a frame pointer. */
411 #define CAN_DEBUG_WITHOUT_FP
413 /* target machine storage layout */
415 /* Define the size of `int'. The default is the same as the word size. */
416 #define INT_TYPE_SIZE 32
418 /* Define the size of `long long'. The default is the twice the word size. */
419 #define LONG_LONG_TYPE_SIZE 64
421 /* We're IEEE unless someone says to use VAX. */
422 #define TARGET_FLOAT_FORMAT \
423 (TARGET_FLOAT_VAX ? VAX_FLOAT_FORMAT : IEEE_FLOAT_FORMAT)
425 /* The two floating-point formats we support are S-floating, which is
426 4 bytes, and T-floating, which is 8 bytes. `float' is S and `double'
427 and `long double' are T. */
429 #define FLOAT_TYPE_SIZE 32
430 #define DOUBLE_TYPE_SIZE 64
431 #define LONG_DOUBLE_TYPE_SIZE 64
433 #define WCHAR_TYPE "unsigned int"
434 #define WCHAR_TYPE_SIZE 32
436 /* Define this macro if it is advisable to hold scalars in registers
437 in a wider mode than that declared by the program. In such cases,
438 the value is constrained to be within the bounds of the declared
439 type, but kept valid in the wider mode. The signedness of the
440 extension may differ from that of the type.
442 For Alpha, we always store objects in a full register. 32-bit objects
443 are always sign-extended, but smaller objects retain their signedness. */
445 #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
446 if (GET_MODE_CLASS (MODE) == MODE_INT \
447 && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
449 if ((MODE) == SImode) \
454 /* Define this if function arguments should also be promoted using the above
457 #define PROMOTE_FUNCTION_ARGS
459 /* Likewise, if the function return value is promoted. */
461 #define PROMOTE_FUNCTION_RETURN
463 /* Define this if most significant bit is lowest numbered
464 in instructions that operate on numbered bit-fields.
466 There are no such instructions on the Alpha, but the documentation
468 #define BITS_BIG_ENDIAN 0
470 /* Define this if most significant byte of a word is the lowest numbered.
471 This is false on the Alpha. */
472 #define BYTES_BIG_ENDIAN 0
474 /* Define this if most significant word of a multiword number is lowest
477 For Alpha we can decide arbitrarily since there are no machine instructions
478 for them. Might as well be consistent with bytes. */
479 #define WORDS_BIG_ENDIAN 0
481 /* Width of a word, in units (bytes). */
482 #define UNITS_PER_WORD 8
484 /* Width in bits of a pointer.
485 See also the macro `Pmode' defined below. */
486 #define POINTER_SIZE 64
488 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
489 #define PARM_BOUNDARY 64
491 /* Boundary (in *bits*) on which stack pointer should be aligned. */
492 #define STACK_BOUNDARY 64
494 /* Allocation boundary (in *bits*) for the code of a function. */
495 #define FUNCTION_BOUNDARY 32
497 /* Alignment of field after `int : 0' in a structure. */
498 #define EMPTY_FIELD_BOUNDARY 64
500 /* Every structure's size must be a multiple of this. */
501 #define STRUCTURE_SIZE_BOUNDARY 8
503 /* A bit-field declared as `int' forces `int' alignment for the struct. */
504 #define PCC_BITFIELD_TYPE_MATTERS 1
506 /* No data type wants to be aligned rounder than this. */
507 #define BIGGEST_ALIGNMENT 128
509 /* For atomic access to objects, must have at least 32-bit alignment
510 unless the machine has byte operations. */
511 #define MINIMUM_ATOMIC_ALIGNMENT ((unsigned int) (TARGET_BWX ? 8 : 32))
513 /* Align all constants and variables to at least a word boundary so
514 we can pick up pieces of them faster. */
515 /* ??? Only if block-move stuff knows about different source/destination
518 #define CONSTANT_ALIGNMENT(EXP, ALIGN) MAX ((ALIGN), BITS_PER_WORD)
519 #define DATA_ALIGNMENT(EXP, ALIGN) MAX ((ALIGN), BITS_PER_WORD)
522 /* Set this nonzero if move instructions will actually fail to work
523 when given unaligned data.
525 Since we get an error message when we do one, call them invalid. */
527 #define STRICT_ALIGNMENT 1
529 /* Set this nonzero if unaligned move instructions are extremely slow.
531 On the Alpha, they trap. */
533 #define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) 1
535 /* Standard register usage. */
537 /* Number of actual hardware registers.
538 The hardware registers are assigned numbers for the compiler
539 from 0 to just below FIRST_PSEUDO_REGISTER.
540 All registers that the compiler knows about must be given numbers,
541 even those that are not normally considered general registers.
543 We define all 32 integer registers, even though $31 is always zero,
544 and all 32 floating-point registers, even though $f31 is also
545 always zero. We do not bother defining the FP status register and
546 there are no other registers.
548 Since $31 is always zero, we will use register number 31 as the
549 argument pointer. It will never appear in the generated code
550 because we will always be eliminating it in favor of the stack
551 pointer or hardware frame pointer.
553 Likewise, we use $f31 for the frame pointer, which will always
554 be eliminated in favor of the hardware frame pointer or the
557 #define FIRST_PSEUDO_REGISTER 64
559 /* 1 for registers that have pervasive standard uses
560 and are not available for the register allocator. */
562 #define FIXED_REGISTERS \
563 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
564 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, \
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, 0, 0, 1 }
568 /* 1 for registers not available across function calls.
569 These must include the FIXED_REGISTERS and also any
570 registers that can be used without being saved.
571 The latter must include the registers where values are returned
572 and the register where structure-value addresses are passed.
573 Aside from that, you can include as many other registers as you like. */
574 #define CALL_USED_REGISTERS \
575 {1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, \
576 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, \
577 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
578 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
580 /* List the order in which to allocate registers. Each register must be
581 listed once, even those in FIXED_REGISTERS.
583 We allocate in the following order:
584 $f10-$f15 (nonsaved floating-point register)
586 $f21-$f16 (likewise, but input args)
587 $f0 (nonsaved, but return value)
588 $f1 (nonsaved, but immediate before saved)
589 $f2-$f9 (saved floating-point registers)
590 $1-$8 (nonsaved integer registers)
593 $0 (likewise, but return value)
594 $21-$16 (likewise, but input args)
595 $27 (procedure value in OSF, nonsaved in NT)
596 $9-$14 (saved integer registers)
600 $30, $31, $f31 (stack pointer and always zero/ap & fp) */
602 #define REG_ALLOC_ORDER \
603 {42, 43, 44, 45, 46, 47, \
604 54, 55, 56, 57, 58, 59, 60, 61, 62, \
605 53, 52, 51, 50, 49, 48, \
607 34, 35, 36, 37, 38, 39, 40, 41, \
608 1, 2, 3, 4, 5, 6, 7, 8, \
612 21, 20, 19, 18, 17, 16, \
614 9, 10, 11, 12, 13, 14, \
620 /* Return number of consecutive hard regs needed starting at reg REGNO
621 to hold something of mode MODE.
622 This is ordinarily the length in words of a value of mode MODE
623 but can be less for certain modes in special long registers. */
625 #define HARD_REGNO_NREGS(REGNO, MODE) \
626 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
628 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
629 On Alpha, the integer registers can hold any mode. The floating-point
630 registers can hold 32-bit and 64-bit integers as well, but not 16-bit
633 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
634 ((REGNO) >= 32 && (REGNO) <= 62 \
635 ? GET_MODE_UNIT_SIZE (MODE) == 8 || GET_MODE_UNIT_SIZE (MODE) == 4 \
638 /* Value is 1 if MODE is a supported vector mode. */
640 #define VECTOR_MODE_SUPPORTED_P(MODE) \
642 && ((MODE) == V8QImode || (MODE) == V4HImode || (MODE) == V2SImode))
644 /* A C expression that is nonzero if a value of mode
645 MODE1 is accessible in mode MODE2 without copying.
647 This asymmetric test is true when MODE1 could be put
648 in an FP register but MODE2 could not. */
650 #define MODES_TIEABLE_P(MODE1, MODE2) \
651 (HARD_REGNO_MODE_OK (32, (MODE1)) \
652 ? HARD_REGNO_MODE_OK (32, (MODE2)) \
655 /* Specify the registers used for certain standard purposes.
656 The values of these macros are register numbers. */
658 /* Alpha pc isn't overloaded on a register that the compiler knows about. */
659 /* #define PC_REGNUM */
661 /* Register to use for pushing function arguments. */
662 #define STACK_POINTER_REGNUM 30
664 /* Base register for access to local variables of the function. */
665 #define HARD_FRAME_POINTER_REGNUM 15
667 /* Value should be nonzero if functions must have frame pointers.
668 Zero means the frame pointer need not be set up (and parms
669 may be accessed via the stack pointer) in functions that seem suitable.
670 This is computed in `reload', in reload1.c. */
671 #define FRAME_POINTER_REQUIRED 0
673 /* Base register for access to arguments of the function. */
674 #define ARG_POINTER_REGNUM 31
676 /* Base register for access to local variables of function. */
677 #define FRAME_POINTER_REGNUM 63
679 /* Register in which static-chain is passed to a function.
681 For the Alpha, this is based on an example; the calling sequence
682 doesn't seem to specify this. */
683 #define STATIC_CHAIN_REGNUM 1
685 /* The register number of the register used to address a table of
686 static data addresses in memory. */
687 #define PIC_OFFSET_TABLE_REGNUM 29
689 /* Define this macro if the register defined by `PIC_OFFSET_TABLE_REGNUM'
690 is clobbered by calls. */
691 /* ??? It is and it isn't. It's required to be valid for a given
692 function when the function returns. It isn't clobbered by
693 current_file functions. Moreover, we do not expose the ldgp
694 until after reload, so we're probably safe. */
695 /* #define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED */
697 /* Register in which address to store a structure value
698 arrives in the function. On the Alpha, the address is passed
699 as a hidden argument. */
700 #define STRUCT_VALUE 0
702 /* Define the classes of registers for register constraints in the
703 machine description. Also define ranges of constants.
705 One of the classes must always be named ALL_REGS and include all hard regs.
706 If there is more than one class, another class must be named NO_REGS
707 and contain no registers.
709 The name GENERAL_REGS must be the name of a class (or an alias for
710 another name such as ALL_REGS). This is the class of registers
711 that is allowed by "g" or "r" in a register constraint.
712 Also, registers outside this class are allocated only when
713 instructions express preferences for them.
715 The classes must be numbered in nondecreasing order; that is,
716 a larger-numbered class must never be contained completely
717 in a smaller-numbered class.
719 For any two classes, it is very desirable that there be another
720 class that represents their union. */
723 NO_REGS, R0_REG, R24_REG, R25_REG, R27_REG,
724 GENERAL_REGS, FLOAT_REGS, ALL_REGS,
728 #define N_REG_CLASSES (int) LIM_REG_CLASSES
730 /* Give names of register classes as strings for dump file. */
732 #define REG_CLASS_NAMES \
733 {"NO_REGS", "R0_REG", "R24_REG", "R25_REG", "R27_REG", \
734 "GENERAL_REGS", "FLOAT_REGS", "ALL_REGS" }
736 /* Define which registers fit in which classes.
737 This is an initializer for a vector of HARD_REG_SET
738 of length N_REG_CLASSES. */
740 #define REG_CLASS_CONTENTS \
741 { {0x00000000, 0x00000000}, /* NO_REGS */ \
742 {0x00000001, 0x00000000}, /* R0_REG */ \
743 {0x01000000, 0x00000000}, /* R24_REG */ \
744 {0x02000000, 0x00000000}, /* R25_REG */ \
745 {0x08000000, 0x00000000}, /* R27_REG */ \
746 {0xffffffff, 0x80000000}, /* GENERAL_REGS */ \
747 {0x00000000, 0x7fffffff}, /* FLOAT_REGS */ \
748 {0xffffffff, 0xffffffff} }
750 /* The same information, inverted:
751 Return the class number of the smallest class containing
752 reg number REGNO. This could be a conditional expression
753 or could index an array. */
755 #define REGNO_REG_CLASS(REGNO) \
756 ((REGNO) == 0 ? R0_REG \
757 : (REGNO) == 24 ? R24_REG \
758 : (REGNO) == 25 ? R25_REG \
759 : (REGNO) == 27 ? R27_REG \
760 : (REGNO) >= 32 && (REGNO) <= 62 ? FLOAT_REGS \
763 /* The class value for index registers, and the one for base regs. */
764 #define INDEX_REG_CLASS NO_REGS
765 #define BASE_REG_CLASS GENERAL_REGS
767 /* Get reg_class from a letter such as appears in the machine description. */
769 #define REG_CLASS_FROM_LETTER(C) \
770 ((C) == 'a' ? R24_REG \
771 : (C) == 'b' ? R25_REG \
772 : (C) == 'c' ? R27_REG \
773 : (C) == 'f' ? FLOAT_REGS \
774 : (C) == 'v' ? R0_REG \
777 /* Define this macro to change register usage conditional on target flags. */
778 /* #define CONDITIONAL_REGISTER_USAGE */
780 /* The letters I, J, K, L, M, N, O, and P in a register constraint string
781 can be used to stand for particular ranges of immediate operands.
782 This macro defines what the ranges are.
783 C is the letter, and VALUE is a constant value.
784 Return 1 if VALUE is in the range specified by C.
787 `I' is used for the range of constants most insns can contain.
788 `J' is the constant zero.
789 `K' is used for the constant in an LDA insn.
790 `L' is used for the constant in a LDAH insn.
791 `M' is used for the constants that can be AND'ed with using a ZAP insn.
792 `N' is used for complemented 8-bit constants.
793 `O' is used for negated 8-bit constants.
794 `P' is used for the constants 1, 2 and 3. */
796 #define CONST_OK_FOR_LETTER_P alpha_const_ok_for_letter_p
798 /* Similar, but for floating or large integer constants, and defining letters
799 G and H. Here VALUE is the CONST_DOUBLE rtx itself.
801 For Alpha, `G' is the floating-point constant zero. `H' is a CONST_DOUBLE
802 that is the operand of a ZAP insn. */
804 #define CONST_DOUBLE_OK_FOR_LETTER_P alpha_const_double_ok_for_letter_p
806 /* Optional extra constraints for this machine.
808 For the Alpha, `Q' means that this is a memory operand but not a
809 reference to an unaligned location.
811 `R' is a SYMBOL_REF that has SYMBOL_REF_FLAG set or is the current
814 'S' is a 6-bit constant (valid for a shift insn).
818 'U' is a symbolic operand.
820 'W' is a vector zero. */
822 #define EXTRA_CONSTRAINT alpha_extra_constraint
824 /* Given an rtx X being reloaded into a reg required to be
825 in class CLASS, return the class of reg to actually use.
826 In general this is just CLASS; but on some machines
827 in some cases it is preferable to use a more restrictive class. */
829 #define PREFERRED_RELOAD_CLASS alpha_preferred_reload_class
831 /* Loading and storing HImode or QImode values to and from memory
832 usually requires a scratch register. The exceptions are loading
833 QImode and HImode from an aligned address to a general register
834 unless byte instructions are permitted.
835 We also cannot load an unaligned address or a paradoxical SUBREG into an
838 #define SECONDARY_INPUT_RELOAD_CLASS(CLASS,MODE,IN) \
839 secondary_reload_class((CLASS), (MODE), (IN), 1)
841 #define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS,MODE,OUT) \
842 secondary_reload_class((CLASS), (MODE), (OUT), 0)
844 /* If we are copying between general and FP registers, we need a memory
845 location unless the FIX extension is available. */
847 #define SECONDARY_MEMORY_NEEDED(CLASS1,CLASS2,MODE) \
848 (! TARGET_FIX && (((CLASS1) == FLOAT_REGS && (CLASS2) != FLOAT_REGS) \
849 || ((CLASS2) == FLOAT_REGS && (CLASS1) != FLOAT_REGS)))
851 /* Specify the mode to be used for memory when a secondary memory
852 location is needed. If MODE is floating-point, use it. Otherwise,
853 widen to a word like the default. This is needed because we always
854 store integers in FP registers in quadword format. This whole
855 area is very tricky! */
856 #define SECONDARY_MEMORY_NEEDED_MODE(MODE) \
857 (GET_MODE_CLASS (MODE) == MODE_FLOAT ? (MODE) \
858 : GET_MODE_SIZE (MODE) >= 4 ? (MODE) \
859 : mode_for_size (BITS_PER_WORD, GET_MODE_CLASS (MODE), 0))
861 /* Return the maximum number of consecutive registers
862 needed to represent mode MODE in a register of class CLASS. */
864 #define CLASS_MAX_NREGS(CLASS, MODE) \
865 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
867 /* Return the class of registers that cannot change mode from FROM to TO. */
869 #define CANNOT_CHANGE_MODE_CLASS(FROM, TO) \
870 (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO) ? FLOAT_REGS : NO_REGS)
872 /* Define the cost of moving between registers of various classes. Moving
873 between FLOAT_REGS and anything else except float regs is expensive.
874 In fact, we make it quite expensive because we really don't want to
875 do these moves unless it is clearly worth it. Optimizations may
876 reduce the impact of not being able to allocate a pseudo to a
879 #define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \
880 (((CLASS1) == FLOAT_REGS) == ((CLASS2) == FLOAT_REGS) \
882 : TARGET_FIX ? 3 : 4+2*alpha_memory_latency)
884 /* A C expressions returning the cost of moving data of MODE from a register to
887 On the Alpha, bump this up a bit. */
889 extern int alpha_memory_latency;
890 #define MEMORY_MOVE_COST(MODE,CLASS,IN) (2*alpha_memory_latency)
892 /* Provide the cost of a branch. Exact meaning under development. */
893 #define BRANCH_COST 5
895 /* Stack layout; function entry, exit and calling. */
897 /* Define this if pushing a word on the stack
898 makes the stack pointer a smaller address. */
899 #define STACK_GROWS_DOWNWARD
901 /* Define this if the nominal address of the stack frame
902 is at the high-address end of the local variables;
903 that is, each additional local variable allocated
904 goes at a more negative offset in the frame. */
905 /* #define FRAME_GROWS_DOWNWARD */
907 /* Offset within stack frame to start allocating local variables at.
908 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
909 first local allocated. Otherwise, it is the offset to the BEGINNING
910 of the first local allocated. */
912 #define STARTING_FRAME_OFFSET 0
914 /* If we generate an insn to push BYTES bytes,
915 this says how many the stack pointer really advances by.
916 On Alpha, don't define this because there are no push insns. */
917 /* #define PUSH_ROUNDING(BYTES) */
919 /* Define this to be nonzero if stack checking is built into the ABI. */
920 #define STACK_CHECK_BUILTIN 1
922 /* Define this if the maximum size of all the outgoing args is to be
923 accumulated and pushed during the prologue. The amount can be
924 found in the variable current_function_outgoing_args_size. */
925 #define ACCUMULATE_OUTGOING_ARGS 1
927 /* Offset of first parameter from the argument pointer register value. */
929 #define FIRST_PARM_OFFSET(FNDECL) 0
931 /* Definitions for register eliminations.
933 We have two registers that can be eliminated on the Alpha. First, the
934 frame pointer register can often be eliminated in favor of the stack
935 pointer register. Secondly, the argument pointer register can always be
936 eliminated; it is replaced with either the stack or frame pointer. */
938 /* This is an array of structures. Each structure initializes one pair
939 of eliminable registers. The "from" register number is given first,
940 followed by "to". Eliminations of the same "from" register are listed
941 in order of preference. */
943 #define ELIMINABLE_REGS \
944 {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
945 { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \
946 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
947 { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}}
949 /* Given FROM and TO register numbers, say whether this elimination is allowed.
950 Frame pointer elimination is automatically handled.
952 All eliminations are valid since the cases where FP can't be
953 eliminated are already handled. */
955 #define CAN_ELIMINATE(FROM, TO) 1
957 /* Round up to a multiple of 16 bytes. */
958 #define ALPHA_ROUND(X) (((X) + 15) & ~ 15)
960 /* Define the offset between two registers, one to be eliminated, and the other
961 its replacement, at the start of a routine. */
962 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
963 { if ((FROM) == FRAME_POINTER_REGNUM) \
964 (OFFSET) = (ALPHA_ROUND (current_function_outgoing_args_size) \
965 + alpha_sa_size ()); \
966 else if ((FROM) == ARG_POINTER_REGNUM) \
967 (OFFSET) = (ALPHA_ROUND (current_function_outgoing_args_size) \
969 + (ALPHA_ROUND (get_frame_size () \
970 + current_function_pretend_args_size) \
971 - current_function_pretend_args_size)); \
976 /* Define this if stack space is still allocated for a parameter passed
978 /* #define REG_PARM_STACK_SPACE */
980 /* Value is the number of bytes of arguments automatically
981 popped when returning from a subroutine call.
982 FUNDECL is the declaration node of the function (as a tree),
983 FUNTYPE is the data type of the function (as a tree),
984 or for a library call it is an identifier node for the subroutine name.
985 SIZE is the number of bytes of arguments passed on the stack. */
987 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
989 /* Define how to find the value returned by a function.
990 VALTYPE is the data type of the value (as a tree).
991 If the precise function being called is known, FUNC is its FUNCTION_DECL;
992 otherwise, FUNC is 0.
994 On Alpha the value is found in $0 for integer functions and
995 $f0 for floating-point functions. */
997 #define FUNCTION_VALUE(VALTYPE, FUNC) \
998 gen_rtx_REG (((INTEGRAL_TYPE_P (VALTYPE) \
999 && TYPE_PRECISION (VALTYPE) < BITS_PER_WORD) \
1000 || POINTER_TYPE_P (VALTYPE)) \
1001 ? word_mode : TYPE_MODE (VALTYPE), \
1003 && (TREE_CODE (VALTYPE) == REAL_TYPE \
1004 || TREE_CODE (VALTYPE) == COMPLEX_TYPE)) \
1007 /* Define how to find the value returned by a library function
1008 assuming the value has mode MODE. */
1010 #define LIBCALL_VALUE(MODE) \
1011 gen_rtx_REG (MODE, \
1013 && (GET_MODE_CLASS (MODE) == MODE_FLOAT \
1014 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) \
1017 /* The definition of this macro implies that there are cases where
1018 a scalar value cannot be returned in registers.
1020 For the Alpha, any structure or union type is returned in memory, as
1021 are integers whose size is larger than 64 bits. */
1023 #define RETURN_IN_MEMORY(TYPE) \
1024 (TYPE_MODE (TYPE) == BLKmode \
1025 || TYPE_MODE (TYPE) == TFmode \
1026 || TYPE_MODE (TYPE) == TCmode \
1027 || (TREE_CODE (TYPE) == INTEGER_TYPE && TYPE_PRECISION (TYPE) > 64))
1029 /* 1 if N is a possible register number for a function value
1030 as seen by the caller. */
1032 #define FUNCTION_VALUE_REGNO_P(N) \
1033 ((N) == 0 || (N) == 1 || (N) == 32 || (N) == 33)
1035 /* 1 if N is a possible register number for function argument passing.
1036 On Alpha, these are $16-$21 and $f16-$f21. */
1038 #define FUNCTION_ARG_REGNO_P(N) \
1039 (((N) >= 16 && (N) <= 21) || ((N) >= 16 + 32 && (N) <= 21 + 32))
1041 /* Define a data type for recording info about an argument list
1042 during the scan of that argument list. This data type should
1043 hold all necessary information about the function itself
1044 and about the args processed so far, enough to enable macros
1045 such as FUNCTION_ARG to determine where the next arg should go.
1047 On Alpha, this is a single integer, which is a number of words
1048 of arguments scanned so far.
1049 Thus 6 or more means all following args should go on the stack. */
1051 #define CUMULATIVE_ARGS int
1053 /* Initialize a variable CUM of type CUMULATIVE_ARGS
1054 for a call to a function whose data type is FNTYPE.
1055 For a library call, FNTYPE is 0. */
1057 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) (CUM) = 0
1059 /* Define intermediate macro to compute the size (in registers) of an argument
1062 #define ALPHA_ARG_SIZE(MODE, TYPE, NAMED) \
1063 ((MODE) == TFmode || (MODE) == TCmode ? 1 \
1064 : (((MODE) == BLKmode ? int_size_in_bytes (TYPE) : GET_MODE_SIZE (MODE)) \
1065 + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
1067 /* Update the data in CUM to advance over an argument
1068 of mode MODE and data type TYPE.
1069 (TYPE is null for libcalls where that information may not be available.) */
1071 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
1072 if (MUST_PASS_IN_STACK (MODE, TYPE)) \
1075 (CUM) += ALPHA_ARG_SIZE (MODE, TYPE, NAMED)
1077 /* Determine where to put an argument to a function.
1078 Value is zero to push the argument on the stack,
1079 or a hard register in which to store the argument.
1081 MODE is the argument's machine mode.
1082 TYPE is the data type of the argument (as a tree).
1083 This is null for libcalls where that information may
1085 CUM is a variable of type CUMULATIVE_ARGS which gives info about
1086 the preceding args and about the function being called.
1087 NAMED is nonzero if this argument is a named parameter
1088 (otherwise it is an extra parameter matching an ellipsis).
1090 On Alpha the first 6 words of args are normally in registers
1091 and the rest are pushed. */
1093 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
1094 function_arg((CUM), (MODE), (TYPE), (NAMED))
1096 /* A C expression that indicates when an argument must be passed by
1097 reference. If nonzero for an argument, a copy of that argument is
1098 made in memory and a pointer to the argument is passed instead of
1099 the argument itself. The pointer is passed in whatever way is
1100 appropriate for passing a pointer to that type. */
1102 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
1103 ((MODE) == TFmode || (MODE) == TCmode)
1105 /* Specify the padding direction of arguments.
1107 On the Alpha, we must pad upwards in order to be able to pass args in
1110 #define FUNCTION_ARG_PADDING(MODE, TYPE) upward
1112 /* For an arg passed partly in registers and partly in memory,
1113 this is the number of registers used.
1114 For args passed entirely in registers or entirely in memory, zero. */
1116 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
1117 ((CUM) < 6 && 6 < (CUM) + ALPHA_ARG_SIZE (MODE, TYPE, NAMED) \
1120 /* Perform any needed actions needed for a function that is receiving a
1121 variable number of arguments.
1125 MODE and TYPE are the mode and type of the current parameter.
1127 PRETEND_SIZE is a variable that should be set to the amount of stack
1128 that must be pushed by the prolog to pretend that our caller pushed
1131 Normally, this macro will push all remaining incoming registers on the
1132 stack and set PRETEND_SIZE to the length of the registers pushed.
1134 On the Alpha, we allocate space for all 12 arg registers, but only
1135 push those that are remaining.
1137 However, if NO registers need to be saved, don't allocate any space.
1138 This is not only because we won't need the space, but because AP includes
1139 the current_pretend_args_size and we don't want to mess up any
1140 ap-relative addresses already made.
1142 If we are not to use the floating-point registers, save the integer
1143 registers where we would put the floating-point registers. This is
1144 not the most efficient way to implement varargs with just one register
1145 class, but it isn't worth doing anything more efficient in this rare
1148 #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
1153 rtx tmp; int set = get_varargs_alias_set (); \
1154 tmp = gen_rtx_MEM (BLKmode, \
1155 plus_constant (virtual_incoming_args_rtx, \
1156 ((CUM) + 6)* UNITS_PER_WORD)); \
1157 set_mem_alias_set (tmp, set); \
1158 move_block_from_reg \
1160 6 - (CUM), (6 - (CUM)) * UNITS_PER_WORD); \
1162 tmp = gen_rtx_MEM (BLKmode, \
1163 plus_constant (virtual_incoming_args_rtx, \
1164 (CUM) * UNITS_PER_WORD)); \
1165 set_mem_alias_set (tmp, set); \
1166 move_block_from_reg \
1167 (16 + (TARGET_FPREGS ? 32 : 0) + CUM, tmp, \
1168 6 - (CUM), (6 - (CUM)) * UNITS_PER_WORD); \
1170 PRETEND_SIZE = 12 * UNITS_PER_WORD; \
1174 /* Try to output insns to set TARGET equal to the constant C if it can be
1175 done in less than N insns. Do all computations in MODE. Returns the place
1176 where the output has been placed if it can be done and the insns have been
1177 emitted. If it would take more than N insns, zero is returned and no
1178 insns and emitted. */
1180 /* Define the information needed to generate branch and scc insns. This is
1181 stored from the compare operation. Note that we can't use "rtx" here
1182 since it hasn't been defined! */
1184 struct alpha_compare
1186 struct rtx_def *op0, *op1;
1190 extern struct alpha_compare alpha_compare;
1192 /* Make (or fake) .linkage entry for function call.
1193 IS_LOCAL is 0 if name is used in call, 1 if name is used in definition. */
1195 /* This macro defines the start of an assembly comment. */
1197 #define ASM_COMMENT_START " #"
1199 /* This macro produces the initial definition of a function. */
1201 #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
1202 alpha_start_function(FILE,NAME,DECL);
1204 /* This macro closes up a function definition for the assembler. */
1206 #define ASM_DECLARE_FUNCTION_SIZE(FILE,NAME,DECL) \
1207 alpha_end_function(FILE,NAME,DECL)
1209 /* Output any profiling code before the prologue. */
1211 #define PROFILE_BEFORE_PROLOGUE 1
1213 /* Output assembler code to FILE to increment profiler label # LABELNO
1214 for profiling a function entry. Under OSF/1, profiling is enabled
1215 by simply passing -pg to the assembler and linker. */
1217 #define FUNCTION_PROFILER(FILE, LABELNO)
1219 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
1220 the stack pointer does not matter. The value is tested only in
1221 functions that have frame pointers.
1222 No definition is equivalent to always zero. */
1224 #define EXIT_IGNORE_STACK 1
1226 /* Define registers used by the epilogue and return instruction. */
1228 #define EPILOGUE_USES(REGNO) ((REGNO) == 26)
1230 /* Output assembler code for a block containing the constant parts
1231 of a trampoline, leaving space for the variable parts.
1233 The trampoline should set the static chain pointer to value placed
1234 into the trampoline and should branch to the specified routine.
1235 Note that $27 has been set to the address of the trampoline, so we can
1236 use it for addressability of the two data items. */
1238 #define TRAMPOLINE_TEMPLATE(FILE) \
1240 fprintf (FILE, "\tldq $1,24($27)\n"); \
1241 fprintf (FILE, "\tldq $27,16($27)\n"); \
1242 fprintf (FILE, "\tjmp $31,($27),0\n"); \
1243 fprintf (FILE, "\tnop\n"); \
1244 fprintf (FILE, "\t.quad 0,0\n"); \
1247 /* Section in which to place the trampoline. On Alpha, instructions
1248 may only be placed in a text segment. */
1250 #define TRAMPOLINE_SECTION text_section
1252 /* Length in units of the trampoline for entering a nested function. */
1254 #define TRAMPOLINE_SIZE 32
1256 /* The alignment of a trampoline, in bits. */
1258 #define TRAMPOLINE_ALIGNMENT 64
1260 /* Emit RTL insns to initialize the variable parts of a trampoline.
1261 FNADDR is an RTX for the address of the function's pure code.
1262 CXT is an RTX for the static chain value for the function. */
1264 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
1265 alpha_initialize_trampoline (TRAMP, FNADDR, CXT, 16, 24, 8)
1267 /* A C expression whose value is RTL representing the value of the return
1268 address for the frame COUNT steps up from the current frame.
1269 FRAMEADDR is the frame pointer of the COUNT frame, or the frame pointer of
1270 the COUNT-1 frame if RETURN_ADDR_IN_PREVIOUS_FRAME is defined. */
1272 #define RETURN_ADDR_RTX alpha_return_addr
1274 /* Before the prologue, RA lives in $26. */
1275 #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, 26)
1276 #define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (26)
1278 /* Describe how we implement __builtin_eh_return. */
1279 #define EH_RETURN_DATA_REGNO(N) ((N) < 4 ? (N) + 16 : INVALID_REGNUM)
1280 #define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, 28)
1281 #define EH_RETURN_HANDLER_RTX \
1282 gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx, \
1283 current_function_outgoing_args_size))
1285 /* Addressing modes, and classification of registers for them. */
1287 /* Macros to check register numbers against specific register classes. */
1289 /* These assume that REGNO is a hard or pseudo reg number.
1290 They give nonzero only if REGNO is a hard reg of the suitable class
1291 or a pseudo reg currently allocated to a suitable hard reg.
1292 Since they use reg_renumber, they are safe only once reg_renumber
1293 has been allocated, which happens in local-alloc.c. */
1295 #define REGNO_OK_FOR_INDEX_P(REGNO) 0
1296 #define REGNO_OK_FOR_BASE_P(REGNO) \
1297 ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32 \
1298 || (REGNO) == 63 || reg_renumber[REGNO] == 63)
1300 /* Maximum number of registers that can appear in a valid memory address. */
1301 #define MAX_REGS_PER_ADDRESS 1
1303 /* Recognize any constant value that is a valid address. For the Alpha,
1304 there are only constants none since we want to use LDA to load any
1305 symbolic addresses into registers. */
1307 #define CONSTANT_ADDRESS_P(X) \
1308 (GET_CODE (X) == CONST_INT \
1309 && (unsigned HOST_WIDE_INT) (INTVAL (X) + 0x8000) < 0x10000)
1311 /* Include all constant integers and constant doubles, but not
1312 floating-point, except for floating-point zero. */
1314 #define LEGITIMATE_CONSTANT_P(X) \
1315 (GET_MODE_CLASS (GET_MODE (X)) != MODE_FLOAT \
1316 || (X) == CONST0_RTX (GET_MODE (X)))
1318 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1319 and check its validity for a certain class.
1320 We have two alternate definitions for each of them.
1321 The usual definition accepts all pseudo regs; the other rejects
1322 them unless they have been allocated suitable hard regs.
1323 The symbol REG_OK_STRICT causes the latter definition to be used.
1325 Most source files want to accept pseudo regs in the hope that
1326 they will get allocated to the class that the insn wants them to be in.
1327 Source files for reload pass need to be strict.
1328 After reload, it makes no difference, since pseudo regs have
1329 been eliminated by then. */
1331 /* Nonzero if X is a hard reg that can be used as an index
1332 or if it is a pseudo reg. */
1333 #define REG_OK_FOR_INDEX_P(X) 0
1335 /* Nonzero if X is a hard reg that can be used as a base reg
1336 or if it is a pseudo reg. */
1337 #define NONSTRICT_REG_OK_FOR_BASE_P(X) \
1338 (REGNO (X) < 32 || REGNO (X) == 63 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
1340 /* ??? Nonzero if X is the frame pointer, or some virtual register
1341 that may eliminate to the frame pointer. These will be allowed to
1342 have offsets greater than 32K. This is done because register
1343 elimination offsets will change the hi/lo split, and if we split
1344 before reload, we will require additional instructions. */
1345 #define NONSTRICT_REG_OK_FP_BASE_P(X) \
1346 (REGNO (X) == 31 || REGNO (X) == 63 \
1347 || (REGNO (X) >= FIRST_PSEUDO_REGISTER \
1348 && REGNO (X) < LAST_VIRTUAL_REGISTER))
1350 /* Nonzero if X is a hard reg that can be used as a base reg. */
1351 #define STRICT_REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1353 #ifdef REG_OK_STRICT
1354 #define REG_OK_FOR_BASE_P(X) STRICT_REG_OK_FOR_BASE_P (X)
1356 #define REG_OK_FOR_BASE_P(X) NONSTRICT_REG_OK_FOR_BASE_P (X)
1359 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression that is a
1360 valid memory address for an instruction. */
1362 #ifdef REG_OK_STRICT
1363 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, WIN) \
1365 if (alpha_legitimate_address_p (MODE, X, 1)) \
1369 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, WIN) \
1371 if (alpha_legitimate_address_p (MODE, X, 0)) \
1376 /* Try machine-dependent ways of modifying an illegitimate address
1377 to be legitimate. If we find one, return the new, valid address.
1378 This macro is used in only one place: `memory_address' in explow.c. */
1380 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
1382 rtx new_x = alpha_legitimize_address (X, NULL_RTX, MODE); \
1390 /* Try a machine-dependent way of reloading an illegitimate address
1391 operand. If we find one, push the reload and jump to WIN. This
1392 macro is used in only one place: `find_reloads_address' in reload.c. */
1394 #define LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OPNUM,TYPE,IND_L,WIN) \
1396 rtx new_x = alpha_legitimize_reload_address (X, MODE, OPNUM, TYPE, IND_L); \
1404 /* Go to LABEL if ADDR (a legitimate address expression)
1405 has an effect that depends on the machine mode it is used for.
1406 On the Alpha this is true only for the unaligned modes. We can
1407 simplify this test since we know that the address must be valid. */
1409 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1410 { if (GET_CODE (ADDR) == AND) goto LABEL; }
1412 /* Compute the cost of an address. For the Alpha, all valid addresses are
1415 #define ADDRESS_COST(X) 0
1417 /* Machine-dependent reorg pass. */
1418 #define MACHINE_DEPENDENT_REORG(X) alpha_reorg(X)
1420 /* Specify the machine mode that this machine uses
1421 for the index in the tablejump instruction. */
1422 #define CASE_VECTOR_MODE SImode
1424 /* Define as C expression which evaluates to nonzero if the tablejump
1425 instruction expects the table to contain offsets from the address of the
1428 Do not define this if the table should contain absolute addresses.
1429 On the Alpha, the table is really GP-relative, not relative to the PC
1430 of the table, but we pretend that it is PC-relative; this should be OK,
1431 but we should try to find some better way sometime. */
1432 #define CASE_VECTOR_PC_RELATIVE 1
1434 /* Define this as 1 if `char' should by default be signed; else as 0. */
1435 #define DEFAULT_SIGNED_CHAR 1
1437 /* This flag, if defined, says the same insns that convert to a signed fixnum
1438 also convert validly to an unsigned one.
1440 We actually lie a bit here as overflow conditions are different. But
1441 they aren't being checked anyway. */
1443 #define FIXUNS_TRUNC_LIKE_FIX_TRUNC
1445 /* Max number of bytes we can move to or from memory
1446 in one reasonably fast instruction. */
1450 /* If a memory-to-memory move would take MOVE_RATIO or more simple
1451 move-instruction pairs, we will do a movstr or libcall instead.
1453 Without byte/word accesses, we want no more than four instructions;
1454 with, several single byte accesses are better. */
1456 #define MOVE_RATIO (TARGET_BWX ? 7 : 2)
1458 /* Largest number of bytes of an object that can be placed in a register.
1459 On the Alpha we have plenty of registers, so use TImode. */
1460 #define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (TImode)
1462 /* Nonzero if access to memory by bytes is no faster than for words.
1463 Also nonzero if doing byte operations (specifically shifts) in registers
1466 On the Alpha, we want to not use the byte operation and instead use
1467 masking operations to access fields; these will save instructions. */
1469 #define SLOW_BYTE_ACCESS 1
1471 /* Define if operations between registers always perform the operation
1472 on the full register even if a narrower mode is specified. */
1473 #define WORD_REGISTER_OPERATIONS
1475 /* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
1476 will either zero-extend or sign-extend. The value of this macro should
1477 be the code that says which one of the two operations is implicitly
1478 done, NIL if none. */
1479 #define LOAD_EXTEND_OP(MODE) ((MODE) == SImode ? SIGN_EXTEND : ZERO_EXTEND)
1481 /* Define if loading short immediate values into registers sign extends. */
1482 #define SHORT_IMMEDIATES_SIGN_EXTEND
1484 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1485 is done just by pretending it is already truncated. */
1486 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1488 /* We assume that the store-condition-codes instructions store 0 for false
1489 and some other value for true. This is the value stored for true. */
1491 #define STORE_FLAG_VALUE 1
1493 /* Define the value returned by a floating-point comparison instruction. */
1495 #define FLOAT_STORE_FLAG_VALUE(MODE) \
1496 REAL_VALUE_ATOF ((TARGET_FLOAT_VAX ? "0.5" : "2.0"), (MODE))
1498 /* Canonicalize a comparison from one we don't have to one we do have. */
1500 #define CANONICALIZE_COMPARISON(CODE,OP0,OP1) \
1502 if (((CODE) == GE || (CODE) == GT || (CODE) == GEU || (CODE) == GTU) \
1503 && (GET_CODE (OP1) == REG || (OP1) == const0_rtx)) \
1508 (CODE) = swap_condition (CODE); \
1510 if (((CODE) == LT || (CODE) == LTU) \
1511 && GET_CODE (OP1) == CONST_INT && INTVAL (OP1) == 256) \
1513 (CODE) = (CODE) == LT ? LE : LEU; \
1514 (OP1) = GEN_INT (255); \
1518 /* Specify the machine mode that pointers have.
1519 After generation of rtl, the compiler makes no further distinction
1520 between pointers and any other objects of this machine mode. */
1521 #define Pmode DImode
1523 /* Mode of a function address in a call instruction (for indexing purposes). */
1525 #define FUNCTION_MODE Pmode
1527 /* Define this if addresses of constant functions
1528 shouldn't be put through pseudo regs where they can be cse'd.
1529 Desirable on machines where ordinary constants are expensive
1530 but a CALL with constant address is cheap.
1532 We define this on the Alpha so that gen_call and gen_call_value
1533 get to see the SYMBOL_REF (for the hint field of the jsr). It will
1534 then copy it into a register, thus actually letting the address be
1537 #define NO_FUNCTION_CSE
1539 /* Define this to be nonzero if shift instructions ignore all but the low-order
1541 #define SHIFT_COUNT_TRUNCATED 1
1543 /* Compute the cost of computing a constant rtl expression RTX
1544 whose rtx-code is CODE. The body of this macro is a portion
1545 of a switch statement. If the code is computed here,
1546 return it with a return statement. Otherwise, break from the switch.
1548 If this is an 8-bit constant, return zero since it can be used
1549 nearly anywhere with no cost. If it is a valid operand for an
1550 ADD or AND, likewise return 0 if we know it will be used in that
1551 context. Otherwise, return 2 since it might be used there later.
1552 All other constants take at least two insns. */
1554 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
1556 if (INTVAL (RTX) >= 0 && INTVAL (RTX) < 256) \
1558 case CONST_DOUBLE: \
1559 if ((RTX) == CONST0_RTX (GET_MODE (RTX))) \
1561 else if (((OUTER_CODE) == PLUS && add_operand (RTX, VOIDmode)) \
1562 || ((OUTER_CODE) == AND && and_operand (RTX, VOIDmode))) \
1564 else if (add_operand (RTX, VOIDmode) || and_operand (RTX, VOIDmode)) \
1567 return COSTS_N_INSNS (2); \
1571 switch (alpha_cpu) \
1573 case PROCESSOR_EV4: \
1574 return COSTS_N_INSNS (3); \
1575 case PROCESSOR_EV5: \
1576 case PROCESSOR_EV6: \
1577 return COSTS_N_INSNS (2); \
1581 /* Provide the costs of a rtl expression. This is in the body of a
1584 #define RTX_COSTS(X,CODE,OUTER_CODE) \
1585 case PLUS: case MINUS: \
1586 if (FLOAT_MODE_P (GET_MODE (X))) \
1587 switch (alpha_cpu) \
1589 case PROCESSOR_EV4: \
1590 return COSTS_N_INSNS (6); \
1591 case PROCESSOR_EV5: \
1592 case PROCESSOR_EV6: \
1593 return COSTS_N_INSNS (4); \
1596 else if (GET_CODE (XEXP (X, 0)) == MULT \
1597 && const48_operand (XEXP (XEXP (X, 0), 1), VOIDmode)) \
1598 return (2 + rtx_cost (XEXP (XEXP (X, 0), 0), OUTER_CODE) \
1599 + rtx_cost (XEXP (X, 1), OUTER_CODE)); \
1602 switch (alpha_cpu) \
1604 case PROCESSOR_EV4: \
1605 if (FLOAT_MODE_P (GET_MODE (X))) \
1606 return COSTS_N_INSNS (6); \
1607 return COSTS_N_INSNS (23); \
1608 case PROCESSOR_EV5: \
1609 if (FLOAT_MODE_P (GET_MODE (X))) \
1610 return COSTS_N_INSNS (4); \
1611 else if (GET_MODE (X) == DImode) \
1612 return COSTS_N_INSNS (12); \
1614 return COSTS_N_INSNS (8); \
1615 case PROCESSOR_EV6: \
1616 if (FLOAT_MODE_P (GET_MODE (X))) \
1617 return COSTS_N_INSNS (4); \
1619 return COSTS_N_INSNS (7); \
1623 if (GET_CODE (XEXP (X, 1)) == CONST_INT \
1624 && INTVAL (XEXP (X, 1)) <= 3) \
1626 /* ... fall through ... */ \
1627 case ASHIFTRT: case LSHIFTRT: \
1628 switch (alpha_cpu) \
1630 case PROCESSOR_EV4: \
1631 return COSTS_N_INSNS (2); \
1632 case PROCESSOR_EV5: \
1633 case PROCESSOR_EV6: \
1634 return COSTS_N_INSNS (1); \
1637 case IF_THEN_ELSE: \
1638 switch (alpha_cpu) \
1640 case PROCESSOR_EV4: \
1641 case PROCESSOR_EV6: \
1642 return COSTS_N_INSNS (2); \
1643 case PROCESSOR_EV5: \
1644 return COSTS_N_INSNS (1); \
1647 case DIV: case UDIV: case MOD: case UMOD: \
1648 switch (alpha_cpu) \
1650 case PROCESSOR_EV4: \
1651 if (GET_MODE (X) == SFmode) \
1652 return COSTS_N_INSNS (34); \
1653 else if (GET_MODE (X) == DFmode) \
1654 return COSTS_N_INSNS (63); \
1656 return COSTS_N_INSNS (70); \
1657 case PROCESSOR_EV5: \
1658 if (GET_MODE (X) == SFmode) \
1659 return COSTS_N_INSNS (15); \
1660 else if (GET_MODE (X) == DFmode) \
1661 return COSTS_N_INSNS (22); \
1663 return COSTS_N_INSNS (70); /* ??? */ \
1664 case PROCESSOR_EV6: \
1665 if (GET_MODE (X) == SFmode) \
1666 return COSTS_N_INSNS (12); \
1667 else if (GET_MODE (X) == DFmode) \
1668 return COSTS_N_INSNS (15); \
1670 return COSTS_N_INSNS (70); /* ??? */ \
1674 switch (alpha_cpu) \
1676 case PROCESSOR_EV4: \
1677 case PROCESSOR_EV6: \
1678 return COSTS_N_INSNS (3); \
1679 case PROCESSOR_EV5: \
1680 return COSTS_N_INSNS (2); \
1683 case NEG: case ABS: \
1684 if (! FLOAT_MODE_P (GET_MODE (X))) \
1686 /* ... fall through ... */ \
1687 case FLOAT: case UNSIGNED_FLOAT: case FIX: case UNSIGNED_FIX: \
1688 case FLOAT_EXTEND: case FLOAT_TRUNCATE: \
1689 switch (alpha_cpu) \
1691 case PROCESSOR_EV4: \
1692 return COSTS_N_INSNS (6); \
1693 case PROCESSOR_EV5: \
1694 case PROCESSOR_EV6: \
1695 return COSTS_N_INSNS (4); \
1699 /* Control the assembler format that we output. */
1701 /* Output to assembler file text saying following lines
1702 may contain character constants, extra white space, comments, etc. */
1703 #define ASM_APP_ON (TARGET_EXPLICIT_RELOCS ? "\t.set\tmacro\n" : "")
1705 /* Output to assembler file text saying following lines
1706 no longer contain unusual constructs. */
1707 #define ASM_APP_OFF (TARGET_EXPLICIT_RELOCS ? "\t.set\tnomacro\n" : "")
1709 #define TEXT_SECTION_ASM_OP "\t.text"
1711 /* Output before read-only data. */
1713 #define READONLY_DATA_SECTION_ASM_OP "\t.rdata"
1715 /* Output before writable data. */
1717 #define DATA_SECTION_ASM_OP "\t.data"
1719 /* How to refer to registers in assembler output.
1720 This sequence is indexed by compiler's hard-register-number (see above). */
1722 #define REGISTER_NAMES \
1723 {"$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \
1724 "$9", "$10", "$11", "$12", "$13", "$14", "$15", \
1725 "$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23", \
1726 "$24", "$25", "$26", "$27", "$28", "$29", "$30", "AP", \
1727 "$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "$f6", "$f7", "$f8", \
1728 "$f9", "$f10", "$f11", "$f12", "$f13", "$f14", "$f15", \
1729 "$f16", "$f17", "$f18", "$f19", "$f20", "$f21", "$f22", "$f23",\
1730 "$f24", "$f25", "$f26", "$f27", "$f28", "$f29", "$f30", "FP"}
1732 /* Strip name encoding when emitting labels. */
1734 #define ASM_OUTPUT_LABELREF(STREAM, NAME) \
1736 const char *name_ = NAME; \
1737 if (*name_ == '@' || *name_ == '%') \
1739 if (*name_ == '*') \
1742 fputs (user_label_prefix, STREAM); \
1743 fputs (name_, STREAM); \
1746 /* Globalizing directive for a label. */
1747 #define GLOBAL_ASM_OP "\t.globl "
1749 /* The prefix to add to user-visible assembler symbols. */
1751 #define USER_LABEL_PREFIX ""
1753 /* This is how to output a label for a jump table. Arguments are the same as
1754 for (*targetm.asm_out.internal_label), except the insn for the jump table is
1757 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
1758 { ASM_OUTPUT_ALIGN (FILE, 2); (*targetm.asm_out.internal_label) (FILE, PREFIX, NUM); }
1760 /* This is how to store into the string LABEL
1761 the symbol_ref name of an internal numbered label where
1762 PREFIX is the class of label and NUM is the number within the class.
1763 This is suitable for output with `assemble_name'. */
1765 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
1766 sprintf ((LABEL), "*$%s%ld", (PREFIX), (long)(NUM))
1768 /* We use the default ASCII-output routine, except that we don't write more
1769 than 50 characters since the assembler doesn't support very long lines. */
1771 #define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \
1773 FILE *_hide_asm_out_file = (MYFILE); \
1774 const unsigned char *_hide_p = (const unsigned char *) (MYSTRING); \
1775 int _hide_thissize = (MYLENGTH); \
1776 int _size_so_far = 0; \
1778 FILE *asm_out_file = _hide_asm_out_file; \
1779 const unsigned char *p = _hide_p; \
1780 int thissize = _hide_thissize; \
1782 fprintf (asm_out_file, "\t.ascii \""); \
1784 for (i = 0; i < thissize; i++) \
1786 register int c = p[i]; \
1788 if (_size_so_far ++ > 50 && i < thissize - 4) \
1789 _size_so_far = 0, fprintf (asm_out_file, "\"\n\t.ascii \""); \
1791 if (c == '\"' || c == '\\') \
1792 putc ('\\', asm_out_file); \
1793 if (c >= ' ' && c < 0177) \
1794 putc (c, asm_out_file); \
1797 fprintf (asm_out_file, "\\%o", c); \
1798 /* After an octal-escape, if a digit follows, \
1799 terminate one string constant and start another. \
1800 The VAX assembler fails to stop reading the escape \
1801 after three digits, so this is the only way we \
1802 can get it to parse the data properly. */ \
1803 if (i < thissize - 1 && ISDIGIT (p[i + 1])) \
1804 _size_so_far = 0, fprintf (asm_out_file, "\"\n\t.ascii \""); \
1807 fprintf (asm_out_file, "\"\n"); \
1812 /* This is how to output an insn to push a register on the stack.
1813 It need not be very fast code. */
1815 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
1816 fprintf (FILE, "\tsubq $30,8,$30\n\tst%s $%s%d,0($30)\n", \
1817 (REGNO) > 32 ? "t" : "q", (REGNO) > 32 ? "f" : "", \
1820 /* This is how to output an insn to pop a register from the stack.
1821 It need not be very fast code. */
1823 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
1824 fprintf (FILE, "\tld%s $%s%d,0($30)\n\taddq $30,8,$30\n", \
1825 (REGNO) > 32 ? "t" : "q", (REGNO) > 32 ? "f" : "", \
1828 /* This is how to output an element of a case-vector that is absolute.
1829 (Alpha does not use such vectors, but we must define this macro anyway.) */
1831 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) abort ()
1833 /* This is how to output an element of a case-vector that is relative. */
1835 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
1836 fprintf (FILE, "\t.%s $L%d\n", TARGET_ABI_WINDOWS_NT ? "long" : "gprel32", \
1839 /* This is how to output an assembler line
1840 that says to advance the location counter
1841 to a multiple of 2**LOG bytes. */
1843 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1845 fprintf (FILE, "\t.align %d\n", LOG);
1847 /* This is how to advance the location counter by SIZE bytes. */
1849 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
1850 fprintf (FILE, "\t.space %d\n", (SIZE))
1852 /* This says how to output an assembler line
1853 to define a global common symbol. */
1855 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
1856 ( fputs ("\t.comm ", (FILE)), \
1857 assemble_name ((FILE), (NAME)), \
1858 fprintf ((FILE), ",%d\n", (SIZE)))
1860 /* This says how to output an assembler line
1861 to define a local common symbol. */
1863 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \
1864 ( fputs ("\t.lcomm ", (FILE)), \
1865 assemble_name ((FILE), (NAME)), \
1866 fprintf ((FILE), ",%d\n", (SIZE)))
1869 /* Print operand X (an rtx) in assembler syntax to file FILE.
1870 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1871 For `%' followed by punctuation, CODE is the punctuation and X is null. */
1873 #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
1875 /* Determine which codes are valid without a following integer. These must
1878 ~ Generates the name of the current function.
1880 / Generates the instruction suffix. The TRAP_SUFFIX and ROUND_SUFFIX
1881 attributes are examined to determine what is appropriate.
1883 , Generates single precision suffix for floating point
1884 instructions (s for IEEE, f for VAX)
1886 - Generates double precision suffix for floating point
1887 instructions (t for IEEE, g for VAX)
1890 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
1891 ((CODE) == '/' || (CODE) == ',' || (CODE) == '-' || (CODE) == '~' \
1892 || (CODE) == '#' || (CODE) == '*' || (CODE) == '&')
1894 /* Print a memory address as an operand to reference that memory location. */
1896 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
1897 print_operand_address((FILE), (ADDR))
1899 /* Define the codes that are matched by predicates in alpha.c. */
1901 #define PREDICATE_CODES \
1902 {"reg_or_0_operand", {SUBREG, REG, CONST_INT, CONST_DOUBLE, \
1904 {"reg_or_6bit_operand", {SUBREG, REG, CONST_INT}}, \
1905 {"reg_or_8bit_operand", {SUBREG, REG, CONST_INT}}, \
1906 {"reg_or_const_int_operand", {SUBREG, REG, CONST_INT}}, \
1907 {"cint8_operand", {CONST_INT}}, \
1908 {"reg_or_cint_operand", {SUBREG, REG, CONST_INT}}, \
1909 {"add_operand", {SUBREG, REG, CONST_INT}}, \
1910 {"sext_add_operand", {SUBREG, REG, CONST_INT}}, \
1911 {"const48_operand", {CONST_INT}}, \
1912 {"and_operand", {SUBREG, REG, CONST_INT}}, \
1913 {"or_operand", {SUBREG, REG, CONST_INT}}, \
1914 {"mode_mask_operand", {CONST_INT}}, \
1915 {"mul8_operand", {CONST_INT}}, \
1916 {"mode_width_operand", {CONST_INT}}, \
1917 {"alpha_comparison_operator", {EQ, LE, LT, LEU, LTU}}, \
1918 {"alpha_zero_comparison_operator", {EQ, NE, LE, LT, LEU, LTU}}, \
1919 {"alpha_swapped_comparison_operator", {EQ, GE, GT, GEU, GTU}}, \
1920 {"signed_comparison_operator", {EQ, NE, LE, LT, GE, GT}}, \
1921 {"alpha_fp_comparison_operator", {EQ, LE, LT, UNORDERED}}, \
1922 {"divmod_operator", {DIV, MOD, UDIV, UMOD}}, \
1923 {"const0_operand", {CONST_INT, CONST_DOUBLE, CONST_VECTOR}}, \
1924 {"samegp_function_operand", {SYMBOL_REF}}, \
1925 {"direct_call_operand", {SYMBOL_REF}}, \
1926 {"local_symbolic_operand", {SYMBOL_REF, CONST, LABEL_REF}}, \
1927 {"small_symbolic_operand", {SYMBOL_REF, CONST}}, \
1928 {"global_symbolic_operand", {SYMBOL_REF, CONST}}, \
1929 {"dtp16_symbolic_operand", {CONST}}, \
1930 {"dtp32_symbolic_operand", {CONST}}, \
1931 {"gotdtp_symbolic_operand", {CONST}}, \
1932 {"tp16_symbolic_operand", {CONST}}, \
1933 {"tp32_symbolic_operand", {CONST}}, \
1934 {"gottp_symbolic_operand", {CONST}}, \
1935 {"call_operand", {REG, SYMBOL_REF}}, \
1936 {"input_operand", {SUBREG, REG, MEM, CONST_INT, CONST_DOUBLE, \
1937 CONST_VECTOR, SYMBOL_REF, CONST, LABEL_REF, HIGH}},\
1938 {"some_operand", {SUBREG, REG, MEM, CONST_INT, CONST_DOUBLE, \
1939 CONST_VECTOR, SYMBOL_REF, CONST, LABEL_REF, HIGH}}, \
1940 {"some_ni_operand", {SUBREG, REG, MEM}}, \
1941 {"aligned_memory_operand", {MEM}}, \
1942 {"unaligned_memory_operand", {MEM}}, \
1943 {"reg_or_unaligned_mem_operand", {SUBREG, REG, MEM}}, \
1944 {"any_memory_operand", {MEM}}, \
1945 {"hard_fp_register_operand", {SUBREG, REG}}, \
1946 {"hard_int_register_operand", {SUBREG, REG}}, \
1947 {"reg_not_elim_operand", {SUBREG, REG}}, \
1948 {"reg_no_subreg_operand", {REG}}, \
1949 {"addition_operation", {PLUS}}, \
1950 {"symbolic_operand", {SYMBOL_REF, LABEL_REF, CONST}}, \
1951 {"some_small_symbolic_operand", {SET, PARALLEL, PREFETCH, UNSPEC, \
1954 /* Define the `__builtin_va_list' type for the ABI. */
1955 #define BUILD_VA_LIST_TYPE(VALIST) \
1956 (VALIST) = alpha_build_va_list ()
1958 /* Implement `va_start' for varargs and stdarg. */
1959 #define EXPAND_BUILTIN_VA_START(valist, nextarg) \
1960 alpha_va_start (valist, nextarg)
1962 /* Implement `va_arg'. */
1963 #define EXPAND_BUILTIN_VA_ARG(valist, type) \
1964 alpha_va_arg (valist, type)
1966 /* Tell collect that the object format is ECOFF. */
1967 #define OBJECT_FORMAT_COFF
1968 #define EXTENDED_COFF
1970 /* If we use NM, pass -g to it so it only lists globals. */
1971 #define NM_FLAGS "-pg"
1973 /* Definitions for debugging. */
1975 #define SDB_DEBUGGING_INFO 1 /* generate info for mips-tfile */
1976 #define DBX_DEBUGGING_INFO 1 /* generate embedded stabs */
1977 #define MIPS_DEBUGGING_INFO 1 /* MIPS specific debugging info */
1979 #ifndef PREFERRED_DEBUGGING_TYPE /* assume SDB_DEBUGGING_INFO */
1980 #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
1984 /* Correct the offset of automatic variables and arguments. Note that
1985 the Alpha debug format wants all automatic variables and arguments
1986 to be in terms of two different offsets from the virtual frame pointer,
1987 which is the stack pointer before any adjustment in the function.
1988 The offset for the argument pointer is fixed for the native compiler,
1989 it is either zero (for the no arguments case) or large enough to hold
1990 all argument registers.
1991 The offset for the auto pointer is the fourth argument to the .frame
1992 directive (local_offset).
1993 To stay compatible with the native tools we use the same offsets
1994 from the virtual frame pointer and adjust the debugger arg/auto offsets
1995 accordingly. These debugger offsets are set up in output_prolog. */
1997 extern long alpha_arg_offset;
1998 extern long alpha_auto_offset;
1999 #define DEBUGGER_AUTO_OFFSET(X) \
2000 ((GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0) + alpha_auto_offset)
2001 #define DEBUGGER_ARG_OFFSET(OFFSET, X) (OFFSET + alpha_arg_offset)
2004 #define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE) \
2005 alpha_output_lineno (STREAM, LINE)
2007 #define ASM_OUTPUT_SOURCE_FILENAME(STREAM, NAME) \
2008 alpha_output_filename (STREAM, NAME)
2010 /* mips-tfile.c limits us to strings of one page. We must underestimate this
2011 number, because the real length runs past this up to the next
2012 continuation point. This is really a dbxout.c bug. */
2013 #define DBX_CONTIN_LENGTH 3000
2015 /* By default, turn on GDB extensions. */
2016 #define DEFAULT_GDB_EXTENSIONS 1
2018 /* Stabs-in-ECOFF can't handle dbxout_function_end(). */
2019 #define NO_DBX_FUNCTION_END 1
2021 /* If we are smuggling stabs through the ALPHA ECOFF object
2022 format, put a comment in front of the .stab<x> operation so
2023 that the ALPHA assembler does not choke. The mips-tfile program
2024 will correctly put the stab into the object file. */
2026 #define ASM_STABS_OP ((TARGET_GAS) ? "\t.stabs\t" : " #.stabs\t")
2027 #define ASM_STABN_OP ((TARGET_GAS) ? "\t.stabn\t" : " #.stabn\t")
2028 #define ASM_STABD_OP ((TARGET_GAS) ? "\t.stabd\t" : " #.stabd\t")
2030 /* Forward references to tags are allowed. */
2031 #define SDB_ALLOW_FORWARD_REFERENCES
2033 /* Unknown tags are also allowed. */
2034 #define SDB_ALLOW_UNKNOWN_REFERENCES
2036 #define PUT_SDB_DEF(a) \
2038 fprintf (asm_out_file, "\t%s.def\t", \
2039 (TARGET_GAS) ? "" : "#"); \
2040 ASM_OUTPUT_LABELREF (asm_out_file, a); \
2041 fputc (';', asm_out_file); \
2044 #define PUT_SDB_PLAIN_DEF(a) \
2046 fprintf (asm_out_file, "\t%s.def\t.%s;", \
2047 (TARGET_GAS) ? "" : "#", (a)); \
2050 #define PUT_SDB_TYPE(a) \
2052 fprintf (asm_out_file, "\t.type\t0x%x;", (a)); \
2055 /* For block start and end, we create labels, so that
2056 later we can figure out where the correct offset is.
2057 The normal .ent/.end serve well enough for functions,
2058 so those are just commented out. */
2060 extern int sdb_label_count; /* block start/end next label # */
2062 #define PUT_SDB_BLOCK_START(LINE) \
2064 fprintf (asm_out_file, \
2065 "$Lb%d:\n\t%s.begin\t$Lb%d\t%d\n", \
2067 (TARGET_GAS) ? "" : "#", \
2070 sdb_label_count++; \
2073 #define PUT_SDB_BLOCK_END(LINE) \
2075 fprintf (asm_out_file, \
2076 "$Le%d:\n\t%s.bend\t$Le%d\t%d\n", \
2078 (TARGET_GAS) ? "" : "#", \
2081 sdb_label_count++; \
2084 #define PUT_SDB_FUNCTION_START(LINE)
2086 #define PUT_SDB_FUNCTION_END(LINE)
2088 #define PUT_SDB_EPILOGUE_END(NAME) ((void)(NAME))
2090 /* Macros for mips-tfile.c to encapsulate stabs in ECOFF, and for
2091 mips-tdump.c to print them out.
2093 These must match the corresponding definitions in gdb/mipsread.c.
2094 Unfortunately, gcc and gdb do not currently share any directories. */
2096 #define CODE_MASK 0x8F300
2097 #define MIPS_IS_STAB(sym) (((sym)->index & 0xFFF00) == CODE_MASK)
2098 #define MIPS_MARK_STAB(code) ((code)+CODE_MASK)
2099 #define MIPS_UNMARK_STAB(code) ((code)-CODE_MASK)
2101 /* Override some mips-tfile definitions. */
2103 #define SHASH_SIZE 511
2104 #define THASH_SIZE 55
2106 /* Align ecoff symbol tables to avoid OSF1/1.3 nm complaints. */
2108 #define ALIGN_SYMTABLE_OFFSET(OFFSET) (((OFFSET) + 7) & ~7)
2110 /* The system headers under Alpha systems are generally C++-aware. */
2111 #define NO_IMPLICIT_EXTERN_C
2113 /* Generate calls to memcpy, etc., not bcopy, etc. */
2114 #define TARGET_MEM_FUNCTIONS 1