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 that the processor is an EV5, EV56, or PCA56.
226 Unlike alpha_cpu this is not affected by -mtune= setting. */
227 #define MASK_CPU_EV5 (1 << 28)
228 #define TARGET_CPU_EV5 (target_flags & MASK_CPU_EV5)
230 /* Likewise for EV6. */
231 #define MASK_CPU_EV6 (1 << 29)
232 #define TARGET_CPU_EV6 (target_flags & MASK_CPU_EV6)
234 /* This means we support the .arch directive in the assembler. Only
235 defined in TARGET_CPU_DEFAULT. */
236 #define MASK_SUPPORT_ARCH (1 << 30)
237 #define TARGET_SUPPORT_ARCH (target_flags & MASK_SUPPORT_ARCH)
239 /* These are for target os support and cannot be changed at runtime. */
240 #define TARGET_ABI_WINDOWS_NT 0
241 #define TARGET_ABI_OPEN_VMS 0
242 #define TARGET_ABI_UNICOSMK 0
243 #define TARGET_ABI_OSF (!TARGET_ABI_WINDOWS_NT \
244 && !TARGET_ABI_OPEN_VMS \
245 && !TARGET_ABI_UNICOSMK)
247 #ifndef TARGET_AS_CAN_SUBTRACT_LABELS
248 #define TARGET_AS_CAN_SUBTRACT_LABELS TARGET_GAS
250 #ifndef TARGET_AS_SLASH_BEFORE_SUFFIX
251 #define TARGET_AS_SLASH_BEFORE_SUFFIX TARGET_GAS
253 #ifndef TARGET_CAN_FAULT_IN_PROLOGUE
254 #define TARGET_CAN_FAULT_IN_PROLOGUE 0
256 #ifndef TARGET_HAS_XFLOATING_LIBS
257 #define TARGET_HAS_XFLOATING_LIBS 0
259 #ifndef TARGET_PROFILING_NEEDS_GP
260 #define TARGET_PROFILING_NEEDS_GP 0
262 #ifndef TARGET_LD_BUGGY_LDGP
263 #define TARGET_LD_BUGGY_LDGP 0
265 #ifndef TARGET_FIXUP_EV5_PREFETCH
266 #define TARGET_FIXUP_EV5_PREFETCH 0
269 #define HAVE_AS_TLS 0
272 /* Macro to define tables used to set the flags.
273 This is a list in braces of pairs in braces,
274 each pair being { "NAME", VALUE }
275 where VALUE is the bits to set or minus the bits to clear.
276 An empty string NAME is used to identify the default VALUE. */
278 #define TARGET_SWITCHES \
279 { {"no-soft-float", MASK_FP, N_("Use hardware fp")}, \
280 {"soft-float", - MASK_FP, N_("Do not use hardware fp")}, \
281 {"fp-regs", MASK_FPREGS, N_("Use fp registers")}, \
282 {"no-fp-regs", - (MASK_FP|MASK_FPREGS), \
283 N_("Do not use fp registers")}, \
284 {"alpha-as", -MASK_GAS, N_("Do not assume GAS")}, \
285 {"gas", MASK_GAS, N_("Assume GAS")}, \
286 {"ieee-conformant", MASK_IEEE_CONFORMANT, \
287 N_("Request IEEE-conformant math library routines (OSF/1)")}, \
288 {"ieee", MASK_IEEE|MASK_IEEE_CONFORMANT, \
289 N_("Emit IEEE-conformant code, without inexact exceptions")}, \
290 {"ieee-with-inexact", MASK_IEEE_WITH_INEXACT|MASK_IEEE_CONFORMANT, \
291 N_("Emit IEEE-conformant code, with inexact exceptions")}, \
292 {"build-constants", MASK_BUILD_CONSTANTS, \
293 N_("Do not emit complex integer constants to read-only memory")}, \
294 {"float-vax", MASK_FLOAT_VAX, N_("Use VAX fp")}, \
295 {"float-ieee", -MASK_FLOAT_VAX, N_("Do not use VAX fp")}, \
296 {"bwx", MASK_BWX, N_("Emit code for the byte/word ISA extension")}, \
297 {"no-bwx", -MASK_BWX, ""}, \
299 N_("Emit code for the motion video ISA extension")}, \
300 {"no-max", -MASK_MAX, ""}, \
302 N_("Emit code for the fp move and sqrt ISA extension")}, \
303 {"no-fix", -MASK_FIX, ""}, \
304 {"cix", MASK_CIX, N_("Emit code for the counting ISA extension")}, \
305 {"no-cix", -MASK_CIX, ""}, \
306 {"explicit-relocs", MASK_EXPLICIT_RELOCS, \
307 N_("Emit code using explicit relocation directives")}, \
308 {"no-explicit-relocs", -MASK_EXPLICIT_RELOCS, ""}, \
309 {"small-data", MASK_SMALL_DATA, \
310 N_("Emit 16-bit relocations to the small data areas")}, \
311 {"large-data", -MASK_SMALL_DATA, \
312 N_("Emit 32-bit relocations to the small data areas")}, \
313 {"tls-kernel", MASK_TLS_KERNEL, \
314 N_("Emit rdval instead of rduniq for thread pointer")}, \
315 {"", TARGET_DEFAULT | TARGET_CPU_DEFAULT \
316 | TARGET_DEFAULT_EXPLICIT_RELOCS, ""} }
318 #define TARGET_DEFAULT MASK_FP|MASK_FPREGS
320 #ifndef TARGET_CPU_DEFAULT
321 #define TARGET_CPU_DEFAULT 0
324 #ifndef TARGET_DEFAULT_EXPLICIT_RELOCS
325 #ifdef HAVE_AS_EXPLICIT_RELOCS
326 #define TARGET_DEFAULT_EXPLICIT_RELOCS MASK_EXPLICIT_RELOCS
328 #define TARGET_DEFAULT_EXPLICIT_RELOCS 0
332 extern const char *alpha_cpu_string; /* For -mcpu= */
333 extern const char *alpha_tune_string; /* For -mtune= */
334 extern const char *alpha_fprm_string; /* For -mfp-rounding-mode=[n|m|c|d] */
335 extern const char *alpha_fptm_string; /* For -mfp-trap-mode=[n|u|su|sui] */
336 extern const char *alpha_tp_string; /* For -mtrap-precision=[p|f|i] */
337 extern const char *alpha_mlat_string; /* For -mmemory-latency= */
338 extern const char *alpha_tls_size_string; /* For -mtls-size= */
340 #define TARGET_OPTIONS \
342 {"cpu=", &alpha_cpu_string, \
343 N_("Use features of and schedule given CPU")}, \
344 {"tune=", &alpha_tune_string, \
345 N_("Schedule given CPU")}, \
346 {"fp-rounding-mode=", &alpha_fprm_string, \
347 N_("Control the generated fp rounding mode")}, \
348 {"fp-trap-mode=", &alpha_fptm_string, \
349 N_("Control the IEEE trap mode")}, \
350 {"trap-precision=", &alpha_tp_string, \
351 N_("Control the precision given to fp exceptions")}, \
352 {"memory-latency=", &alpha_mlat_string, \
353 N_("Tune expected memory latency")}, \
354 {"tls-size=", &alpha_tls_size_string, \
355 N_("Specify bit size of immediate TLS offsets")}, \
358 /* This macro defines names of additional specifications to put in the
359 specs that can be used in various specifications like CC1_SPEC. Its
360 definition is an initializer with a subgrouping for each command option.
362 Each subgrouping contains a string constant, that defines the
363 specification name, and a string constant that used by the GNU CC driver
366 Do not define this macro if it does not need to do anything. */
368 #ifndef SUBTARGET_EXTRA_SPECS
369 #define SUBTARGET_EXTRA_SPECS
372 #define EXTRA_SPECS \
373 { "cpp_subtarget", CPP_SUBTARGET_SPEC }, \
374 SUBTARGET_EXTRA_SPECS
377 /* Sometimes certain combinations of command options do not make sense
378 on a particular target machine. You can define a macro
379 `OVERRIDE_OPTIONS' to take account of this. This macro, if
380 defined, is executed once just after all the command options have
383 On the Alpha, it is used to translate target-option strings into
386 #define OVERRIDE_OPTIONS override_options ()
389 /* Define this macro to change register usage conditional on target flags.
391 On the Alpha, we use this to disable the floating-point registers when
394 #define CONDITIONAL_REGISTER_USAGE \
397 if (! TARGET_FPREGS) \
398 for (i = 32; i < 63; i++) \
399 fixed_regs[i] = call_used_regs[i] = 1; \
403 /* Show we can debug even without a frame pointer. */
404 #define CAN_DEBUG_WITHOUT_FP
406 /* target machine storage layout */
408 /* Define the size of `int'. The default is the same as the word size. */
409 #define INT_TYPE_SIZE 32
411 /* Define the size of `long long'. The default is the twice the word size. */
412 #define LONG_LONG_TYPE_SIZE 64
414 /* We're IEEE unless someone says to use VAX. */
415 #define TARGET_FLOAT_FORMAT \
416 (TARGET_FLOAT_VAX ? VAX_FLOAT_FORMAT : IEEE_FLOAT_FORMAT)
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. */
422 #define FLOAT_TYPE_SIZE 32
423 #define DOUBLE_TYPE_SIZE 64
424 #define LONG_DOUBLE_TYPE_SIZE 64
426 #define WCHAR_TYPE "unsigned int"
427 #define WCHAR_TYPE_SIZE 32
429 /* Define this macro if it is advisable to hold scalars in registers
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.
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. */
438 #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
439 if (GET_MODE_CLASS (MODE) == MODE_INT \
440 && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
442 if ((MODE) == SImode) \
447 /* Define this if function arguments should also be promoted using the above
450 #define PROMOTE_FUNCTION_ARGS
452 /* Likewise, if the function return value is promoted. */
454 #define PROMOTE_FUNCTION_RETURN
456 /* Define this if most significant bit is lowest numbered
457 in instructions that operate on numbered bit-fields.
459 There are no such instructions on the Alpha, but the documentation
461 #define BITS_BIG_ENDIAN 0
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
467 /* Define this if most significant word of a multiword number is lowest
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
474 /* Width of a word, in units (bytes). */
475 #define UNITS_PER_WORD 8
477 /* Width in bits of a pointer.
478 See also the macro `Pmode' defined below. */
479 #define POINTER_SIZE 64
481 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
482 #define PARM_BOUNDARY 64
484 /* Boundary (in *bits*) on which stack pointer should be aligned. */
485 #define STACK_BOUNDARY 64
487 /* Allocation boundary (in *bits*) for the code of a function. */
488 #define FUNCTION_BOUNDARY 32
490 /* Alignment of field after `int : 0' in a structure. */
491 #define EMPTY_FIELD_BOUNDARY 64
493 /* Every structure's size must be a multiple of this. */
494 #define STRUCTURE_SIZE_BOUNDARY 8
496 /* A bit-field declared as `int' forces `int' alignment for the struct. */
497 #define PCC_BITFIELD_TYPE_MATTERS 1
499 /* No data type wants to be aligned rounder than this. */
500 #define BIGGEST_ALIGNMENT 128
502 /* For atomic access to objects, must have at least 32-bit alignment
503 unless the machine has byte operations. */
504 #define MINIMUM_ATOMIC_ALIGNMENT ((unsigned int) (TARGET_BWX ? 8 : 32))
506 /* Align all constants and variables to at least a word boundary so
507 we can pick up pieces of them faster. */
508 /* ??? Only if block-move stuff knows about different source/destination
511 #define CONSTANT_ALIGNMENT(EXP, ALIGN) MAX ((ALIGN), BITS_PER_WORD)
512 #define DATA_ALIGNMENT(EXP, ALIGN) MAX ((ALIGN), BITS_PER_WORD)
515 /* Set this nonzero if move instructions will actually fail to work
516 when given unaligned data.
518 Since we get an error message when we do one, call them invalid. */
520 #define STRICT_ALIGNMENT 1
522 /* Set this nonzero if unaligned move instructions are extremely slow.
524 On the Alpha, they trap. */
526 #define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) 1
528 /* Standard register usage. */
530 /* Number of actual hardware registers.
531 The hardware registers are assigned numbers for the compiler
532 from 0 to just below FIRST_PSEUDO_REGISTER.
533 All registers that the compiler knows about must be given numbers,
534 even those that are not normally considered general registers.
536 We define all 32 integer registers, even though $31 is always zero,
537 and all 32 floating-point registers, even though $f31 is also
538 always zero. We do not bother defining the FP status register and
539 there are no other registers.
541 Since $31 is always zero, we will use register number 31 as the
542 argument pointer. It will never appear in the generated code
543 because we will always be eliminating it in favor of the stack
544 pointer or hardware frame pointer.
546 Likewise, we use $f31 for the frame pointer, which will always
547 be eliminated in favor of the hardware frame pointer or the
550 #define FIRST_PSEUDO_REGISTER 64
552 /* 1 for registers that have pervasive standard uses
553 and are not available for the register allocator. */
555 #define FIXED_REGISTERS \
556 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
557 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, \
558 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
559 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }
561 /* 1 for registers not available across function calls.
562 These must include the FIXED_REGISTERS and also any
563 registers that can be used without being saved.
564 The latter must include the registers where values are returned
565 and the register where structure-value addresses are passed.
566 Aside from that, you can include as many other registers as you like. */
567 #define CALL_USED_REGISTERS \
568 {1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, \
569 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, \
570 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
571 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
573 /* List the order in which to allocate registers. Each register must be
574 listed once, even those in FIXED_REGISTERS.
576 We allocate in the following order:
577 $f10-$f15 (nonsaved floating-point register)
579 $f21-$f16 (likewise, but input args)
580 $f0 (nonsaved, but return value)
581 $f1 (nonsaved, but immediate before saved)
582 $f2-$f9 (saved floating-point registers)
583 $1-$8 (nonsaved integer registers)
586 $0 (likewise, but return value)
587 $21-$16 (likewise, but input args)
588 $27 (procedure value in OSF, nonsaved in NT)
589 $9-$14 (saved integer registers)
593 $30, $31, $f31 (stack pointer and always zero/ap & fp) */
595 #define REG_ALLOC_ORDER \
596 {42, 43, 44, 45, 46, 47, \
597 54, 55, 56, 57, 58, 59, 60, 61, 62, \
598 53, 52, 51, 50, 49, 48, \
600 34, 35, 36, 37, 38, 39, 40, 41, \
601 1, 2, 3, 4, 5, 6, 7, 8, \
605 21, 20, 19, 18, 17, 16, \
607 9, 10, 11, 12, 13, 14, \
613 /* Return number of consecutive hard regs needed starting at reg REGNO
614 to hold something of mode MODE.
615 This is ordinarily the length in words of a value of mode MODE
616 but can be less for certain modes in special long registers. */
618 #define HARD_REGNO_NREGS(REGNO, MODE) \
619 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
621 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
622 On Alpha, the integer registers can hold any mode. The floating-point
623 registers can hold 32-bit and 64-bit integers as well, but not 16-bit
626 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
627 ((REGNO) >= 32 && (REGNO) <= 62 \
628 ? GET_MODE_UNIT_SIZE (MODE) == 8 || GET_MODE_UNIT_SIZE (MODE) == 4 \
631 /* Value is 1 if MODE is a supported vector mode. */
633 #define VECTOR_MODE_SUPPORTED_P(MODE) \
635 && ((MODE) == V8QImode || (MODE) == V4HImode || (MODE) == V2SImode))
637 /* A C expression that is nonzero if a value of mode
638 MODE1 is accessible in mode MODE2 without copying.
640 This asymmetric test is true when MODE1 could be put
641 in an FP register but MODE2 could not. */
643 #define MODES_TIEABLE_P(MODE1, MODE2) \
644 (HARD_REGNO_MODE_OK (32, (MODE1)) \
645 ? HARD_REGNO_MODE_OK (32, (MODE2)) \
648 /* Specify the registers used for certain standard purposes.
649 The values of these macros are register numbers. */
651 /* Alpha pc isn't overloaded on a register that the compiler knows about. */
652 /* #define PC_REGNUM */
654 /* Register to use for pushing function arguments. */
655 #define STACK_POINTER_REGNUM 30
657 /* Base register for access to local variables of the function. */
658 #define HARD_FRAME_POINTER_REGNUM 15
660 /* Value should be nonzero if functions must have frame pointers.
661 Zero means the frame pointer need not be set up (and parms
662 may be accessed via the stack pointer) in functions that seem suitable.
663 This is computed in `reload', in reload1.c. */
664 #define FRAME_POINTER_REQUIRED 0
666 /* Base register for access to arguments of the function. */
667 #define ARG_POINTER_REGNUM 31
669 /* Base register for access to local variables of function. */
670 #define FRAME_POINTER_REGNUM 63
672 /* Register in which static-chain is passed to a function.
674 For the Alpha, this is based on an example; the calling sequence
675 doesn't seem to specify this. */
676 #define STATIC_CHAIN_REGNUM 1
678 /* The register number of the register used to address a table of
679 static data addresses in memory. */
680 #define PIC_OFFSET_TABLE_REGNUM 29
682 /* Define this macro if the register defined by `PIC_OFFSET_TABLE_REGNUM'
683 is clobbered by calls. */
684 /* ??? It is and it isn't. It's required to be valid for a given
685 function when the function returns. It isn't clobbered by
686 current_file functions. Moreover, we do not expose the ldgp
687 until after reload, so we're probably safe. */
688 /* #define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED */
690 /* Register in which address to store a structure value
691 arrives in the function. On the Alpha, the address is passed
692 as a hidden argument. */
693 #define STRUCT_VALUE 0
695 /* Define the classes of registers for register constraints in the
696 machine description. Also define ranges of constants.
698 One of the classes must always be named ALL_REGS and include all hard regs.
699 If there is more than one class, another class must be named NO_REGS
700 and contain no registers.
702 The name GENERAL_REGS must be the name of a class (or an alias for
703 another name such as ALL_REGS). This is the class of registers
704 that is allowed by "g" or "r" in a register constraint.
705 Also, registers outside this class are allocated only when
706 instructions express preferences for them.
708 The classes must be numbered in nondecreasing order; that is,
709 a larger-numbered class must never be contained completely
710 in a smaller-numbered class.
712 For any two classes, it is very desirable that there be another
713 class that represents their union. */
716 NO_REGS, R0_REG, R24_REG, R25_REG, R27_REG,
717 GENERAL_REGS, FLOAT_REGS, ALL_REGS,
721 #define N_REG_CLASSES (int) LIM_REG_CLASSES
723 /* Give names of register classes as strings for dump file. */
725 #define REG_CLASS_NAMES \
726 {"NO_REGS", "R0_REG", "R24_REG", "R25_REG", "R27_REG", \
727 "GENERAL_REGS", "FLOAT_REGS", "ALL_REGS" }
729 /* Define which registers fit in which classes.
730 This is an initializer for a vector of HARD_REG_SET
731 of length N_REG_CLASSES. */
733 #define REG_CLASS_CONTENTS \
734 { {0x00000000, 0x00000000}, /* NO_REGS */ \
735 {0x00000001, 0x00000000}, /* R0_REG */ \
736 {0x01000000, 0x00000000}, /* R24_REG */ \
737 {0x02000000, 0x00000000}, /* R25_REG */ \
738 {0x08000000, 0x00000000}, /* R27_REG */ \
739 {0xffffffff, 0x80000000}, /* GENERAL_REGS */ \
740 {0x00000000, 0x7fffffff}, /* FLOAT_REGS */ \
741 {0xffffffff, 0xffffffff} }
743 /* The same information, inverted:
744 Return the class number of the smallest class containing
745 reg number REGNO. This could be a conditional expression
746 or could index an array. */
748 #define REGNO_REG_CLASS(REGNO) \
749 ((REGNO) == 0 ? R0_REG \
750 : (REGNO) == 24 ? R24_REG \
751 : (REGNO) == 25 ? R25_REG \
752 : (REGNO) == 27 ? R27_REG \
753 : (REGNO) >= 32 && (REGNO) <= 62 ? FLOAT_REGS \
756 /* The class value for index registers, and the one for base regs. */
757 #define INDEX_REG_CLASS NO_REGS
758 #define BASE_REG_CLASS GENERAL_REGS
760 /* Get reg_class from a letter such as appears in the machine description. */
762 #define REG_CLASS_FROM_LETTER(C) \
763 ((C) == 'a' ? R24_REG \
764 : (C) == 'b' ? R25_REG \
765 : (C) == 'c' ? R27_REG \
766 : (C) == 'f' ? FLOAT_REGS \
767 : (C) == 'v' ? R0_REG \
770 /* Define this macro to change register usage conditional on target flags. */
771 /* #define CONDITIONAL_REGISTER_USAGE */
773 /* The letters I, J, K, L, M, N, O, and P in a register constraint string
774 can be used to stand for particular ranges of immediate operands.
775 This macro defines what the ranges are.
776 C is the letter, and VALUE is a constant value.
777 Return 1 if VALUE is in the range specified by C.
780 `I' is used for the range of constants most insns can contain.
781 `J' is the constant zero.
782 `K' is used for the constant in an LDA insn.
783 `L' is used for the constant in a LDAH insn.
784 `M' is used for the constants that can be AND'ed with using a ZAP insn.
785 `N' is used for complemented 8-bit constants.
786 `O' is used for negated 8-bit constants.
787 `P' is used for the constants 1, 2 and 3. */
789 #define CONST_OK_FOR_LETTER_P alpha_const_ok_for_letter_p
791 /* Similar, but for floating or large integer constants, and defining letters
792 G and H. Here VALUE is the CONST_DOUBLE rtx itself.
794 For Alpha, `G' is the floating-point constant zero. `H' is a CONST_DOUBLE
795 that is the operand of a ZAP insn. */
797 #define CONST_DOUBLE_OK_FOR_LETTER_P alpha_const_double_ok_for_letter_p
799 /* Optional extra constraints for this machine.
801 For the Alpha, `Q' means that this is a memory operand but not a
802 reference to an unaligned location.
804 `R' is a SYMBOL_REF that has SYMBOL_REF_FLAG set or is the current
807 'S' is a 6-bit constant (valid for a shift insn).
811 'U' is a symbolic operand.
813 'W' is a vector zero. */
815 #define EXTRA_CONSTRAINT alpha_extra_constraint
817 /* Given an rtx X being reloaded into a reg required to be
818 in class CLASS, return the class of reg to actually use.
819 In general this is just CLASS; but on some machines
820 in some cases it is preferable to use a more restrictive class. */
822 #define PREFERRED_RELOAD_CLASS alpha_preferred_reload_class
824 /* Loading and storing HImode or QImode values to and from memory
825 usually requires a scratch register. The exceptions are loading
826 QImode and HImode from an aligned address to a general register
827 unless byte instructions are permitted.
828 We also cannot load an unaligned address or a paradoxical SUBREG into an
831 #define SECONDARY_INPUT_RELOAD_CLASS(CLASS,MODE,IN) \
832 secondary_reload_class((CLASS), (MODE), (IN), 1)
834 #define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS,MODE,OUT) \
835 secondary_reload_class((CLASS), (MODE), (OUT), 0)
837 /* If we are copying between general and FP registers, we need a memory
838 location unless the FIX extension is available. */
840 #define SECONDARY_MEMORY_NEEDED(CLASS1,CLASS2,MODE) \
841 (! TARGET_FIX && (((CLASS1) == FLOAT_REGS && (CLASS2) != FLOAT_REGS) \
842 || ((CLASS2) == FLOAT_REGS && (CLASS1) != FLOAT_REGS)))
844 /* Specify the mode to be used for memory when a secondary memory
845 location is needed. If MODE is floating-point, use it. Otherwise,
846 widen to a word like the default. This is needed because we always
847 store integers in FP registers in quadword format. This whole
848 area is very tricky! */
849 #define SECONDARY_MEMORY_NEEDED_MODE(MODE) \
850 (GET_MODE_CLASS (MODE) == MODE_FLOAT ? (MODE) \
851 : GET_MODE_SIZE (MODE) >= 4 ? (MODE) \
852 : mode_for_size (BITS_PER_WORD, GET_MODE_CLASS (MODE), 0))
854 /* Return the maximum number of consecutive registers
855 needed to represent mode MODE in a register of class CLASS. */
857 #define CLASS_MAX_NREGS(CLASS, MODE) \
858 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
860 /* If defined, gives a class of registers that cannot be used as the
861 operand of a SUBREG that changes the mode of the object illegally. */
863 #define CLASS_CANNOT_CHANGE_MODE FLOAT_REGS
865 /* Defines illegal mode changes for CLASS_CANNOT_CHANGE_MODE. */
867 #define CLASS_CANNOT_CHANGE_MODE_P(FROM,TO) \
868 (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO))
870 /* Define the cost of moving between registers of various classes. Moving
871 between FLOAT_REGS and anything else except float regs is expensive.
872 In fact, we make it quite expensive because we really don't want to
873 do these moves unless it is clearly worth it. Optimizations may
874 reduce the impact of not being able to allocate a pseudo to a
877 #define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \
878 (((CLASS1) == FLOAT_REGS) == ((CLASS2) == FLOAT_REGS) \
880 : TARGET_FIX ? 3 : 4+2*alpha_memory_latency)
882 /* A C expressions returning the cost of moving data of MODE from a register to
885 On the Alpha, bump this up a bit. */
887 extern int alpha_memory_latency;
888 #define MEMORY_MOVE_COST(MODE,CLASS,IN) (2*alpha_memory_latency)
890 /* Provide the cost of a branch. Exact meaning under development. */
891 #define BRANCH_COST 5
893 /* Stack layout; function entry, exit and calling. */
895 /* Define this if pushing a word on the stack
896 makes the stack pointer a smaller address. */
897 #define STACK_GROWS_DOWNWARD
899 /* Define this if the nominal address of the stack frame
900 is at the high-address end of the local variables;
901 that is, each additional local variable allocated
902 goes at a more negative offset in the frame. */
903 /* #define FRAME_GROWS_DOWNWARD */
905 /* Offset within stack frame to start allocating local variables at.
906 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
907 first local allocated. Otherwise, it is the offset to the BEGINNING
908 of the first local allocated. */
910 #define STARTING_FRAME_OFFSET 0
912 /* If we generate an insn to push BYTES bytes,
913 this says how many the stack pointer really advances by.
914 On Alpha, don't define this because there are no push insns. */
915 /* #define PUSH_ROUNDING(BYTES) */
917 /* Define this to be nonzero if stack checking is built into the ABI. */
918 #define STACK_CHECK_BUILTIN 1
920 /* Define this if the maximum size of all the outgoing args is to be
921 accumulated and pushed during the prologue. The amount can be
922 found in the variable current_function_outgoing_args_size. */
923 #define ACCUMULATE_OUTGOING_ARGS 1
925 /* Offset of first parameter from the argument pointer register value. */
927 #define FIRST_PARM_OFFSET(FNDECL) 0
929 /* Definitions for register eliminations.
931 We have two registers that can be eliminated on the Alpha. First, the
932 frame pointer register can often be eliminated in favor of the stack
933 pointer register. Secondly, the argument pointer register can always be
934 eliminated; it is replaced with either the stack or frame pointer. */
936 /* This is an array of structures. Each structure initializes one pair
937 of eliminable registers. The "from" register number is given first,
938 followed by "to". Eliminations of the same "from" register are listed
939 in order of preference. */
941 #define ELIMINABLE_REGS \
942 {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
943 { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \
944 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
945 { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}}
947 /* Given FROM and TO register numbers, say whether this elimination is allowed.
948 Frame pointer elimination is automatically handled.
950 All eliminations are valid since the cases where FP can't be
951 eliminated are already handled. */
953 #define CAN_ELIMINATE(FROM, TO) 1
955 /* Round up to a multiple of 16 bytes. */
956 #define ALPHA_ROUND(X) (((X) + 15) & ~ 15)
958 /* Define the offset between two registers, one to be eliminated, and the other
959 its replacement, at the start of a routine. */
960 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
961 { if ((FROM) == FRAME_POINTER_REGNUM) \
962 (OFFSET) = (ALPHA_ROUND (current_function_outgoing_args_size) \
963 + alpha_sa_size ()); \
964 else if ((FROM) == ARG_POINTER_REGNUM) \
965 (OFFSET) = (ALPHA_ROUND (current_function_outgoing_args_size) \
967 + (ALPHA_ROUND (get_frame_size () \
968 + current_function_pretend_args_size) \
969 - current_function_pretend_args_size)); \
974 /* Define this if stack space is still allocated for a parameter passed
976 /* #define REG_PARM_STACK_SPACE */
978 /* Value is the number of bytes of arguments automatically
979 popped when returning from a subroutine call.
980 FUNDECL is the declaration node of the function (as a tree),
981 FUNTYPE is the data type of the function (as a tree),
982 or for a library call it is an identifier node for the subroutine name.
983 SIZE is the number of bytes of arguments passed on the stack. */
985 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
987 /* Define how to find the value returned by a function.
988 VALTYPE is the data type of the value (as a tree).
989 If the precise function being called is known, FUNC is its FUNCTION_DECL;
990 otherwise, FUNC is 0.
992 On Alpha the value is found in $0 for integer functions and
993 $f0 for floating-point functions. */
995 #define FUNCTION_VALUE(VALTYPE, FUNC) \
996 gen_rtx_REG (((INTEGRAL_TYPE_P (VALTYPE) \
997 && TYPE_PRECISION (VALTYPE) < BITS_PER_WORD) \
998 || POINTER_TYPE_P (VALTYPE)) \
999 ? word_mode : TYPE_MODE (VALTYPE), \
1001 && (TREE_CODE (VALTYPE) == REAL_TYPE \
1002 || TREE_CODE (VALTYPE) == COMPLEX_TYPE)) \
1005 /* Define how to find the value returned by a library function
1006 assuming the value has mode MODE. */
1008 #define LIBCALL_VALUE(MODE) \
1009 gen_rtx_REG (MODE, \
1011 && (GET_MODE_CLASS (MODE) == MODE_FLOAT \
1012 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) \
1015 /* The definition of this macro implies that there are cases where
1016 a scalar value cannot be returned in registers.
1018 For the Alpha, any structure or union type is returned in memory, as
1019 are integers whose size is larger than 64 bits. */
1021 #define RETURN_IN_MEMORY(TYPE) \
1022 (TYPE_MODE (TYPE) == BLKmode \
1023 || TYPE_MODE (TYPE) == TFmode \
1024 || TYPE_MODE (TYPE) == TCmode \
1025 || (TREE_CODE (TYPE) == INTEGER_TYPE && TYPE_PRECISION (TYPE) > 64))
1027 /* 1 if N is a possible register number for a function value
1028 as seen by the caller. */
1030 #define FUNCTION_VALUE_REGNO_P(N) \
1031 ((N) == 0 || (N) == 1 || (N) == 32 || (N) == 33)
1033 /* 1 if N is a possible register number for function argument passing.
1034 On Alpha, these are $16-$21 and $f16-$f21. */
1036 #define FUNCTION_ARG_REGNO_P(N) \
1037 (((N) >= 16 && (N) <= 21) || ((N) >= 16 + 32 && (N) <= 21 + 32))
1039 /* Define a data type for recording info about an argument list
1040 during the scan of that argument list. This data type should
1041 hold all necessary information about the function itself
1042 and about the args processed so far, enough to enable macros
1043 such as FUNCTION_ARG to determine where the next arg should go.
1045 On Alpha, this is a single integer, which is a number of words
1046 of arguments scanned so far.
1047 Thus 6 or more means all following args should go on the stack. */
1049 #define CUMULATIVE_ARGS int
1051 /* Initialize a variable CUM of type CUMULATIVE_ARGS
1052 for a call to a function whose data type is FNTYPE.
1053 For a library call, FNTYPE is 0. */
1055 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) (CUM) = 0
1057 /* Define intermediate macro to compute the size (in registers) of an argument
1060 #define ALPHA_ARG_SIZE(MODE, TYPE, NAMED) \
1061 ((MODE) == TFmode || (MODE) == TCmode ? 1 \
1062 : (((MODE) == BLKmode ? int_size_in_bytes (TYPE) : GET_MODE_SIZE (MODE)) \
1063 + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
1065 /* Update the data in CUM to advance over an argument
1066 of mode MODE and data type TYPE.
1067 (TYPE is null for libcalls where that information may not be available.) */
1069 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
1070 if (MUST_PASS_IN_STACK (MODE, TYPE)) \
1073 (CUM) += ALPHA_ARG_SIZE (MODE, TYPE, NAMED)
1075 /* Determine where to put an argument to a function.
1076 Value is zero to push the argument on the stack,
1077 or a hard register in which to store the argument.
1079 MODE is the argument's machine mode.
1080 TYPE is the data type of the argument (as a tree).
1081 This is null for libcalls where that information may
1083 CUM is a variable of type CUMULATIVE_ARGS which gives info about
1084 the preceding args and about the function being called.
1085 NAMED is nonzero if this argument is a named parameter
1086 (otherwise it is an extra parameter matching an ellipsis).
1088 On Alpha the first 6 words of args are normally in registers
1089 and the rest are pushed. */
1091 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
1092 function_arg((CUM), (MODE), (TYPE), (NAMED))
1094 /* A C expression that indicates when an argument must be passed by
1095 reference. If nonzero for an argument, a copy of that argument is
1096 made in memory and a pointer to the argument is passed instead of
1097 the argument itself. The pointer is passed in whatever way is
1098 appropriate for passing a pointer to that type. */
1100 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
1101 ((MODE) == TFmode || (MODE) == TCmode)
1103 /* Specify the padding direction of arguments.
1105 On the Alpha, we must pad upwards in order to be able to pass args in
1108 #define FUNCTION_ARG_PADDING(MODE, TYPE) upward
1110 /* For an arg passed partly in registers and partly in memory,
1111 this is the number of registers used.
1112 For args passed entirely in registers or entirely in memory, zero. */
1114 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
1115 ((CUM) < 6 && 6 < (CUM) + ALPHA_ARG_SIZE (MODE, TYPE, NAMED) \
1118 /* Perform any needed actions needed for a function that is receiving a
1119 variable number of arguments.
1123 MODE and TYPE are the mode and type of the current parameter.
1125 PRETEND_SIZE is a variable that should be set to the amount of stack
1126 that must be pushed by the prolog to pretend that our caller pushed
1129 Normally, this macro will push all remaining incoming registers on the
1130 stack and set PRETEND_SIZE to the length of the registers pushed.
1132 On the Alpha, we allocate space for all 12 arg registers, but only
1133 push those that are remaining.
1135 However, if NO registers need to be saved, don't allocate any space.
1136 This is not only because we won't need the space, but because AP includes
1137 the current_pretend_args_size and we don't want to mess up any
1138 ap-relative addresses already made.
1140 If we are not to use the floating-point registers, save the integer
1141 registers where we would put the floating-point registers. This is
1142 not the most efficient way to implement varargs with just one register
1143 class, but it isn't worth doing anything more efficient in this rare
1146 #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
1151 rtx tmp; int set = get_varargs_alias_set (); \
1152 tmp = gen_rtx_MEM (BLKmode, \
1153 plus_constant (virtual_incoming_args_rtx, \
1154 ((CUM) + 6)* UNITS_PER_WORD)); \
1155 set_mem_alias_set (tmp, set); \
1156 move_block_from_reg \
1158 6 - (CUM), (6 - (CUM)) * UNITS_PER_WORD); \
1160 tmp = gen_rtx_MEM (BLKmode, \
1161 plus_constant (virtual_incoming_args_rtx, \
1162 (CUM) * UNITS_PER_WORD)); \
1163 set_mem_alias_set (tmp, set); \
1164 move_block_from_reg \
1165 (16 + (TARGET_FPREGS ? 32 : 0) + CUM, tmp, \
1166 6 - (CUM), (6 - (CUM)) * UNITS_PER_WORD); \
1168 PRETEND_SIZE = 12 * UNITS_PER_WORD; \
1172 /* We do not allow indirect calls to be optimized into sibling calls, nor
1173 can we allow a call to a function in a different compilation unit to
1174 be optimized into a sibcall. */
1175 #define FUNCTION_OK_FOR_SIBCALL(DECL) \
1177 && (! TREE_PUBLIC (DECL) \
1178 || (TREE_ASM_WRITTEN (DECL) && (*targetm.binds_local_p) (DECL))))
1180 /* Try to output insns to set TARGET equal to the constant C if it can be
1181 done in less than N insns. Do all computations in MODE. Returns the place
1182 where the output has been placed if it can be done and the insns have been
1183 emitted. If it would take more than N insns, zero is returned and no
1184 insns and emitted. */
1186 /* Define the information needed to generate branch and scc insns. This is
1187 stored from the compare operation. Note that we can't use "rtx" here
1188 since it hasn't been defined! */
1190 struct alpha_compare
1192 struct rtx_def *op0, *op1;
1196 extern struct alpha_compare alpha_compare;
1198 /* Make (or fake) .linkage entry for function call.
1199 IS_LOCAL is 0 if name is used in call, 1 if name is used in definition. */
1201 /* This macro defines the start of an assembly comment. */
1203 #define ASM_COMMENT_START " #"
1205 /* This macro produces the initial definition of a function. */
1207 #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
1208 alpha_start_function(FILE,NAME,DECL);
1210 /* This macro closes up a function definition for the assembler. */
1212 #define ASM_DECLARE_FUNCTION_SIZE(FILE,NAME,DECL) \
1213 alpha_end_function(FILE,NAME,DECL)
1215 /* Output any profiling code before the prologue. */
1217 #define PROFILE_BEFORE_PROLOGUE 1
1219 /* Output assembler code to FILE to increment profiler label # LABELNO
1220 for profiling a function entry. Under OSF/1, profiling is enabled
1221 by simply passing -pg to the assembler and linker. */
1223 #define FUNCTION_PROFILER(FILE, LABELNO)
1225 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
1226 the stack pointer does not matter. The value is tested only in
1227 functions that have frame pointers.
1228 No definition is equivalent to always zero. */
1230 #define EXIT_IGNORE_STACK 1
1232 /* Define registers used by the epilogue and return instruction. */
1234 #define EPILOGUE_USES(REGNO) ((REGNO) == 26)
1236 /* Output assembler code for a block containing the constant parts
1237 of a trampoline, leaving space for the variable parts.
1239 The trampoline should set the static chain pointer to value placed
1240 into the trampoline and should branch to the specified routine.
1241 Note that $27 has been set to the address of the trampoline, so we can
1242 use it for addressability of the two data items. */
1244 #define TRAMPOLINE_TEMPLATE(FILE) \
1246 fprintf (FILE, "\tldq $1,24($27)\n"); \
1247 fprintf (FILE, "\tldq $27,16($27)\n"); \
1248 fprintf (FILE, "\tjmp $31,($27),0\n"); \
1249 fprintf (FILE, "\tnop\n"); \
1250 fprintf (FILE, "\t.quad 0,0\n"); \
1253 /* Section in which to place the trampoline. On Alpha, instructions
1254 may only be placed in a text segment. */
1256 #define TRAMPOLINE_SECTION text_section
1258 /* Length in units of the trampoline for entering a nested function. */
1260 #define TRAMPOLINE_SIZE 32
1262 /* The alignment of a trampoline, in bits. */
1264 #define TRAMPOLINE_ALIGNMENT 64
1266 /* Emit RTL insns to initialize the variable parts of a trampoline.
1267 FNADDR is an RTX for the address of the function's pure code.
1268 CXT is an RTX for the static chain value for the function. */
1270 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
1271 alpha_initialize_trampoline (TRAMP, FNADDR, CXT, 16, 24, 8)
1273 /* A C expression whose value is RTL representing the value of the return
1274 address for the frame COUNT steps up from the current frame.
1275 FRAMEADDR is the frame pointer of the COUNT frame, or the frame pointer of
1276 the COUNT-1 frame if RETURN_ADDR_IN_PREVIOUS_FRAME is defined. */
1278 #define RETURN_ADDR_RTX alpha_return_addr
1280 /* Before the prologue, RA lives in $26. */
1281 #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, 26)
1282 #define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (26)
1284 /* Describe how we implement __builtin_eh_return. */
1285 #define EH_RETURN_DATA_REGNO(N) ((N) < 4 ? (N) + 16 : INVALID_REGNUM)
1286 #define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, 28)
1287 #define EH_RETURN_HANDLER_RTX \
1288 gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx, \
1289 current_function_outgoing_args_size))
1291 /* Addressing modes, and classification of registers for them. */
1293 /* #define HAVE_POST_INCREMENT 0 */
1294 /* #define HAVE_POST_DECREMENT 0 */
1296 /* #define HAVE_PRE_DECREMENT 0 */
1297 /* #define HAVE_PRE_INCREMENT 0 */
1299 /* Macros to check register numbers against specific register classes. */
1301 /* These assume that REGNO is a hard or pseudo reg number.
1302 They give nonzero only if REGNO is a hard reg of the suitable class
1303 or a pseudo reg currently allocated to a suitable hard reg.
1304 Since they use reg_renumber, they are safe only once reg_renumber
1305 has been allocated, which happens in local-alloc.c. */
1307 #define REGNO_OK_FOR_INDEX_P(REGNO) 0
1308 #define REGNO_OK_FOR_BASE_P(REGNO) \
1309 ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32 \
1310 || (REGNO) == 63 || reg_renumber[REGNO] == 63)
1312 /* Maximum number of registers that can appear in a valid memory address. */
1313 #define MAX_REGS_PER_ADDRESS 1
1315 /* Recognize any constant value that is a valid address. For the Alpha,
1316 there are only constants none since we want to use LDA to load any
1317 symbolic addresses into registers. */
1319 #define CONSTANT_ADDRESS_P(X) \
1320 (GET_CODE (X) == CONST_INT \
1321 && (unsigned HOST_WIDE_INT) (INTVAL (X) + 0x8000) < 0x10000)
1323 /* Include all constant integers and constant doubles, but not
1324 floating-point, except for floating-point zero. */
1326 #define LEGITIMATE_CONSTANT_P(X) \
1327 (GET_MODE_CLASS (GET_MODE (X)) != MODE_FLOAT \
1328 || (X) == CONST0_RTX (GET_MODE (X)))
1330 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1331 and check its validity for a certain class.
1332 We have two alternate definitions for each of them.
1333 The usual definition accepts all pseudo regs; the other rejects
1334 them unless they have been allocated suitable hard regs.
1335 The symbol REG_OK_STRICT causes the latter definition to be used.
1337 Most source files want to accept pseudo regs in the hope that
1338 they will get allocated to the class that the insn wants them to be in.
1339 Source files for reload pass need to be strict.
1340 After reload, it makes no difference, since pseudo regs have
1341 been eliminated by then. */
1343 /* Nonzero if X is a hard reg that can be used as an index
1344 or if it is a pseudo reg. */
1345 #define REG_OK_FOR_INDEX_P(X) 0
1347 /* Nonzero if X is a hard reg that can be used as a base reg
1348 or if it is a pseudo reg. */
1349 #define NONSTRICT_REG_OK_FOR_BASE_P(X) \
1350 (REGNO (X) < 32 || REGNO (X) == 63 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
1352 /* ??? Nonzero if X is the frame pointer, or some virtual register
1353 that may eliminate to the frame pointer. These will be allowed to
1354 have offsets greater than 32K. This is done because register
1355 elimination offsets will change the hi/lo split, and if we split
1356 before reload, we will require additional instructions. */
1357 #define NONSTRICT_REG_OK_FP_BASE_P(X) \
1358 (REGNO (X) == 31 || REGNO (X) == 63 \
1359 || (REGNO (X) >= FIRST_PSEUDO_REGISTER \
1360 && REGNO (X) < LAST_VIRTUAL_REGISTER))
1362 /* Nonzero if X is a hard reg that can be used as a base reg. */
1363 #define STRICT_REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1365 #ifdef REG_OK_STRICT
1366 #define REG_OK_FOR_BASE_P(X) STRICT_REG_OK_FOR_BASE_P (X)
1368 #define REG_OK_FOR_BASE_P(X) NONSTRICT_REG_OK_FOR_BASE_P (X)
1371 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression that is a
1372 valid memory address for an instruction. */
1374 #ifdef REG_OK_STRICT
1375 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, WIN) \
1377 if (alpha_legitimate_address_p (MODE, X, 1)) \
1381 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, WIN) \
1383 if (alpha_legitimate_address_p (MODE, X, 0)) \
1388 /* Try machine-dependent ways of modifying an illegitimate address
1389 to be legitimate. If we find one, return the new, valid address.
1390 This macro is used in only one place: `memory_address' in explow.c. */
1392 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
1394 rtx new_x = alpha_legitimize_address (X, NULL_RTX, MODE); \
1402 /* Try a machine-dependent way of reloading an illegitimate address
1403 operand. If we find one, push the reload and jump to WIN. This
1404 macro is used in only one place: `find_reloads_address' in reload.c. */
1406 #define LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OPNUM,TYPE,IND_L,WIN) \
1408 rtx new_x = alpha_legitimize_reload_address (X, MODE, OPNUM, TYPE, IND_L); \
1416 /* Go to LABEL if ADDR (a legitimate address expression)
1417 has an effect that depends on the machine mode it is used for.
1418 On the Alpha this is true only for the unaligned modes. We can
1419 simplify this test since we know that the address must be valid. */
1421 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1422 { if (GET_CODE (ADDR) == AND) goto LABEL; }
1424 /* Compute the cost of an address. For the Alpha, all valid addresses are
1427 #define ADDRESS_COST(X) 0
1429 /* Machine-dependent reorg pass. */
1430 #define MACHINE_DEPENDENT_REORG(X) alpha_reorg(X)
1432 /* Specify the machine mode that this machine uses
1433 for the index in the tablejump instruction. */
1434 #define CASE_VECTOR_MODE SImode
1436 /* Define as C expression which evaluates to nonzero if the tablejump
1437 instruction expects the table to contain offsets from the address of the
1440 Do not define this if the table should contain absolute addresses.
1441 On the Alpha, the table is really GP-relative, not relative to the PC
1442 of the table, but we pretend that it is PC-relative; this should be OK,
1443 but we should try to find some better way sometime. */
1444 #define CASE_VECTOR_PC_RELATIVE 1
1446 /* Define this as 1 if `char' should by default be signed; else as 0. */
1447 #define DEFAULT_SIGNED_CHAR 1
1449 /* This flag, if defined, says the same insns that convert to a signed fixnum
1450 also convert validly to an unsigned one.
1452 We actually lie a bit here as overflow conditions are different. But
1453 they aren't being checked anyway. */
1455 #define FIXUNS_TRUNC_LIKE_FIX_TRUNC
1457 /* Max number of bytes we can move to or from memory
1458 in one reasonably fast instruction. */
1462 /* If a memory-to-memory move would take MOVE_RATIO or more simple
1463 move-instruction pairs, we will do a movstr or libcall instead.
1465 Without byte/word accesses, we want no more than four instructions;
1466 with, several single byte accesses are better. */
1468 #define MOVE_RATIO (TARGET_BWX ? 7 : 2)
1470 /* Largest number of bytes of an object that can be placed in a register.
1471 On the Alpha we have plenty of registers, so use TImode. */
1472 #define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (TImode)
1474 /* Nonzero if access to memory by bytes is no faster than for words.
1475 Also nonzero if doing byte operations (specifically shifts) in registers
1478 On the Alpha, we want to not use the byte operation and instead use
1479 masking operations to access fields; these will save instructions. */
1481 #define SLOW_BYTE_ACCESS 1
1483 /* Define if operations between registers always perform the operation
1484 on the full register even if a narrower mode is specified. */
1485 #define WORD_REGISTER_OPERATIONS
1487 /* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
1488 will either zero-extend or sign-extend. The value of this macro should
1489 be the code that says which one of the two operations is implicitly
1490 done, NIL if none. */
1491 #define LOAD_EXTEND_OP(MODE) ((MODE) == SImode ? SIGN_EXTEND : ZERO_EXTEND)
1493 /* Define if loading short immediate values into registers sign extends. */
1494 #define SHORT_IMMEDIATES_SIGN_EXTEND
1496 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1497 is done just by pretending it is already truncated. */
1498 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1500 /* We assume that the store-condition-codes instructions store 0 for false
1501 and some other value for true. This is the value stored for true. */
1503 #define STORE_FLAG_VALUE 1
1505 /* Define the value returned by a floating-point comparison instruction. */
1507 #define FLOAT_STORE_FLAG_VALUE(MODE) \
1508 REAL_VALUE_ATOF ((TARGET_FLOAT_VAX ? "0.5" : "2.0"), (MODE))
1510 /* Canonicalize a comparison from one we don't have to one we do have. */
1512 #define CANONICALIZE_COMPARISON(CODE,OP0,OP1) \
1514 if (((CODE) == GE || (CODE) == GT || (CODE) == GEU || (CODE) == GTU) \
1515 && (GET_CODE (OP1) == REG || (OP1) == const0_rtx)) \
1520 (CODE) = swap_condition (CODE); \
1522 if (((CODE) == LT || (CODE) == LTU) \
1523 && GET_CODE (OP1) == CONST_INT && INTVAL (OP1) == 256) \
1525 (CODE) = (CODE) == LT ? LE : LEU; \
1526 (OP1) = GEN_INT (255); \
1530 /* Specify the machine mode that pointers have.
1531 After generation of rtl, the compiler makes no further distinction
1532 between pointers and any other objects of this machine mode. */
1533 #define Pmode DImode
1535 /* Mode of a function address in a call instruction (for indexing purposes). */
1537 #define FUNCTION_MODE Pmode
1539 /* Define this if addresses of constant functions
1540 shouldn't be put through pseudo regs where they can be cse'd.
1541 Desirable on machines where ordinary constants are expensive
1542 but a CALL with constant address is cheap.
1544 We define this on the Alpha so that gen_call and gen_call_value
1545 get to see the SYMBOL_REF (for the hint field of the jsr). It will
1546 then copy it into a register, thus actually letting the address be
1549 #define NO_FUNCTION_CSE
1551 /* Define this to be nonzero if shift instructions ignore all but the low-order
1553 #define SHIFT_COUNT_TRUNCATED 1
1555 /* Compute the cost of computing a constant rtl expression RTX
1556 whose rtx-code is CODE. The body of this macro is a portion
1557 of a switch statement. If the code is computed here,
1558 return it with a return statement. Otherwise, break from the switch.
1560 If this is an 8-bit constant, return zero since it can be used
1561 nearly anywhere with no cost. If it is a valid operand for an
1562 ADD or AND, likewise return 0 if we know it will be used in that
1563 context. Otherwise, return 2 since it might be used there later.
1564 All other constants take at least two insns. */
1566 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
1568 if (INTVAL (RTX) >= 0 && INTVAL (RTX) < 256) \
1570 case CONST_DOUBLE: \
1571 if ((RTX) == CONST0_RTX (GET_MODE (RTX))) \
1573 else if (((OUTER_CODE) == PLUS && add_operand (RTX, VOIDmode)) \
1574 || ((OUTER_CODE) == AND && and_operand (RTX, VOIDmode))) \
1576 else if (add_operand (RTX, VOIDmode) || and_operand (RTX, VOIDmode)) \
1579 return COSTS_N_INSNS (2); \
1583 switch (alpha_cpu) \
1585 case PROCESSOR_EV4: \
1586 return COSTS_N_INSNS (3); \
1587 case PROCESSOR_EV5: \
1588 case PROCESSOR_EV6: \
1589 return COSTS_N_INSNS (2); \
1593 /* Provide the costs of a rtl expression. This is in the body of a
1596 #define RTX_COSTS(X,CODE,OUTER_CODE) \
1597 case PLUS: case MINUS: \
1598 if (FLOAT_MODE_P (GET_MODE (X))) \
1599 switch (alpha_cpu) \
1601 case PROCESSOR_EV4: \
1602 return COSTS_N_INSNS (6); \
1603 case PROCESSOR_EV5: \
1604 case PROCESSOR_EV6: \
1605 return COSTS_N_INSNS (4); \
1608 else if (GET_CODE (XEXP (X, 0)) == MULT \
1609 && const48_operand (XEXP (XEXP (X, 0), 1), VOIDmode)) \
1610 return (2 + rtx_cost (XEXP (XEXP (X, 0), 0), OUTER_CODE) \
1611 + rtx_cost (XEXP (X, 1), OUTER_CODE)); \
1614 switch (alpha_cpu) \
1616 case PROCESSOR_EV4: \
1617 if (FLOAT_MODE_P (GET_MODE (X))) \
1618 return COSTS_N_INSNS (6); \
1619 return COSTS_N_INSNS (23); \
1620 case PROCESSOR_EV5: \
1621 if (FLOAT_MODE_P (GET_MODE (X))) \
1622 return COSTS_N_INSNS (4); \
1623 else if (GET_MODE (X) == DImode) \
1624 return COSTS_N_INSNS (12); \
1626 return COSTS_N_INSNS (8); \
1627 case PROCESSOR_EV6: \
1628 if (FLOAT_MODE_P (GET_MODE (X))) \
1629 return COSTS_N_INSNS (4); \
1631 return COSTS_N_INSNS (7); \
1635 if (GET_CODE (XEXP (X, 1)) == CONST_INT \
1636 && INTVAL (XEXP (X, 1)) <= 3) \
1638 /* ... fall through ... */ \
1639 case ASHIFTRT: case LSHIFTRT: \
1640 switch (alpha_cpu) \
1642 case PROCESSOR_EV4: \
1643 return COSTS_N_INSNS (2); \
1644 case PROCESSOR_EV5: \
1645 case PROCESSOR_EV6: \
1646 return COSTS_N_INSNS (1); \
1649 case IF_THEN_ELSE: \
1650 switch (alpha_cpu) \
1652 case PROCESSOR_EV4: \
1653 case PROCESSOR_EV6: \
1654 return COSTS_N_INSNS (2); \
1655 case PROCESSOR_EV5: \
1656 return COSTS_N_INSNS (1); \
1659 case DIV: case UDIV: case MOD: case UMOD: \
1660 switch (alpha_cpu) \
1662 case PROCESSOR_EV4: \
1663 if (GET_MODE (X) == SFmode) \
1664 return COSTS_N_INSNS (34); \
1665 else if (GET_MODE (X) == DFmode) \
1666 return COSTS_N_INSNS (63); \
1668 return COSTS_N_INSNS (70); \
1669 case PROCESSOR_EV5: \
1670 if (GET_MODE (X) == SFmode) \
1671 return COSTS_N_INSNS (15); \
1672 else if (GET_MODE (X) == DFmode) \
1673 return COSTS_N_INSNS (22); \
1675 return COSTS_N_INSNS (70); /* ??? */ \
1676 case PROCESSOR_EV6: \
1677 if (GET_MODE (X) == SFmode) \
1678 return COSTS_N_INSNS (12); \
1679 else if (GET_MODE (X) == DFmode) \
1680 return COSTS_N_INSNS (15); \
1682 return COSTS_N_INSNS (70); /* ??? */ \
1686 switch (alpha_cpu) \
1688 case PROCESSOR_EV4: \
1689 case PROCESSOR_EV6: \
1690 return COSTS_N_INSNS (3); \
1691 case PROCESSOR_EV5: \
1692 return COSTS_N_INSNS (2); \
1695 case NEG: case ABS: \
1696 if (! FLOAT_MODE_P (GET_MODE (X))) \
1698 /* ... fall through ... */ \
1699 case FLOAT: case UNSIGNED_FLOAT: case FIX: case UNSIGNED_FIX: \
1700 case FLOAT_EXTEND: case FLOAT_TRUNCATE: \
1701 switch (alpha_cpu) \
1703 case PROCESSOR_EV4: \
1704 return COSTS_N_INSNS (6); \
1705 case PROCESSOR_EV5: \
1706 case PROCESSOR_EV6: \
1707 return COSTS_N_INSNS (4); \
1711 /* Control the assembler format that we output. */
1713 /* Output to assembler file text saying following lines
1714 may contain character constants, extra white space, comments, etc. */
1715 #define ASM_APP_ON (TARGET_EXPLICIT_RELOCS ? "\t.set\tmacro\n" : "")
1717 /* Output to assembler file text saying following lines
1718 no longer contain unusual constructs. */
1719 #define ASM_APP_OFF (TARGET_EXPLICIT_RELOCS ? "\t.set\tnomacro\n" : "")
1721 #define TEXT_SECTION_ASM_OP "\t.text"
1723 /* Output before read-only data. */
1725 #define READONLY_DATA_SECTION_ASM_OP "\t.rdata"
1727 /* Output before writable data. */
1729 #define DATA_SECTION_ASM_OP "\t.data"
1731 /* How to refer to registers in assembler output.
1732 This sequence is indexed by compiler's hard-register-number (see above). */
1734 #define REGISTER_NAMES \
1735 {"$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \
1736 "$9", "$10", "$11", "$12", "$13", "$14", "$15", \
1737 "$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23", \
1738 "$24", "$25", "$26", "$27", "$28", "$29", "$30", "AP", \
1739 "$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "$f6", "$f7", "$f8", \
1740 "$f9", "$f10", "$f11", "$f12", "$f13", "$f14", "$f15", \
1741 "$f16", "$f17", "$f18", "$f19", "$f20", "$f21", "$f22", "$f23",\
1742 "$f24", "$f25", "$f26", "$f27", "$f28", "$f29", "$f30", "FP"}
1744 /* Strip name encoding when emitting labels. */
1746 #define ASM_OUTPUT_LABELREF(STREAM, NAME) \
1748 const char *name_ = NAME; \
1749 if (*name_ == '@' || *name_ == '%') \
1751 if (*name_ == '*') \
1754 fputs (user_label_prefix, STREAM); \
1755 fputs (name_, STREAM); \
1758 /* Globalizing directive for a label. */
1759 #define GLOBAL_ASM_OP "\t.globl "
1761 /* The prefix to add to user-visible assembler symbols. */
1763 #define USER_LABEL_PREFIX ""
1765 /* This is how to output an internal numbered label where
1766 PREFIX is the class of label and NUM is the number within the class. */
1768 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
1769 fprintf (FILE, "$%s%d:\n", PREFIX, NUM)
1771 /* This is how to output a label for a jump table. Arguments are the same as
1772 for ASM_OUTPUT_INTERNAL_LABEL, except the insn for the jump table is
1775 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
1776 { ASM_OUTPUT_ALIGN (FILE, 2); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); }
1778 /* This is how to store into the string LABEL
1779 the symbol_ref name of an internal numbered label where
1780 PREFIX is the class of label and NUM is the number within the class.
1781 This is suitable for output with `assemble_name'. */
1783 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
1784 sprintf ((LABEL), "*$%s%ld", (PREFIX), (long)(NUM))
1786 /* We use the default ASCII-output routine, except that we don't write more
1787 than 50 characters since the assembler doesn't support very long lines. */
1789 #define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \
1791 FILE *_hide_asm_out_file = (MYFILE); \
1792 const unsigned char *_hide_p = (const unsigned char *) (MYSTRING); \
1793 int _hide_thissize = (MYLENGTH); \
1794 int _size_so_far = 0; \
1796 FILE *asm_out_file = _hide_asm_out_file; \
1797 const unsigned char *p = _hide_p; \
1798 int thissize = _hide_thissize; \
1800 fprintf (asm_out_file, "\t.ascii \""); \
1802 for (i = 0; i < thissize; i++) \
1804 register int c = p[i]; \
1806 if (_size_so_far ++ > 50 && i < thissize - 4) \
1807 _size_so_far = 0, fprintf (asm_out_file, "\"\n\t.ascii \""); \
1809 if (c == '\"' || c == '\\') \
1810 putc ('\\', asm_out_file); \
1811 if (c >= ' ' && c < 0177) \
1812 putc (c, asm_out_file); \
1815 fprintf (asm_out_file, "\\%o", c); \
1816 /* After an octal-escape, if a digit follows, \
1817 terminate one string constant and start another. \
1818 The VAX assembler fails to stop reading the escape \
1819 after three digits, so this is the only way we \
1820 can get it to parse the data properly. */ \
1821 if (i < thissize - 1 && ISDIGIT (p[i + 1])) \
1822 _size_so_far = 0, fprintf (asm_out_file, "\"\n\t.ascii \""); \
1825 fprintf (asm_out_file, "\"\n"); \
1830 /* This is how to output an insn to push a register on the stack.
1831 It need not be very fast code. */
1833 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
1834 fprintf (FILE, "\tsubq $30,8,$30\n\tst%s $%s%d,0($30)\n", \
1835 (REGNO) > 32 ? "t" : "q", (REGNO) > 32 ? "f" : "", \
1838 /* This is how to output an insn to pop a register from the stack.
1839 It need not be very fast code. */
1841 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
1842 fprintf (FILE, "\tld%s $%s%d,0($30)\n\taddq $30,8,$30\n", \
1843 (REGNO) > 32 ? "t" : "q", (REGNO) > 32 ? "f" : "", \
1846 /* This is how to output an element of a case-vector that is absolute.
1847 (Alpha does not use such vectors, but we must define this macro anyway.) */
1849 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) abort ()
1851 /* This is how to output an element of a case-vector that is relative. */
1853 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
1854 fprintf (FILE, "\t.%s $L%d\n", TARGET_ABI_WINDOWS_NT ? "long" : "gprel32", \
1857 /* This is how to output an assembler line
1858 that says to advance the location counter
1859 to a multiple of 2**LOG bytes. */
1861 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1863 fprintf (FILE, "\t.align %d\n", LOG);
1865 /* This is how to advance the location counter by SIZE bytes. */
1867 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
1868 fprintf (FILE, "\t.space %d\n", (SIZE))
1870 /* This says how to output an assembler line
1871 to define a global common symbol. */
1873 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
1874 ( fputs ("\t.comm ", (FILE)), \
1875 assemble_name ((FILE), (NAME)), \
1876 fprintf ((FILE), ",%d\n", (SIZE)))
1878 /* This says how to output an assembler line
1879 to define a local common symbol. */
1881 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \
1882 ( fputs ("\t.lcomm ", (FILE)), \
1883 assemble_name ((FILE), (NAME)), \
1884 fprintf ((FILE), ",%d\n", (SIZE)))
1886 /* Store in OUTPUT a string (made with alloca) containing
1887 an assembler-name for a local static variable named NAME.
1888 LABELNO is an integer which is different for each call. */
1890 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1891 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
1892 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1895 /* Print operand X (an rtx) in assembler syntax to file FILE.
1896 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1897 For `%' followed by punctuation, CODE is the punctuation and X is null. */
1899 #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
1901 /* Determine which codes are valid without a following integer. These must
1904 ~ Generates the name of the current function.
1906 / Generates the instruction suffix. The TRAP_SUFFIX and ROUND_SUFFIX
1907 attributes are examined to determine what is appropriate.
1909 , Generates single precision suffix for floating point
1910 instructions (s for IEEE, f for VAX)
1912 - Generates double precision suffix for floating point
1913 instructions (t for IEEE, g for VAX)
1916 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
1917 ((CODE) == '/' || (CODE) == ',' || (CODE) == '-' || (CODE) == '~' \
1918 || (CODE) == '#' || (CODE) == '*' || (CODE) == '&')
1920 /* Print a memory address as an operand to reference that memory location. */
1922 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
1923 print_operand_address((FILE), (ADDR))
1925 /* Define the codes that are matched by predicates in alpha.c. */
1927 #define PREDICATE_CODES \
1928 {"reg_or_0_operand", {SUBREG, REG, CONST_INT, CONST_DOUBLE, \
1930 {"reg_or_6bit_operand", {SUBREG, REG, CONST_INT}}, \
1931 {"reg_or_8bit_operand", {SUBREG, REG, CONST_INT}}, \
1932 {"reg_or_const_int_operand", {SUBREG, REG, CONST_INT}}, \
1933 {"cint8_operand", {CONST_INT}}, \
1934 {"reg_or_cint_operand", {SUBREG, REG, CONST_INT}}, \
1935 {"add_operand", {SUBREG, REG, CONST_INT}}, \
1936 {"sext_add_operand", {SUBREG, REG, CONST_INT}}, \
1937 {"const48_operand", {CONST_INT}}, \
1938 {"and_operand", {SUBREG, REG, CONST_INT}}, \
1939 {"or_operand", {SUBREG, REG, CONST_INT}}, \
1940 {"mode_mask_operand", {CONST_INT}}, \
1941 {"mul8_operand", {CONST_INT}}, \
1942 {"mode_width_operand", {CONST_INT}}, \
1943 {"alpha_comparison_operator", {EQ, LE, LT, LEU, LTU}}, \
1944 {"alpha_zero_comparison_operator", {EQ, NE, LE, LT, LEU, LTU}}, \
1945 {"alpha_swapped_comparison_operator", {EQ, GE, GT, GEU, GTU}}, \
1946 {"signed_comparison_operator", {EQ, NE, LE, LT, GE, GT}}, \
1947 {"alpha_fp_comparison_operator", {EQ, LE, LT, UNORDERED}}, \
1948 {"divmod_operator", {DIV, MOD, UDIV, UMOD}}, \
1949 {"const0_operand", {CONST_INT, CONST_DOUBLE, CONST_VECTOR}}, \
1950 {"current_file_function_operand", {SYMBOL_REF}}, \
1951 {"direct_call_operand", {SYMBOL_REF}}, \
1952 {"local_symbolic_operand", {SYMBOL_REF, CONST, LABEL_REF}}, \
1953 {"small_symbolic_operand", {SYMBOL_REF, CONST}}, \
1954 {"global_symbolic_operand", {SYMBOL_REF, CONST}}, \
1955 {"dtp16_symbolic_operand", {CONST}}, \
1956 {"dtp32_symbolic_operand", {CONST}}, \
1957 {"gotdtp_symbolic_operand", {CONST}}, \
1958 {"tp16_symbolic_operand", {CONST}}, \
1959 {"tp32_symbolic_operand", {CONST}}, \
1960 {"gottp_symbolic_operand", {CONST}}, \
1961 {"call_operand", {REG, SYMBOL_REF}}, \
1962 {"input_operand", {SUBREG, REG, MEM, CONST_INT, CONST_DOUBLE, \
1963 CONST_VECTOR, SYMBOL_REF, CONST, LABEL_REF, HIGH}},\
1964 {"some_operand", {SUBREG, REG, MEM, CONST_INT, CONST_DOUBLE, \
1965 CONST_VECTOR, SYMBOL_REF, CONST, LABEL_REF, HIGH}}, \
1966 {"some_ni_operand", {SUBREG, REG, MEM}}, \
1967 {"aligned_memory_operand", {MEM}}, \
1968 {"unaligned_memory_operand", {MEM}}, \
1969 {"reg_or_unaligned_mem_operand", {SUBREG, REG, MEM}}, \
1970 {"any_memory_operand", {MEM}}, \
1971 {"hard_fp_register_operand", {SUBREG, REG}}, \
1972 {"hard_int_register_operand", {SUBREG, REG}}, \
1973 {"reg_not_elim_operand", {SUBREG, REG}}, \
1974 {"reg_no_subreg_operand", {REG}}, \
1975 {"addition_operation", {PLUS}}, \
1976 {"symbolic_operand", {SYMBOL_REF, LABEL_REF, CONST}}, \
1977 {"some_small_symbolic_operand", {SET, PARALLEL, PREFETCH, UNSPEC, \
1980 /* Define the `__builtin_va_list' type for the ABI. */
1981 #define BUILD_VA_LIST_TYPE(VALIST) \
1982 (VALIST) = alpha_build_va_list ()
1984 /* Implement `va_start' for varargs and stdarg. */
1985 #define EXPAND_BUILTIN_VA_START(valist, nextarg) \
1986 alpha_va_start (valist, nextarg)
1988 /* Implement `va_arg'. */
1989 #define EXPAND_BUILTIN_VA_ARG(valist, type) \
1990 alpha_va_arg (valist, type)
1992 /* Tell collect that the object format is ECOFF. */
1993 #define OBJECT_FORMAT_COFF
1994 #define EXTENDED_COFF
1996 /* If we use NM, pass -g to it so it only lists globals. */
1997 #define NM_FLAGS "-pg"
1999 /* Definitions for debugging. */
2001 #define SDB_DEBUGGING_INFO 1 /* generate info for mips-tfile */
2002 #define DBX_DEBUGGING_INFO 1 /* generate embedded stabs */
2003 #define MIPS_DEBUGGING_INFO 1 /* MIPS specific debugging info */
2005 #ifndef PREFERRED_DEBUGGING_TYPE /* assume SDB_DEBUGGING_INFO */
2006 #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
2010 /* Correct the offset of automatic variables and arguments. Note that
2011 the Alpha debug format wants all automatic variables and arguments
2012 to be in terms of two different offsets from the virtual frame pointer,
2013 which is the stack pointer before any adjustment in the function.
2014 The offset for the argument pointer is fixed for the native compiler,
2015 it is either zero (for the no arguments case) or large enough to hold
2016 all argument registers.
2017 The offset for the auto pointer is the fourth argument to the .frame
2018 directive (local_offset).
2019 To stay compatible with the native tools we use the same offsets
2020 from the virtual frame pointer and adjust the debugger arg/auto offsets
2021 accordingly. These debugger offsets are set up in output_prolog. */
2023 extern long alpha_arg_offset;
2024 extern long alpha_auto_offset;
2025 #define DEBUGGER_AUTO_OFFSET(X) \
2026 ((GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0) + alpha_auto_offset)
2027 #define DEBUGGER_ARG_OFFSET(OFFSET, X) (OFFSET + alpha_arg_offset)
2030 #define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE) \
2031 alpha_output_lineno (STREAM, LINE)
2033 #define ASM_OUTPUT_SOURCE_FILENAME(STREAM, NAME) \
2034 alpha_output_filename (STREAM, NAME)
2036 /* mips-tfile.c limits us to strings of one page. We must underestimate this
2037 number, because the real length runs past this up to the next
2038 continuation point. This is really a dbxout.c bug. */
2039 #define DBX_CONTIN_LENGTH 3000
2041 /* By default, turn on GDB extensions. */
2042 #define DEFAULT_GDB_EXTENSIONS 1
2044 /* Stabs-in-ECOFF can't handle dbxout_function_end(). */
2045 #define NO_DBX_FUNCTION_END 1
2047 /* If we are smuggling stabs through the ALPHA ECOFF object
2048 format, put a comment in front of the .stab<x> operation so
2049 that the ALPHA assembler does not choke. The mips-tfile program
2050 will correctly put the stab into the object file. */
2052 #define ASM_STABS_OP ((TARGET_GAS) ? "\t.stabs\t" : " #.stabs\t")
2053 #define ASM_STABN_OP ((TARGET_GAS) ? "\t.stabn\t" : " #.stabn\t")
2054 #define ASM_STABD_OP ((TARGET_GAS) ? "\t.stabd\t" : " #.stabd\t")
2056 /* Forward references to tags are allowed. */
2057 #define SDB_ALLOW_FORWARD_REFERENCES
2059 /* Unknown tags are also allowed. */
2060 #define SDB_ALLOW_UNKNOWN_REFERENCES
2062 #define PUT_SDB_DEF(a) \
2064 fprintf (asm_out_file, "\t%s.def\t", \
2065 (TARGET_GAS) ? "" : "#"); \
2066 ASM_OUTPUT_LABELREF (asm_out_file, a); \
2067 fputc (';', asm_out_file); \
2070 #define PUT_SDB_PLAIN_DEF(a) \
2072 fprintf (asm_out_file, "\t%s.def\t.%s;", \
2073 (TARGET_GAS) ? "" : "#", (a)); \
2076 #define PUT_SDB_TYPE(a) \
2078 fprintf (asm_out_file, "\t.type\t0x%x;", (a)); \
2081 /* For block start and end, we create labels, so that
2082 later we can figure out where the correct offset is.
2083 The normal .ent/.end serve well enough for functions,
2084 so those are just commented out. */
2086 extern int sdb_label_count; /* block start/end next label # */
2088 #define PUT_SDB_BLOCK_START(LINE) \
2090 fprintf (asm_out_file, \
2091 "$Lb%d:\n\t%s.begin\t$Lb%d\t%d\n", \
2093 (TARGET_GAS) ? "" : "#", \
2096 sdb_label_count++; \
2099 #define PUT_SDB_BLOCK_END(LINE) \
2101 fprintf (asm_out_file, \
2102 "$Le%d:\n\t%s.bend\t$Le%d\t%d\n", \
2104 (TARGET_GAS) ? "" : "#", \
2107 sdb_label_count++; \
2110 #define PUT_SDB_FUNCTION_START(LINE)
2112 #define PUT_SDB_FUNCTION_END(LINE)
2114 #define PUT_SDB_EPILOGUE_END(NAME) ((void)(NAME))
2116 /* Macros for mips-tfile.c to encapsulate stabs in ECOFF, and for
2117 mips-tdump.c to print them out.
2119 These must match the corresponding definitions in gdb/mipsread.c.
2120 Unfortunately, gcc and gdb do not currently share any directories. */
2122 #define CODE_MASK 0x8F300
2123 #define MIPS_IS_STAB(sym) (((sym)->index & 0xFFF00) == CODE_MASK)
2124 #define MIPS_MARK_STAB(code) ((code)+CODE_MASK)
2125 #define MIPS_UNMARK_STAB(code) ((code)-CODE_MASK)
2127 /* Override some mips-tfile definitions. */
2129 #define SHASH_SIZE 511
2130 #define THASH_SIZE 55
2132 /* Align ecoff symbol tables to avoid OSF1/1.3 nm complaints. */
2134 #define ALIGN_SYMTABLE_OFFSET(OFFSET) (((OFFSET) + 7) & ~7)
2136 /* The system headers under Alpha systems are generally C++-aware. */
2137 #define NO_IMPLICIT_EXTERN_C
2139 /* Generate calls to memcpy, etc., not bcopy, etc. */
2140 #define TARGET_MEM_FUNCTIONS 1