1 /* Definitions of target machine for GNU compiler, for Sun SPARC.
2 Copyright (C) 1987, 88, 89, 92, 94-97, 1998 Free Software Foundation, Inc.
3 Contributed by Michael Tiemann (tiemann@cygnus.com).
4 64 bit SPARC V9 support by Michael Tiemann, Jim Wilson, and Doug Evans,
7 This file is part of GNU CC.
9 GNU CC is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
14 GNU CC is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with GNU CC; see the file COPYING. If not, write to
21 the Free Software Foundation, 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
24 /* Note that some other tm.h files include this one and then override
25 whatever definitions are necessary. */
27 /* Specify this in a cover file to provide bi-architecture (32/64) support. */
28 /* #define SPARC_BI_ARCH */
30 /* Macro used later in this file to determine default architecture. */
31 #define DEFAULT_ARCH32_P ((TARGET_DEFAULT & MASK_64BIT) == 0)
33 /* TARGET_ARCH{32,64} are the main macros to decide which of the two
34 architectures to compile for. We allow targets to choose compile time or
37 #define TARGET_ARCH32 (! TARGET_64BIT)
39 #define TARGET_ARCH32 (DEFAULT_ARCH32_P)
41 #define TARGET_ARCH64 (! TARGET_ARCH32)
43 /* Code model selection.
44 -mcmodel is used to select the v9 code model.
45 Different code models aren't supported for v8 code.
47 TARGET_CM_32: 32 bit address space, top 32 bits = 0,
48 pointers are 32 bits. Note that this isn't intended
51 TARGET_CM_MEDLOW: 32 bit address space, top 32 bits = 0,
52 avoid generating %uhi and %ulo terms,
55 TARGET_CM_MEDMID: 64 bit address space.
56 The executable must be in the low 16 TB of memory.
57 This corresponds to the low 44 bits, and the %[hml]44
60 TARGET_CM_MEDANY: 64 bit address space.
61 The text and data segments have a maximum size of 31
62 bits and may be located anywhere. The maximum offset
63 from any instruction to the label _GLOBAL_OFFSET_TABLE_
66 TARGET_CM_EMBMEDANY: 64 bit address space.
67 The text and data segments have a maximum size of 31 bits
68 and may be located anywhere. Register %g4 contains
69 the start address of the data segment.
80 /* Value of -mcmodel specified by user. */
81 extern char *sparc_cmodel_string
;
83 extern enum cmodel sparc_cmodel
;
85 /* V9 code model selection. */
86 #define TARGET_CM_MEDLOW (sparc_cmodel == CM_MEDLOW)
87 #define TARGET_CM_MEDMID (sparc_cmodel == CM_MEDMID)
88 #define TARGET_CM_MEDANY (sparc_cmodel == CM_MEDANY)
89 #define TARGET_CM_EMBMEDANY (sparc_cmodel == CM_EMBMEDANY)
91 #define SPARC_DEFAULT_CMODEL CM_MEDLOW
93 /* This is call-clobbered in the normal ABI, but is reserved in the
94 home grown (aka upward compatible) embedded ABI. */
95 #define EMBMEDANY_BASE_REG "%g4"
97 /* Values of TARGET_CPU_DEFAULT, set via -D in the Makefile,
98 and specified by the user via --with-cpu=foo.
99 This specifies the cpu implementation, not the architecture size. */
100 #define TARGET_CPU_sparc 0
101 #define TARGET_CPU_v7 0 /* alias for previous */
102 #define TARGET_CPU_sparclet 1
103 #define TARGET_CPU_sparclite 2
104 #define TARGET_CPU_v8 3 /* generic v8 implementation */
105 #define TARGET_CPU_supersparc 4
106 #define TARGET_CPU_v9 5 /* generic v9 implementation */
107 #define TARGET_CPU_sparc64 5 /* alias */
108 #define TARGET_CPU_ultrasparc 6
110 #if TARGET_CPU_DEFAULT == TARGET_CPU_sparc || TARGET_CPU_DEFAULT == TARGET_CPU_v8 || TARGET_CPU_DEFAULT == TARGET_CPU_supersparc
111 #define CPP_CPU_DEFAULT_SPEC ""
112 #define ASM_CPU_DEFAULT_SPEC ""
114 #if TARGET_CPU_DEFAULT == TARGET_CPU_sparclet
115 #define CPP_CPU_DEFAULT_SPEC "-D__sparclet__"
116 #define ASM_CPU_DEFAULT_SPEC "-Asparclet"
118 #if TARGET_CPU_DEFAULT == TARGET_CPU_sparclite
119 #define CPP_CPU_DEFAULT_SPEC "-D__sparclite__"
120 #define ASM_CPU_DEFAULT_SPEC "-Asparclite"
122 #if TARGET_CPU_DEFAULT == TARGET_CPU_v9
123 /* ??? What does Sun's CC pass? */
124 #define CPP_CPU_DEFAULT_SPEC "-D__sparc_v9__"
125 /* ??? It's not clear how other assemblers will handle this, so by default
126 use GAS. Sun's Solaris assembler recognizes -xarch=v8plus, but this case
127 is handled in sol2.h. */
128 #define ASM_CPU_DEFAULT_SPEC "-Av9"
130 #if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
131 #define CPP_CPU_DEFAULT_SPEC "-D__sparc_v9__"
132 #define ASM_CPU_DEFAULT_SPEC "-Av9a"
134 #ifndef CPP_CPU_DEFAULT_SPEC
135 Unrecognized value in TARGET_CPU_DEFAULT
.
138 /* Names to predefine in the preprocessor for this target machine.
139 ??? It would be nice to not include any subtarget specific values here,
140 however there's no way to portably provide subtarget values to
141 CPP_PREFINES. Also, -D values in CPP_SUBTARGET_SPEC don't get turned into
142 foo, __foo and __foo__. */
144 #define CPP_PREDEFINES "-Dsparc -Dsun -Dunix -Asystem(unix) -Asystem(bsd)"
146 /* Define macros to distinguish architectures. */
148 /* Common CPP definitions used by CPP_SPEC amongst the various targets
149 for handling -mcpu=xxx switches. */
150 #define CPP_CPU_SPEC "\
152 %{msparclite:-D__sparclite__} \
153 %{mf930:-D__sparclite__} %{mf934:-D__sparclite__} \
154 %{mv8:-D__sparc_v8__} \
155 %{msupersparc:-D__supersparc__ -D__sparc_v8__} \
156 %{mcpu=sparclet:-D__sparclet__} %{mcpu=tsc701:-D__sparclet__} \
157 %{mcpu=sparclite:-D__sparclite__} \
158 %{mcpu=f930:-D__sparclite__} %{mcpu=f934:-D__sparclite__} \
159 %{mcpu=v8:-D__sparc_v8__} \
160 %{mcpu=supersparc:-D__supersparc__ -D__sparc_v8__} \
161 %{mcpu=v9:-D__sparc_v9__} \
162 %{mcpu=ultrasparc:-D__sparc_v9__} \
163 %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(cpp_cpu_default)}}}}}}} \
166 /* ??? The GCC_NEW_VARARGS macro is now obsolete, because gcc always uses
167 the right varags.h file when bootstrapping. */
168 /* ??? It's not clear what value we want to use for -Acpu/machine for
169 sparc64 in 32 bit environments, so for now we only use `sparc64' in
170 64 bit environments. */
172 #define CPP_ARCH32_SPEC "-D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc)"
173 #define CPP_ARCH64_SPEC "-D__arch64__ -Acpu(sparc64) -Amachine(sparc64)"
174 #define CPP_ARCH_DEFAULT_SPEC \
175 (DEFAULT_ARCH32_P ? CPP_ARCH32_SPEC : CPP_ARCH64_SPEC)
177 #define CPP_ARCH_SPEC "\
178 %{m32:%(cpp_arch32)} \
179 %{m64:%(cpp_arch64)} \
180 %{!m32:%{!m64:%(cpp_arch_default)}} \
183 /* Macros to distinguish endianness. */
184 #define CPP_ENDIAN_SPEC "%{mlittle-endian:-D__LITTLE_ENDIAN__}"
186 /* Macros to distinguish the particular subtarget. */
187 #define CPP_SUBTARGET_SPEC ""
189 #define CPP_SPEC "%(cpp_cpu) %(cpp_arch) %(cpp_endian) %(cpp_subtarget)"
191 /* Prevent error on `-sun4' and `-target sun4' options. */
192 /* This used to translate -dalign to -malign, but that is no good
193 because it can't turn off the usual meaning of making debugging dumps. */
194 /* Translate old style -m<cpu> into new style -mcpu=<cpu>.
195 ??? Delete support for -m<cpu> for 2.9. */
198 %{sun4:} %{target:} \
199 %{mcypress:-mcpu=cypress} \
200 %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
201 %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
204 /* Override in target specific files. */
205 #define ASM_CPU_SPEC "\
206 %{mcpu=sparclet:-Asparclet} %{mcpu=tsc701:-Asparclet} \
207 %{msparclite:-Asparclite} \
208 %{mf930:-Asparclite} %{mf934:-Asparclite} \
209 %{mcpu=sparclite:-Asparclite} \
210 %{mcpu=f930:-Asparclite} %{mcpu=f934:-Asparclite} \
211 %{mv8plus:-Av8plus} \
213 %{mcpu=ultrasparc:%{!mv8plus:-Av9a}} \
214 %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(asm_cpu_default)}}}}}}} \
217 /* Word size selection, among other things.
218 This is what GAS uses. Add %(asm_arch) to ASM_SPEC to enable. */
220 #define ASM_ARCH32_SPEC "-32"
221 #define ASM_ARCH64_SPEC "-64"
222 #define ASM_ARCH_DEFAULT_SPEC \
223 (DEFAULT_ARCH32_P ? ASM_ARCH32_SPEC : ASM_ARCH64_SPEC)
225 #define ASM_ARCH_SPEC "\
226 %{m32:%(asm_arch32)} \
227 %{m64:%(asm_arch64)} \
228 %{!m32:%{!m64:%(asm_arch_default)}} \
231 /* Special flags to the Sun-4 assembler when using pipe for input. */
234 %| %{R} %{!pg:%{!p:%{fpic:-k} %{fPIC:-k}}} %{keep-local-as-symbols:-L} \
238 #define LIB_SPEC "%{!shared:%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} %{g:-lg}}"
240 /* Provide required defaults for linker -e and -d switches. */
243 "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp} %{static:-Bstatic} \
244 %{assert*} %{shared:%{!mimpure-text:-assert pure-text}}"
246 /* This macro defines names of additional specifications to put in the specs
247 that can be used in various specifications like CC1_SPEC. Its definition
248 is an initializer with a subgrouping for each command option.
250 Each subgrouping contains a string constant, that defines the
251 specification name, and a string constant that used by the GNU CC driver
254 Do not define this macro if it does not need to do anything. */
256 #define EXTRA_SPECS \
257 { "cpp_cpu", CPP_CPU_SPEC }, \
258 { "cpp_cpu_default", CPP_CPU_DEFAULT_SPEC }, \
259 { "cpp_arch32", CPP_ARCH32_SPEC }, \
260 { "cpp_arch64", CPP_ARCH64_SPEC }, \
261 { "cpp_arch_default", CPP_ARCH_DEFAULT_SPEC }, \
262 { "cpp_arch", CPP_ARCH_SPEC }, \
263 { "cpp_endian", CPP_ENDIAN_SPEC }, \
264 { "cpp_subtarget", CPP_SUBTARGET_SPEC }, \
265 { "asm_cpu", ASM_CPU_SPEC }, \
266 { "asm_cpu_default", ASM_CPU_DEFAULT_SPEC }, \
267 { "asm_arch32", ASM_ARCH32_SPEC }, \
268 { "asm_arch64", ASM_ARCH64_SPEC }, \
269 { "asm_arch_default", ASM_ARCH_DEFAULT_SPEC }, \
270 { "asm_arch", ASM_ARCH_SPEC }, \
271 SUBTARGET_EXTRA_SPECS
273 #define SUBTARGET_EXTRA_SPECS
276 #define NO_BUILTIN_PTRDIFF_TYPE
277 #define NO_BUILTIN_SIZE_TYPE
279 #define PTRDIFF_TYPE (TARGET_ARCH64 ? "long int" : "int")
280 #define SIZE_TYPE (TARGET_ARCH64 ? "long unsigned int" : "unsigned int")
282 /* ??? This should be 32 bits for v9 but what can we do? */
283 #define WCHAR_TYPE "short unsigned int"
284 #define WCHAR_TYPE_SIZE 16
285 #define MAX_WCHAR_TYPE_SIZE 16
287 /* Show we can debug even without a frame pointer. */
288 #define CAN_DEBUG_WITHOUT_FP
290 /* To make profiling work with -f{pic,PIC}, we need to emit the profiling
291 code into the rtl. Also, if we are profiling, we cannot eliminate
292 the frame pointer (because the return address will get smashed). */
294 void sparc_override_options ();
296 #define OVERRIDE_OPTIONS \
298 if (profile_flag || profile_block_flag || profile_arc_flag) \
302 char *pic_string = (flag_pic == 1) ? "-fpic" : "-fPIC"; \
303 warning ("%s and profiling conflict: disabling %s", \
304 pic_string, pic_string); \
307 flag_omit_frame_pointer = 0; \
309 sparc_override_options (); \
310 SUBTARGET_OVERRIDE_OPTIONS; \
313 /* This is meant to be redefined in the host dependent files. */
314 #define SUBTARGET_OVERRIDE_OPTIONS
316 /* These compiler options take an argument. We ignore -target for now. */
318 #define WORD_SWITCH_TAKES_ARG(STR) \
319 (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
320 || !strcmp (STR, "target") || !strcmp (STR, "assert"))
322 /* Print subsidiary information on the compiler version in use. */
324 #define TARGET_VERSION fprintf (stderr, " (sparc)");
326 /* Generate DBX debugging information. */
328 #define DBX_DEBUGGING_INFO
330 /* Run-time compilation parameters selecting different hardware subsets. */
332 extern int target_flags
;
334 /* Nonzero if we should generate code to use the fpu. */
336 #define TARGET_FPU (target_flags & MASK_FPU)
338 /* Nonzero if we should use FUNCTION_EPILOGUE. Otherwise, we
339 use fast return insns, but lose some generality. */
340 #define MASK_EPILOGUE 2
341 #define TARGET_EPILOGUE (target_flags & MASK_EPILOGUE)
343 /* Nonzero if we should assume that double pointers might be unaligned.
344 This can happen when linking gcc compiled code with other compilers,
345 because the ABI only guarantees 4 byte alignment. */
346 #define MASK_UNALIGNED_DOUBLES 4
347 #define TARGET_UNALIGNED_DOUBLES (target_flags & MASK_UNALIGNED_DOUBLES)
349 /* Nonzero means that we should generate code for a v8 sparc. */
351 #define TARGET_V8 (target_flags & MASK_V8)
353 /* Nonzero means that we should generate code for a sparclite.
354 This enables the sparclite specific instructions, but does not affect
355 whether FPU instructions are emitted. */
356 #define MASK_SPARCLITE 0x10
357 #define TARGET_SPARCLITE (target_flags & MASK_SPARCLITE)
359 /* Nonzero if we're compiling for the sparclet. */
360 #define MASK_SPARCLET 0x20
361 #define TARGET_SPARCLET (target_flags & MASK_SPARCLET)
363 /* Nonzero if we're compiling for v9 sparc.
364 Note that v9's can run in 32 bit mode so this doesn't necessarily mean
365 the word size is 64. */
367 #define TARGET_V9 (target_flags & MASK_V9)
369 /* Non-zero to generate code that uses the instructions deprecated in
370 the v9 architecture. This option only applies to v9 systems. */
371 /* ??? This isn't user selectable yet. It's used to enable such insns
372 on 32 bit v9 systems and for the moment they're permanently disabled
373 on 64 bit v9 systems. */
374 #define MASK_DEPRECATED_V8_INSNS 0x80
375 #define TARGET_DEPRECATED_V8_INSNS (target_flags & MASK_DEPRECATED_V8_INSNS)
377 /* Mask of all CPU selection flags. */
379 (MASK_V8 + MASK_SPARCLITE + MASK_SPARCLET + MASK_V9 + MASK_DEPRECATED_V8_INSNS)
381 /* Non-zero means don't pass `-assert pure-text' to the linker. */
382 #define MASK_IMPURE_TEXT 0x100
383 #define TARGET_IMPURE_TEXT (target_flags & MASK_IMPURE_TEXT)
385 /* Nonzero means that we should generate code using a flat register window
386 model, i.e. no save/restore instructions are generated, which is
387 compatible with normal sparc code.
388 The frame pointer is %i7 instead of %fp. */
389 #define MASK_FLAT 0x200
390 #define TARGET_FLAT (target_flags & MASK_FLAT)
392 /* Nonzero means use the registers that the Sparc ABI reserves for
393 application software. This must be the default to coincide with the
394 setting in FIXED_REGISTERS. */
395 #define MASK_APP_REGS 0x400
396 #define TARGET_APP_REGS (target_flags & MASK_APP_REGS)
398 /* Option to select how quad word floating point is implemented.
399 When TARGET_HARD_QUAD is true, we use the hardware quad instructions.
400 Otherwise, we use the SPARC ABI quad library functions. */
401 #define MASK_HARD_QUAD 0x800
402 #define TARGET_HARD_QUAD (target_flags & MASK_HARD_QUAD)
404 /* Non-zero on little-endian machines. */
405 /* ??? Little endian support currently only exists for sparclet-aout and
406 sparc64-elf configurations. May eventually want to expand the support
407 to all targets, but for now it's kept local to only those two. */
408 #define MASK_LITTLE_ENDIAN 0x1000
409 #define TARGET_LITTLE_ENDIAN (target_flags & MASK_LITTLE_ENDIAN)
411 /* 0x2000, 0x4000 are unused */
413 /* Nonzero if pointers are 64 bits.
414 This is not a user selectable option, though it may be one day -
415 so it is used to determine pointer size instead of an architecture flag. */
416 #define MASK_PTR64 0x8000
417 #define TARGET_PTR64 (target_flags & MASK_PTR64)
419 /* Nonzero if generating code to run in a 64 bit environment.
420 This is intended to only be used by TARGET_ARCH{32,64} as they are the
421 mechanism used to control compile time or run time selection. */
422 #define MASK_64BIT 0x10000
423 #define TARGET_64BIT (target_flags & MASK_64BIT)
425 /* 0x20000,0x40000 unused */
427 /* Non-zero means use a stack bias of 2047. Stack offsets are obtained by
428 adding 2047 to %sp. This option is for v9 only and is the default. */
429 #define MASK_STACK_BIAS 0x80000
430 #define TARGET_STACK_BIAS (target_flags & MASK_STACK_BIAS)
432 /* Non-zero means %g0 is a normal register.
433 We still clobber it as necessary, but we can't rely on it always having
435 We don't bother to support this in true 64 bit mode. */
436 #define MASK_LIVE_G0 0x100000
437 #define TARGET_LIVE_G0 (target_flags & MASK_LIVE_G0)
439 /* Non-zero means the cpu has broken `save' and `restore' insns, only
440 the trivial versions work (save %g0,%g0,%g0; restore %g0,%g0,%g0).
441 We assume the environment will properly handle or otherwise avoid
442 trouble associated with an interrupt occurring after the `save' or trap
443 occurring during it. */
444 #define MASK_BROKEN_SAVERESTORE 0x200000
445 #define TARGET_BROKEN_SAVERESTORE (target_flags & MASK_BROKEN_SAVERESTORE)
447 /* Non-zero means -m{,no-}fpu was passed on the command line. */
448 #define MASK_FPU_SET 0x400000
449 #define TARGET_FPU_SET (target_flags & MASK_FPU_SET)
451 /* Use the UltraSPARC Visual Instruction Set extensions. */
452 #define MASK_VIS 0x1000000
453 #define TARGET_VIS (target_flags & MASK_VIS)
455 /* Compile for Solaris V8+. 32 bit Solaris preserves the high bits of
456 the current out and global registers. Linux saves the high bits on
457 context switches but not signals. */
458 #define MASK_V8PLUS 0x2000000
459 #define TARGET_V8PLUS (target_flags & MASK_V8PLUS)
461 /* TARGET_HARD_MUL: Use hardware multiply instructions but not %y.
462 TARGET_HARD_MUL32: Use hardware multiply instructions with rd %y
463 to get high 32 bits. False in V8+ or V9 because multiply stores
464 a 64 bit result in a register. */
466 #define TARGET_HARD_MUL32 \
467 ((TARGET_V8 || TARGET_SPARCLITE \
468 || TARGET_SPARCLET || TARGET_DEPRECATED_V8_INSNS) \
471 #define TARGET_HARD_MUL \
472 (TARGET_V8 || TARGET_SPARCLITE || TARGET_SPARCLET \
473 || TARGET_DEPRECATED_V8_INSNS || TARGET_V8PLUS)
476 /* Macro to define tables used to set the flags.
477 This is a list in braces of pairs in braces,
478 each pair being { "NAME", VALUE }
479 where VALUE is the bits to set or minus the bits to clear.
480 An empty string NAME is used to identify the default VALUE. */
482 #define TARGET_SWITCHES \
483 { {"fpu", MASK_FPU | MASK_FPU_SET}, \
484 {"no-fpu", -MASK_FPU}, \
485 {"no-fpu", MASK_FPU_SET}, \
486 {"hard-float", MASK_FPU | MASK_FPU_SET}, \
487 {"soft-float", -MASK_FPU}, \
488 {"soft-float", MASK_FPU_SET}, \
489 {"epilogue", MASK_EPILOGUE}, \
490 {"no-epilogue", -MASK_EPILOGUE}, \
491 {"unaligned-doubles", MASK_UNALIGNED_DOUBLES}, \
492 {"no-unaligned-doubles", -MASK_UNALIGNED_DOUBLES}, \
493 {"impure-text", MASK_IMPURE_TEXT}, \
494 {"no-impure-text", -MASK_IMPURE_TEXT}, \
495 {"flat", MASK_FLAT}, \
496 {"no-flat", -MASK_FLAT}, \
497 {"app-regs", MASK_APP_REGS}, \
498 {"no-app-regs", -MASK_APP_REGS}, \
499 {"hard-quad-float", MASK_HARD_QUAD}, \
500 {"soft-quad-float", -MASK_HARD_QUAD}, \
501 {"v8plus", MASK_V8PLUS}, \
502 {"no-v8plus", -MASK_V8PLUS}, \
504 {"no-vis", -MASK_VIS}, \
505 /* ??? These are deprecated, coerced to -mcpu=. Delete in 2.9. */ \
512 /* End of deprecated options. */ \
513 /* -mptrNN exists for *experimental* purposes. */ \
514 /* {"ptr64", MASK_PTR64}, */ \
515 /* {"ptr32", -MASK_PTR64}, */ \
516 {"32", -MASK_64BIT}, \
517 {"64", MASK_64BIT}, \
518 {"stack-bias", MASK_STACK_BIAS}, \
519 {"no-stack-bias", -MASK_STACK_BIAS}, \
521 { "", TARGET_DEFAULT}}
523 /* MASK_APP_REGS must always be the default because that's what
524 FIXED_REGISTERS is set to and -ffixed- is processed before
525 CONDITIONAL_REGISTER_USAGE is called (where we process -mno-app-regs). */
526 #define TARGET_DEFAULT (MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU)
528 /* This is meant to be redefined in target specific files. */
529 #define SUBTARGET_SWITCHES
532 These must match the values for the cpu attribute in sparc.md. */
533 enum processor_type
{
537 PROCESSOR_SUPERSPARC
,
547 /* This is set from -m{cpu,tune}=xxx. */
548 extern enum processor_type sparc_cpu
;
550 /* Recast the cpu class to be the cpu attribute.
551 Every file includes us, but not every file includes insn-attr.h. */
552 #define sparc_cpu_attr ((enum attr_cpu) sparc_cpu)
554 /* This macro is similar to `TARGET_SWITCHES' but defines names of
555 command options that have values. Its definition is an
556 initializer with a subgrouping for each command option.
558 Each subgrouping contains a string constant, that defines the
559 fixed part of the option name, and the address of a variable.
560 The variable, type `char *', is set to the variable part of the
561 given option if the fixed part matches. The actual option name
562 is made by appending `-m' to the specified name.
564 Here is an example which defines `-mshort-data-NUMBER'. If the
565 given option is `-mshort-data-512', the variable `m88k_short_data'
566 will be set to the string `"512"'.
568 extern char *m88k_short_data;
569 #define TARGET_OPTIONS { { "short-data-", &m88k_short_data } } */
571 #define TARGET_OPTIONS \
573 { "cpu=", &sparc_select[1].string }, \
574 { "tune=", &sparc_select[2].string }, \
575 { "cmodel=", &sparc_cmodel_string }, \
576 { "align-loops=", &sparc_align_loops_string }, \
577 { "align-jumps=", &sparc_align_jumps_string }, \
578 { "align-functions=", &sparc_align_funcs_string }, \
582 /* This is meant to be redefined in target specific files. */
583 #define SUBTARGET_OPTIONS
585 /* sparc_select[0] is reserved for the default cpu. */
586 struct sparc_cpu_select
594 extern struct sparc_cpu_select sparc_select
[];
596 /* Variables to record values the user passes. */
597 extern char *sparc_align_loops_string
;
598 extern char *sparc_align_jumps_string
;
599 extern char *sparc_align_funcs_string
;
600 /* Parsed values as a power of two. */
601 extern int sparc_align_loops
;
602 extern int sparc_align_jumps
;
603 extern int sparc_align_funcs
;
605 #define DEFAULT_SPARC_ALIGN_FUNCS \
606 (sparc_cpu == PROCESSOR_ULTRASPARC ? 5 : 2)
608 /* target machine storage layout */
610 /* Define for cross-compilation to a sparc target with no TFmode from a host
611 with a different float format (e.g. VAX). */
612 #define REAL_ARITHMETIC
614 /* Define this if most significant bit is lowest numbered
615 in instructions that operate on numbered bit-fields. */
616 #define BITS_BIG_ENDIAN 1
618 /* Define this if most significant byte of a word is the lowest numbered. */
619 #define BYTES_BIG_ENDIAN 1
621 /* Define this if most significant word of a multiword number is the lowest
623 #define WORDS_BIG_ENDIAN 1
625 /* Define this to set the endianness to use in libgcc2.c, which can
626 not depend on target_flags. */
627 #if defined (__LITTLE_ENDIAN__)
628 #define LIBGCC2_WORDS_BIG_ENDIAN 0
630 #define LIBGCC2_WORDS_BIG_ENDIAN 1
633 /* number of bits in an addressable storage unit */
634 #define BITS_PER_UNIT 8
636 /* Width in bits of a "word", which is the contents of a machine register.
637 Note that this is not necessarily the width of data type `int';
638 if using 16-bit ints on a 68000, this would still be 32.
639 But on a machine with 16-bit registers, this would be 16. */
640 #define BITS_PER_WORD (TARGET_ARCH64 ? 64 : 32)
641 #define MAX_BITS_PER_WORD 64
643 /* Width of a word, in units (bytes). */
644 #define UNITS_PER_WORD (TARGET_ARCH64 ? 8 : 4)
645 #define MIN_UNITS_PER_WORD 4
647 /* Now define the sizes of the C data types. */
649 #define SHORT_TYPE_SIZE 16
650 #define INT_TYPE_SIZE 32
651 #define LONG_TYPE_SIZE (TARGET_ARCH64 ? 64 : 32)
652 #define LONG_LONG_TYPE_SIZE 64
653 #define FLOAT_TYPE_SIZE 32
654 #define DOUBLE_TYPE_SIZE 64
656 #if defined (SPARC_BI_ARCH)
657 #define MAX_LONG_TYPE_SIZE 64
661 /* ??? This does not work in SunOS 4.x, so it is not enabled here.
662 Instead, it is enabled in sol2.h, because it does work under Solaris. */
663 /* Define for support of TFmode long double and REAL_ARITHMETIC.
664 Sparc ABI says that long double is 4 words. */
665 #define LONG_DOUBLE_TYPE_SIZE 128
668 /* Width in bits of a pointer.
669 See also the macro `Pmode' defined below. */
670 #define POINTER_SIZE (TARGET_PTR64 ? 64 : 32)
672 /* A macro to update MODE and UNSIGNEDP when an object whose type
673 is TYPE and which has the specified mode and signedness is to be
674 stored in a register. This macro is only called when TYPE is a
676 #define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
678 && GET_MODE_CLASS (MODE) == MODE_INT \
679 && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
684 /* Define this macro if the promotion described by PROMOTE_MODE
685 should also be done for outgoing function arguments. */
686 /* This is only needed for TARGET_ARCH64, but since PROMOTE_MODE is a no-op
687 for TARGET_ARCH32 this is ok. Otherwise we'd need to add a runtime test
689 #define PROMOTE_FUNCTION_ARGS
691 /* Define this macro if the promotion described by PROMOTE_MODE
692 should also be done for the return value of functions.
693 If this macro is defined, FUNCTION_VALUE must perform the same
694 promotions done by PROMOTE_MODE. */
695 /* This is only needed for TARGET_ARCH64, but since PROMOTE_MODE is a no-op
696 for TARGET_ARCH32 this is ok. Otherwise we'd need to add a runtime test
698 #define PROMOTE_FUNCTION_RETURN
700 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
701 #define PARM_BOUNDARY (TARGET_ARCH64 ? 64 : 32)
703 /* Boundary (in *bits*) on which stack pointer should be aligned. */
704 #define STACK_BOUNDARY (TARGET_ARCH64 ? 128 : 64)
706 /* ALIGN FRAMES on double word boundaries */
708 #define SPARC_STACK_ALIGN(LOC) \
709 (TARGET_ARCH64 ? (((LOC)+15) & ~15) : (((LOC)+7) & ~7))
711 /* Allocation boundary (in *bits*) for the code of a function. */
712 #define FUNCTION_BOUNDARY (1 << (sparc_align_funcs + 3))
714 /* Alignment of field after `int : 0' in a structure. */
715 #define EMPTY_FIELD_BOUNDARY (TARGET_ARCH64 ? 64 : 32)
717 /* Every structure's size must be a multiple of this. */
718 #define STRUCTURE_SIZE_BOUNDARY 8
720 /* A bitfield declared as `int' forces `int' alignment for the struct. */
721 #define PCC_BITFIELD_TYPE_MATTERS 1
723 /* No data type wants to be aligned rounder than this. */
724 #define BIGGEST_ALIGNMENT (TARGET_ARCH64 ? 128 : 64)
726 /* The best alignment to use in cases where we have a choice. */
727 #define FASTEST_ALIGNMENT 64
729 /* Make strings word-aligned so strcpy from constants will be faster. */
730 #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
731 ((TREE_CODE (EXP) == STRING_CST \
732 && (ALIGN) < FASTEST_ALIGNMENT) \
733 ? FASTEST_ALIGNMENT : (ALIGN))
735 /* Make arrays of chars word-aligned for the same reasons. */
736 #define DATA_ALIGNMENT(TYPE, ALIGN) \
737 (TREE_CODE (TYPE) == ARRAY_TYPE \
738 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
739 && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
741 /* Set this nonzero if move instructions will actually fail to work
742 when given unaligned data. */
743 #define STRICT_ALIGNMENT 1
745 /* Things that must be doubleword aligned cannot go in the text section,
746 because the linker fails to align the text section enough!
747 Put them in the data section. This macro is only used in this file. */
748 #define MAX_TEXT_ALIGN 32
750 /* This forces all variables and constants to the data section when PIC.
751 This is because the SunOS 4 shared library scheme thinks everything in
752 text is a function, and patches the address to point to a loader stub. */
753 /* This is defined to zero for every system which doesn't use the a.out object
755 #ifndef SUNOS4_SHARED_LIBRARIES
756 #define SUNOS4_SHARED_LIBRARIES 0
759 /* This is defined differently for v9 in a cover file. */
760 #define SELECT_SECTION(T,RELOC) \
762 if (TREE_CODE (T) == VAR_DECL) \
764 if (TREE_READONLY (T) && ! TREE_SIDE_EFFECTS (T) \
765 && DECL_INITIAL (T) \
766 && (DECL_INITIAL (T) == error_mark_node \
767 || TREE_CONSTANT (DECL_INITIAL (T))) \
768 && DECL_ALIGN (T) <= MAX_TEXT_ALIGN \
769 && ! (flag_pic && ((RELOC) || SUNOS4_SHARED_LIBRARIES))) \
774 else if (TREE_CODE (T) == CONSTRUCTOR) \
776 if (flag_pic && ((RELOC) || SUNOS4_SHARED_LIBRARIES)) \
779 else if (TREE_CODE_CLASS (TREE_CODE (T)) == 'c') \
781 if ((TREE_CODE (T) == STRING_CST && flag_writable_strings) \
782 || TYPE_ALIGN (TREE_TYPE (T)) > MAX_TEXT_ALIGN \
783 || (flag_pic && ((RELOC) || SUNOS4_SHARED_LIBRARIES))) \
790 /* Use text section for a constant
791 unless we need more alignment than that offers. */
792 /* This is defined differently for v9 in a cover file. */
793 #define SELECT_RTX_SECTION(MODE, X) \
795 if (GET_MODE_BITSIZE (MODE) <= MAX_TEXT_ALIGN \
796 && ! (flag_pic && (symbolic_operand (X) || SUNOS4_SHARED_LIBRARIES))) \
802 /* Standard register usage. */
804 /* Number of actual hardware registers.
805 The hardware registers are assigned numbers for the compiler
806 from 0 to just below FIRST_PSEUDO_REGISTER.
807 All registers that the compiler knows about must be given numbers,
808 even those that are not normally considered general registers.
810 SPARC has 32 integer registers and 32 floating point registers.
811 64 bit SPARC has 32 additional fp regs, but the odd numbered ones are not
812 accessible. We still account for them to simplify register computations
813 (eg: in CLASS_MAX_NREGS). There are also 4 fp condition code registers, so
815 Register 100 is used as the integer condition code register. */
817 #define FIRST_PSEUDO_REGISTER 101
819 #define SPARC_FIRST_FP_REG 32
820 /* Additional V9 fp regs. */
821 #define SPARC_FIRST_V9_FP_REG 64
822 #define SPARC_LAST_V9_FP_REG 95
823 /* V9 %fcc[0123]. V8 uses (figuratively) %fcc0. */
824 #define SPARC_FIRST_V9_FCC_REG 96
825 #define SPARC_LAST_V9_FCC_REG 99
827 #define SPARC_FCC_REG 96
828 /* Integer CC reg. We don't distinguish %icc from %xcc. */
829 #define SPARC_ICC_REG 100
831 /* Nonzero if REGNO is an fp reg. */
832 #define SPARC_FP_REG_P(REGNO) \
833 ((REGNO) >= SPARC_FIRST_FP_REG && (REGNO) <= SPARC_LAST_V9_FP_REG)
835 /* Argument passing regs. */
836 #define SPARC_OUTGOING_INT_ARG_FIRST 8
837 #define SPARC_INCOMING_INT_ARG_FIRST (TARGET_FLAT ? 8 : 24)
838 #define SPARC_FP_ARG_FIRST 32
840 /* 1 for registers that have pervasive standard uses
841 and are not available for the register allocator.
844 g1 is free to use as temporary.
845 g2-g4 are reserved for applications. Gcc normally uses them as
846 temporaries, but this can be disabled via the -mno-app-regs option.
847 g5 through g7 are reserved for the operating system.
850 g1,g5 are free to use as temporaries, and are free to use between calls
851 if the call is to an external function via the PLT.
852 g4 is free to use as a temporary in the non-embedded case.
853 g4 is reserved in the embedded case.
854 g2-g3 are reserved for applications. Gcc normally uses them as
855 temporaries, but this can be disabled via the -mno-app-regs option.
856 g6-g7 are reserved for the operating system (or application in
858 ??? Register 1 is used as a temporary by the 64 bit sethi pattern, so must
859 currently be a fixed register until this pattern is rewritten.
860 Register 1 is also used when restoring call-preserved registers in large
863 Registers fixed in arch32 and not arch64 (or vice-versa) are marked in
864 CONDITIONAL_REGISTER_USAGE in order to properly handle -ffixed-.
867 #define FIXED_REGISTERS \
868 {1, 0, 0, 0, 0, 0, 1, 1, \
869 0, 0, 0, 0, 0, 0, 1, 0, \
870 0, 0, 0, 0, 0, 0, 0, 0, \
871 0, 0, 0, 0, 0, 0, 1, 1, \
873 0, 0, 0, 0, 0, 0, 0, 0, \
874 0, 0, 0, 0, 0, 0, 0, 0, \
875 0, 0, 0, 0, 0, 0, 0, 0, \
876 0, 0, 0, 0, 0, 0, 0, 0, \
878 0, 0, 0, 0, 0, 0, 0, 0, \
879 0, 0, 0, 0, 0, 0, 0, 0, \
880 0, 0, 0, 0, 0, 0, 0, 0, \
881 0, 0, 0, 0, 0, 0, 0, 0, \
885 /* 1 for registers not available across function calls.
886 These must include the FIXED_REGISTERS and also any
887 registers that can be used without being saved.
888 The latter must include the registers where values are returned
889 and the register where structure-value addresses are passed.
890 Aside from that, you can include as many other registers as you like. */
892 #define CALL_USED_REGISTERS \
893 {1, 1, 1, 1, 1, 1, 1, 1, \
894 1, 1, 1, 1, 1, 1, 1, 1, \
895 0, 0, 0, 0, 0, 0, 0, 0, \
896 0, 0, 0, 0, 0, 0, 1, 1, \
898 1, 1, 1, 1, 1, 1, 1, 1, \
899 1, 1, 1, 1, 1, 1, 1, 1, \
900 1, 1, 1, 1, 1, 1, 1, 1, \
901 1, 1, 1, 1, 1, 1, 1, 1, \
903 1, 1, 1, 1, 1, 1, 1, 1, \
904 1, 1, 1, 1, 1, 1, 1, 1, \
905 1, 1, 1, 1, 1, 1, 1, 1, \
906 1, 1, 1, 1, 1, 1, 1, 1, \
910 /* If !TARGET_FPU, then make the fp registers and fp cc regs fixed so that
911 they won't be allocated. */
913 #define CONDITIONAL_REGISTER_USAGE \
920 if (TARGET_LIVE_G0) \
925 for (regno = SPARC_FIRST_V9_FP_REG; \
926 regno <= SPARC_LAST_V9_FP_REG; \
928 fixed_regs[regno] = 1; \
929 /* %fcc0 is used by v8 and v9. */ \
930 for (regno = SPARC_FIRST_V9_FCC_REG + 1; \
931 regno <= SPARC_LAST_V9_FCC_REG; \
933 fixed_regs[regno] = 1; \
938 for (regno = 32; regno < SPARC_LAST_V9_FCC_REG; regno++) \
939 fixed_regs[regno] = 1; \
941 /* Don't unfix g2-g4 if they were fixed with -ffixed-. */ \
942 fixed_regs[2] |= ! TARGET_APP_REGS; \
943 fixed_regs[3] |= ! TARGET_APP_REGS; \
944 fixed_regs[4] |= ! TARGET_APP_REGS || TARGET_CM_EMBMEDANY; \
947 /* Let the compiler believe the frame pointer is still \
948 %fp, but output it as %i7. */ \
949 fixed_regs[31] = 1; \
950 reg_names[FRAME_POINTER_REGNUM] = "%i7"; \
951 /* ??? This is a hack to disable leaf functions. */ \
952 global_regs[7] = 1; \
954 if (profile_block_flag) \
956 /* %g1 and %g2 must be fixed, because BLOCK_PROFILER \
964 /* Return number of consecutive hard regs needed starting at reg REGNO
965 to hold something of mode MODE.
966 This is ordinarily the length in words of a value of mode MODE
967 but can be less for certain modes in special long registers.
969 On SPARC, ordinary registers hold 32 bits worth;
970 this means both integer and floating point registers.
971 On v9, integer regs hold 64 bits worth; floating point regs hold
972 32 bits worth (this includes the new fp regs as even the odd ones are
973 included in the hard register count). */
975 #define HARD_REGNO_NREGS(REGNO, MODE) \
978 ? (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD \
979 : (GET_MODE_SIZE (MODE) + 3) / 4) \
980 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
982 /* A subreg in 64 bit mode will have the wrong offset for a floating point
983 register. The least significant part is at offset 1, compared to 0 for
984 integer registers. This only applies when FMODE is a larger mode.
985 We also need to handle a special case of TF-->DF conversions. */
986 #define ALTER_HARD_SUBREG(TMODE, WORD, FMODE, REGNO) \
988 && (REGNO) >= SPARC_FIRST_FP_REG \
989 && (REGNO) <= SPARC_LAST_V9_FP_REG \
990 && (TMODE) == SImode \
991 && !((FMODE) == QImode || (FMODE) == HImode) \
993 : ((TMODE) == DFmode && (FMODE) == TFmode) \
994 ? ((REGNO) + ((WORD) * 2)) \
995 : ((REGNO) + (WORD)))
997 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
998 See sparc.c for how we initialize this. */
999 extern int *hard_regno_mode_classes
;
1000 extern int sparc_mode_class
[];
1001 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
1002 ((hard_regno_mode_classes[REGNO] & sparc_mode_class[MODE]) != 0)
1004 /* Value is 1 if it is a good idea to tie two pseudo registers
1005 when one has mode MODE1 and one has mode MODE2.
1006 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
1007 for any hard reg, then this must be 0 for correct output.
1009 For V9: SFmode can't be combined with other float modes, because they can't
1010 be allocated to the %d registers. Also, DFmode won't fit in odd %f
1011 registers, but SFmode will. */
1012 #define MODES_TIEABLE_P(MODE1, MODE2) \
1013 ((MODE1) == (MODE2) \
1014 || (GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2) \
1016 || (GET_MODE_CLASS (MODE1) != MODE_FLOAT \
1017 || (MODE1 != SFmode && MODE2 != SFmode)))))
1019 /* Specify the registers used for certain standard purposes.
1020 The values of these macros are register numbers. */
1022 /* SPARC pc isn't overloaded on a register that the compiler knows about. */
1023 /* #define PC_REGNUM */
1025 /* Register to use for pushing function arguments. */
1026 #define STACK_POINTER_REGNUM 14
1028 /* Actual top-of-stack address is 92/176 greater than the contents of the
1029 stack pointer register for !v9/v9. That is:
1030 - !v9: 64 bytes for the in and local registers, 4 bytes for structure return
1031 address, and 6*4 bytes for the 6 register parameters.
1032 - v9: 128 bytes for the in and local registers + 6*8 bytes for the integer
1034 #define STACK_POINTER_OFFSET FIRST_PARM_OFFSET(0)
1036 /* The stack bias (amount by which the hardware register is offset by). */
1037 #define SPARC_STACK_BIAS ((TARGET_ARCH64 && TARGET_STACK_BIAS) ? 2047 : 0)
1039 /* Is stack biased? */
1040 #define STACK_BIAS SPARC_STACK_BIAS
1042 /* Base register for access to local variables of the function. */
1043 #define FRAME_POINTER_REGNUM 30
1046 /* Register that is used for the return address for the flat model. */
1047 #define RETURN_ADDR_REGNUM 15
1050 /* Value should be nonzero if functions must have frame pointers.
1051 Zero means the frame pointer need not be set up (and parms
1052 may be accessed via the stack pointer) in functions that seem suitable.
1053 This is computed in `reload', in reload1.c.
1054 Used in flow.c, global.c, and reload1.c.
1056 Being a non-leaf function does not mean a frame pointer is needed in the
1057 flat window model. However, the debugger won't be able to backtrace through
1059 #define FRAME_POINTER_REQUIRED \
1060 (TARGET_FLAT ? (current_function_calls_alloca || current_function_varargs \
1061 || !leaf_function_p ()) \
1062 : ! (leaf_function_p () && only_leaf_regs_used ()))
1064 /* C statement to store the difference between the frame pointer
1065 and the stack pointer values immediately after the function prologue.
1067 Note, we always pretend that this is a leaf function because if
1068 it's not, there's no point in trying to eliminate the
1069 frame pointer. If it is a leaf function, we guessed right! */
1070 #define INITIAL_FRAME_POINTER_OFFSET(VAR) \
1071 ((VAR) = (TARGET_FLAT ? sparc_flat_compute_frame_size (get_frame_size ()) \
1072 : compute_frame_size (get_frame_size (), 1)))
1074 /* Base register for access to arguments of the function. */
1075 #define ARG_POINTER_REGNUM FRAME_POINTER_REGNUM
1077 /* Register in which static-chain is passed to a function. This must
1078 not be a register used by the prologue. */
1079 #define STATIC_CHAIN_REGNUM (TARGET_ARCH64 ? 5 : 2)
1081 /* Register which holds offset table for position-independent
1084 #define PIC_OFFSET_TABLE_REGNUM 23
1086 #define FINALIZE_PIC finalize_pic ()
1088 /* Pick a default value we can notice from override_options:
1090 v9: Default is off. */
1092 #define DEFAULT_PCC_STRUCT_RETURN -1
1094 /* Sparc ABI says that quad-precision floats and all structures are returned
1096 For v9: unions <= 32 bytes in size are returned in int regs,
1097 structures up to 32 bytes are returned in int and fp regs. */
1099 #define RETURN_IN_MEMORY(TYPE) \
1101 ? (TYPE_MODE (TYPE) == BLKmode \
1102 || TYPE_MODE (TYPE) == TFmode \
1103 || TYPE_MODE (TYPE) == TCmode) \
1104 : (TYPE_MODE (TYPE) == BLKmode \
1105 && int_size_in_bytes (TYPE) > 32))
1107 /* Functions which return large structures get the address
1108 to place the wanted value at offset 64 from the frame.
1109 Must reserve 64 bytes for the in and local registers.
1110 v9: Functions which return large structures get the address to place the
1111 wanted value from an invisible first argument. */
1112 /* Used only in other #defines in this file. */
1113 #define STRUCT_VALUE_OFFSET 64
1115 #define STRUCT_VALUE \
1118 : gen_rtx_MEM (Pmode, \
1119 gen_rtx_PLUS (Pmode, stack_pointer_rtx, \
1120 GEN_INT (STRUCT_VALUE_OFFSET))))
1121 #define STRUCT_VALUE_INCOMING \
1124 : gen_rtx_MEM (Pmode, \
1125 gen_rtx_PLUS (Pmode, frame_pointer_rtx, \
1126 GEN_INT (STRUCT_VALUE_OFFSET))))
1128 /* Define the classes of registers for register constraints in the
1129 machine description. Also define ranges of constants.
1131 One of the classes must always be named ALL_REGS and include all hard regs.
1132 If there is more than one class, another class must be named NO_REGS
1133 and contain no registers.
1135 The name GENERAL_REGS must be the name of a class (or an alias for
1136 another name such as ALL_REGS). This is the class of registers
1137 that is allowed by "g" or "r" in a register constraint.
1138 Also, registers outside this class are allocated only when
1139 instructions express preferences for them.
1141 The classes must be numbered in nondecreasing order; that is,
1142 a larger-numbered class must never be contained completely
1143 in a smaller-numbered class.
1145 For any two classes, it is very desirable that there be another
1146 class that represents their union. */
1148 /* The SPARC has various kinds of registers: general, floating point,
1149 and condition codes [well, it has others as well, but none that we
1150 care directly about].
1152 For v9 we must distinguish between the upper and lower floating point
1153 registers because the upper ones can't hold SFmode values.
1154 HARD_REGNO_MODE_OK won't help here because reload assumes that register(s)
1155 satisfying a group need for a class will also satisfy a single need for
1156 that class. EXTRA_FP_REGS is a bit of a misnomer as it covers all 64 fp
1159 It is important that one class contains all the general and all the standard
1160 fp regs. Otherwise find_reg() won't properly allocate int regs for moves,
1161 because reg_class_record() will bias the selection in favor of fp regs,
1162 because reg_class_subunion[GENERAL_REGS][FP_REGS] will yield FP_REGS,
1163 because FP_REGS > GENERAL_REGS.
1165 It is also important that one class contain all the general and all the
1166 fp regs. Otherwise when spilling a DFmode reg, it may be from EXTRA_FP_REGS
1167 but find_reloads() may use class GENERAL_OR_FP_REGS. This will cause
1168 allocate_reload_reg() to bypass it causing an abort because the compiler
1169 thinks it doesn't have a spill reg when in fact it does.
1171 v9 also has 4 floating point condition code registers. Since we don't
1172 have a class that is the union of FPCC_REGS with either of the others,
1173 it is important that it appear first. Otherwise the compiler will die
1174 trying to compile _fixunsdfsi because fix_truncdfsi2 won't match its
1177 It is important that SPARC_ICC_REG have class NO_REGS. Otherwise combine
1178 may try to use it to hold an SImode value. See register_operand.
1179 ??? Should %fcc[0123] be handled similarly?
1182 enum reg_class
{ NO_REGS
, FPCC_REGS
, I64_REGS
, GENERAL_REGS
, FP_REGS
,
1183 EXTRA_FP_REGS
, GENERAL_OR_FP_REGS
, GENERAL_OR_EXTRA_FP_REGS
,
1184 ALL_REGS
, LIM_REG_CLASSES
};
1186 #define N_REG_CLASSES (int) LIM_REG_CLASSES
1188 /* Give names of register classes as strings for dump file. */
1190 #define REG_CLASS_NAMES \
1191 { "NO_REGS", "FPCC_REGS", "I64_REGS", "GENERAL_REGS", "FP_REGS", \
1192 "EXTRA_FP_REGS", "GENERAL_OR_FP_REGS", "GENERAL_OR_EXTRA_FP_REGS", \
1195 /* Define which registers fit in which classes.
1196 This is an initializer for a vector of HARD_REG_SET
1197 of length N_REG_CLASSES. */
1199 #define REG_CLASS_CONTENTS \
1200 {{0, 0, 0, 0}, {0, 0, 0, 0xf}, {0xffff, 0, 0, 0}, \
1201 {-1, 0, 0, 0}, {0, -1, 0, 0}, {0, -1, -1, 0}, \
1202 {-1, -1, 0, 0}, {-1, -1, -1, 0}, {-1, -1, -1, 0x1f}}
1204 /* The same information, inverted:
1205 Return the class number of the smallest class containing
1206 reg number REGNO. This could be a conditional expression
1207 or could index an array. */
1209 extern enum reg_class sparc_regno_reg_class
[];
1211 #define REGNO_REG_CLASS(REGNO) sparc_regno_reg_class[(REGNO)]
1213 /* This is the order in which to allocate registers normally.
1215 We put %f0/%f1 last among the float registers, so as to make it more
1216 likely that a pseudo-register which dies in the float return register
1217 will get allocated to the float return register, thus saving a move
1218 instruction at the end of the function. */
1220 #define REG_ALLOC_ORDER \
1221 { 8, 9, 10, 11, 12, 13, 2, 3, \
1222 15, 16, 17, 18, 19, 20, 21, 22, \
1223 23, 24, 25, 26, 27, 28, 29, 31, \
1224 34, 35, 36, 37, 38, 39, /* %f2-%f7 */ \
1225 40, 41, 42, 43, 44, 45, 46, 47, /* %f8-%f15 */ \
1226 48, 49, 50, 51, 52, 53, 54, 55, /* %f16-%f23 */ \
1227 56, 57, 58, 59, 60, 61, 62, 63, /* %f24-%f31 */ \
1228 64, 65, 66, 67, 68, 69, 70, 71, /* %f32-%f39 */ \
1229 72, 73, 74, 75, 76, 77, 78, 79, /* %f40-%f47 */ \
1230 80, 81, 82, 83, 84, 85, 86, 87, /* %f48-%f55 */ \
1231 88, 89, 90, 91, 92, 93, 94, 95, /* %f56-%f63 */ \
1232 32, 33, /* %f0,%f1 */ \
1233 96, 97, 98, 99, 100, /* %fcc0-3, %icc */ \
1234 1, 4, 5, 6, 7, 0, 14, 30}
1236 /* This is the order in which to allocate registers for
1237 leaf functions. If all registers can fit in the "i" registers,
1238 then we have the possibility of having a leaf function. */
1240 #define REG_LEAF_ALLOC_ORDER \
1241 { 2, 3, 24, 25, 26, 27, 28, 29, \
1242 15, 8, 9, 10, 11, 12, 13, \
1243 16, 17, 18, 19, 20, 21, 22, 23, \
1244 34, 35, 36, 37, 38, 39, \
1245 40, 41, 42, 43, 44, 45, 46, 47, \
1246 48, 49, 50, 51, 52, 53, 54, 55, \
1247 56, 57, 58, 59, 60, 61, 62, 63, \
1248 64, 65, 66, 67, 68, 69, 70, 71, \
1249 72, 73, 74, 75, 76, 77, 78, 79, \
1250 80, 81, 82, 83, 84, 85, 86, 87, \
1251 88, 89, 90, 91, 92, 93, 94, 95, \
1253 96, 97, 98, 99, 100, \
1254 1, 4, 5, 6, 7, 0, 14, 30, 31}
1256 #define ORDER_REGS_FOR_LOCAL_ALLOC order_regs_for_local_alloc ()
1258 /* ??? %g7 is not a leaf register to effectively #undef LEAF_REGISTERS when
1259 -mflat is used. Function only_leaf_regs_used will return 0 if a global
1260 register is used and is not permitted in a leaf function. We make %g7
1261 a global reg if -mflat and voila. Since %g7 is a system register and is
1262 fixed it won't be used by gcc anyway. */
1264 #define LEAF_REGISTERS \
1265 { 1, 1, 1, 1, 1, 1, 1, 0, \
1266 0, 0, 0, 0, 0, 0, 1, 0, \
1267 0, 0, 0, 0, 0, 0, 0, 0, \
1268 1, 1, 1, 1, 1, 1, 0, 1, \
1269 1, 1, 1, 1, 1, 1, 1, 1, \
1270 1, 1, 1, 1, 1, 1, 1, 1, \
1271 1, 1, 1, 1, 1, 1, 1, 1, \
1272 1, 1, 1, 1, 1, 1, 1, 1, \
1273 1, 1, 1, 1, 1, 1, 1, 1, \
1274 1, 1, 1, 1, 1, 1, 1, 1, \
1275 1, 1, 1, 1, 1, 1, 1, 1, \
1276 1, 1, 1, 1, 1, 1, 1, 1, \
1279 extern char leaf_reg_remap
[];
1280 #define LEAF_REG_REMAP(REGNO) (leaf_reg_remap[REGNO])
1282 /* The class value for index registers, and the one for base regs. */
1283 #define INDEX_REG_CLASS GENERAL_REGS
1284 #define BASE_REG_CLASS GENERAL_REGS
1286 /* Local macro to handle the two v9 classes of FP regs. */
1287 #define FP_REG_CLASS_P(CLASS) ((CLASS) == FP_REGS || (CLASS) == EXTRA_FP_REGS)
1289 /* Get reg_class from a letter such as appears in the machine description.
1290 In the not-v9 case, coerce v9's 'e' class to 'f', so we can use 'e' in the
1291 .md file for v8 and v9.
1292 'd' and 'b' are used for single and double precision VIS operations,
1294 'h' is used for V8+ 64 bit global and out registers. */
1296 #define REG_CLASS_FROM_LETTER(C) \
1298 ? ((C) == 'f' ? FP_REGS \
1299 : (C) == 'e' ? EXTRA_FP_REGS \
1300 : (C) == 'c' ? FPCC_REGS \
1301 : ((C) == 'd' && TARGET_VIS) ? FP_REGS\
1302 : ((C) == 'b' && TARGET_VIS) ? EXTRA_FP_REGS\
1303 : ((C) == 'h' && TARGET_V8PLUS) ? I64_REGS\
1305 : ((C) == 'f' ? FP_REGS \
1306 : (C) == 'e' ? FP_REGS \
1307 : (C) == 'c' ? FPCC_REGS \
1310 /* The letters I, J, K, L and M in a register constraint string
1311 can be used to stand for particular ranges of immediate operands.
1312 This macro defines what the ranges are.
1313 C is the letter, and VALUE is a constant value.
1314 Return 1 if VALUE is in the range specified by C.
1316 `I' is used for the range of constants an insn can actually contain.
1317 `J' is used for the range which is just zero (since that is R0).
1318 `K' is used for constants which can be loaded with a single sethi insn.
1319 `L' is used for the range of constants supported by the movcc insns.
1320 `M' is used for the range of constants supported by the movrcc insns. */
1322 #define SPARC_SIMM10_P(X) ((unsigned HOST_WIDE_INT) (X) + 0x200 < 0x400)
1323 #define SPARC_SIMM11_P(X) ((unsigned HOST_WIDE_INT) (X) + 0x400 < 0x800)
1324 #define SPARC_SIMM13_P(X) ((unsigned HOST_WIDE_INT) (X) + 0x1000 < 0x2000)
1325 /* 10 and 11 bit immediates are only used for a few specific insns.
1326 SMALL_INT is used throughout the port so we continue to use it. */
1327 #define SMALL_INT(X) (SPARC_SIMM13_P (INTVAL (X)))
1328 /* 13 bit immediate, considering only the low 32 bits */
1329 #define SMALL_INT32(X) (SPARC_SIMM13_P ((int)INTVAL (X) & 0xffffffff))
1330 #define SPARC_SETHI_P(X) \
1331 (((unsigned HOST_WIDE_INT) (X) & ~(unsigned HOST_WIDE_INT) 0xfffffc00) == 0)
1333 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
1334 ((C) == 'I' ? SPARC_SIMM13_P (VALUE) \
1335 : (C) == 'J' ? (VALUE) == 0 \
1336 : (C) == 'K' ? SPARC_SETHI_P (VALUE) \
1337 : (C) == 'L' ? SPARC_SIMM11_P (VALUE) \
1338 : (C) == 'M' ? SPARC_SIMM10_P (VALUE) \
1341 /* Similar, but for floating constants, and defining letters G and H.
1342 Here VALUE is the CONST_DOUBLE rtx itself. */
1344 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
1345 ((C) == 'G' ? fp_zero_operand (VALUE) \
1346 : (C) == 'H' ? arith_double_operand (VALUE, DImode) \
1349 /* Given an rtx X being reloaded into a reg required to be
1350 in class CLASS, return the class of reg to actually use.
1351 In general this is just CLASS; but on some machines
1352 in some cases it is preferable to use a more restrictive class. */
1353 /* We can't load constants into FP registers. We can't load any FP constant
1354 if an 'E' constraint fails to match it. */
1355 #define PREFERRED_RELOAD_CLASS(X,CLASS) \
1357 && (FP_REG_CLASS_P (CLASS) \
1358 || (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
1359 && (HOST_FLOAT_FORMAT != IEEE_FLOAT_FORMAT \
1360 || HOST_BITS_PER_INT != BITS_PER_WORD))) \
1361 ? NO_REGS : (CLASS))
1363 /* Return the register class of a scratch register needed to load IN into
1364 a register of class CLASS in MODE.
1366 We need a temporary when loading/storing a HImode/QImode value
1367 between memory and the FPU registers. This can happen when combine puts
1368 a paradoxical subreg in a float/fix conversion insn. */
1370 #define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, IN) \
1371 ((FP_REG_CLASS_P (CLASS) \
1372 && ((MODE) == HImode || (MODE) == QImode) \
1373 && (GET_CODE (IN) == MEM \
1374 || ((GET_CODE (IN) == REG || GET_CODE (IN) == SUBREG) \
1375 && true_regnum (IN) == -1))) \
1377 : (((TARGET_CM_MEDANY \
1378 && symbolic_operand ((IN), (MODE))) \
1379 || (TARGET_CM_EMBMEDANY \
1380 && text_segment_operand ((IN), (MODE)))) \
1385 #define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, IN) \
1386 ((FP_REG_CLASS_P (CLASS) \
1387 && ((MODE) == HImode || (MODE) == QImode) \
1388 && (GET_CODE (IN) == MEM \
1389 || ((GET_CODE (IN) == REG || GET_CODE (IN) == SUBREG) \
1390 && true_regnum (IN) == -1))) \
1392 : (((TARGET_CM_MEDANY \
1393 && symbolic_operand ((IN), (MODE))) \
1394 || (TARGET_CM_EMBMEDANY \
1395 && text_segment_operand ((IN), (MODE)))) \
1400 /* On SPARC it is not possible to directly move data between
1401 GENERAL_REGS and FP_REGS. */
1402 #define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \
1403 (FP_REG_CLASS_P (CLASS1) != FP_REG_CLASS_P (CLASS2))
1405 /* Return the stack location to use for secondary memory needed reloads.
1406 We want to use the reserved location just below the frame pointer.
1407 However, we must ensure that there is a frame, so use assign_stack_local
1408 if the frame size is zero. */
1409 #define SECONDARY_MEMORY_NEEDED_RTX(MODE) \
1410 (get_frame_size () == 0 \
1411 ? assign_stack_local (MODE, GET_MODE_SIZE (MODE), 0) \
1412 : gen_rtx_MEM (MODE, gen_rtx_PLUS (Pmode, frame_pointer_rtx, \
1413 GEN_INT (STARTING_FRAME_OFFSET))))
1415 /* Get_secondary_mem widens its argument to BITS_PER_WORD which loses on v9
1416 because the movsi and movsf patterns don't handle r/f moves.
1417 For v8 we copy the default definition. */
1418 #define SECONDARY_MEMORY_NEEDED_MODE(MODE) \
1420 ? (GET_MODE_BITSIZE (MODE) < 32 \
1421 ? mode_for_size (32, GET_MODE_CLASS (MODE), 0) \
1423 : (GET_MODE_BITSIZE (MODE) < BITS_PER_WORD \
1424 ? mode_for_size (BITS_PER_WORD, GET_MODE_CLASS (MODE), 0) \
1427 /* Return the maximum number of consecutive registers
1428 needed to represent mode MODE in a register of class CLASS. */
1429 /* On SPARC, this is the size of MODE in words. */
1430 #define CLASS_MAX_NREGS(CLASS, MODE) \
1431 (FP_REG_CLASS_P (CLASS) ? (GET_MODE_SIZE (MODE) + 3) / 4 \
1432 : (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
1434 /* Stack layout; function entry, exit and calling. */
1436 /* Define the number of register that can hold parameters.
1437 This macro is only used in other macro definitions below and in sparc.c.
1438 MODE is the mode of the argument.
1439 !v9: All args are passed in %o0-%o5.
1440 v9: %o0-%o5 and %f0-%f31 are cumulatively used to pass values.
1441 See the description in sparc.c. */
1442 #define NPARM_REGS(MODE) \
1444 ? (GET_MODE_CLASS (MODE) == MODE_FLOAT ? 32 : 6) \
1447 /* Define this if pushing a word on the stack
1448 makes the stack pointer a smaller address. */
1449 #define STACK_GROWS_DOWNWARD
1451 /* Define this if the nominal address of the stack frame
1452 is at the high-address end of the local variables;
1453 that is, each additional local variable allocated
1454 goes at a more negative offset in the frame. */
1455 #define FRAME_GROWS_DOWNWARD
1457 /* Offset within stack frame to start allocating local variables at.
1458 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
1459 first local allocated. Otherwise, it is the offset to the BEGINNING
1460 of the first local allocated. */
1461 /* This allows space for one TFmode floating point value. */
1462 #define STARTING_FRAME_OFFSET \
1463 (TARGET_ARCH64 ? (SPARC_STACK_BIAS - 16) \
1464 : (-SPARC_STACK_ALIGN (LONG_DOUBLE_TYPE_SIZE / BITS_PER_UNIT)))
1466 /* If we generate an insn to push BYTES bytes,
1467 this says how many the stack pointer really advances by.
1468 On SPARC, don't define this because there are no push insns. */
1469 /* #define PUSH_ROUNDING(BYTES) */
1471 /* Offset of first parameter from the argument pointer register value.
1472 !v9: This is 64 for the ins and locals, plus 4 for the struct-return reg
1473 even if this function isn't going to use it.
1474 v9: This is 128 for the ins and locals. */
1475 #define FIRST_PARM_OFFSET(FNDECL) \
1476 (TARGET_ARCH64 ? (SPARC_STACK_BIAS + 16 * UNITS_PER_WORD) \
1477 : (STRUCT_VALUE_OFFSET + UNITS_PER_WORD))
1479 /* When a parameter is passed in a register, stack space is still
1481 !v9: All 6 possible integer registers have backing store allocated.
1482 v9: Only space for the arguments passed is allocated. */
1483 /* ??? Ideally, we'd use zero here (as the minimum), but zero has special
1484 meaning to the backend. Further, we need to be able to detect if a
1485 varargs/unprototyped function is called, as they may want to spill more
1486 registers than we've provided space. Ugly, ugly. So for now we retain
1487 all 6 slots even for v9. */
1488 #define REG_PARM_STACK_SPACE(DECL) (6 * UNITS_PER_WORD)
1490 /* Keep the stack pointer constant throughout the function.
1491 This is both an optimization and a necessity: longjmp
1492 doesn't behave itself when the stack pointer moves within
1494 #define ACCUMULATE_OUTGOING_ARGS
1496 /* Value is the number of bytes of arguments automatically
1497 popped when returning from a subroutine call.
1498 FUNDECL is the declaration node of the function (as a tree),
1499 FUNTYPE is the data type of the function (as a tree),
1500 or for a library call it is an identifier node for the subroutine name.
1501 SIZE is the number of bytes of arguments passed on the stack. */
1503 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
1505 /* Some subroutine macros specific to this machine.
1506 When !TARGET_FPU, put float return values in the general registers,
1507 since we don't have any fp registers. */
1508 #define BASE_RETURN_VALUE_REG(MODE) \
1510 ? (TARGET_FPU && FLOAT_MODE_P (MODE) ? 32 : 8) \
1511 : (((MODE) == SFmode || (MODE) == DFmode) && TARGET_FPU ? 32 : 8))
1513 #define BASE_OUTGOING_VALUE_REG(MODE) \
1515 ? (TARGET_FPU && FLOAT_MODE_P (MODE) ? 32 \
1516 : TARGET_FLAT ? 8 : 24) \
1517 : (((MODE) == SFmode || (MODE) == DFmode) && TARGET_FPU ? 32 \
1518 : (TARGET_FLAT ? 8 : 24)))
1520 #define BASE_PASSING_ARG_REG(MODE) \
1522 ? (TARGET_FPU && FLOAT_MODE_P (MODE) ? 32 : 8) \
1525 /* ??? FIXME -- seems wrong for v9 structure passing... */
1526 #define BASE_INCOMING_ARG_REG(MODE) \
1528 ? (TARGET_FPU && FLOAT_MODE_P (MODE) ? 32 \
1529 : TARGET_FLAT ? 8 : 24) \
1530 : (TARGET_FLAT ? 8 : 24))
1532 /* Define this macro if the target machine has "register windows". This
1533 C expression returns the register number as seen by the called function
1534 corresponding to register number OUT as seen by the calling function.
1535 Return OUT if register number OUT is not an outbound register. */
1537 #define INCOMING_REGNO(OUT) \
1538 ((TARGET_FLAT || (OUT) < 8 || (OUT) > 15) ? (OUT) : (OUT) + 16)
1540 /* Define this macro if the target machine has "register windows". This
1541 C expression returns the register number as seen by the calling function
1542 corresponding to register number IN as seen by the called function.
1543 Return IN if register number IN is not an inbound register. */
1545 #define OUTGOING_REGNO(IN) \
1546 ((TARGET_FLAT || (IN) < 24 || (IN) > 31) ? (IN) : (IN) - 16)
1548 /* Define how to find the value returned by a function.
1549 VALTYPE is the data type of the value (as a tree).
1550 If the precise function being called is known, FUNC is its FUNCTION_DECL;
1551 otherwise, FUNC is 0. */
1553 /* On SPARC the value is found in the first "output" register. */
1555 extern struct rtx_def
*function_value ();
1556 #define FUNCTION_VALUE(VALTYPE, FUNC) \
1557 function_value ((VALTYPE), TYPE_MODE (VALTYPE), 1)
1559 /* But the called function leaves it in the first "input" register. */
1561 #define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \
1562 function_value ((VALTYPE), TYPE_MODE (VALTYPE), 0)
1564 /* Define how to find the value returned by a library function
1565 assuming the value has mode MODE. */
1567 #define LIBCALL_VALUE(MODE) \
1568 function_value (NULL_TREE, (MODE), 1)
1570 /* 1 if N is a possible register number for a function value
1571 as seen by the caller.
1572 On SPARC, the first "output" reg is used for integer values,
1573 and the first floating point register is used for floating point values. */
1575 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 8 || (N) == 32)
1577 /* Define the size of space to allocate for the return value of an
1580 #define APPLY_RESULT_SIZE 16
1582 /* 1 if N is a possible register number for function argument passing.
1583 On SPARC, these are the "output" registers. v9 also uses %f0-%f31. */
1585 #define FUNCTION_ARG_REGNO_P(N) \
1587 ? (((N) >= 8 && (N) <= 13) || ((N) >= 32 && (N) <= 63)) \
1588 : ((N) >= 8 && (N) <= 13))
1590 /* Define a data type for recording info about an argument list
1591 during the scan of that argument list. This data type should
1592 hold all necessary information about the function itself
1593 and about the args processed so far, enough to enable macros
1594 such as FUNCTION_ARG to determine where the next arg should go.
1596 On SPARC (!v9), this is a single integer, which is a number of words
1597 of arguments scanned so far (including the invisible argument,
1598 if any, which holds the structure-value-address).
1599 Thus 7 or more means all following args should go on the stack.
1601 For v9, we also need to know whether a prototype is present. */
1604 int words
; /* number of words passed so far */
1605 int prototype_p
; /* non-zero if a prototype is present */
1606 int libcall_p
; /* non-zero if a library call */
1608 #define CUMULATIVE_ARGS struct sparc_args
1610 /* Initialize a variable CUM of type CUMULATIVE_ARGS
1611 for a call to a function whose data type is FNTYPE.
1612 For a library call, FNTYPE is 0. */
1614 extern void init_cumulative_args ();
1615 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) \
1616 init_cumulative_args (& (CUM), (FNTYPE), (LIBNAME), (INDIRECT));
1618 /* Update the data in CUM to advance over an argument
1619 of mode MODE and data type TYPE.
1620 TYPE is null for libcalls where that information may not be available. */
1622 extern void function_arg_advance ();
1623 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
1624 function_arg_advance (& (CUM), (MODE), (TYPE), (NAMED))
1626 /* Determine where to put an argument to a function.
1627 Value is zero to push the argument on the stack,
1628 or a hard register in which to store the argument.
1630 MODE is the argument's machine mode.
1631 TYPE is the data type of the argument (as a tree).
1632 This is null for libcalls where that information may
1634 CUM is a variable of type CUMULATIVE_ARGS which gives info about
1635 the preceding args and about the function being called.
1636 NAMED is nonzero if this argument is a named parameter
1637 (otherwise it is an extra parameter matching an ellipsis). */
1639 extern struct rtx_def
*function_arg ();
1640 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
1641 function_arg (& (CUM), (MODE), (TYPE), (NAMED), 0)
1643 /* Define where a function finds its arguments.
1644 This is different from FUNCTION_ARG because of register windows. */
1646 #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
1647 function_arg (& (CUM), (MODE), (TYPE), (NAMED), 1)
1649 /* For an arg passed partly in registers and partly in memory,
1650 this is the number of registers used.
1651 For args passed entirely in registers or entirely in memory, zero. */
1653 extern int function_arg_partial_nregs ();
1654 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
1655 function_arg_partial_nregs (& (CUM), (MODE), (TYPE), (NAMED))
1657 /* A C expression that indicates when an argument must be passed by reference.
1658 If nonzero for an argument, a copy of that argument is made in memory and a
1659 pointer to the argument is passed instead of the argument itself.
1660 The pointer is passed in whatever way is appropriate for passing a pointer
1663 extern int function_arg_pass_by_reference ();
1664 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
1665 function_arg_pass_by_reference (& (CUM), (MODE), (TYPE), (NAMED))
1667 /* If defined, a C expression which determines whether, and in which direction,
1668 to pad out an argument with extra space. The value should be of type
1669 `enum direction': either `upward' to pad above the argument,
1670 `downward' to pad below, or `none' to inhibit padding. */
1672 #define FUNCTION_ARG_PADDING(MODE, TYPE) \
1673 function_arg_padding ((MODE), (TYPE))
1675 /* If defined, a C expression that gives the alignment boundary, in bits,
1676 of an argument with the specified mode and type. If it is not defined,
1677 PARM_BOUNDARY is used for all arguments.
1678 For sparc64, objects requiring 16 byte alignment are passed that way. */
1680 #define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
1682 && (GET_MODE_ALIGNMENT (MODE) == 128 \
1683 || ((TYPE) && TYPE_ALIGN (TYPE) == 128))) \
1684 ? 128 : PARM_BOUNDARY)
1686 /* Define the information needed to generate branch and scc insns. This is
1687 stored from the compare operation. Note that we can't use "rtx" here
1688 since it hasn't been defined! */
1690 extern struct rtx_def
*sparc_compare_op0
, *sparc_compare_op1
;
1692 /* Define the function that build the compare insn for scc and bcc. */
1694 extern struct rtx_def
*gen_compare_reg ();
1696 /* This function handles all v9 scc insns */
1698 extern int gen_v9_scc ();
1700 /* Generate the special assembly code needed to tell the assembler whatever
1701 it might need to know about the return value of a function.
1703 For Sparc assemblers, we need to output a .proc pseudo-op which conveys
1704 information to the assembler relating to peephole optimization (done in
1707 #define ASM_DECLARE_RESULT(FILE, RESULT) \
1708 fprintf ((FILE), "\t.proc\t0%lo\n", sparc_type_code (TREE_TYPE (RESULT)))
1710 /* Output the label for a function definition. */
1712 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
1714 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
1715 ASM_OUTPUT_LABEL (FILE, NAME); \
1718 /* This macro generates the assembly code for function entry.
1719 FILE is a stdio stream to output the code to.
1720 SIZE is an int: how many units of temporary storage to allocate.
1721 Refer to the array `regs_ever_live' to determine which registers
1722 to save; `regs_ever_live[I]' is nonzero if register number I
1723 is ever used in the function. This macro is responsible for
1724 knowing which registers should not be saved even if used. */
1726 /* On SPARC, move-double insns between fpu and cpu need an 8-byte block
1727 of memory. If any fpu reg is used in the function, we allocate
1728 such a block here, at the bottom of the frame, just in case it's needed.
1730 If this function is a leaf procedure, then we may choose not
1731 to do a "save" insn. The decision about whether or not
1732 to do this is made in regclass.c. */
1734 extern int leaf_function
;
1735 #define FUNCTION_PROLOGUE(FILE, SIZE) \
1736 (TARGET_FLAT ? sparc_flat_output_function_prologue (FILE, (int)SIZE) \
1737 : output_function_prologue (FILE, (int)SIZE, leaf_function))
1739 /* Output assembler code to FILE to increment profiler label # LABELNO
1740 for profiling a function entry.
1742 32 bit sparc uses %g2 as the STATIC_CHAIN_REGNUM which gets clobbered
1743 during profiling so we need to save/restore it around the call to mcount.
1744 We're guaranteed that a save has just been done, and we use the space
1745 allocated for intreg/fpreg value passing. */
1747 #define FUNCTION_PROFILER(FILE, LABELNO) \
1750 ASM_GENERATE_INTERNAL_LABEL (buf, "LP", (LABELNO)); \
1751 if (! TARGET_ARCH64) \
1752 fputs ("\tst %g2,[%fp-4]\n", FILE); \
1753 fputs ("\tsethi %hi(", FILE); \
1754 assemble_name (FILE, buf); \
1755 fputs ("),%o0\n", FILE); \
1756 fputs ("\tcall mcount\n\tadd %o0,%lo(", FILE); \
1757 assemble_name (FILE, buf); \
1758 fputs ("),%o0\n", FILE); \
1759 if (! TARGET_ARCH64) \
1760 fputs ("\tld [%fp-4],%g2\n", FILE); \
1763 /* There are three profiling modes for basic blocks available.
1764 The modes are selected at compile time by using the options
1765 -a or -ax of the gnu compiler.
1766 The variable `profile_block_flag' will be set according to the
1769 profile_block_flag == 0, no option used:
1773 profile_block_flag == 1, -a option used.
1775 Count frequency of execution of every basic block.
1777 profile_block_flag == 2, -ax option used.
1779 Generate code to allow several different profiling modes at run time.
1780 Available modes are:
1781 Produce a trace of all basic blocks.
1782 Count frequency of jump instructions executed.
1783 In every mode it is possible to start profiling upon entering
1784 certain functions and to disable profiling of some other functions.
1786 The result of basic-block profiling will be written to a file `bb.out'.
1787 If the -ax option is used parameters for the profiling will be read
1792 /* The following macro shall output assembler code to FILE
1793 to initialize basic-block profiling.
1795 If profile_block_flag == 2
1797 Output code to call the subroutine `__bb_init_trace_func'
1798 and pass two parameters to it. The first parameter is
1799 the address of a block allocated in the object module.
1800 The second parameter is the number of the first basic block
1803 The name of the block is a local symbol made with this statement:
1805 ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0);
1807 Of course, since you are writing the definition of
1808 `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
1809 can take a short cut in the definition of this macro and use the
1810 name that you know will result.
1812 The number of the first basic block of the function is
1813 passed to the macro in BLOCK_OR_LABEL.
1815 If described in a virtual assembler language the code to be
1819 parameter2 <- BLOCK_OR_LABEL
1820 call __bb_init_trace_func
1822 else if profile_block_flag != 0
1824 Output code to call the subroutine `__bb_init_func'
1825 and pass one single parameter to it, which is the same
1826 as the first parameter to `__bb_init_trace_func'.
1828 The first word of this parameter is a flag which will be nonzero if
1829 the object module has already been initialized. So test this word
1830 first, and do not call `__bb_init_func' if the flag is nonzero.
1831 Note: When profile_block_flag == 2 the test need not be done
1832 but `__bb_init_trace_func' *must* be called.
1834 BLOCK_OR_LABEL may be used to generate a label number as a
1835 branch destination in case `__bb_init_func' will not be called.
1837 If described in a virtual assembler language the code to be
1848 #define FUNCTION_BLOCK_PROFILER(FILE, BLOCK_OR_LABEL) \
1851 int bol = (BLOCK_OR_LABEL); \
1852 switch (profile_block_flag) \
1855 fprintf (FILE, "\tsethi %%hi(LPBX0),%%o0\n\tor %%o0,%%lo(LPBX0),%%o0\n\tsethi %%hi(%d),%%o1\n\tcall ___bb_init_trace_func\n\tor %%o1,%%lo(%d),%%o1\n",\
1859 fprintf (FILE, "\tsethi %%hi(LPBX0),%%o0\n\tld [%%lo(LPBX0)+%%o0],%%o1\n\ttst %%o1\n\tbne LPY%d\n\tadd %%o0,%%lo(LPBX0),%%o0\n\tcall ___bb_init_func\n\tnop\nLPY%d:\n",\
1866 /* The following macro shall output assembler code to FILE
1867 to increment a counter associated with basic block number BLOCKNO.
1869 If profile_block_flag == 2
1871 Output code to initialize the global structure `__bb' and
1872 call the function `__bb_trace_func' which will increment the
1875 `__bb' consists of two words. In the first word the number
1876 of the basic block has to be stored. In the second word
1877 the address of a block allocated in the object module
1880 The basic block number is given by BLOCKNO.
1882 The address of the block is given by the label created with
1884 ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0);
1886 by FUNCTION_BLOCK_PROFILER.
1888 Of course, since you are writing the definition of
1889 `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
1890 can take a short cut in the definition of this macro and use the
1891 name that you know will result.
1893 If described in a virtual assembler language the code to be
1896 move BLOCKNO -> (__bb)
1897 move LPBX0 -> (__bb+4)
1898 call __bb_trace_func
1900 Note that function `__bb_trace_func' must not change the
1901 machine state, especially the flag register. To grant
1902 this, you must output code to save and restore registers
1903 either in this macro or in the macros MACHINE_STATE_SAVE
1904 and MACHINE_STATE_RESTORE. The last two macros will be
1905 used in the function `__bb_trace_func', so you must make
1906 sure that the function prologue does not change any
1907 register prior to saving it with MACHINE_STATE_SAVE.
1909 else if profile_block_flag != 0
1911 Output code to increment the counter directly.
1912 Basic blocks are numbered separately from zero within each
1913 compiled object module. The count associated with block number
1914 BLOCKNO is at index BLOCKNO in an array of words; the name of
1915 this array is a local symbol made with this statement:
1917 ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 2);
1919 Of course, since you are writing the definition of
1920 `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
1921 can take a short cut in the definition of this macro and use the
1922 name that you know will result.
1924 If described in a virtual assembler language, the code to be
1927 inc (LPBX2+4*BLOCKNO)
1931 #define BLOCK_PROFILER(FILE, BLOCKNO) \
1934 int blockn = (BLOCKNO); \
1935 switch (profile_block_flag) \
1938 fprintf (FILE, "\tsethi %%hi(___bb),%%g1\n\tsethi %%hi(%d),%%g2\n\tor %%g2,%%lo(%d),%%g2\n\tst %%g2,[%%lo(___bb)+%%g1]\n\tsethi %%hi(LPBX0),%%g2\n\tor %%g2,%%lo(LPBX0),%%g2\n\tadd 4,%%g1,%%g1\n\tst %%g2,[%%lo(___bb)+%%g1]\n\tmov %%o7,%%g2\n\tcall ___bb_trace_func\n\tnop\n\tmov %%g2,%%o7\n",\
1942 fprintf (FILE, "\tsethi %%hi(LPBX2+%d),%%g1\n\tld [%%lo(LPBX2+%d)+%%g1],%%g2\n\
1943 \tadd %%g2,1,%%g2\n\tst %%g2,[%%lo(LPBX2+%d)+%%g1]\n", \
1944 4 * blockn, 4 * blockn, 4 * blockn); \
1950 /* The following macro shall output assembler code to FILE
1951 to indicate a return from function during basic-block profiling.
1953 If profiling_block_flag == 2:
1955 Output assembler code to call function `__bb_trace_ret'.
1957 Note that function `__bb_trace_ret' must not change the
1958 machine state, especially the flag register. To grant
1959 this, you must output code to save and restore registers
1960 either in this macro or in the macros MACHINE_STATE_SAVE_RET
1961 and MACHINE_STATE_RESTORE_RET. The last two macros will be
1962 used in the function `__bb_trace_ret', so you must make
1963 sure that the function prologue does not change any
1964 register prior to saving it with MACHINE_STATE_SAVE_RET.
1966 else if profiling_block_flag != 0:
1968 The macro will not be used, so it need not distinguish
1972 #define FUNCTION_BLOCK_PROFILER_EXIT(FILE) \
1973 fprintf (FILE, "\tcall ___bb_trace_ret\n\tnop\n" );
1975 /* The function `__bb_trace_func' is called in every basic block
1976 and is not allowed to change the machine state. Saving (restoring)
1977 the state can either be done in the BLOCK_PROFILER macro,
1978 before calling function (rsp. after returning from function)
1979 `__bb_trace_func', or it can be done inside the function by
1980 defining the macros:
1982 MACHINE_STATE_SAVE(ID)
1983 MACHINE_STATE_RESTORE(ID)
1985 In the latter case care must be taken, that the prologue code
1986 of function `__bb_trace_func' does not already change the
1987 state prior to saving it with MACHINE_STATE_SAVE.
1989 The parameter `ID' is a string identifying a unique macro use.
1991 On sparc it is sufficient to save the psw register to memory.
1992 Unfortunately the psw register can be read in supervisor mode only,
1993 so we read only the condition codes by using branch instructions
1994 and hope that this is enough. */
1996 #define MACHINE_STATE_SAVE(ID) \
1997 int ms_flags, ms_saveret; \
2009 bneg,a LFLGNN"ID"\n\
2013 : "=r"(ms_flags), "=r"(ms_saveret));
2015 /* On sparc MACHINE_STATE_RESTORE restores the psw register from memory.
2016 The psw register can be written in supervisor mode only,
2017 which is true even for simple condition codes.
2018 We use some combination of instructions to produce the
2019 proper condition codes, but some flag combinations can not
2020 be generated in this way. If this happens an unimplemented
2021 instruction will be executed to abort the program. */
2023 #define MACHINE_STATE_RESTORE(ID) \
2024 { extern char flgtab[] __asm__("LFLGTAB"ID); \
2028 ! Do part of VC in the delay slot here, as it needs 3 insns.\n\
2045 subcc %%g0,%%g0,%%g0\n\
2054 orcc %%g0,-1,%%g0\n\
2057 addcc %%g0,%3,%%g0\n\
2079 : "r"(ms_flags*8), "r"(flgtab), "r"(-1), \
2080 "r"(0x80000000), "r"(ms_saveret) \
2083 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
2084 the stack pointer does not matter. The value is tested only in
2085 functions that have frame pointers.
2086 No definition is equivalent to always zero. */
2088 extern int current_function_calls_alloca
;
2089 extern int current_function_outgoing_args_size
;
2091 #define EXIT_IGNORE_STACK \
2092 (get_frame_size () != 0 \
2093 || current_function_calls_alloca || current_function_outgoing_args_size)
2095 /* This macro generates the assembly code for function exit,
2096 on machines that need it. If FUNCTION_EPILOGUE is not defined
2097 then individual return instructions are generated for each
2098 return statement. Args are same as for FUNCTION_PROLOGUE.
2100 The function epilogue should not depend on the current stack pointer!
2101 It should use the frame pointer only. This is mandatory because
2102 of alloca; we also take advantage of it to omit stack adjustments
2103 before returning. */
2105 /* This declaration is needed due to traditional/ANSI
2106 incompatibilities which cannot be #ifdefed away
2107 because they occur inside of macros. Sigh. */
2108 extern union tree_node
*current_function_decl
;
2110 #define FUNCTION_EPILOGUE(FILE, SIZE) \
2111 (TARGET_FLAT ? sparc_flat_output_function_epilogue (FILE, (int)SIZE) \
2112 : output_function_epilogue (FILE, (int)SIZE, leaf_function))
2114 #define DELAY_SLOTS_FOR_EPILOGUE \
2115 (TARGET_FLAT ? sparc_flat_epilogue_delay_slots () : 1)
2116 #define ELIGIBLE_FOR_EPILOGUE_DELAY(trial, slots_filled) \
2117 (TARGET_FLAT ? sparc_flat_eligible_for_epilogue_delay (trial, slots_filled) \
2118 : eligible_for_epilogue_delay (trial, slots_filled))
2120 /* Define registers used by the epilogue and return instruction. */
2121 #define EPILOGUE_USES(REGNO) \
2122 (!TARGET_FLAT && REGNO == 31)
2124 /* Length in units of the trampoline for entering a nested function. */
2126 #define TRAMPOLINE_SIZE (TARGET_ARCH64 ? 32 : 16)
2128 #define TRAMPOLINE_ALIGNMENT 128 /* 16 bytes */
2130 /* Emit RTL insns to initialize the variable parts of a trampoline.
2131 FNADDR is an RTX for the address of the function's pure code.
2132 CXT is an RTX for the static chain value for the function. */
2134 void sparc_initialize_trampoline ();
2135 void sparc64_initialize_trampoline ();
2136 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
2137 if (TARGET_ARCH64) \
2138 sparc64_initialize_trampoline (TRAMP, FNADDR, CXT); \
2140 sparc_initialize_trampoline (TRAMP, FNADDR, CXT)
2142 /* Generate necessary RTL for __builtin_saveregs().
2143 ARGLIST is the argument list; see expr.c. */
2145 extern struct rtx_def
*sparc_builtin_saveregs ();
2146 #define EXPAND_BUILTIN_SAVEREGS(ARGLIST) sparc_builtin_saveregs (ARGLIST)
2148 /* Define this macro if the location where a function argument is passed
2149 depends on whether or not it is a named argument.
2151 This macro controls how the NAMED argument to FUNCTION_ARG
2152 is set for varargs and stdarg functions. With this macro defined,
2153 the NAMED argument is always true for named arguments, and false for
2154 unnamed arguments. If this is not defined, but SETUP_INCOMING_VARARGS
2155 is defined, then all arguments are treated as named. Otherwise, all named
2156 arguments except the last are treated as named.
2157 For the v9 we want NAMED to mean what it says it means. */
2159 #define STRICT_ARGUMENT_NAMING TARGET_V9
2161 /* Generate RTL to flush the register windows so as to make arbitrary frames
2163 #define SETUP_FRAME_ADDRESSES() \
2164 emit_insn (gen_flush_register_windows ())
2166 /* Given an rtx for the address of a frame,
2167 return an rtx for the address of the word in the frame
2168 that holds the dynamic chain--the previous frame's address.
2169 ??? -mflat support? */
2170 #define DYNAMIC_CHAIN_ADDRESS(frame) \
2171 gen_rtx_PLUS (Pmode, frame, GEN_INT (14 * UNITS_PER_WORD))
2173 /* The return address isn't on the stack, it is in a register, so we can't
2174 access it from the current frame pointer. We can access it from the
2175 previous frame pointer though by reading a value from the register window
2177 #define RETURN_ADDR_IN_PREVIOUS_FRAME
2179 /* This is the offset of the return address to the true next instruction to be
2180 executed for the current function. */
2181 #define RETURN_ADDR_OFFSET \
2182 (8 + 4 * (! TARGET_ARCH64 && current_function_returns_struct))
2184 /* The current return address is in %i7. The return address of anything
2185 farther back is in the register window save area at [%fp+60]. */
2186 /* ??? This ignores the fact that the actual return address is +8 for normal
2187 returns, and +12 for structure returns. */
2188 #define RETURN_ADDR_RTX(count, frame) \
2190 ? gen_rtx_REG (Pmode, 31) \
2191 : gen_rtx_MEM (Pmode, \
2192 memory_address (Pmode, plus_constant (frame, 15 * UNITS_PER_WORD))))
2194 /* Before the prologue, the return address is %o7 + 8. OK, sometimes it's
2195 +12, but always using +8 is close enough for frame unwind purposes.
2196 Actually, just using %o7 is close enough for unwinding, but %o7+8
2197 is something you can return to. */
2198 #define INCOMING_RETURN_ADDR_RTX \
2199 gen_rtx_PLUS (word_mode, gen_rtx_REG (word_mode, 15), GEN_INT (8))
2201 /* The offset from the incoming value of %sp to the top of the stack frame
2202 for the current function. On sparc64, we have to account for the stack
2204 #define INCOMING_FRAME_SP_OFFSET SPARC_STACK_BIAS
2206 #define DOESNT_NEED_UNWINDER (! TARGET_FLAT)
2208 /* Addressing modes, and classification of registers for them. */
2210 /* #define HAVE_POST_INCREMENT */
2211 /* #define HAVE_POST_DECREMENT */
2213 /* #define HAVE_PRE_DECREMENT */
2214 /* #define HAVE_PRE_INCREMENT */
2216 /* Macros to check register numbers against specific register classes. */
2218 /* These assume that REGNO is a hard or pseudo reg number.
2219 They give nonzero only if REGNO is a hard reg of the suitable class
2220 or a pseudo reg currently allocated to a suitable hard reg.
2221 Since they use reg_renumber, they are safe only once reg_renumber
2222 has been allocated, which happens in local-alloc.c. */
2224 #define REGNO_OK_FOR_INDEX_P(REGNO) \
2225 ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < (unsigned)32)
2226 #define REGNO_OK_FOR_BASE_P(REGNO) \
2227 ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < (unsigned)32)
2228 #define REGNO_OK_FOR_FP_P(REGNO) \
2229 (((unsigned) (REGNO) - 32 < (TARGET_V9 ? (unsigned)64 : (unsigned)32)) \
2230 || ((unsigned) reg_renumber[REGNO] - 32 < (TARGET_V9 ? (unsigned)64 : (unsigned)32)))
2231 #define REGNO_OK_FOR_CCFP_P(REGNO) \
2233 && (((unsigned) (REGNO) - 96 < (unsigned)4) \
2234 || ((unsigned) reg_renumber[REGNO] - 96 < (unsigned)4)))
2236 /* Now macros that check whether X is a register and also,
2237 strictly, whether it is in a specified class.
2239 These macros are specific to the SPARC, and may be used only
2240 in code for printing assembler insns and in conditions for
2241 define_optimization. */
2243 /* 1 if X is an fp register. */
2245 #define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
2247 /* Is X, a REG, an in or global register? i.e. is regno 0..7 or 24..31 */
2248 #define IN_OR_GLOBAL_P(X) (REGNO (X) < 8 || (REGNO (X) >= 24 && REGNO (X) <= 31))
2250 /* Maximum number of registers that can appear in a valid memory address. */
2252 #define MAX_REGS_PER_ADDRESS 2
2254 /* Recognize any constant value that is a valid address.
2255 When PIC, we do not accept an address that would require a scratch reg
2256 to load into a register. */
2258 #define CONSTANT_ADDRESS_P(X) \
2259 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
2260 || GET_CODE (X) == CONST_INT || GET_CODE (X) == HIGH \
2261 || (GET_CODE (X) == CONST \
2262 && ! (flag_pic && pic_address_needs_scratch (X))))
2264 /* Define this, so that when PIC, reload won't try to reload invalid
2265 addresses which require two reload registers. */
2267 #define LEGITIMATE_PIC_OPERAND_P(X) (! pic_address_needs_scratch (X))
2269 /* Nonzero if the constant value X is a legitimate general operand.
2270 Anything can be made to work except floating point constants.
2271 If TARGET_VIS, 0.0 can be made to work as well. */
2273 #define LEGITIMATE_CONSTANT_P(X) \
2274 (GET_CODE (X) != CONST_DOUBLE || GET_MODE (X) == VOIDmode || \
2275 (TARGET_VIS && (GET_MODE (X) == SFmode || GET_MODE (X) == DFmode) && \
2276 fp_zero_operand (X)))
2278 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
2279 and check its validity for a certain class.
2280 We have two alternate definitions for each of them.
2281 The usual definition accepts all pseudo regs; the other rejects
2282 them unless they have been allocated suitable hard regs.
2283 The symbol REG_OK_STRICT causes the latter definition to be used.
2285 Most source files want to accept pseudo regs in the hope that
2286 they will get allocated to the class that the insn wants them to be in.
2287 Source files for reload pass need to be strict.
2288 After reload, it makes no difference, since pseudo regs have
2289 been eliminated by then. */
2291 /* Optional extra constraints for this machine.
2293 'T' handles memory addresses where the alignment is known to
2294 be at least 8 bytes.
2296 `U' handles all pseudo registers or a hard even numbered
2297 integer register, needed for ldd/std instructions. */
2299 #ifndef REG_OK_STRICT
2301 /* Nonzero if X is a hard reg that can be used as an index
2302 or if it is a pseudo reg. */
2303 #define REG_OK_FOR_INDEX_P(X) \
2304 (((unsigned) REGNO (X)) - 32 >= (FIRST_PSEUDO_REGISTER - 32))
2305 /* Nonzero if X is a hard reg that can be used as a base reg
2306 or if it is a pseudo reg. */
2307 #define REG_OK_FOR_BASE_P(X) \
2308 (((unsigned) REGNO (X)) - 32 >= (FIRST_PSEUDO_REGISTER - 32))
2310 /* 'T', 'U' are for aligned memory loads which aren't needed for v9. */
2312 #define EXTRA_CONSTRAINT(OP, C) \
2313 ((! TARGET_ARCH64 && (C) == 'T') \
2314 ? (mem_min_alignment (OP, 8)) \
2315 : ((! TARGET_ARCH64 && (C) == 'U') \
2316 ? (register_ok_for_ldd (OP)) \
2321 /* Nonzero if X is a hard reg that can be used as an index. */
2322 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
2323 /* Nonzero if X is a hard reg that can be used as a base reg. */
2324 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
2326 #define EXTRA_CONSTRAINT(OP, C) \
2327 ((! TARGET_ARCH64 && (C) == 'T') \
2328 ? mem_min_alignment (OP, 8) && strict_memory_address_p (Pmode, XEXP (OP, 0)) \
2329 : ((! TARGET_ARCH64 && (C) == 'U') \
2330 ? (GET_CODE (OP) == REG \
2331 && (REGNO (OP) < FIRST_PSEUDO_REGISTER \
2332 || reg_renumber[REGNO (OP)] >= 0) \
2333 && register_ok_for_ldd (OP)) \
2337 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
2338 that is a valid memory address for an instruction.
2339 The MODE argument is the machine mode for the MEM expression
2340 that wants to use this address.
2342 On SPARC, the actual legitimate addresses must be REG+REG or REG+SMALLINT
2343 ordinarily. This changes a bit when generating PIC.
2345 If you change this, execute "rm explow.o recog.o reload.o". */
2347 #define RTX_OK_FOR_BASE_P(X) \
2348 ((GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
2349 || (GET_CODE (X) == SUBREG \
2350 && GET_CODE (SUBREG_REG (X)) == REG \
2351 && REG_OK_FOR_BASE_P (SUBREG_REG (X))))
2353 #define RTX_OK_FOR_INDEX_P(X) \
2354 ((GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X)) \
2355 || (GET_CODE (X) == SUBREG \
2356 && GET_CODE (SUBREG_REG (X)) == REG \
2357 && REG_OK_FOR_INDEX_P (SUBREG_REG (X))))
2359 #define RTX_OK_FOR_OFFSET_P(X) \
2360 (GET_CODE (X) == CONST_INT && INTVAL (X) >= -0x1000 && INTVAL (X) < 0x1000)
2362 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
2363 { if (RTX_OK_FOR_BASE_P (X)) \
2365 else if (GET_CODE (X) == PLUS) \
2367 register rtx op0 = XEXP (X, 0); \
2368 register rtx op1 = XEXP (X, 1); \
2369 if (flag_pic && op0 == pic_offset_table_rtx) \
2371 if (RTX_OK_FOR_BASE_P (op1)) \
2373 else if (flag_pic == 1 \
2374 && GET_CODE (op1) != REG \
2375 && GET_CODE (op1) != LO_SUM \
2376 && GET_CODE (op1) != MEM \
2377 && (GET_CODE (op1) != CONST_INT \
2378 || SMALL_INT (op1))) \
2381 else if (RTX_OK_FOR_BASE_P (op0)) \
2383 if (RTX_OK_FOR_INDEX_P (op1) \
2384 || RTX_OK_FOR_OFFSET_P (op1)) \
2387 else if (RTX_OK_FOR_BASE_P (op1)) \
2389 if (RTX_OK_FOR_INDEX_P (op0) \
2390 || RTX_OK_FOR_OFFSET_P (op0)) \
2394 else if (GET_CODE (X) == LO_SUM) \
2396 register rtx op0 = XEXP (X, 0); \
2397 register rtx op1 = XEXP (X, 1); \
2398 if (RTX_OK_FOR_BASE_P (op0) \
2399 && CONSTANT_P (op1) \
2400 /* We can't allow TFmode, because an offset \
2401 greater than or equal to the alignment (8) \
2402 may cause the LO_SUM to overflow if !v9. */\
2403 && (MODE != TFmode || TARGET_V9)) \
2406 else if (GET_CODE (X) == CONST_INT && SMALL_INT (X)) \
2410 /* Try machine-dependent ways of modifying an illegitimate address
2411 to be legitimate. If we find one, return the new, valid address.
2412 This macro is used in only one place: `memory_address' in explow.c.
2414 OLDX is the address as it was before break_out_memory_refs was called.
2415 In some cases it is useful to look at this to decide what needs to be done.
2417 MODE and WIN are passed so that this macro can use
2418 GO_IF_LEGITIMATE_ADDRESS.
2420 It is always safe for this macro to do nothing. It exists to recognize
2421 opportunities to optimize the output. */
2423 /* On SPARC, change REG+N into REG+REG, and REG+(X*Y) into REG+REG. */
2424 extern struct rtx_def
*legitimize_pic_address ();
2425 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
2426 { rtx sparc_x = (X); \
2427 if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == MULT) \
2428 (X) = gen_rtx_PLUS (Pmode, XEXP (X, 1), \
2429 force_operand (XEXP (X, 0), NULL_RTX)); \
2430 if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == MULT) \
2431 (X) = gen_rtx_PLUS (Pmode, XEXP (X, 0), \
2432 force_operand (XEXP (X, 1), NULL_RTX)); \
2433 if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == PLUS) \
2434 (X) = gen_rtx_PLUS (Pmode, force_operand (XEXP (X, 0), NULL_RTX),\
2436 if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == PLUS) \
2437 (X) = gen_rtx_PLUS (Pmode, XEXP (X, 0), \
2438 force_operand (XEXP (X, 1), NULL_RTX)); \
2439 if (sparc_x != (X) && memory_address_p (MODE, X)) \
2441 if (flag_pic) (X) = legitimize_pic_address (X, MODE, 0); \
2442 else if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 1))) \
2443 (X) = gen_rtx_PLUS (Pmode, XEXP (X, 0), \
2444 copy_to_mode_reg (Pmode, XEXP (X, 1))); \
2445 else if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 0))) \
2446 (X) = gen_rtx_PLUS (Pmode, XEXP (X, 1), \
2447 copy_to_mode_reg (Pmode, XEXP (X, 0))); \
2448 else if (GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == CONST \
2449 || GET_CODE (X) == LABEL_REF) \
2450 (X) = copy_to_suggested_reg (X, NULL_RTX, Pmode); \
2451 if (memory_address_p (MODE, X)) \
2454 /* Go to LABEL if ADDR (a legitimate address expression)
2455 has an effect that depends on the machine mode it is used for.
2456 On the SPARC this is never true. */
2458 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
2460 /* If we are referencing a function make the SYMBOL_REF special.
2461 In the Embedded Medium/Anywhere code model, %g4 points to the data segment
2462 so we must not add it to function addresses. */
2464 #define ENCODE_SECTION_INFO(DECL) \
2466 if (TARGET_CM_EMBMEDANY && TREE_CODE (DECL) == FUNCTION_DECL) \
2467 SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \
2470 /* Specify the machine mode that this machine uses
2471 for the index in the tablejump instruction. */
2472 #define CASE_VECTOR_MODE Pmode
2474 /* Define as C expression which evaluates to nonzero if the tablejump
2475 instruction expects the table to contain offsets from the address of the
2477 Do not define this if the table should contain absolute addresses. */
2478 /* #define CASE_VECTOR_PC_RELATIVE 1 */
2480 /* Specify the tree operation to be used to convert reals to integers. */
2481 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
2483 /* This is the kind of divide that is easiest to do in the general case. */
2484 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
2486 /* Define this as 1 if `char' should by default be signed; else as 0. */
2487 #define DEFAULT_SIGNED_CHAR 1
2489 /* Max number of bytes we can move from memory to memory
2490 in one reasonably fast instruction. */
2493 #if 0 /* Sun 4 has matherr, so this is no good. */
2494 /* This is the value of the error code EDOM for this machine,
2495 used by the sqrt instruction. */
2496 #define TARGET_EDOM 33
2498 /* This is how to refer to the variable errno. */
2499 #define GEN_ERRNO_RTX \
2500 gen_rtx_MEM (SImode, gen_rtx_SYMBOL_REF (Pmode, "errno"))
2503 /* Define if operations between registers always perform the operation
2504 on the full register even if a narrower mode is specified. */
2505 #define WORD_REGISTER_OPERATIONS
2507 /* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
2508 will either zero-extend or sign-extend. The value of this macro should
2509 be the code that says which one of the two operations is implicitly
2510 done, NIL if none. */
2511 #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
2513 /* Nonzero if access to memory by bytes is slow and undesirable.
2514 For RISC chips, it means that access to memory by bytes is no
2515 better than access by words when possible, so grab a whole word
2516 and maybe make use of that. */
2517 #define SLOW_BYTE_ACCESS 1
2519 /* We assume that the store-condition-codes instructions store 0 for false
2520 and some other value for true. This is the value stored for true. */
2522 #define STORE_FLAG_VALUE 1
2524 /* When a prototype says `char' or `short', really pass an `int'. */
2525 #define PROMOTE_PROTOTYPES
2527 /* Define this to be nonzero if shift instructions ignore all but the low-order
2529 #define SHIFT_COUNT_TRUNCATED 1
2531 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
2532 is done just by pretending it is already truncated. */
2533 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
2535 /* Specify the machine mode that pointers have.
2536 After generation of rtl, the compiler makes no further distinction
2537 between pointers and any other objects of this machine mode. */
2538 #define Pmode (TARGET_PTR64 ? DImode : SImode)
2540 /* Generate calls to memcpy, memcmp and memset. */
2541 #define TARGET_MEM_FUNCTIONS
2543 /* Add any extra modes needed to represent the condition code.
2545 On the Sparc, we have a "no-overflow" mode which is used when an add or
2546 subtract insn is used to set the condition code. Different branches are
2547 used in this case for some operations.
2549 We also have two modes to indicate that the relevant condition code is
2550 in the floating-point condition code register. One for comparisons which
2551 will generate an exception if the result is unordered (CCFPEmode) and
2552 one for comparisons which will never trap (CCFPmode).
2554 CCXmode and CCX_NOOVmode are only used by v9. */
2556 #define EXTRA_CC_MODES CCXmode, CC_NOOVmode, CCX_NOOVmode, CCFPmode, CCFPEmode
2558 /* Define the names for the modes specified above. */
2560 #define EXTRA_CC_NAMES "CCX", "CC_NOOV", "CCX_NOOV", "CCFP", "CCFPE"
2562 /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
2563 return the mode to be used for the comparison. For floating-point,
2564 CCFP[E]mode is used. CC_NOOVmode should be used when the first operand is a
2565 PLUS, MINUS, NEG, or ASHIFT. CCmode should be used when no special
2566 processing is needed. */
2567 #define SELECT_CC_MODE(OP,X,Y) \
2568 (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
2569 ? ((OP == EQ || OP == NE) ? CCFPmode : CCFPEmode) \
2570 : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS \
2571 || GET_CODE (X) == NEG || GET_CODE (X) == ASHIFT) \
2572 ? (TARGET_ARCH64 && GET_MODE (X) == DImode ? CCX_NOOVmode : CC_NOOVmode) \
2573 : ((TARGET_ARCH64 || TARGET_V8PLUS) && GET_MODE (X) == DImode ? CCXmode : CCmode)))
2575 /* Return non-zero if SELECT_CC_MODE will never return MODE for a
2576 floating point inequality comparison. */
2578 #define REVERSIBLE_CC_MODE(MODE) ((MODE) != CCFPEmode)
2580 /* A function address in a call instruction
2581 is a byte address (for indexing purposes)
2582 so give the MEM rtx a byte's mode. */
2583 #define FUNCTION_MODE SImode
2585 /* Define this if addresses of constant functions
2586 shouldn't be put through pseudo regs where they can be cse'd.
2587 Desirable on machines where ordinary constants are expensive
2588 but a CALL with constant address is cheap. */
2589 #define NO_FUNCTION_CSE
2591 /* alloca should avoid clobbering the old register save area. */
2592 #define SETJMP_VIA_SAVE_AREA
2594 /* Define subroutines to call to handle multiply and divide.
2595 Use the subroutines that Sun's library provides.
2596 The `*' prevents an underscore from being prepended by the compiler. */
2598 #define DIVSI3_LIBCALL "*.div"
2599 #define UDIVSI3_LIBCALL "*.udiv"
2600 #define MODSI3_LIBCALL "*.rem"
2601 #define UMODSI3_LIBCALL "*.urem"
2602 /* .umul is a little faster than .mul. */
2603 #define MULSI3_LIBCALL "*.umul"
2605 /* Define library calls for quad FP operations. These are all part of the
2607 #define ADDTF3_LIBCALL "_Q_add"
2608 #define SUBTF3_LIBCALL "_Q_sub"
2609 #define NEGTF2_LIBCALL "_Q_neg"
2610 #define MULTF3_LIBCALL "_Q_mul"
2611 #define DIVTF3_LIBCALL "_Q_div"
2612 #define FLOATSITF2_LIBCALL "_Q_itoq"
2613 #define FIX_TRUNCTFSI2_LIBCALL "_Q_qtoi"
2614 #define FIXUNS_TRUNCTFSI2_LIBCALL "_Q_qtou"
2615 #define EXTENDSFTF2_LIBCALL "_Q_stoq"
2616 #define TRUNCTFSF2_LIBCALL "_Q_qtos"
2617 #define EXTENDDFTF2_LIBCALL "_Q_dtoq"
2618 #define TRUNCTFDF2_LIBCALL "_Q_qtod"
2619 #define EQTF2_LIBCALL "_Q_feq"
2620 #define NETF2_LIBCALL "_Q_fne"
2621 #define GTTF2_LIBCALL "_Q_fgt"
2622 #define GETF2_LIBCALL "_Q_fge"
2623 #define LTTF2_LIBCALL "_Q_flt"
2624 #define LETF2_LIBCALL "_Q_fle"
2626 /* We can define the TFmode sqrt optab only if TARGET_FPU. This is because
2627 with soft-float, the SFmode and DFmode sqrt instructions will be absent,
2628 and the compiler will notice and try to use the TFmode sqrt instruction
2629 for calls to the builtin function sqrt, but this fails. */
2630 #define INIT_TARGET_OPTABS \
2632 add_optab->handlers[(int) TFmode].libfunc \
2633 = gen_rtx_SYMBOL_REF (Pmode, ADDTF3_LIBCALL); \
2634 sub_optab->handlers[(int) TFmode].libfunc \
2635 = gen_rtx_SYMBOL_REF (Pmode, SUBTF3_LIBCALL); \
2636 neg_optab->handlers[(int) TFmode].libfunc \
2637 = gen_rtx_SYMBOL_REF (Pmode, NEGTF2_LIBCALL); \
2638 smul_optab->handlers[(int) TFmode].libfunc \
2639 = gen_rtx_SYMBOL_REF (Pmode, MULTF3_LIBCALL); \
2640 flodiv_optab->handlers[(int) TFmode].libfunc \
2641 = gen_rtx_SYMBOL_REF (Pmode, DIVTF3_LIBCALL); \
2642 eqtf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EQTF2_LIBCALL); \
2643 netf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, NETF2_LIBCALL); \
2644 gttf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, GTTF2_LIBCALL); \
2645 getf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, GETF2_LIBCALL); \
2646 lttf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, LTTF2_LIBCALL); \
2647 letf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, LETF2_LIBCALL); \
2648 trunctfsf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, TRUNCTFSF2_LIBCALL); \
2649 trunctfdf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, TRUNCTFDF2_LIBCALL); \
2650 extendsftf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EXTENDSFTF2_LIBCALL); \
2651 extenddftf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EXTENDDFTF2_LIBCALL); \
2652 floatsitf_libfunc = gen_rtx_SYMBOL_REF (Pmode, FLOATSITF2_LIBCALL); \
2653 fixtfsi_libfunc = gen_rtx_SYMBOL_REF (Pmode, FIX_TRUNCTFSI2_LIBCALL); \
2654 fixunstfsi_libfunc \
2655 = gen_rtx_SYMBOL_REF (Pmode, FIXUNS_TRUNCTFSI2_LIBCALL); \
2657 sqrt_optab->handlers[(int) TFmode].libfunc \
2658 = gen_rtx_SYMBOL_REF (Pmode, "_Q_sqrt"); \
2659 INIT_SUBTARGET_OPTABS; \
2662 /* This is meant to be redefined in the host dependent files */
2663 #define INIT_SUBTARGET_OPTABS
2665 /* Compute the cost of computing a constant rtl expression RTX
2666 whose rtx-code is CODE. The body of this macro is a portion
2667 of a switch statement. If the code is computed here,
2668 return it with a return statement. Otherwise, break from the switch. */
2670 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
2672 if (INTVAL (RTX) < 0x1000 && INTVAL (RTX) >= -0x1000) \
2680 case CONST_DOUBLE: \
2681 if (GET_MODE (RTX) == DImode) \
2682 if ((XINT (RTX, 3) == 0 \
2683 && (unsigned) XINT (RTX, 2) < 0x1000) \
2684 || (XINT (RTX, 3) == -1 \
2685 && XINT (RTX, 2) < 0 \
2686 && XINT (RTX, 2) >= -0x1000)) \
2690 #define ADDRESS_COST(RTX) 1
2692 /* Compute extra cost of moving data between one register class
2694 #define GENERAL_OR_I64(C) ((C) == GENERAL_REGS || (C) == I64_REGS)
2695 #define REGISTER_MOVE_COST(CLASS1, CLASS2) \
2696 (((FP_REG_CLASS_P (CLASS1) && GENERAL_OR_I64 (CLASS2)) \
2697 || (GENERAL_OR_I64 (CLASS1) && FP_REG_CLASS_P (CLASS2)) \
2698 || (CLASS1) == FPCC_REGS || (CLASS2) == FPCC_REGS) \
2699 ? (sparc_cpu == PROCESSOR_ULTRASPARC ? 12 : 6) : 2)
2701 /* Provide the costs of a rtl expression. This is in the body of a
2702 switch on CODE. The purpose for the cost of MULT is to encourage
2703 `synth_mult' to find a synthetic multiply when reasonable.
2705 If we need more than 12 insns to do a multiply, then go out-of-line,
2706 since the call overhead will be < 10% of the cost of the multiply. */
2708 #define RTX_COSTS(X,CODE,OUTER_CODE) \
2710 if (sparc_cpu == PROCESSOR_ULTRASPARC) \
2711 return (GET_MODE (X) == DImode ? \
2712 COSTS_N_INSNS (34) : COSTS_N_INSNS (19)); \
2713 return TARGET_HARD_MUL ? COSTS_N_INSNS (5) : COSTS_N_INSNS (25); \
2718 if (sparc_cpu == PROCESSOR_ULTRASPARC) \
2719 return (GET_MODE (X) == DImode ? \
2720 COSTS_N_INSNS (68) : COSTS_N_INSNS (37)); \
2721 return COSTS_N_INSNS (25); \
2722 /* Make FLOAT and FIX more expensive than CONST_DOUBLE,\
2723 so that cse will favor the latter. */ \
2728 #define ISSUE_RATE sparc_issue_rate()
2730 /* Adjust the cost of dependencies. */
2731 #define ADJUST_COST(INSN,LINK,DEP,COST) \
2732 if (sparc_cpu == PROCESSOR_SUPERSPARC) \
2733 (COST) = supersparc_adjust_cost (INSN, LINK, DEP, COST); \
2734 else if (sparc_cpu == PROCESSOR_ULTRASPARC) \
2735 (COST) = ultrasparc_adjust_cost (INSN, LINK, DEP, COST); \
2738 extern void ultrasparc_sched_reorder ();
2739 extern void ultrasparc_sched_init ();
2740 extern int ultrasparc_variable_issue ();
2742 #define MD_SCHED_INIT(DUMP, SCHED_VERBOSE) \
2743 if (sparc_cpu == PROCESSOR_ULTRASPARC) \
2744 ultrasparc_sched_init (DUMP, SCHED_VERBOSE)
2746 #define MD_SCHED_REORDER(DUMP, SCHED_VERBOSE, READY, N_READY) \
2747 if (sparc_cpu == PROCESSOR_ULTRASPARC) \
2748 ultrasparc_sched_reorder (DUMP, SCHED_VERBOSE, READY, N_READY)
2750 #define MD_SCHED_VARIABLE_ISSUE(DUMP, SCHED_VERBOSE, INSN, CAN_ISSUE_MORE) \
2751 if (sparc_cpu == PROCESSOR_ULTRASPARC) \
2752 (CAN_ISSUE_MORE) = ultrasparc_variable_issue (INSN); \
2756 /* Conditional branches with empty delay slots have a length of two. */
2757 #define ADJUST_INSN_LENGTH(INSN, LENGTH) \
2758 if (GET_CODE (INSN) == CALL_INSN \
2759 || (GET_CODE (INSN) == JUMP_INSN && ! simplejump_p (insn))) \
2762 /* Control the assembler format that we output. */
2764 /* Output at beginning of assembler file. */
2766 #define ASM_FILE_START(file)
2768 /* A C string constant describing how to begin a comment in the target
2769 assembler language. The compiler assumes that the comment will end at
2770 the end of the line. */
2772 #define ASM_COMMENT_START "!"
2774 /* Output to assembler file text saying following lines
2775 may contain character constants, extra white space, comments, etc. */
2777 #define ASM_APP_ON ""
2779 /* Output to assembler file text saying following lines
2780 no longer contain unusual constructs. */
2782 #define ASM_APP_OFF ""
2784 /* ??? Try to make the style consistent here (_OP?). */
2786 #define ASM_LONGLONG ".xword"
2787 #define ASM_LONG ".word"
2788 #define ASM_SHORT ".half"
2789 #define ASM_BYTE_OP ".byte"
2790 #define ASM_FLOAT ".single"
2791 #define ASM_DOUBLE ".double"
2792 #define ASM_LONGDOUBLE ".xxx" /* ??? Not known (or used yet). */
2794 /* Output before read-only data. */
2796 #define TEXT_SECTION_ASM_OP ".text"
2798 /* Output before writable data. */
2800 #define DATA_SECTION_ASM_OP ".data"
2802 /* How to refer to registers in assembler output.
2803 This sequence is indexed by compiler's hard-register-number (see above). */
2805 #define REGISTER_NAMES \
2806 {"%g0", "%g1", "%g2", "%g3", "%g4", "%g5", "%g6", "%g7", \
2807 "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%sp", "%o7", \
2808 "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", \
2809 "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%fp", "%i7", \
2810 "%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7", \
2811 "%f8", "%f9", "%f10", "%f11", "%f12", "%f13", "%f14", "%f15", \
2812 "%f16", "%f17", "%f18", "%f19", "%f20", "%f21", "%f22", "%f23", \
2813 "%f24", "%f25", "%f26", "%f27", "%f28", "%f29", "%f30", "%f31", \
2814 "%f32", "%f33", "%f34", "%f35", "%f36", "%f37", "%f38", "%f39", \
2815 "%f40", "%f41", "%f42", "%f43", "%f44", "%f45", "%f46", "%f47", \
2816 "%f48", "%f49", "%f50", "%f51", "%f52", "%f53", "%f54", "%f55", \
2817 "%f56", "%f57", "%f58", "%f59", "%f60", "%f61", "%f62", "%f63", \
2818 "%fcc0", "%fcc1", "%fcc2", "%fcc3", "%icc"}
2820 /* Define additional names for use in asm clobbers and asm declarations. */
2822 #define ADDITIONAL_REGISTER_NAMES \
2823 {{"ccr", SPARC_ICC_REG}, {"cc", SPARC_ICC_REG}}
2825 /* How to renumber registers for dbx and gdb. In the flat model, the frame
2826 pointer is really %i7. */
2828 #define DBX_REGISTER_NUMBER(REGNO) \
2829 (TARGET_FLAT && REGNO == FRAME_POINTER_REGNUM ? 31 : REGNO)
2831 /* On Sun 4, this limit is 2048. We use 1000 to be safe, since the length
2832 can run past this up to a continuation point. Once we used 1500, but
2833 a single entry in C++ can run more than 500 bytes, due to the length of
2834 mangled symbol names. dbxout.c should really be fixed to do
2835 continuations when they are actually needed instead of trying to
2837 #define DBX_CONTIN_LENGTH 1000
2839 /* This is how to output a note to DBX telling it the line number
2840 to which the following sequence of instructions corresponds.
2842 This is needed for SunOS 4.0, and should not hurt for 3.2
2844 #define ASM_OUTPUT_SOURCE_LINE(file, line) \
2845 { static int sym_lineno = 1; \
2846 fprintf (file, ".stabn 68,0,%d,LM%d\nLM%d:\n", \
2847 line, sym_lineno, sym_lineno); \
2850 /* This is how to output the definition of a user-level label named NAME,
2851 such as the label on a static function or variable NAME. */
2853 #define ASM_OUTPUT_LABEL(FILE,NAME) \
2854 do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
2856 /* This is how to output a command to make the user-level label named NAME
2857 defined for reference from other files. */
2859 #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
2860 do { fputs ("\t.global ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
2862 /* The prefix to add to user-visible assembler symbols. */
2864 #define USER_LABEL_PREFIX "_"
2866 /* This is how to output a definition of an internal numbered label where
2867 PREFIX is the class of label and NUM is the number within the class. */
2869 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
2870 fprintf (FILE, "%s%d:\n", PREFIX, NUM)
2872 /* This is how to store into the string LABEL
2873 the symbol_ref name of an internal numbered label where
2874 PREFIX is the class of label and NUM is the number within the class.
2875 This is suitable for output with `assemble_name'. */
2877 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
2878 sprintf ((LABEL), "*%s%ld", (PREFIX), (long)(NUM))
2880 /* This is how to output an assembler line defining a `float' constant.
2881 We always have to use a .long pseudo-op to do this because the native
2882 SVR4 ELF assembler is buggy and it generates incorrect values when we
2883 try to use the .float pseudo-op instead. */
2885 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
2889 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
2890 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
2891 fprintf (FILE, "\t%s\t0x%lx %s ~%s\n", ASM_LONG, t, \
2892 ASM_COMMENT_START, str); \
2895 /* This is how to output an assembler line defining a `double' constant.
2896 We always have to use a .long pseudo-op to do this because the native
2897 SVR4 ELF assembler is buggy and it generates incorrect values when we
2898 try to use the .float pseudo-op instead. */
2900 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
2904 REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
2905 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
2906 fprintf (FILE, "\t%s\t0x%lx %s ~%s\n", ASM_LONG, t[0], \
2907 ASM_COMMENT_START, str); \
2908 fprintf (FILE, "\t%s\t0x%lx\n", ASM_LONG, t[1]); \
2911 /* This is how to output an assembler line defining a `long double'
2914 #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
2918 REAL_VALUE_TO_TARGET_LONG_DOUBLE ((VALUE), t); \
2919 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
2920 fprintf (FILE, "\t%s\t0x%lx %s ~%s\n", ASM_LONG, t[0], \
2921 ASM_COMMENT_START, str); \
2922 fprintf (FILE, "\t%s\t0x%lx\n", ASM_LONG, t[1]); \
2923 fprintf (FILE, "\t%s\t0x%lx\n", ASM_LONG, t[2]); \
2924 fprintf (FILE, "\t%s\t0x%lx\n", ASM_LONG, t[3]); \
2927 /* This is how to output an assembler line defining an `int' constant. */
2929 #define ASM_OUTPUT_INT(FILE,VALUE) \
2930 ( fprintf (FILE, "\t%s\t", ASM_LONG), \
2931 output_addr_const (FILE, (VALUE)), \
2932 fprintf (FILE, "\n"))
2934 /* This is how to output an assembler line defining a DImode constant. */
2935 #define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE) \
2936 output_double_int (FILE, VALUE)
2938 /* Likewise for `char' and `short' constants. */
2940 #define ASM_OUTPUT_SHORT(FILE,VALUE) \
2941 ( fprintf (FILE, "\t%s\t", ASM_SHORT), \
2942 output_addr_const (FILE, (VALUE)), \
2943 fprintf (FILE, "\n"))
2945 #define ASM_OUTPUT_CHAR(FILE,VALUE) \
2946 ( fprintf (FILE, "\t%s\t", ASM_BYTE_OP), \
2947 output_addr_const (FILE, (VALUE)), \
2948 fprintf (FILE, "\n"))
2950 /* This is how to output an assembler line for a numeric constant byte. */
2952 #define ASM_OUTPUT_BYTE(FILE,VALUE) \
2953 fprintf (FILE, "\t%s\t0x%x\n", ASM_BYTE_OP, (VALUE))
2955 /* This is how we hook in and defer the case-vector until the end of
2958 #define ASM_OUTPUT_ADDR_VEC(LAB,VEC) \
2959 sparc_defer_case_vector ((LAB),(VEC), 0)
2961 #define ASM_OUTPUT_ADDR_DIFF_VEC(LAB,VEC) \
2962 sparc_defer_case_vector ((LAB),(VEC), 1)
2964 /* This is how to output an element of a case-vector that is absolute. */
2966 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
2969 ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
2970 if (Pmode == SImode) \
2971 fprintf (FILE, "\t.word\t"); \
2972 else if (TARGET_CM_MEDLOW) \
2973 fprintf (FILE, "\t.word\t0\n\t.word\t"); \
2975 fprintf (FILE, "\t.xword\t"); \
2976 assemble_name (FILE, label); \
2977 fputc ('\n', FILE); \
2980 /* This is how to output an element of a case-vector that is relative.
2981 (SPARC uses such vectors only when generating PIC.) */
2983 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
2986 ASM_GENERATE_INTERNAL_LABEL (label, "L", (VALUE)); \
2987 if (Pmode == SImode) \
2988 fprintf (FILE, "\t.word\t"); \
2989 else if (TARGET_CM_MEDLOW) \
2990 fprintf (FILE, "\t.word\t0\n\t.word\t"); \
2992 fprintf (FILE, "\t.xword\t"); \
2993 assemble_name (FILE, label); \
2994 ASM_GENERATE_INTERNAL_LABEL (label, "L", (REL)); \
2995 fputc ('-', FILE); \
2996 assemble_name (FILE, label); \
2997 fputc ('\n', FILE); \
3000 /* This is how to output an assembler line
3001 that says to advance the location counter
3002 to a multiple of 2**LOG bytes. */
3004 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
3006 fprintf (FILE, "\t.align %d\n", (1<<(LOG)))
3008 #define LABEL_ALIGN_AFTER_BARRIER(LABEL) (sparc_align_jumps)
3010 #define LOOP_ALIGN(LABEL) (sparc_align_loops)
3012 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
3013 fprintf (FILE, "\t.skip %u\n", (SIZE))
3015 /* This says how to output an assembler line
3016 to define a global common symbol. */
3018 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
3019 ( fputs ("\t.common ", (FILE)), \
3020 assemble_name ((FILE), (NAME)), \
3021 fprintf ((FILE), ",%u,\"bss\"\n", (SIZE)))
3023 /* This says how to output an assembler line to define a local common
3026 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGNED) \
3027 ( fputs ("\t.reserve ", (FILE)), \
3028 assemble_name ((FILE), (NAME)), \
3029 fprintf ((FILE), ",%u,\"bss\",%u\n", \
3030 (SIZE), ((ALIGNED) / BITS_PER_UNIT)))
3032 /* A C statement (sans semicolon) to output to the stdio stream
3033 FILE the assembler definition of uninitialized global DECL named
3034 NAME whose size is SIZE bytes and alignment is ALIGN bytes.
3035 Try to use asm_output_aligned_bss to implement this macro. */
3037 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
3039 fputs (".globl ", (FILE)); \
3040 assemble_name ((FILE), (NAME)); \
3041 fputs ("\n", (FILE)); \
3042 ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN); \
3045 /* Store in OUTPUT a string (made with alloca) containing
3046 an assembler-name for a local static variable named NAME.
3047 LABELNO is an integer which is different for each call. */
3049 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
3050 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
3051 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
3053 #define IDENT_ASM_OP ".ident"
3055 /* Output #ident as a .ident. */
3057 #define ASM_OUTPUT_IDENT(FILE, NAME) \
3058 fprintf (FILE, "\t%s\t\"%s\"\n", IDENT_ASM_OP, NAME);
3060 /* Output code to add DELTA to the first argument, and then jump to FUNCTION.
3061 Used for C++ multiple inheritance. */
3062 #define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
3064 int big_delta = (DELTA) >= 4096 || (DELTA) < -4096; \
3066 fprintf (FILE, "\tset %d,%%g1\n\tadd %%o0,%%g1,%%o0\n", (DELTA)); \
3067 /* Don't use the jmp solution unless we know the target is local to \
3068 the application or shared object. \
3069 XXX: Wimp out and don't actually check anything except if this is \
3070 an embedded target where we assume there are no shared libs. */ \
3071 if (!TARGET_CM_EMBMEDANY || flag_pic) \
3074 fprintf (FILE, "\tadd %%o0,%d,%%o0\n", DELTA); \
3075 fprintf (FILE, "\tmov %%o7,%%g1\n"); \
3076 fprintf (FILE, "\tcall "); \
3077 assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \
3078 fprintf (FILE, ",0\n"); \
3080 else if (TARGET_CM_EMBMEDANY) \
3082 fprintf (FILE, "\tsetx "); \
3083 assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \
3084 fprintf (FILE, ",%%g5,%%g1\n\tjmp %%g1\n"); \
3088 fprintf (FILE, "\tsethi %%hi("); \
3089 assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \
3090 fprintf (FILE, "),%%g1\n\tjmp %%g1+%%lo("); \
3091 assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \
3092 fprintf (FILE, ")\n"); \
3094 if (!TARGET_CM_EMBMEDANY || flag_pic) \
3095 fprintf (FILE, "\tmov %%g1,%%o7\n"); \
3096 else if (big_delta) \
3097 fprintf (FILE, "\tnop\n"); \
3099 fprintf (FILE, "\tadd %%o0,%d,%%o0\n", DELTA); \
3102 /* Define the parentheses used to group arithmetic operations
3103 in assembler code. */
3105 #define ASM_OPEN_PAREN "("
3106 #define ASM_CLOSE_PAREN ")"
3108 /* Define results of standard character escape sequences. */
3109 #define TARGET_BELL 007
3110 #define TARGET_BS 010
3111 #define TARGET_TAB 011
3112 #define TARGET_NEWLINE 012
3113 #define TARGET_VT 013
3114 #define TARGET_FF 014
3115 #define TARGET_CR 015
3117 #define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \
3118 ((CHAR) == '#' || (CHAR) == '*' || (CHAR) == '^' || (CHAR) == '(' || (CHAR) == '_')
3120 /* Print operand X (an rtx) in assembler syntax to file FILE.
3121 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
3122 For `%' followed by punctuation, CODE is the punctuation and X is null. */
3124 #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
3126 /* Print a memory address as an operand to reference that memory location. */
3128 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
3129 { register rtx base, index = 0; \
3131 register rtx addr = ADDR; \
3132 if (GET_CODE (addr) == REG) \
3133 fputs (reg_names[REGNO (addr)], FILE); \
3134 else if (GET_CODE (addr) == PLUS) \
3136 if (GET_CODE (XEXP (addr, 0)) == CONST_INT) \
3137 offset = INTVAL (XEXP (addr, 0)), base = XEXP (addr, 1);\
3138 else if (GET_CODE (XEXP (addr, 1)) == CONST_INT) \
3139 offset = INTVAL (XEXP (addr, 1)), base = XEXP (addr, 0);\
3141 base = XEXP (addr, 0), index = XEXP (addr, 1); \
3142 fputs (reg_names[REGNO (base)], FILE); \
3144 fprintf (FILE, "%+d", offset); \
3145 else if (GET_CODE (index) == REG) \
3146 fprintf (FILE, "+%s", reg_names[REGNO (index)]); \
3147 else if (GET_CODE (index) == SYMBOL_REF \
3148 || GET_CODE (index) == CONST) \
3149 fputc ('+', FILE), output_addr_const (FILE, index); \
3152 else if (GET_CODE (addr) == MINUS \
3153 && GET_CODE (XEXP (addr, 1)) == LABEL_REF) \
3155 output_addr_const (FILE, XEXP (addr, 0)); \
3156 fputs ("-(", FILE); \
3157 output_addr_const (FILE, XEXP (addr, 1)); \
3158 fputs ("-.)", FILE); \
3160 else if (GET_CODE (addr) == LO_SUM) \
3162 output_operand (XEXP (addr, 0), 0); \
3163 if (TARGET_CM_MEDMID) \
3164 fputs ("+%l44(", FILE); \
3166 fputs ("+%lo(", FILE); \
3167 output_address (XEXP (addr, 1)); \
3168 fputc (')', FILE); \
3170 else if (flag_pic && GET_CODE (addr) == CONST \
3171 && GET_CODE (XEXP (addr, 0)) == MINUS \
3172 && GET_CODE (XEXP (XEXP (addr, 0), 1)) == CONST \
3173 && GET_CODE (XEXP (XEXP (XEXP (addr, 0), 1), 0)) == MINUS \
3174 && XEXP (XEXP (XEXP (XEXP (addr, 0), 1), 0), 1) == pc_rtx) \
3176 addr = XEXP (addr, 0); \
3177 output_addr_const (FILE, XEXP (addr, 0)); \
3178 /* Group the args of the second CONST in parenthesis. */ \
3179 fputs ("-(", FILE); \
3180 /* Skip past the second CONST--it does nothing for us. */\
3181 output_addr_const (FILE, XEXP (XEXP (addr, 1), 0)); \
3182 /* Close the parenthesis. */ \
3183 fputc (')', FILE); \
3187 output_addr_const (FILE, addr); \
3191 /* Define the codes that are matched by predicates in sparc.c. */
3193 #define PREDICATE_CODES \
3194 {"reg_or_0_operand", {SUBREG, REG, CONST_INT, CONST_DOUBLE}}, \
3195 {"fp_zero_operand", {CONST_DOUBLE}}, \
3196 {"intreg_operand", {SUBREG, REG}}, \
3197 {"fcc_reg_operand", {REG}}, \
3198 {"icc_or_fcc_reg_operand", {REG}}, \
3199 {"restore_operand", {REG}}, \
3200 {"call_operand", {MEM}}, \
3201 {"call_operand_address", {SYMBOL_REF, LABEL_REF, CONST, CONST_DOUBLE, ADDRESSOF, \
3202 SUBREG, REG, PLUS, LO_SUM, CONST_INT}}, \
3203 {"symbolic_operand", {SYMBOL_REF, LABEL_REF, CONST, CONST_DOUBLE}}, \
3204 {"symbolic_memory_operand", {SUBREG, MEM}}, \
3205 {"label_ref_operand", {LABEL_REF}}, \
3206 {"sp64_medium_pic_operand", {CONST}}, \
3207 {"data_segment_operand", {SYMBOL_REF, PLUS, CONST}}, \
3208 {"text_segment_operand", {LABEL_REF, SYMBOL_REF, PLUS, CONST}}, \
3209 {"reg_or_nonsymb_mem_operand", {SUBREG, REG, MEM}}, \
3210 {"splittable_symbolic_memory_operand", {MEM}}, \
3211 {"splittable_immediate_memory_operand", {MEM}}, \
3212 {"eq_or_neq", {EQ, NE}}, \
3213 {"normal_comp_operator", {GE, GT, LE, LT, GTU, LEU}}, \
3214 {"noov_compare_op", {NE, EQ, GE, GT, LE, LT, GEU, GTU, LEU, LTU}}, \
3215 {"v9_regcmp_op", {EQ, NE, GE, LT, LE, GT}}, \
3216 {"extend_op", {SIGN_EXTEND, ZERO_EXTEND}}, \
3217 {"cc_arithop", {AND, IOR, XOR}}, \
3218 {"cc_arithopn", {AND, IOR}}, \
3219 {"arith_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT}}, \
3220 {"arith_add_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT}}, \
3221 {"arith11_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT}}, \
3222 {"arith10_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT}}, \
3223 {"arith_double_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT, CONST_DOUBLE}}, \
3224 {"arith_double_add_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT, CONST_DOUBLE}},\
3225 {"arith11_double_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT, CONST_DOUBLE}}, \
3226 {"arith10_double_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT, CONST_DOUBLE}}, \
3227 {"small_int", {CONST_INT, CONSTANT_P_RTX}}, \
3228 {"small_int_or_double", {CONST_INT, CONST_DOUBLE, CONSTANT_P_RTX}}, \
3229 {"uns_small_int", {CONST_INT, CONSTANT_P_RTX}}, \
3230 {"uns_arith_operand", {SUBREG, REG, CONST_INT, CONSTANT_P_RTX}}, \
3231 {"clobbered_register", {REG}}, \
3232 {"input_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT, MEM}}, \
3233 {"zero_operand", {CONST_INT, CONSTANT_P_RTX}}, \
3234 {"const64_operand", {CONST_INT, CONST_DOUBLE, CONSTANT_P_RTX}}, \
3235 {"const64_high_operand", {CONST_INT, CONST_DOUBLE, CONSTANT_P_RTX}},
3238 /* The number of Pmode words for the setjmp buffer. */
3239 #define JMP_BUF_SIZE 12
3241 #define DONT_ACCESS_GBLS_AFTER_EPILOGUE (flag_pic)
3243 /* Declare functions defined in sparc.c and used in templates. */
3245 extern void sparc_emit_set_const32 ();
3246 extern void sparc_emit_set_const64 ();
3247 extern void sparc_emit_set_symbolic_const64 ();
3248 extern int sparc_splitdi_legitimate ();
3249 extern int sparc_absnegfloat_split_legitimate ();
3251 extern char *output_cbranch ();
3252 extern char *output_return ();
3253 extern char *output_v9branch ();
3255 extern void emit_v9_brxx_insn ();
3256 extern void finalize_pic ();
3257 extern void order_regs_for_local_alloc ();
3258 extern void output_double_int ();
3259 extern void output_function_epilogue ();
3260 extern void output_function_prologue ();
3261 extern void print_operand ();
3262 extern void sparc_flat_output_function_epilogue ();
3263 extern void sparc_flat_output_function_prologue ();
3265 extern int addrs_ok_for_ldd_peep ();
3266 extern int arith10_double_operand ();
3267 extern int arith10_operand ();
3268 extern int arith11_double_operand ();
3269 extern int arith11_operand ();
3270 extern int arith_double_operand ();
3271 extern int arith_double_4096_operand ();
3272 extern int arith_double_add_operand ();
3273 extern int arith_operand ();
3274 extern int arith_4096_operand ();
3275 extern int arith_add_operand ();
3276 extern int call_operand_address ();
3277 extern int input_operand ();
3278 extern int zero_operand ();
3279 extern int const64_operand ();
3280 extern int const64_high_operand ();
3281 extern int cc_arithop ();
3282 extern int cc_arithopn ();
3283 extern int check_pic ();
3284 extern int compute_frame_size ();
3285 extern int data_segment_operand ();
3286 extern int eligible_for_epilogue_delay ();
3287 extern int eligible_for_return_delay ();
3288 extern int emit_move_sequence ();
3289 extern int extend_op ();
3290 extern int fcc_reg_operand ();
3291 extern int fp_zero_operand ();
3292 extern int icc_or_fcc_reg_operand ();
3293 extern int label_ref_operand ();
3294 extern int mem_min_alignment ();
3295 extern int noov_compare_op ();
3296 extern int pic_address_needs_scratch ();
3297 extern int reg_or_0_operand ();
3298 extern int reg_or_nonsymb_mem_operand ();
3299 extern int reg_unused_after ();
3300 extern int register_ok_for_ldd ();
3301 extern int registers_ok_for_ldd_peep ();
3302 extern int restore_operand ();
3303 extern int short_branch ();
3304 extern int small_int ();
3305 extern int small_int_or_double ();
3306 extern int sp64_medium_pic_operand ();
3307 extern int sparc_flat_eligible_for_epilogue_delay ();
3308 extern int sparc_flat_epilogue_delay_slots ();
3309 extern int sparc_issue_rate ();
3310 extern int splittable_immediate_memory_operand ();
3311 extern int splittable_symbolic_memory_operand ();
3312 extern int supersparc_adjust_cost ();
3313 extern int symbolic_memory_operand ();
3314 extern int symbolic_operand ();
3315 extern int text_segment_operand ();
3316 extern int ultrasparc_adjust_cost ();
3317 extern int uns_small_int ();
3318 extern int v9_regcmp_op ();
3319 extern int v9_regcmp_p ();
3321 extern unsigned long sparc_flat_compute_frame_size ();
3322 extern unsigned long sparc_type_code ();
3324 extern char *sparc_v8plus_shift ();
3327 /* Function used for V8+ code generation. Returns 1 if the high
3328 32 bits of REG are 0 before INSN. */
3329 extern int sparc_check_64 (struct rtx_def
*, struct rtx_def
*);
3330 extern int sparc_return_peephole_ok (struct rtx_def
*, struct rtx_def
*);
3331 extern int compute_frame_size (int, int);
3334 /* Defined in flags.h, but insn-emit.c does not include flags.h. */
3336 extern int flag_pic
;