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 /* Return the class of registers that cannot change mode from FROM to TO. */
862 #define CANNOT_CHANGE_MODE_CLASS(FROM, TO) \
863 (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO) ? FLOAT_REGS : NO_REGS)
865 /* Define the cost of moving between registers of various classes. Moving
866 between FLOAT_REGS and anything else except float regs is expensive.
867 In fact, we make it quite expensive because we really don't want to
868 do these moves unless it is clearly worth it. Optimizations may
869 reduce the impact of not being able to allocate a pseudo to a
872 #define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \
873 (((CLASS1) == FLOAT_REGS) == ((CLASS2) == FLOAT_REGS) \
875 : TARGET_FIX ? 3 : 4+2*alpha_memory_latency)
877 /* A C expressions returning the cost of moving data of MODE from a register to
880 On the Alpha, bump this up a bit. */
882 extern int alpha_memory_latency;
883 #define MEMORY_MOVE_COST(MODE,CLASS,IN) (2*alpha_memory_latency)
885 /* Provide the cost of a branch. Exact meaning under development. */
886 #define BRANCH_COST 5
888 /* Stack layout; function entry, exit and calling. */
890 /* Define this if pushing a word on the stack
891 makes the stack pointer a smaller address. */
892 #define STACK_GROWS_DOWNWARD
894 /* Define this if the nominal address of the stack frame
895 is at the high-address end of the local variables;
896 that is, each additional local variable allocated
897 goes at a more negative offset in the frame. */
898 /* #define FRAME_GROWS_DOWNWARD */
900 /* Offset within stack frame to start allocating local variables at.
901 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
902 first local allocated. Otherwise, it is the offset to the BEGINNING
903 of the first local allocated. */
905 #define STARTING_FRAME_OFFSET 0
907 /* If we generate an insn to push BYTES bytes,
908 this says how many the stack pointer really advances by.
909 On Alpha, don't define this because there are no push insns. */
910 /* #define PUSH_ROUNDING(BYTES) */
912 /* Define this to be nonzero if stack checking is built into the ABI. */
913 #define STACK_CHECK_BUILTIN 1
915 /* Define this if the maximum size of all the outgoing args is to be
916 accumulated and pushed during the prologue. The amount can be
917 found in the variable current_function_outgoing_args_size. */
918 #define ACCUMULATE_OUTGOING_ARGS 1
920 /* Offset of first parameter from the argument pointer register value. */
922 #define FIRST_PARM_OFFSET(FNDECL) 0
924 /* Definitions for register eliminations.
926 We have two registers that can be eliminated on the Alpha. First, the
927 frame pointer register can often be eliminated in favor of the stack
928 pointer register. Secondly, the argument pointer register can always be
929 eliminated; it is replaced with either the stack or frame pointer. */
931 /* This is an array of structures. Each structure initializes one pair
932 of eliminable registers. The "from" register number is given first,
933 followed by "to". Eliminations of the same "from" register are listed
934 in order of preference. */
936 #define ELIMINABLE_REGS \
937 {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
938 { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \
939 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
940 { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}}
942 /* Given FROM and TO register numbers, say whether this elimination is allowed.
943 Frame pointer elimination is automatically handled.
945 All eliminations are valid since the cases where FP can't be
946 eliminated are already handled. */
948 #define CAN_ELIMINATE(FROM, TO) 1
950 /* Round up to a multiple of 16 bytes. */
951 #define ALPHA_ROUND(X) (((X) + 15) & ~ 15)
953 /* Define the offset between two registers, one to be eliminated, and the other
954 its replacement, at the start of a routine. */
955 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
956 { if ((FROM) == FRAME_POINTER_REGNUM) \
957 (OFFSET) = (ALPHA_ROUND (current_function_outgoing_args_size) \
958 + alpha_sa_size ()); \
959 else if ((FROM) == ARG_POINTER_REGNUM) \
960 (OFFSET) = (ALPHA_ROUND (current_function_outgoing_args_size) \
962 + (ALPHA_ROUND (get_frame_size () \
963 + current_function_pretend_args_size) \
964 - current_function_pretend_args_size)); \
969 /* Define this if stack space is still allocated for a parameter passed
971 /* #define REG_PARM_STACK_SPACE */
973 /* Value is the number of bytes of arguments automatically
974 popped when returning from a subroutine call.
975 FUNDECL is the declaration node of the function (as a tree),
976 FUNTYPE is the data type of the function (as a tree),
977 or for a library call it is an identifier node for the subroutine name.
978 SIZE is the number of bytes of arguments passed on the stack. */
980 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
982 /* Define how to find the value returned by a function.
983 VALTYPE is the data type of the value (as a tree).
984 If the precise function being called is known, FUNC is its FUNCTION_DECL;
985 otherwise, FUNC is 0.
987 On Alpha the value is found in $0 for integer functions and
988 $f0 for floating-point functions. */
990 #define FUNCTION_VALUE(VALTYPE, FUNC) \
991 gen_rtx_REG (((INTEGRAL_TYPE_P (VALTYPE) \
992 && TYPE_PRECISION (VALTYPE) < BITS_PER_WORD) \
993 || POINTER_TYPE_P (VALTYPE)) \
994 ? word_mode : TYPE_MODE (VALTYPE), \
996 && (TREE_CODE (VALTYPE) == REAL_TYPE \
997 || TREE_CODE (VALTYPE) == COMPLEX_TYPE)) \
1000 /* Define how to find the value returned by a library function
1001 assuming the value has mode MODE. */
1003 #define LIBCALL_VALUE(MODE) \
1004 gen_rtx_REG (MODE, \
1006 && (GET_MODE_CLASS (MODE) == MODE_FLOAT \
1007 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) \
1010 /* The definition of this macro implies that there are cases where
1011 a scalar value cannot be returned in registers.
1013 For the Alpha, any structure or union type is returned in memory, as
1014 are integers whose size is larger than 64 bits. */
1016 #define RETURN_IN_MEMORY(TYPE) \
1017 (TYPE_MODE (TYPE) == BLKmode \
1018 || TYPE_MODE (TYPE) == TFmode \
1019 || TYPE_MODE (TYPE) == TCmode \
1020 || (TREE_CODE (TYPE) == INTEGER_TYPE && TYPE_PRECISION (TYPE) > 64))
1022 /* 1 if N is a possible register number for a function value
1023 as seen by the caller. */
1025 #define FUNCTION_VALUE_REGNO_P(N) \
1026 ((N) == 0 || (N) == 1 || (N) == 32 || (N) == 33)
1028 /* 1 if N is a possible register number for function argument passing.
1029 On Alpha, these are $16-$21 and $f16-$f21. */
1031 #define FUNCTION_ARG_REGNO_P(N) \
1032 (((N) >= 16 && (N) <= 21) || ((N) >= 16 + 32 && (N) <= 21 + 32))
1034 /* Define a data type for recording info about an argument list
1035 during the scan of that argument list. This data type should
1036 hold all necessary information about the function itself
1037 and about the args processed so far, enough to enable macros
1038 such as FUNCTION_ARG to determine where the next arg should go.
1040 On Alpha, this is a single integer, which is a number of words
1041 of arguments scanned so far.
1042 Thus 6 or more means all following args should go on the stack. */
1044 #define CUMULATIVE_ARGS int
1046 /* Initialize a variable CUM of type CUMULATIVE_ARGS
1047 for a call to a function whose data type is FNTYPE.
1048 For a library call, FNTYPE is 0. */
1050 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) (CUM) = 0
1052 /* Define intermediate macro to compute the size (in registers) of an argument
1055 #define ALPHA_ARG_SIZE(MODE, TYPE, NAMED) \
1056 ((MODE) == TFmode || (MODE) == TCmode ? 1 \
1057 : (((MODE) == BLKmode ? int_size_in_bytes (TYPE) : GET_MODE_SIZE (MODE)) \
1058 + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
1060 /* Update the data in CUM to advance over an argument
1061 of mode MODE and data type TYPE.
1062 (TYPE is null for libcalls where that information may not be available.) */
1064 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
1065 if (MUST_PASS_IN_STACK (MODE, TYPE)) \
1068 (CUM) += ALPHA_ARG_SIZE (MODE, TYPE, NAMED)
1070 /* Determine where to put an argument to a function.
1071 Value is zero to push the argument on the stack,
1072 or a hard register in which to store the argument.
1074 MODE is the argument's machine mode.
1075 TYPE is the data type of the argument (as a tree).
1076 This is null for libcalls where that information may
1078 CUM is a variable of type CUMULATIVE_ARGS which gives info about
1079 the preceding args and about the function being called.
1080 NAMED is nonzero if this argument is a named parameter
1081 (otherwise it is an extra parameter matching an ellipsis).
1083 On Alpha the first 6 words of args are normally in registers
1084 and the rest are pushed. */
1086 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
1087 function_arg((CUM), (MODE), (TYPE), (NAMED))
1089 /* A C expression that indicates when an argument must be passed by
1090 reference. If nonzero for an argument, a copy of that argument is
1091 made in memory and a pointer to the argument is passed instead of
1092 the argument itself. The pointer is passed in whatever way is
1093 appropriate for passing a pointer to that type. */
1095 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
1096 ((MODE) == TFmode || (MODE) == TCmode)
1098 /* Specify the padding direction of arguments.
1100 On the Alpha, we must pad upwards in order to be able to pass args in
1103 #define FUNCTION_ARG_PADDING(MODE, TYPE) upward
1105 /* For an arg passed partly in registers and partly in memory,
1106 this is the number of registers used.
1107 For args passed entirely in registers or entirely in memory, zero. */
1109 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
1110 ((CUM) < 6 && 6 < (CUM) + ALPHA_ARG_SIZE (MODE, TYPE, NAMED) \
1113 /* Perform any needed actions needed for a function that is receiving a
1114 variable number of arguments.
1118 MODE and TYPE are the mode and type of the current parameter.
1120 PRETEND_SIZE is a variable that should be set to the amount of stack
1121 that must be pushed by the prolog to pretend that our caller pushed
1124 Normally, this macro will push all remaining incoming registers on the
1125 stack and set PRETEND_SIZE to the length of the registers pushed.
1127 On the Alpha, we allocate space for all 12 arg registers, but only
1128 push those that are remaining.
1130 However, if NO registers need to be saved, don't allocate any space.
1131 This is not only because we won't need the space, but because AP includes
1132 the current_pretend_args_size and we don't want to mess up any
1133 ap-relative addresses already made.
1135 If we are not to use the floating-point registers, save the integer
1136 registers where we would put the floating-point registers. This is
1137 not the most efficient way to implement varargs with just one register
1138 class, but it isn't worth doing anything more efficient in this rare
1141 #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
1146 rtx tmp; int set = get_varargs_alias_set (); \
1147 tmp = gen_rtx_MEM (BLKmode, \
1148 plus_constant (virtual_incoming_args_rtx, \
1149 ((CUM) + 6)* UNITS_PER_WORD)); \
1150 set_mem_alias_set (tmp, set); \
1151 move_block_from_reg \
1153 6 - (CUM), (6 - (CUM)) * UNITS_PER_WORD); \
1155 tmp = gen_rtx_MEM (BLKmode, \
1156 plus_constant (virtual_incoming_args_rtx, \
1157 (CUM) * UNITS_PER_WORD)); \
1158 set_mem_alias_set (tmp, set); \
1159 move_block_from_reg \
1160 (16 + (TARGET_FPREGS ? 32 : 0) + CUM, tmp, \
1161 6 - (CUM), (6 - (CUM)) * UNITS_PER_WORD); \
1163 PRETEND_SIZE = 12 * UNITS_PER_WORD; \
1167 /* We do not allow indirect calls to be optimized into sibling calls, nor
1168 can we allow a call to a function in a different compilation unit to
1169 be optimized into a sibcall. */
1170 #define FUNCTION_OK_FOR_SIBCALL(DECL) \
1172 && (! TREE_PUBLIC (DECL) \
1173 || (TREE_ASM_WRITTEN (DECL) && (*targetm.binds_local_p) (DECL))))
1175 /* Try to output insns to set TARGET equal to the constant C if it can be
1176 done in less than N insns. Do all computations in MODE. Returns the place
1177 where the output has been placed if it can be done and the insns have been
1178 emitted. If it would take more than N insns, zero is returned and no
1179 insns and emitted. */
1181 /* Define the information needed to generate branch and scc insns. This is
1182 stored from the compare operation. Note that we can't use "rtx" here
1183 since it hasn't been defined! */
1185 struct alpha_compare
1187 struct rtx_def *op0, *op1;
1191 extern struct alpha_compare alpha_compare;
1193 /* Make (or fake) .linkage entry for function call.
1194 IS_LOCAL is 0 if name is used in call, 1 if name is used in definition. */
1196 /* This macro defines the start of an assembly comment. */
1198 #define ASM_COMMENT_START " #"
1200 /* This macro produces the initial definition of a function. */
1202 #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
1203 alpha_start_function(FILE,NAME,DECL);
1205 /* This macro closes up a function definition for the assembler. */
1207 #define ASM_DECLARE_FUNCTION_SIZE(FILE,NAME,DECL) \
1208 alpha_end_function(FILE,NAME,DECL)
1210 /* Output any profiling code before the prologue. */
1212 #define PROFILE_BEFORE_PROLOGUE 1
1214 /* Output assembler code to FILE to increment profiler label # LABELNO
1215 for profiling a function entry. Under OSF/1, profiling is enabled
1216 by simply passing -pg to the assembler and linker. */
1218 #define FUNCTION_PROFILER(FILE, LABELNO)
1220 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
1221 the stack pointer does not matter. The value is tested only in
1222 functions that have frame pointers.
1223 No definition is equivalent to always zero. */
1225 #define EXIT_IGNORE_STACK 1
1227 /* Define registers used by the epilogue and return instruction. */
1229 #define EPILOGUE_USES(REGNO) ((REGNO) == 26)
1231 /* Output assembler code for a block containing the constant parts
1232 of a trampoline, leaving space for the variable parts.
1234 The trampoline should set the static chain pointer to value placed
1235 into the trampoline and should branch to the specified routine.
1236 Note that $27 has been set to the address of the trampoline, so we can
1237 use it for addressability of the two data items. */
1239 #define TRAMPOLINE_TEMPLATE(FILE) \
1241 fprintf (FILE, "\tldq $1,24($27)\n"); \
1242 fprintf (FILE, "\tldq $27,16($27)\n"); \
1243 fprintf (FILE, "\tjmp $31,($27),0\n"); \
1244 fprintf (FILE, "\tnop\n"); \
1245 fprintf (FILE, "\t.quad 0,0\n"); \
1248 /* Section in which to place the trampoline. On Alpha, instructions
1249 may only be placed in a text segment. */
1251 #define TRAMPOLINE_SECTION text_section
1253 /* Length in units of the trampoline for entering a nested function. */
1255 #define TRAMPOLINE_SIZE 32
1257 /* The alignment of a trampoline, in bits. */
1259 #define TRAMPOLINE_ALIGNMENT 64
1261 /* Emit RTL insns to initialize the variable parts of a trampoline.
1262 FNADDR is an RTX for the address of the function's pure code.
1263 CXT is an RTX for the static chain value for the function. */
1265 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
1266 alpha_initialize_trampoline (TRAMP, FNADDR, CXT, 16, 24, 8)
1268 /* A C expression whose value is RTL representing the value of the return
1269 address for the frame COUNT steps up from the current frame.
1270 FRAMEADDR is the frame pointer of the COUNT frame, or the frame pointer of
1271 the COUNT-1 frame if RETURN_ADDR_IN_PREVIOUS_FRAME is defined. */
1273 #define RETURN_ADDR_RTX alpha_return_addr
1275 /* Before the prologue, RA lives in $26. */
1276 #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, 26)
1277 #define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (26)
1279 /* Describe how we implement __builtin_eh_return. */
1280 #define EH_RETURN_DATA_REGNO(N) ((N) < 4 ? (N) + 16 : INVALID_REGNUM)
1281 #define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, 28)
1282 #define EH_RETURN_HANDLER_RTX \
1283 gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx, \
1284 current_function_outgoing_args_size))
1286 /* Addressing modes, and classification of registers for them. */
1288 /* #define HAVE_POST_INCREMENT 0 */
1289 /* #define HAVE_POST_DECREMENT 0 */
1291 /* #define HAVE_PRE_DECREMENT 0 */
1292 /* #define HAVE_PRE_INCREMENT 0 */
1294 /* Macros to check register numbers against specific register classes. */
1296 /* These assume that REGNO is a hard or pseudo reg number.
1297 They give nonzero only if REGNO is a hard reg of the suitable class
1298 or a pseudo reg currently allocated to a suitable hard reg.
1299 Since they use reg_renumber, they are safe only once reg_renumber
1300 has been allocated, which happens in local-alloc.c. */
1302 #define REGNO_OK_FOR_INDEX_P(REGNO) 0
1303 #define REGNO_OK_FOR_BASE_P(REGNO) \
1304 ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32 \
1305 || (REGNO) == 63 || reg_renumber[REGNO] == 63)
1307 /* Maximum number of registers that can appear in a valid memory address. */
1308 #define MAX_REGS_PER_ADDRESS 1
1310 /* Recognize any constant value that is a valid address. For the Alpha,
1311 there are only constants none since we want to use LDA to load any
1312 symbolic addresses into registers. */
1314 #define CONSTANT_ADDRESS_P(X) \
1315 (GET_CODE (X) == CONST_INT \
1316 && (unsigned HOST_WIDE_INT) (INTVAL (X) + 0x8000) < 0x10000)
1318 /* Include all constant integers and constant doubles, but not
1319 floating-point, except for floating-point zero. */
1321 #define LEGITIMATE_CONSTANT_P(X) \
1322 (GET_MODE_CLASS (GET_MODE (X)) != MODE_FLOAT \
1323 || (X) == CONST0_RTX (GET_MODE (X)))
1325 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1326 and check its validity for a certain class.
1327 We have two alternate definitions for each of them.
1328 The usual definition accepts all pseudo regs; the other rejects
1329 them unless they have been allocated suitable hard regs.
1330 The symbol REG_OK_STRICT causes the latter definition to be used.
1332 Most source files want to accept pseudo regs in the hope that
1333 they will get allocated to the class that the insn wants them to be in.
1334 Source files for reload pass need to be strict.
1335 After reload, it makes no difference, since pseudo regs have
1336 been eliminated by then. */
1338 /* Nonzero if X is a hard reg that can be used as an index
1339 or if it is a pseudo reg. */
1340 #define REG_OK_FOR_INDEX_P(X) 0
1342 /* Nonzero if X is a hard reg that can be used as a base reg
1343 or if it is a pseudo reg. */
1344 #define NONSTRICT_REG_OK_FOR_BASE_P(X) \
1345 (REGNO (X) < 32 || REGNO (X) == 63 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
1347 /* ??? Nonzero if X is the frame pointer, or some virtual register
1348 that may eliminate to the frame pointer. These will be allowed to
1349 have offsets greater than 32K. This is done because register
1350 elimination offsets will change the hi/lo split, and if we split
1351 before reload, we will require additional instructions. */
1352 #define NONSTRICT_REG_OK_FP_BASE_P(X) \
1353 (REGNO (X) == 31 || REGNO (X) == 63 \
1354 || (REGNO (X) >= FIRST_PSEUDO_REGISTER \
1355 && REGNO (X) < LAST_VIRTUAL_REGISTER))
1357 /* Nonzero if X is a hard reg that can be used as a base reg. */
1358 #define STRICT_REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1360 #ifdef REG_OK_STRICT
1361 #define REG_OK_FOR_BASE_P(X) STRICT_REG_OK_FOR_BASE_P (X)
1363 #define REG_OK_FOR_BASE_P(X) NONSTRICT_REG_OK_FOR_BASE_P (X)
1366 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression that is a
1367 valid memory address for an instruction. */
1369 #ifdef REG_OK_STRICT
1370 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, WIN) \
1372 if (alpha_legitimate_address_p (MODE, X, 1)) \
1376 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, WIN) \
1378 if (alpha_legitimate_address_p (MODE, X, 0)) \
1383 /* Try machine-dependent ways of modifying an illegitimate address
1384 to be legitimate. If we find one, return the new, valid address.
1385 This macro is used in only one place: `memory_address' in explow.c. */
1387 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
1389 rtx new_x = alpha_legitimize_address (X, NULL_RTX, MODE); \
1397 /* Try a machine-dependent way of reloading an illegitimate address
1398 operand. If we find one, push the reload and jump to WIN. This
1399 macro is used in only one place: `find_reloads_address' in reload.c. */
1401 #define LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OPNUM,TYPE,IND_L,WIN) \
1403 rtx new_x = alpha_legitimize_reload_address (X, MODE, OPNUM, TYPE, IND_L); \
1411 /* Go to LABEL if ADDR (a legitimate address expression)
1412 has an effect that depends on the machine mode it is used for.
1413 On the Alpha this is true only for the unaligned modes. We can
1414 simplify this test since we know that the address must be valid. */
1416 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1417 { if (GET_CODE (ADDR) == AND) goto LABEL; }
1419 /* Compute the cost of an address. For the Alpha, all valid addresses are
1422 #define ADDRESS_COST(X) 0
1424 /* Machine-dependent reorg pass. */
1425 #define MACHINE_DEPENDENT_REORG(X) alpha_reorg(X)
1427 /* Specify the machine mode that this machine uses
1428 for the index in the tablejump instruction. */
1429 #define CASE_VECTOR_MODE SImode
1431 /* Define as C expression which evaluates to nonzero if the tablejump
1432 instruction expects the table to contain offsets from the address of the
1435 Do not define this if the table should contain absolute addresses.
1436 On the Alpha, the table is really GP-relative, not relative to the PC
1437 of the table, but we pretend that it is PC-relative; this should be OK,
1438 but we should try to find some better way sometime. */
1439 #define CASE_VECTOR_PC_RELATIVE 1
1441 /* Define this as 1 if `char' should by default be signed; else as 0. */
1442 #define DEFAULT_SIGNED_CHAR 1
1444 /* This flag, if defined, says the same insns that convert to a signed fixnum
1445 also convert validly to an unsigned one.
1447 We actually lie a bit here as overflow conditions are different. But
1448 they aren't being checked anyway. */
1450 #define FIXUNS_TRUNC_LIKE_FIX_TRUNC
1452 /* Max number of bytes we can move to or from memory
1453 in one reasonably fast instruction. */
1457 /* If a memory-to-memory move would take MOVE_RATIO or more simple
1458 move-instruction pairs, we will do a movstr or libcall instead.
1460 Without byte/word accesses, we want no more than four instructions;
1461 with, several single byte accesses are better. */
1463 #define MOVE_RATIO (TARGET_BWX ? 7 : 2)
1465 /* Largest number of bytes of an object that can be placed in a register.
1466 On the Alpha we have plenty of registers, so use TImode. */
1467 #define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (TImode)
1469 /* Nonzero if access to memory by bytes is no faster than for words.
1470 Also nonzero if doing byte operations (specifically shifts) in registers
1473 On the Alpha, we want to not use the byte operation and instead use
1474 masking operations to access fields; these will save instructions. */
1476 #define SLOW_BYTE_ACCESS 1
1478 /* Define if operations between registers always perform the operation
1479 on the full register even if a narrower mode is specified. */
1480 #define WORD_REGISTER_OPERATIONS
1482 /* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
1483 will either zero-extend or sign-extend. The value of this macro should
1484 be the code that says which one of the two operations is implicitly
1485 done, NIL if none. */
1486 #define LOAD_EXTEND_OP(MODE) ((MODE) == SImode ? SIGN_EXTEND : ZERO_EXTEND)
1488 /* Define if loading short immediate values into registers sign extends. */
1489 #define SHORT_IMMEDIATES_SIGN_EXTEND
1491 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1492 is done just by pretending it is already truncated. */
1493 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1495 /* We assume that the store-condition-codes instructions store 0 for false
1496 and some other value for true. This is the value stored for true. */
1498 #define STORE_FLAG_VALUE 1
1500 /* Define the value returned by a floating-point comparison instruction. */
1502 #define FLOAT_STORE_FLAG_VALUE(MODE) \
1503 REAL_VALUE_ATOF ((TARGET_FLOAT_VAX ? "0.5" : "2.0"), (MODE))
1505 /* Canonicalize a comparison from one we don't have to one we do have. */
1507 #define CANONICALIZE_COMPARISON(CODE,OP0,OP1) \
1509 if (((CODE) == GE || (CODE) == GT || (CODE) == GEU || (CODE) == GTU) \
1510 && (GET_CODE (OP1) == REG || (OP1) == const0_rtx)) \
1515 (CODE) = swap_condition (CODE); \
1517 if (((CODE) == LT || (CODE) == LTU) \
1518 && GET_CODE (OP1) == CONST_INT && INTVAL (OP1) == 256) \
1520 (CODE) = (CODE) == LT ? LE : LEU; \
1521 (OP1) = GEN_INT (255); \
1525 /* Specify the machine mode that pointers have.
1526 After generation of rtl, the compiler makes no further distinction
1527 between pointers and any other objects of this machine mode. */
1528 #define Pmode DImode
1530 /* Mode of a function address in a call instruction (for indexing purposes). */
1532 #define FUNCTION_MODE Pmode
1534 /* Define this if addresses of constant functions
1535 shouldn't be put through pseudo regs where they can be cse'd.
1536 Desirable on machines where ordinary constants are expensive
1537 but a CALL with constant address is cheap.
1539 We define this on the Alpha so that gen_call and gen_call_value
1540 get to see the SYMBOL_REF (for the hint field of the jsr). It will
1541 then copy it into a register, thus actually letting the address be
1544 #define NO_FUNCTION_CSE
1546 /* Define this to be nonzero if shift instructions ignore all but the low-order
1548 #define SHIFT_COUNT_TRUNCATED 1
1550 /* Compute the cost of computing a constant rtl expression RTX
1551 whose rtx-code is CODE. The body of this macro is a portion
1552 of a switch statement. If the code is computed here,
1553 return it with a return statement. Otherwise, break from the switch.
1555 If this is an 8-bit constant, return zero since it can be used
1556 nearly anywhere with no cost. If it is a valid operand for an
1557 ADD or AND, likewise return 0 if we know it will be used in that
1558 context. Otherwise, return 2 since it might be used there later.
1559 All other constants take at least two insns. */
1561 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
1563 if (INTVAL (RTX) >= 0 && INTVAL (RTX) < 256) \
1565 case CONST_DOUBLE: \
1566 if ((RTX) == CONST0_RTX (GET_MODE (RTX))) \
1568 else if (((OUTER_CODE) == PLUS && add_operand (RTX, VOIDmode)) \
1569 || ((OUTER_CODE) == AND && and_operand (RTX, VOIDmode))) \
1571 else if (add_operand (RTX, VOIDmode) || and_operand (RTX, VOIDmode)) \
1574 return COSTS_N_INSNS (2); \
1578 switch (alpha_cpu) \
1580 case PROCESSOR_EV4: \
1581 return COSTS_N_INSNS (3); \
1582 case PROCESSOR_EV5: \
1583 case PROCESSOR_EV6: \
1584 return COSTS_N_INSNS (2); \
1588 /* Provide the costs of a rtl expression. This is in the body of a
1591 #define RTX_COSTS(X,CODE,OUTER_CODE) \
1592 case PLUS: case MINUS: \
1593 if (FLOAT_MODE_P (GET_MODE (X))) \
1594 switch (alpha_cpu) \
1596 case PROCESSOR_EV4: \
1597 return COSTS_N_INSNS (6); \
1598 case PROCESSOR_EV5: \
1599 case PROCESSOR_EV6: \
1600 return COSTS_N_INSNS (4); \
1603 else if (GET_CODE (XEXP (X, 0)) == MULT \
1604 && const48_operand (XEXP (XEXP (X, 0), 1), VOIDmode)) \
1605 return (2 + rtx_cost (XEXP (XEXP (X, 0), 0), OUTER_CODE) \
1606 + rtx_cost (XEXP (X, 1), OUTER_CODE)); \
1609 switch (alpha_cpu) \
1611 case PROCESSOR_EV4: \
1612 if (FLOAT_MODE_P (GET_MODE (X))) \
1613 return COSTS_N_INSNS (6); \
1614 return COSTS_N_INSNS (23); \
1615 case PROCESSOR_EV5: \
1616 if (FLOAT_MODE_P (GET_MODE (X))) \
1617 return COSTS_N_INSNS (4); \
1618 else if (GET_MODE (X) == DImode) \
1619 return COSTS_N_INSNS (12); \
1621 return COSTS_N_INSNS (8); \
1622 case PROCESSOR_EV6: \
1623 if (FLOAT_MODE_P (GET_MODE (X))) \
1624 return COSTS_N_INSNS (4); \
1626 return COSTS_N_INSNS (7); \
1630 if (GET_CODE (XEXP (X, 1)) == CONST_INT \
1631 && INTVAL (XEXP (X, 1)) <= 3) \
1633 /* ... fall through ... */ \
1634 case ASHIFTRT: case LSHIFTRT: \
1635 switch (alpha_cpu) \
1637 case PROCESSOR_EV4: \
1638 return COSTS_N_INSNS (2); \
1639 case PROCESSOR_EV5: \
1640 case PROCESSOR_EV6: \
1641 return COSTS_N_INSNS (1); \
1644 case IF_THEN_ELSE: \
1645 switch (alpha_cpu) \
1647 case PROCESSOR_EV4: \
1648 case PROCESSOR_EV6: \
1649 return COSTS_N_INSNS (2); \
1650 case PROCESSOR_EV5: \
1651 return COSTS_N_INSNS (1); \
1654 case DIV: case UDIV: case MOD: case UMOD: \
1655 switch (alpha_cpu) \
1657 case PROCESSOR_EV4: \
1658 if (GET_MODE (X) == SFmode) \
1659 return COSTS_N_INSNS (34); \
1660 else if (GET_MODE (X) == DFmode) \
1661 return COSTS_N_INSNS (63); \
1663 return COSTS_N_INSNS (70); \
1664 case PROCESSOR_EV5: \
1665 if (GET_MODE (X) == SFmode) \
1666 return COSTS_N_INSNS (15); \
1667 else if (GET_MODE (X) == DFmode) \
1668 return COSTS_N_INSNS (22); \
1670 return COSTS_N_INSNS (70); /* ??? */ \
1671 case PROCESSOR_EV6: \
1672 if (GET_MODE (X) == SFmode) \
1673 return COSTS_N_INSNS (12); \
1674 else if (GET_MODE (X) == DFmode) \
1675 return COSTS_N_INSNS (15); \
1677 return COSTS_N_INSNS (70); /* ??? */ \
1681 switch (alpha_cpu) \
1683 case PROCESSOR_EV4: \
1684 case PROCESSOR_EV6: \
1685 return COSTS_N_INSNS (3); \
1686 case PROCESSOR_EV5: \
1687 return COSTS_N_INSNS (2); \
1690 case NEG: case ABS: \
1691 if (! FLOAT_MODE_P (GET_MODE (X))) \
1693 /* ... fall through ... */ \
1694 case FLOAT: case UNSIGNED_FLOAT: case FIX: case UNSIGNED_FIX: \
1695 case FLOAT_EXTEND: case FLOAT_TRUNCATE: \
1696 switch (alpha_cpu) \
1698 case PROCESSOR_EV4: \
1699 return COSTS_N_INSNS (6); \
1700 case PROCESSOR_EV5: \
1701 case PROCESSOR_EV6: \
1702 return COSTS_N_INSNS (4); \
1706 /* Control the assembler format that we output. */
1708 /* Output to assembler file text saying following lines
1709 may contain character constants, extra white space, comments, etc. */
1710 #define ASM_APP_ON (TARGET_EXPLICIT_RELOCS ? "\t.set\tmacro\n" : "")
1712 /* Output to assembler file text saying following lines
1713 no longer contain unusual constructs. */
1714 #define ASM_APP_OFF (TARGET_EXPLICIT_RELOCS ? "\t.set\tnomacro\n" : "")
1716 #define TEXT_SECTION_ASM_OP "\t.text"
1718 /* Output before read-only data. */
1720 #define READONLY_DATA_SECTION_ASM_OP "\t.rdata"
1722 /* Output before writable data. */
1724 #define DATA_SECTION_ASM_OP "\t.data"
1726 /* How to refer to registers in assembler output.
1727 This sequence is indexed by compiler's hard-register-number (see above). */
1729 #define REGISTER_NAMES \
1730 {"$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \
1731 "$9", "$10", "$11", "$12", "$13", "$14", "$15", \
1732 "$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23", \
1733 "$24", "$25", "$26", "$27", "$28", "$29", "$30", "AP", \
1734 "$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "$f6", "$f7", "$f8", \
1735 "$f9", "$f10", "$f11", "$f12", "$f13", "$f14", "$f15", \
1736 "$f16", "$f17", "$f18", "$f19", "$f20", "$f21", "$f22", "$f23",\
1737 "$f24", "$f25", "$f26", "$f27", "$f28", "$f29", "$f30", "FP"}
1739 /* Strip name encoding when emitting labels. */
1741 #define ASM_OUTPUT_LABELREF(STREAM, NAME) \
1743 const char *name_ = NAME; \
1744 if (*name_ == '@' || *name_ == '%') \
1746 if (*name_ == '*') \
1749 fputs (user_label_prefix, STREAM); \
1750 fputs (name_, STREAM); \
1753 /* Globalizing directive for a label. */
1754 #define GLOBAL_ASM_OP "\t.globl "
1756 /* The prefix to add to user-visible assembler symbols. */
1758 #define USER_LABEL_PREFIX ""
1760 /* This is how to output an internal numbered label where
1761 PREFIX is the class of label and NUM is the number within the class. */
1763 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
1764 fprintf (FILE, "$%s%d:\n", PREFIX, NUM)
1766 /* This is how to output a label for a jump table. Arguments are the same as
1767 for ASM_OUTPUT_INTERNAL_LABEL, except the insn for the jump table is
1770 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
1771 { ASM_OUTPUT_ALIGN (FILE, 2); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); }
1773 /* This is how to store into the string LABEL
1774 the symbol_ref name of an internal numbered label where
1775 PREFIX is the class of label and NUM is the number within the class.
1776 This is suitable for output with `assemble_name'. */
1778 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
1779 sprintf ((LABEL), "*$%s%ld", (PREFIX), (long)(NUM))
1781 /* We use the default ASCII-output routine, except that we don't write more
1782 than 50 characters since the assembler doesn't support very long lines. */
1784 #define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \
1786 FILE *_hide_asm_out_file = (MYFILE); \
1787 const unsigned char *_hide_p = (const unsigned char *) (MYSTRING); \
1788 int _hide_thissize = (MYLENGTH); \
1789 int _size_so_far = 0; \
1791 FILE *asm_out_file = _hide_asm_out_file; \
1792 const unsigned char *p = _hide_p; \
1793 int thissize = _hide_thissize; \
1795 fprintf (asm_out_file, "\t.ascii \""); \
1797 for (i = 0; i < thissize; i++) \
1799 register int c = p[i]; \
1801 if (_size_so_far ++ > 50 && i < thissize - 4) \
1802 _size_so_far = 0, fprintf (asm_out_file, "\"\n\t.ascii \""); \
1804 if (c == '\"' || c == '\\') \
1805 putc ('\\', asm_out_file); \
1806 if (c >= ' ' && c < 0177) \
1807 putc (c, asm_out_file); \
1810 fprintf (asm_out_file, "\\%o", c); \
1811 /* After an octal-escape, if a digit follows, \
1812 terminate one string constant and start another. \
1813 The VAX assembler fails to stop reading the escape \
1814 after three digits, so this is the only way we \
1815 can get it to parse the data properly. */ \
1816 if (i < thissize - 1 && ISDIGIT (p[i + 1])) \
1817 _size_so_far = 0, fprintf (asm_out_file, "\"\n\t.ascii \""); \
1820 fprintf (asm_out_file, "\"\n"); \
1825 /* This is how to output an insn to push a register on the stack.
1826 It need not be very fast code. */
1828 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
1829 fprintf (FILE, "\tsubq $30,8,$30\n\tst%s $%s%d,0($30)\n", \
1830 (REGNO) > 32 ? "t" : "q", (REGNO) > 32 ? "f" : "", \
1833 /* This is how to output an insn to pop a register from the stack.
1834 It need not be very fast code. */
1836 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
1837 fprintf (FILE, "\tld%s $%s%d,0($30)\n\taddq $30,8,$30\n", \
1838 (REGNO) > 32 ? "t" : "q", (REGNO) > 32 ? "f" : "", \
1841 /* This is how to output an element of a case-vector that is absolute.
1842 (Alpha does not use such vectors, but we must define this macro anyway.) */
1844 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) abort ()
1846 /* This is how to output an element of a case-vector that is relative. */
1848 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
1849 fprintf (FILE, "\t.%s $L%d\n", TARGET_ABI_WINDOWS_NT ? "long" : "gprel32", \
1852 /* This is how to output an assembler line
1853 that says to advance the location counter
1854 to a multiple of 2**LOG bytes. */
1856 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1858 fprintf (FILE, "\t.align %d\n", LOG);
1860 /* This is how to advance the location counter by SIZE bytes. */
1862 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
1863 fprintf (FILE, "\t.space %d\n", (SIZE))
1865 /* This says how to output an assembler line
1866 to define a global common symbol. */
1868 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
1869 ( fputs ("\t.comm ", (FILE)), \
1870 assemble_name ((FILE), (NAME)), \
1871 fprintf ((FILE), ",%d\n", (SIZE)))
1873 /* This says how to output an assembler line
1874 to define a local common symbol. */
1876 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \
1877 ( fputs ("\t.lcomm ", (FILE)), \
1878 assemble_name ((FILE), (NAME)), \
1879 fprintf ((FILE), ",%d\n", (SIZE)))
1881 /* Store in OUTPUT a string (made with alloca) containing
1882 an assembler-name for a local static variable named NAME.
1883 LABELNO is an integer which is different for each call. */
1885 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1886 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
1887 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1890 /* Print operand X (an rtx) in assembler syntax to file FILE.
1891 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1892 For `%' followed by punctuation, CODE is the punctuation and X is null. */
1894 #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
1896 /* Determine which codes are valid without a following integer. These must
1899 ~ Generates the name of the current function.
1901 / Generates the instruction suffix. The TRAP_SUFFIX and ROUND_SUFFIX
1902 attributes are examined to determine what is appropriate.
1904 , Generates single precision suffix for floating point
1905 instructions (s for IEEE, f for VAX)
1907 - Generates double precision suffix for floating point
1908 instructions (t for IEEE, g for VAX)
1911 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
1912 ((CODE) == '/' || (CODE) == ',' || (CODE) == '-' || (CODE) == '~' \
1913 || (CODE) == '#' || (CODE) == '*' || (CODE) == '&')
1915 /* Print a memory address as an operand to reference that memory location. */
1917 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
1918 print_operand_address((FILE), (ADDR))
1920 /* Define the codes that are matched by predicates in alpha.c. */
1922 #define PREDICATE_CODES \
1923 {"reg_or_0_operand", {SUBREG, REG, CONST_INT, CONST_DOUBLE, \
1925 {"reg_or_6bit_operand", {SUBREG, REG, CONST_INT}}, \
1926 {"reg_or_8bit_operand", {SUBREG, REG, CONST_INT}}, \
1927 {"reg_or_const_int_operand", {SUBREG, REG, CONST_INT}}, \
1928 {"cint8_operand", {CONST_INT}}, \
1929 {"reg_or_cint_operand", {SUBREG, REG, CONST_INT}}, \
1930 {"add_operand", {SUBREG, REG, CONST_INT}}, \
1931 {"sext_add_operand", {SUBREG, REG, CONST_INT}}, \
1932 {"const48_operand", {CONST_INT}}, \
1933 {"and_operand", {SUBREG, REG, CONST_INT}}, \
1934 {"or_operand", {SUBREG, REG, CONST_INT}}, \
1935 {"mode_mask_operand", {CONST_INT}}, \
1936 {"mul8_operand", {CONST_INT}}, \
1937 {"mode_width_operand", {CONST_INT}}, \
1938 {"alpha_comparison_operator", {EQ, LE, LT, LEU, LTU}}, \
1939 {"alpha_zero_comparison_operator", {EQ, NE, LE, LT, LEU, LTU}}, \
1940 {"alpha_swapped_comparison_operator", {EQ, GE, GT, GEU, GTU}}, \
1941 {"signed_comparison_operator", {EQ, NE, LE, LT, GE, GT}}, \
1942 {"alpha_fp_comparison_operator", {EQ, LE, LT, UNORDERED}}, \
1943 {"divmod_operator", {DIV, MOD, UDIV, UMOD}}, \
1944 {"const0_operand", {CONST_INT, CONST_DOUBLE, CONST_VECTOR}}, \
1945 {"current_file_function_operand", {SYMBOL_REF}}, \
1946 {"direct_call_operand", {SYMBOL_REF}}, \
1947 {"local_symbolic_operand", {SYMBOL_REF, CONST, LABEL_REF}}, \
1948 {"small_symbolic_operand", {SYMBOL_REF, CONST}}, \
1949 {"global_symbolic_operand", {SYMBOL_REF, CONST}}, \
1950 {"dtp16_symbolic_operand", {CONST}}, \
1951 {"dtp32_symbolic_operand", {CONST}}, \
1952 {"gotdtp_symbolic_operand", {CONST}}, \
1953 {"tp16_symbolic_operand", {CONST}}, \
1954 {"tp32_symbolic_operand", {CONST}}, \
1955 {"gottp_symbolic_operand", {CONST}}, \
1956 {"call_operand", {REG, SYMBOL_REF}}, \
1957 {"input_operand", {SUBREG, REG, MEM, CONST_INT, CONST_DOUBLE, \
1958 CONST_VECTOR, SYMBOL_REF, CONST, LABEL_REF, HIGH}},\
1959 {"some_operand", {SUBREG, REG, MEM, CONST_INT, CONST_DOUBLE, \
1960 CONST_VECTOR, SYMBOL_REF, CONST, LABEL_REF, HIGH}}, \
1961 {"some_ni_operand", {SUBREG, REG, MEM}}, \
1962 {"aligned_memory_operand", {MEM}}, \
1963 {"unaligned_memory_operand", {MEM}}, \
1964 {"reg_or_unaligned_mem_operand", {SUBREG, REG, MEM}}, \
1965 {"any_memory_operand", {MEM}}, \
1966 {"hard_fp_register_operand", {SUBREG, REG}}, \
1967 {"hard_int_register_operand", {SUBREG, REG}}, \
1968 {"reg_not_elim_operand", {SUBREG, REG}}, \
1969 {"reg_no_subreg_operand", {REG}}, \
1970 {"addition_operation", {PLUS}}, \
1971 {"symbolic_operand", {SYMBOL_REF, LABEL_REF, CONST}}, \
1972 {"some_small_symbolic_operand", {SET, PARALLEL, PREFETCH, UNSPEC, \
1975 /* Define the `__builtin_va_list' type for the ABI. */
1976 #define BUILD_VA_LIST_TYPE(VALIST) \
1977 (VALIST) = alpha_build_va_list ()
1979 /* Implement `va_start' for varargs and stdarg. */
1980 #define EXPAND_BUILTIN_VA_START(valist, nextarg) \
1981 alpha_va_start (valist, nextarg)
1983 /* Implement `va_arg'. */
1984 #define EXPAND_BUILTIN_VA_ARG(valist, type) \
1985 alpha_va_arg (valist, type)
1987 /* Tell collect that the object format is ECOFF. */
1988 #define OBJECT_FORMAT_COFF
1989 #define EXTENDED_COFF
1991 /* If we use NM, pass -g to it so it only lists globals. */
1992 #define NM_FLAGS "-pg"
1994 /* Definitions for debugging. */
1996 #define SDB_DEBUGGING_INFO 1 /* generate info for mips-tfile */
1997 #define DBX_DEBUGGING_INFO 1 /* generate embedded stabs */
1998 #define MIPS_DEBUGGING_INFO 1 /* MIPS specific debugging info */
2000 #ifndef PREFERRED_DEBUGGING_TYPE /* assume SDB_DEBUGGING_INFO */
2001 #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
2005 /* Correct the offset of automatic variables and arguments. Note that
2006 the Alpha debug format wants all automatic variables and arguments
2007 to be in terms of two different offsets from the virtual frame pointer,
2008 which is the stack pointer before any adjustment in the function.
2009 The offset for the argument pointer is fixed for the native compiler,
2010 it is either zero (for the no arguments case) or large enough to hold
2011 all argument registers.
2012 The offset for the auto pointer is the fourth argument to the .frame
2013 directive (local_offset).
2014 To stay compatible with the native tools we use the same offsets
2015 from the virtual frame pointer and adjust the debugger arg/auto offsets
2016 accordingly. These debugger offsets are set up in output_prolog. */
2018 extern long alpha_arg_offset;
2019 extern long alpha_auto_offset;
2020 #define DEBUGGER_AUTO_OFFSET(X) \
2021 ((GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0) + alpha_auto_offset)
2022 #define DEBUGGER_ARG_OFFSET(OFFSET, X) (OFFSET + alpha_arg_offset)
2025 #define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE) \
2026 alpha_output_lineno (STREAM, LINE)
2028 #define ASM_OUTPUT_SOURCE_FILENAME(STREAM, NAME) \
2029 alpha_output_filename (STREAM, NAME)
2031 /* mips-tfile.c limits us to strings of one page. We must underestimate this
2032 number, because the real length runs past this up to the next
2033 continuation point. This is really a dbxout.c bug. */
2034 #define DBX_CONTIN_LENGTH 3000
2036 /* By default, turn on GDB extensions. */
2037 #define DEFAULT_GDB_EXTENSIONS 1
2039 /* Stabs-in-ECOFF can't handle dbxout_function_end(). */
2040 #define NO_DBX_FUNCTION_END 1
2042 /* If we are smuggling stabs through the ALPHA ECOFF object
2043 format, put a comment in front of the .stab<x> operation so
2044 that the ALPHA assembler does not choke. The mips-tfile program
2045 will correctly put the stab into the object file. */
2047 #define ASM_STABS_OP ((TARGET_GAS) ? "\t.stabs\t" : " #.stabs\t")
2048 #define ASM_STABN_OP ((TARGET_GAS) ? "\t.stabn\t" : " #.stabn\t")
2049 #define ASM_STABD_OP ((TARGET_GAS) ? "\t.stabd\t" : " #.stabd\t")
2051 /* Forward references to tags are allowed. */
2052 #define SDB_ALLOW_FORWARD_REFERENCES
2054 /* Unknown tags are also allowed. */
2055 #define SDB_ALLOW_UNKNOWN_REFERENCES
2057 #define PUT_SDB_DEF(a) \
2059 fprintf (asm_out_file, "\t%s.def\t", \
2060 (TARGET_GAS) ? "" : "#"); \
2061 ASM_OUTPUT_LABELREF (asm_out_file, a); \
2062 fputc (';', asm_out_file); \
2065 #define PUT_SDB_PLAIN_DEF(a) \
2067 fprintf (asm_out_file, "\t%s.def\t.%s;", \
2068 (TARGET_GAS) ? "" : "#", (a)); \
2071 #define PUT_SDB_TYPE(a) \
2073 fprintf (asm_out_file, "\t.type\t0x%x;", (a)); \
2076 /* For block start and end, we create labels, so that
2077 later we can figure out where the correct offset is.
2078 The normal .ent/.end serve well enough for functions,
2079 so those are just commented out. */
2081 extern int sdb_label_count; /* block start/end next label # */
2083 #define PUT_SDB_BLOCK_START(LINE) \
2085 fprintf (asm_out_file, \
2086 "$Lb%d:\n\t%s.begin\t$Lb%d\t%d\n", \
2088 (TARGET_GAS) ? "" : "#", \
2091 sdb_label_count++; \
2094 #define PUT_SDB_BLOCK_END(LINE) \
2096 fprintf (asm_out_file, \
2097 "$Le%d:\n\t%s.bend\t$Le%d\t%d\n", \
2099 (TARGET_GAS) ? "" : "#", \
2102 sdb_label_count++; \
2105 #define PUT_SDB_FUNCTION_START(LINE)
2107 #define PUT_SDB_FUNCTION_END(LINE)
2109 #define PUT_SDB_EPILOGUE_END(NAME) ((void)(NAME))
2111 /* Macros for mips-tfile.c to encapsulate stabs in ECOFF, and for
2112 mips-tdump.c to print them out.
2114 These must match the corresponding definitions in gdb/mipsread.c.
2115 Unfortunately, gcc and gdb do not currently share any directories. */
2117 #define CODE_MASK 0x8F300
2118 #define MIPS_IS_STAB(sym) (((sym)->index & 0xFFF00) == CODE_MASK)
2119 #define MIPS_MARK_STAB(code) ((code)+CODE_MASK)
2120 #define MIPS_UNMARK_STAB(code) ((code)-CODE_MASK)
2122 /* Override some mips-tfile definitions. */
2124 #define SHASH_SIZE 511
2125 #define THASH_SIZE 55
2127 /* Align ecoff symbol tables to avoid OSF1/1.3 nm complaints. */
2129 #define ALIGN_SYMTABLE_OFFSET(OFFSET) (((OFFSET) + 7) & ~7)
2131 /* The system headers under Alpha systems are generally C++-aware. */
2132 #define NO_IMPLICIT_EXTERN_C
2134 /* Generate calls to memcpy, etc., not bcopy, etc. */
2135 #define TARGET_MEM_FUNCTIONS 1