Import final gcc2 snapshot (990109)
[official-gcc.git] / gcc / config / sparc / sparc.h
blob5578a063d19b4990da4d8a9e5eaf97cb30cb903f
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,
5 at Cygnus Support.
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)
12 any later version.
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
35 runtime selection. */
36 #ifdef SPARC_BI_ARCH
37 #define TARGET_ARCH32 (! TARGET_64BIT)
38 #else
39 #define TARGET_ARCH32 (DEFAULT_ARCH32_P)
40 #endif
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
49 to imply a v8 abi.
51 TARGET_CM_MEDLOW: 32 bit address space, top 32 bits = 0,
52 avoid generating %uhi and %ulo terms,
53 pointers are 64 bits.
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
58 relocs are used.
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_
64 is 31 bits.
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.
72 enum cmodel {
73 CM_32,
74 CM_MEDLOW,
75 CM_MEDMID,
76 CM_MEDANY,
77 CM_EMBMEDANY
80 /* Value of -mcmodel specified by user. */
81 extern char *sparc_cmodel_string;
82 /* One of CM_FOO. */
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 ""
113 #endif
114 #if TARGET_CPU_DEFAULT == TARGET_CPU_sparclet
115 #define CPP_CPU_DEFAULT_SPEC "-D__sparclet__"
116 #define ASM_CPU_DEFAULT_SPEC "-Asparclet"
117 #endif
118 #if TARGET_CPU_DEFAULT == TARGET_CPU_sparclite
119 #define CPP_CPU_DEFAULT_SPEC "-D__sparclite__"
120 #define ASM_CPU_DEFAULT_SPEC "-Asparclite"
121 #endif
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"
129 #endif
130 #if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
131 #define CPP_CPU_DEFAULT_SPEC "-D__sparc_v9__"
132 #define ASM_CPU_DEFAULT_SPEC "-Av9a"
133 #endif
134 #ifndef CPP_CPU_DEFAULT_SPEC
135 Unrecognized value in TARGET_CPU_DEFAULT.
136 #endif
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 into 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 "\
151 %{mcypress:} \
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=v8plus:-D__sparc_v9__} \
162 %{mcpu=v9:-D__sparc_v9__} \
163 %{mcpu=ultrasparc:-D__sparc_v9__} \
164 %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(cpp_cpu_default)}}}}}}} \
167 /* ??? The GCC_NEW_VARARGS macro is now obsolete, because gcc always uses
168 the right varags.h file when bootstrapping. */
169 /* ??? It's not clear what value we want to use for -Acpu/machine for
170 sparc64 in 32 bit environments, so for now we only use `sparc64' in
171 64 bit environments. */
173 #define CPP_ARCH32_SPEC "-D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc)"
174 #define CPP_ARCH64_SPEC "-D__arch64__ -Acpu(sparc64) -Amachine(sparc64)"
175 #define CPP_ARCH_DEFAULT_SPEC \
176 (DEFAULT_ARCH32_P ? CPP_ARCH32_SPEC : CPP_ARCH64_SPEC)
178 #define CPP_ARCH_SPEC "\
179 %{m32:%(cpp_arch32)} \
180 %{m64:%(cpp_arch64)} \
181 %{!m32:%{!m64:%(cpp_arch_default)}} \
184 /* Macros to distinguish endianness. */
185 #define CPP_ENDIAN_SPEC "%{mlittle-endian:-D__LITTLE_ENDIAN__}"
187 /* Macros to distinguish the particular subtarget. */
188 #define CPP_SUBTARGET_SPEC ""
190 #define CPP_SPEC "%(cpp_cpu) %(cpp_arch) %(cpp_endian) %(cpp_subtarget)"
192 /* Prevent error on `-sun4' and `-target sun4' options. */
193 /* This used to translate -dalign to -malign, but that is no good
194 because it can't turn off the usual meaning of making debugging dumps. */
195 /* Translate old style -m<cpu> into new style -mcpu=<cpu>.
196 ??? Delete support for -m<cpu> for 2.9. */
198 #define CC1_SPEC "\
199 %{sun4:} %{target:} \
200 %{mcypress:-mcpu=cypress} \
201 %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
202 %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
205 /* Override in target specific files. */
206 #define ASM_CPU_SPEC "\
207 %{mcpu=sparclet:-Asparclet} %{mcpu=tsc701:-Asparclet} \
208 %{msparclite:-Asparclite} \
209 %{mf930:-Asparclite} %{mf934:-Asparclite} \
210 %{mcpu=sparclite:-Asparclite} \
211 %{mcpu=f930:-Asparclite} %{mcpu=f934:-Asparclite} \
212 %{mcpu=v8plus:-Av8plus} \
213 %{mcpu=v9:-Av9} \
214 %{mcpu=ultrasparc:-Av9a} \
215 %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(asm_cpu_default)}}}}}}} \
218 /* Word size selection, among other things.
219 This is what GAS uses. Add %(asm_arch) to ASM_SPEC to enable. */
221 #define ASM_ARCH32_SPEC "-32"
222 #define ASM_ARCH64_SPEC "-64"
223 #define ASM_ARCH_DEFAULT_SPEC \
224 (DEFAULT_ARCH32_P ? ASM_ARCH32_SPEC : ASM_ARCH64_SPEC)
226 #define ASM_ARCH_SPEC "\
227 %{m32:%(asm_arch32)} \
228 %{m64:%(asm_arch64)} \
229 %{!m32:%{!m64:%(asm_arch_default)}} \
232 /* Special flags to the Sun-4 assembler when using pipe for input. */
234 #define ASM_SPEC "\
235 %| %{R} %{!pg:%{!p:%{fpic:-k} %{fPIC:-k}}} %{keep-local-as-symbols:-L} \
236 %(asm_cpu) \
239 #define LIB_SPEC "%{!shared:%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} %{g:-lg}}"
241 /* Provide required defaults for linker -e and -d switches. */
243 #define LINK_SPEC \
244 "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp} %{static:-Bstatic} \
245 %{assert*} %{shared:%{!mimpure-text:-assert pure-text}}"
247 /* This macro defines names of additional specifications to put in the specs
248 that can be used in various specifications like CC1_SPEC. Its definition
249 is an initializer with a subgrouping for each command option.
251 Each subgrouping contains a string constant, that defines the
252 specification name, and a string constant that used by the GNU CC driver
253 program.
255 Do not define this macro if it does not need to do anything. */
257 #define EXTRA_SPECS \
258 { "cpp_cpu", CPP_CPU_SPEC }, \
259 { "cpp_cpu_default", CPP_CPU_DEFAULT_SPEC }, \
260 { "cpp_arch32", CPP_ARCH32_SPEC }, \
261 { "cpp_arch64", CPP_ARCH64_SPEC }, \
262 { "cpp_arch_default", CPP_ARCH_DEFAULT_SPEC }, \
263 { "cpp_arch", CPP_ARCH_SPEC }, \
264 { "cpp_endian", CPP_ENDIAN_SPEC }, \
265 { "cpp_subtarget", CPP_SUBTARGET_SPEC }, \
266 { "asm_cpu", ASM_CPU_SPEC }, \
267 { "asm_cpu_default", ASM_CPU_DEFAULT_SPEC }, \
268 { "asm_arch32", ASM_ARCH32_SPEC }, \
269 { "asm_arch64", ASM_ARCH64_SPEC }, \
270 { "asm_arch_default", ASM_ARCH_DEFAULT_SPEC }, \
271 { "asm_arch", ASM_ARCH_SPEC }, \
272 SUBTARGET_EXTRA_SPECS
274 #define SUBTARGET_EXTRA_SPECS
276 #ifdef SPARC_BI_ARCH
277 #define NO_BUILTIN_PTRDIFF_TYPE
278 #define NO_BUILTIN_SIZE_TYPE
279 #endif
280 #define PTRDIFF_TYPE (TARGET_ARCH64 ? "long long int" : "int")
281 #define SIZE_TYPE (TARGET_ARCH64 ? "long long unsigned int" : "unsigned int")
283 /* ??? This should be 32 bits for v9 but what can we do? */
284 #define WCHAR_TYPE "short unsigned int"
285 #define WCHAR_TYPE_SIZE 16
286 #define MAX_WCHAR_TYPE_SIZE 16
288 /* Show we can debug even without a frame pointer. */
289 #define CAN_DEBUG_WITHOUT_FP
291 /* To make profiling work with -f{pic,PIC}, we need to emit the profiling
292 code into the rtl. Also, if we are profiling, we cannot eliminate
293 the frame pointer (because the return address will get smashed). */
295 void sparc_override_options ();
297 #define OVERRIDE_OPTIONS \
298 do { \
299 if (profile_flag || profile_block_flag || profile_arc_flag) \
301 if (flag_pic) \
303 char *pic_string = (flag_pic == 1) ? "-fpic" : "-fPIC"; \
304 warning ("%s and profiling conflict: disabling %s", \
305 pic_string, pic_string); \
306 flag_pic = 0; \
308 flag_omit_frame_pointer = 0; \
310 sparc_override_options (); \
311 SUBTARGET_OVERRIDE_OPTIONS; \
312 } while (0)
314 /* This is meant to be redefined in the host dependent files. */
315 #define SUBTARGET_OVERRIDE_OPTIONS
317 /* These compiler options take an argument. We ignore -target for now. */
319 #define WORD_SWITCH_TAKES_ARG(STR) \
320 (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
321 || !strcmp (STR, "target") || !strcmp (STR, "assert"))
323 /* Print subsidiary information on the compiler version in use. */
325 #define TARGET_VERSION fprintf (stderr, " (sparc)");
327 /* Generate DBX debugging information. */
329 #define DBX_DEBUGGING_INFO
331 /* Run-time compilation parameters selecting different hardware subsets. */
333 extern int target_flags;
335 /* Nonzero if we should generate code to use the fpu. */
336 #define MASK_FPU 1
337 #define TARGET_FPU (target_flags & MASK_FPU)
339 /* Nonzero if we should use FUNCTION_EPILOGUE. Otherwise, we
340 use fast return insns, but lose some generality. */
341 #define MASK_EPILOGUE 2
342 #define TARGET_EPILOGUE (target_flags & MASK_EPILOGUE)
344 /* Nonzero if we should assume that double pointers might be unaligned.
345 This can happen when linking gcc compiled code with other compilers,
346 because the ABI only guarantees 4 byte alignment. */
347 #define MASK_UNALIGNED_DOUBLES 4
348 #define TARGET_UNALIGNED_DOUBLES (target_flags & MASK_UNALIGNED_DOUBLES)
350 /* Nonzero means that we should generate code for a v8 sparc. */
351 #define MASK_V8 0x8
352 #define TARGET_V8 (target_flags & MASK_V8)
354 /* Nonzero means that we should generate code for a sparclite.
355 This enables the sparclite specific instructions, but does not affect
356 whether FPU instructions are emitted. */
357 #define MASK_SPARCLITE 0x10
358 #define TARGET_SPARCLITE (target_flags & MASK_SPARCLITE)
360 /* Nonzero if we're compiling for the sparclet. */
361 #define MASK_SPARCLET 0x20
362 #define TARGET_SPARCLET (target_flags & MASK_SPARCLET)
364 /* Nonzero if we're compiling for v9 sparc.
365 Note that v9's can run in 32 bit mode so this doesn't necessarily mean
366 the word size is 64. */
367 #define MASK_V9 0x40
368 #define TARGET_V9 (target_flags & MASK_V9)
370 /* Non-zero to generate code that uses the instructions deprecated in
371 the v9 architecture. This option only applies to v9 systems. */
372 /* ??? This isn't user selectable yet. It's used to enable such insns
373 on 32 bit v9 systems and for the moment they're permanently disabled
374 on 64 bit v9 systems. */
375 #define MASK_DEPRECATED_V8_INSNS 0x80
376 #define TARGET_DEPRECATED_V8_INSNS (target_flags & MASK_DEPRECATED_V8_INSNS)
378 /* Mask of all CPU selection flags. */
379 #define MASK_ISA \
380 (MASK_V8 + MASK_SPARCLITE + MASK_SPARCLET + MASK_V9 + MASK_DEPRECATED_V8_INSNS)
382 /* Non-zero means don't pass `-assert pure-text' to the linker. */
383 #define MASK_IMPURE_TEXT 0x100
384 #define TARGET_IMPURE_TEXT (target_flags & MASK_IMPURE_TEXT)
386 /* Nonzero means that we should generate code using a flat register window
387 model, i.e. no save/restore instructions are generated, which is
388 compatible with normal sparc code.
389 The frame pointer is %i7 instead of %fp. */
390 #define MASK_FLAT 0x200
391 #define TARGET_FLAT (target_flags & MASK_FLAT)
393 /* Nonzero means use the registers that the Sparc ABI reserves for
394 application software. This must be the default to coincide with the
395 setting in FIXED_REGISTERS. */
396 #define MASK_APP_REGS 0x400
397 #define TARGET_APP_REGS (target_flags & MASK_APP_REGS)
399 /* Option to select how quad word floating point is implemented.
400 When TARGET_HARD_QUAD is true, we use the hardware quad instructions.
401 Otherwise, we use the SPARC ABI quad library functions. */
402 #define MASK_HARD_QUAD 0x800
403 #define TARGET_HARD_QUAD (target_flags & MASK_HARD_QUAD)
405 /* Non-zero on little-endian machines. */
406 /* ??? Little endian support currently only exists for sparclet-aout and
407 sparc64-elf configurations. May eventually want to expand the support
408 to all targets, but for now it's kept local to only those two. */
409 #define MASK_LITTLE_ENDIAN 0x1000
410 #define TARGET_LITTLE_ENDIAN (target_flags & MASK_LITTLE_ENDIAN)
412 /* 0x2000, 0x4000 are unused */
414 /* Nonzero if pointers are 64 bits.
415 This is not a user selectable option, though it may be one day -
416 so it is used to determine pointer size instead of an architecture flag. */
417 #define MASK_PTR64 0x8000
418 #define TARGET_PTR64 (target_flags & MASK_PTR64)
420 /* Nonzero if generating code to run in a 64 bit environment.
421 This is intended to only be used by TARGET_ARCH{32,64} as they are the
422 mechanism used to control compile time or run time selection. */
423 #define MASK_64BIT 0x10000
424 #define TARGET_64BIT (target_flags & MASK_64BIT)
426 /* 0x20000,0x40000 unused */
428 /* Non-zero means use a stack bias of 2047. Stack offsets are obtained by
429 adding 2047 to %sp. This option is for v9 only and is the default. */
430 #define MASK_STACK_BIAS 0x80000
431 #define TARGET_STACK_BIAS (target_flags & MASK_STACK_BIAS)
433 /* Non-zero means %g0 is a normal register.
434 We still clobber it as necessary, but we can't rely on it always having
435 a zero value.
436 We don't bother to support this in true 64 bit mode. */
437 #define MASK_LIVE_G0 0x100000
438 #define TARGET_LIVE_G0 (target_flags & MASK_LIVE_G0)
440 /* Non-zero means the cpu has broken `save' and `restore' insns, only
441 the trivial versions work (save %g0,%g0,%g0; restore %g0,%g0,%g0).
442 We assume the environment will properly handle or otherwise avoid
443 trouble associated with an interrupt occurring after the `save' or trap
444 occurring during it. */
445 #define MASK_BROKEN_SAVERESTORE 0x200000
446 #define TARGET_BROKEN_SAVERESTORE (target_flags & MASK_BROKEN_SAVERESTORE)
448 /* Non-zero means -m{,no-}fpu was passed on the command line. */
449 #define MASK_FPU_SET 0x400000
450 #define TARGET_FPU_SET (target_flags & MASK_FPU_SET)
452 /* Macro to define tables used to set the flags.
453 This is a list in braces of pairs in braces,
454 each pair being { "NAME", VALUE }
455 where VALUE is the bits to set or minus the bits to clear.
456 An empty string NAME is used to identify the default VALUE. */
458 #define TARGET_SWITCHES \
459 { {"fpu", MASK_FPU | MASK_FPU_SET}, \
460 {"no-fpu", -MASK_FPU}, \
461 {"no-fpu", MASK_FPU_SET}, \
462 {"hard-float", MASK_FPU | MASK_FPU_SET}, \
463 {"soft-float", -MASK_FPU}, \
464 {"soft-float", MASK_FPU_SET}, \
465 {"epilogue", MASK_EPILOGUE}, \
466 {"no-epilogue", -MASK_EPILOGUE}, \
467 {"unaligned-doubles", MASK_UNALIGNED_DOUBLES}, \
468 {"no-unaligned-doubles", -MASK_UNALIGNED_DOUBLES}, \
469 {"impure-text", MASK_IMPURE_TEXT}, \
470 {"no-impure-text", -MASK_IMPURE_TEXT}, \
471 {"flat", MASK_FLAT}, \
472 {"no-flat", -MASK_FLAT}, \
473 {"app-regs", MASK_APP_REGS}, \
474 {"no-app-regs", -MASK_APP_REGS}, \
475 {"hard-quad-float", MASK_HARD_QUAD}, \
476 {"soft-quad-float", -MASK_HARD_QUAD}, \
477 /* ??? These are deprecated, coerced to -mcpu=. Delete in 2.9. */ \
478 {"cypress", 0}, \
479 {"sparclite", 0}, \
480 {"f930", 0}, \
481 {"f934", 0}, \
482 {"v8", 0}, \
483 {"supersparc", 0}, \
484 /* End of deprecated options. */ \
485 /* -mptrNN exists for *experimental* purposes. */ \
486 /* {"ptr64", MASK_PTR64}, */ \
487 /* {"ptr32", -MASK_PTR64}, */ \
488 {"32", -MASK_64BIT}, \
489 {"64", MASK_64BIT}, \
490 {"stack-bias", MASK_STACK_BIAS}, \
491 {"no-stack-bias", -MASK_STACK_BIAS}, \
492 SUBTARGET_SWITCHES \
493 { "", TARGET_DEFAULT}}
495 /* MASK_APP_REGS must always be the default because that's what
496 FIXED_REGISTERS is set to and -ffixed- is processed before
497 CONDITIONAL_REGISTER_USAGE is called (where we process -mno-app-regs). */
498 #define TARGET_DEFAULT (MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU)
500 /* This is meant to be redefined in target specific files. */
501 #define SUBTARGET_SWITCHES
503 /* Processor type.
504 These must match the values for the cpu attribute in sparc.md. */
505 enum processor_type {
506 PROCESSOR_V7,
507 PROCESSOR_CYPRESS,
508 PROCESSOR_V8,
509 PROCESSOR_SUPERSPARC,
510 PROCESSOR_SPARCLITE,
511 PROCESSOR_F930,
512 PROCESSOR_F934,
513 PROCESSOR_SPARCLET,
514 PROCESSOR_TSC701,
515 PROCESSOR_V8PLUS,
516 PROCESSOR_V9,
517 PROCESSOR_ULTRASPARC
520 /* This is set from -m{cpu,tune}=xxx. */
521 extern enum processor_type sparc_cpu;
523 /* Recast the cpu class to be the cpu attribute.
524 Every file includes us, but not every file includes insn-attr.h. */
525 #define sparc_cpu_attr ((enum attr_cpu) sparc_cpu)
527 /* This macro is similar to `TARGET_SWITCHES' but defines names of
528 command options that have values. Its definition is an
529 initializer with a subgrouping for each command option.
531 Each subgrouping contains a string constant, that defines the
532 fixed part of the option name, and the address of a variable.
533 The variable, type `char *', is set to the variable part of the
534 given option if the fixed part matches. The actual option name
535 is made by appending `-m' to the specified name.
537 Here is an example which defines `-mshort-data-NUMBER'. If the
538 given option is `-mshort-data-512', the variable `m88k_short_data'
539 will be set to the string `"512"'.
541 extern char *m88k_short_data;
542 #define TARGET_OPTIONS { { "short-data-", &m88k_short_data } } */
544 #define TARGET_OPTIONS \
546 { "cpu=", &sparc_select[1].string }, \
547 { "tune=", &sparc_select[2].string }, \
548 { "cmodel=", &sparc_cmodel_string }, \
549 { "align-loops=", &sparc_align_loops_string }, \
550 { "align-jumps=", &sparc_align_jumps_string }, \
551 { "align-functions=", &sparc_align_funcs_string }, \
552 SUBTARGET_OPTIONS \
555 /* This is meant to be redefined in target specific files. */
556 #define SUBTARGET_OPTIONS
558 /* sparc_select[0] is reserved for the default cpu. */
559 struct sparc_cpu_select
561 char *string;
562 char *name;
563 int set_tune_p;
564 int set_arch_p;
567 extern struct sparc_cpu_select sparc_select[];
569 /* Variables to record values the user passes. */
570 extern char *sparc_align_loops_string;
571 extern char *sparc_align_jumps_string;
572 extern char *sparc_align_funcs_string;
573 /* Parsed values as a power of two. */
574 extern int sparc_align_loops;
575 extern int sparc_align_jumps;
576 extern int sparc_align_funcs;
578 #define DEFAULT_SPARC_ALIGN_FUNCS \
579 (sparc_cpu == PROCESSOR_ULTRASPARC ? 5 : 2)
581 /* target machine storage layout */
583 /* Define for cross-compilation to a sparc target with no TFmode from a host
584 with a different float format (e.g. VAX). */
585 #define REAL_ARITHMETIC
587 /* Define this if most significant bit is lowest numbered
588 in instructions that operate on numbered bit-fields. */
589 #define BITS_BIG_ENDIAN 1
591 /* Define this if most significant byte of a word is the lowest numbered. */
592 #define BYTES_BIG_ENDIAN 1
594 /* Define this if most significant word of a multiword number is the lowest
595 numbered. */
596 #define WORDS_BIG_ENDIAN 1
598 /* Define this to set the endianness to use in libgcc2.c, which can
599 not depend on target_flags. */
600 #if defined (__LITTLE_ENDIAN__)
601 #define LIBGCC2_WORDS_BIG_ENDIAN 0
602 #else
603 #define LIBGCC2_WORDS_BIG_ENDIAN 1
604 #endif
606 /* number of bits in an addressable storage unit */
607 #define BITS_PER_UNIT 8
609 /* Width in bits of a "word", which is the contents of a machine register.
610 Note that this is not necessarily the width of data type `int';
611 if using 16-bit ints on a 68000, this would still be 32.
612 But on a machine with 16-bit registers, this would be 16. */
613 #define BITS_PER_WORD (TARGET_ARCH64 ? 64 : 32)
614 #define MAX_BITS_PER_WORD 64
616 /* Width of a word, in units (bytes). */
617 #define UNITS_PER_WORD (TARGET_ARCH64 ? 8 : 4)
618 #define MIN_UNITS_PER_WORD 4
620 /* Now define the sizes of the C data types. */
622 #define SHORT_TYPE_SIZE 16
623 #define INT_TYPE_SIZE 32
624 #define LONG_TYPE_SIZE (TARGET_ARCH64 ? 64 : 32)
625 #define LONG_LONG_TYPE_SIZE 64
626 #define FLOAT_TYPE_SIZE 32
627 #define DOUBLE_TYPE_SIZE 64
629 #if defined (SPARC_BI_ARCH)
630 #define MAX_LONG_TYPE_SIZE 64
631 #endif
633 #if 0
634 /* ??? This does not work in SunOS 4.x, so it is not enabled here.
635 Instead, it is enabled in sol2.h, because it does work under Solaris. */
636 /* Define for support of TFmode long double and REAL_ARITHMETIC.
637 Sparc ABI says that long double is 4 words. */
638 #define LONG_DOUBLE_TYPE_SIZE 128
639 #endif
641 /* Width in bits of a pointer.
642 See also the macro `Pmode' defined below. */
643 #define POINTER_SIZE (TARGET_PTR64 ? 64 : 32)
645 /* A macro to update MODE and UNSIGNEDP when an object whose type
646 is TYPE and which has the specified mode and signedness is to be
647 stored in a register. This macro is only called when TYPE is a
648 scalar type. */
649 #define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
650 if (TARGET_ARCH64 \
651 && GET_MODE_CLASS (MODE) == MODE_INT \
652 && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
654 (MODE) = DImode; \
657 /* Define this macro if the promotion described by PROMOTE_MODE
658 should also be done for outgoing function arguments. */
659 /* This is only needed for TARGET_ARCH64, but since PROMOTE_MODE is a no-op
660 for TARGET_ARCH32 this is ok. Otherwise we'd need to add a runtime test
661 for this value. */
662 #define PROMOTE_FUNCTION_ARGS
664 /* Define this macro if the promotion described by PROMOTE_MODE
665 should also be done for the return value of functions.
666 If this macro is defined, FUNCTION_VALUE must perform the same
667 promotions done by PROMOTE_MODE. */
668 /* This is only needed for TARGET_ARCH64, but since PROMOTE_MODE is a no-op
669 for TARGET_ARCH32 this is ok. Otherwise we'd need to add a runtime test
670 for this value. */
671 #define PROMOTE_FUNCTION_RETURN
673 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
674 #define PARM_BOUNDARY (TARGET_ARCH64 ? 64 : 32)
676 /* Boundary (in *bits*) on which stack pointer should be aligned. */
677 #define STACK_BOUNDARY (TARGET_ARCH64 ? 128 : 64)
679 /* ALIGN FRAMES on double word boundaries */
681 #define SPARC_STACK_ALIGN(LOC) \
682 (TARGET_ARCH64 ? (((LOC)+15) & ~15) : (((LOC)+7) & ~7))
684 /* Allocation boundary (in *bits*) for the code of a function. */
685 #define FUNCTION_BOUNDARY (1 << (sparc_align_funcs + 3))
687 /* Alignment of field after `int : 0' in a structure. */
688 #define EMPTY_FIELD_BOUNDARY (TARGET_ARCH64 ? 64 : 32)
690 /* Every structure's size must be a multiple of this. */
691 #define STRUCTURE_SIZE_BOUNDARY 8
693 /* A bitfield declared as `int' forces `int' alignment for the struct. */
694 #define PCC_BITFIELD_TYPE_MATTERS 1
696 /* No data type wants to be aligned rounder than this. */
697 #define BIGGEST_ALIGNMENT (TARGET_ARCH64 ? 128 : 64)
699 /* The best alignment to use in cases where we have a choice. */
700 #define FASTEST_ALIGNMENT 64
702 /* Make strings word-aligned so strcpy from constants will be faster. */
703 #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
704 ((TREE_CODE (EXP) == STRING_CST \
705 && (ALIGN) < FASTEST_ALIGNMENT) \
706 ? FASTEST_ALIGNMENT : (ALIGN))
708 /* Make arrays of chars word-aligned for the same reasons. */
709 #define DATA_ALIGNMENT(TYPE, ALIGN) \
710 (TREE_CODE (TYPE) == ARRAY_TYPE \
711 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
712 && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
714 /* Set this nonzero if move instructions will actually fail to work
715 when given unaligned data. */
716 #define STRICT_ALIGNMENT 1
718 /* Things that must be doubleword aligned cannot go in the text section,
719 because the linker fails to align the text section enough!
720 Put them in the data section. This macro is only used in this file. */
721 #define MAX_TEXT_ALIGN 32
723 /* This forces all variables and constants to the data section when PIC.
724 This is because the SunOS 4 shared library scheme thinks everything in
725 text is a function, and patches the address to point to a loader stub. */
726 /* This is defined to zero for every system which doesn't use the a.out object
727 file format. */
728 #ifndef SUNOS4_SHARED_LIBRARIES
729 #define SUNOS4_SHARED_LIBRARIES 0
730 #endif
732 /* This is defined differently for v9 in a cover file. */
733 #define SELECT_SECTION(T,RELOC) \
735 if (TREE_CODE (T) == VAR_DECL) \
737 if (TREE_READONLY (T) && ! TREE_SIDE_EFFECTS (T) \
738 && DECL_INITIAL (T) \
739 && (DECL_INITIAL (T) == error_mark_node \
740 || TREE_CONSTANT (DECL_INITIAL (T))) \
741 && DECL_ALIGN (T) <= MAX_TEXT_ALIGN \
742 && ! (flag_pic && ((RELOC) || SUNOS4_SHARED_LIBRARIES))) \
743 text_section (); \
744 else \
745 data_section (); \
747 else if (TREE_CODE (T) == CONSTRUCTOR) \
749 if (flag_pic && ((RELOC) || SUNOS4_SHARED_LIBRARIES)) \
750 data_section (); \
752 else if (TREE_CODE_CLASS (TREE_CODE (T)) == 'c') \
754 if ((TREE_CODE (T) == STRING_CST && flag_writable_strings) \
755 || TYPE_ALIGN (TREE_TYPE (T)) > MAX_TEXT_ALIGN \
756 || (flag_pic && ((RELOC) || SUNOS4_SHARED_LIBRARIES))) \
757 data_section (); \
758 else \
759 text_section (); \
763 /* Use text section for a constant
764 unless we need more alignment than that offers. */
765 /* This is defined differently for v9 in a cover file. */
766 #define SELECT_RTX_SECTION(MODE, X) \
768 if (GET_MODE_BITSIZE (MODE) <= MAX_TEXT_ALIGN \
769 && ! (flag_pic && (symbolic_operand (X) || SUNOS4_SHARED_LIBRARIES))) \
770 text_section (); \
771 else \
772 data_section (); \
775 /* Standard register usage. */
777 /* Number of actual hardware registers.
778 The hardware registers are assigned numbers for the compiler
779 from 0 to just below FIRST_PSEUDO_REGISTER.
780 All registers that the compiler knows about must be given numbers,
781 even those that are not normally considered general registers.
783 SPARC has 32 integer registers and 32 floating point registers.
784 64 bit SPARC has 32 additional fp regs, but the odd numbered ones are not
785 accessible. We still account for them to simplify register computations
786 (eg: in CLASS_MAX_NREGS). There are also 4 fp condition code registers, so
787 32+32+32+4 == 100.
788 Register 100 is used as the integer condition code register. */
790 #define FIRST_PSEUDO_REGISTER 101
792 #define SPARC_FIRST_FP_REG 32
793 /* Additional V9 fp regs. */
794 #define SPARC_FIRST_V9_FP_REG 64
795 #define SPARC_LAST_V9_FP_REG 95
796 /* V9 %fcc[0123]. V8 uses (figuratively) %fcc0. */
797 #define SPARC_FIRST_V9_FCC_REG 96
798 #define SPARC_LAST_V9_FCC_REG 99
799 /* V8 fcc reg. */
800 #define SPARC_FCC_REG 96
801 /* Integer CC reg. We don't distinguish %icc from %xcc. */
802 #define SPARC_ICC_REG 100
804 /* Nonzero if REGNO is an fp reg. */
805 #define SPARC_FP_REG_P(REGNO) \
806 ((REGNO) >= SPARC_FIRST_FP_REG && (REGNO) <= SPARC_LAST_V9_FP_REG)
808 /* Argument passing regs. */
809 #define SPARC_OUTGOING_INT_ARG_FIRST 8
810 #define SPARC_INCOMING_INT_ARG_FIRST (TARGET_FLAT ? 8 : 24)
811 #define SPARC_FP_ARG_FIRST 32
813 /* 1 for registers that have pervasive standard uses
814 and are not available for the register allocator.
816 On non-v9 systems:
817 g1 is free to use as temporary.
818 g2-g4 are reserved for applications. Gcc normally uses them as
819 temporaries, but this can be disabled via the -mno-app-regs option.
820 g5 through g7 are reserved for the operating system.
822 On v9 systems:
823 g1,g5 are free to use as temporaries, and are free to use between calls
824 if the call is to an external function via the PLT.
825 g4 is free to use as a temporary in the non-embedded case.
826 g4 is reserved in the embedded case.
827 g2-g3 are reserved for applications. Gcc normally uses them as
828 temporaries, but this can be disabled via the -mno-app-regs option.
829 g6-g7 are reserved for the operating system (or application in
830 embedded case).
831 ??? Register 1 is used as a temporary by the 64 bit sethi pattern, so must
832 currently be a fixed register until this pattern is rewritten.
833 Register 1 is also used when restoring call-preserved registers in large
834 stack frames.
836 Registers fixed in arch32 and not arch64 (or vice-versa) are marked in
837 CONDITIONAL_REGISTER_USAGE in order to properly handle -ffixed-.
840 #define FIXED_REGISTERS \
841 {1, 0, 0, 0, 0, 0, 1, 1, \
842 0, 0, 0, 0, 0, 0, 1, 0, \
843 0, 0, 0, 0, 0, 0, 0, 0, \
844 0, 0, 0, 0, 0, 0, 1, 1, \
846 0, 0, 0, 0, 0, 0, 0, 0, \
847 0, 0, 0, 0, 0, 0, 0, 0, \
848 0, 0, 0, 0, 0, 0, 0, 0, \
849 0, 0, 0, 0, 0, 0, 0, 0, \
851 0, 0, 0, 0, 0, 0, 0, 0, \
852 0, 0, 0, 0, 0, 0, 0, 0, \
853 0, 0, 0, 0, 0, 0, 0, 0, \
854 0, 0, 0, 0, 0, 0, 0, 0, \
856 0, 0, 0, 0, 0}
858 /* 1 for registers not available across function calls.
859 These must include the FIXED_REGISTERS and also any
860 registers that can be used without being saved.
861 The latter must include the registers where values are returned
862 and the register where structure-value addresses are passed.
863 Aside from that, you can include as many other registers as you like. */
865 #define CALL_USED_REGISTERS \
866 {1, 1, 1, 1, 1, 1, 1, 1, \
867 1, 1, 1, 1, 1, 1, 1, 1, \
868 0, 0, 0, 0, 0, 0, 0, 0, \
869 0, 0, 0, 0, 0, 0, 1, 1, \
871 1, 1, 1, 1, 1, 1, 1, 1, \
872 1, 1, 1, 1, 1, 1, 1, 1, \
873 1, 1, 1, 1, 1, 1, 1, 1, \
874 1, 1, 1, 1, 1, 1, 1, 1, \
876 1, 1, 1, 1, 1, 1, 1, 1, \
877 1, 1, 1, 1, 1, 1, 1, 1, \
878 1, 1, 1, 1, 1, 1, 1, 1, \
879 1, 1, 1, 1, 1, 1, 1, 1, \
881 1, 1, 1, 1, 1}
883 /* If !TARGET_FPU, then make the fp registers and fp cc regs fixed so that
884 they won't be allocated. */
886 #define CONDITIONAL_REGISTER_USAGE \
887 do \
889 if (TARGET_ARCH32) \
891 fixed_regs[5] = 1; \
893 else \
895 fixed_regs[1] = 1; \
897 if (! TARGET_V9) \
899 int regno; \
900 for (regno = SPARC_FIRST_V9_FP_REG; \
901 regno <= SPARC_LAST_V9_FP_REG; \
902 regno++) \
903 fixed_regs[regno] = 1; \
904 /* %fcc0 is used by v8 and v9. */ \
905 for (regno = SPARC_FIRST_V9_FCC_REG + 1; \
906 regno <= SPARC_LAST_V9_FCC_REG; \
907 regno++) \
908 fixed_regs[regno] = 1; \
910 if (! TARGET_FPU) \
912 int regno; \
913 for (regno = 32; regno < SPARC_LAST_V9_FCC_REG; regno++) \
914 fixed_regs[regno] = 1; \
916 /* Don't unfix g2-g4 if they were fixed with -ffixed-. */ \
917 fixed_regs[2] |= ! TARGET_APP_REGS; \
918 fixed_regs[3] |= ! TARGET_APP_REGS; \
919 fixed_regs[4] |= ! TARGET_APP_REGS || TARGET_CM_EMBMEDANY; \
920 if (TARGET_FLAT) \
922 /* Let the compiler believe the frame pointer is still \
923 %fp, but output it as %i7. */ \
924 fixed_regs[31] = 1; \
925 reg_names[FRAME_POINTER_REGNUM] = "%i7"; \
926 /* ??? This is a hack to disable leaf functions. */ \
927 global_regs[7] = 1; \
929 if (profile_block_flag) \
931 /* %g1 and %g2 must be fixed, because BLOCK_PROFILER \
932 uses them. */ \
933 fixed_regs[1] = 1; \
934 fixed_regs[2] = 1; \
937 while (0)
939 /* Return number of consecutive hard regs needed starting at reg REGNO
940 to hold something of mode MODE.
941 This is ordinarily the length in words of a value of mode MODE
942 but can be less for certain modes in special long registers.
944 On SPARC, ordinary registers hold 32 bits worth;
945 this means both integer and floating point registers.
946 On v9, integer regs hold 64 bits worth; floating point regs hold
947 32 bits worth (this includes the new fp regs as even the odd ones are
948 included in the hard register count). */
950 #define HARD_REGNO_NREGS(REGNO, MODE) \
951 (TARGET_ARCH64 \
952 ? ((REGNO) < 32 \
953 ? (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD \
954 : (GET_MODE_SIZE (MODE) + 3) / 4) \
955 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
957 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
958 See sparc.c for how we initialize this. */
959 extern int *hard_regno_mode_classes;
960 extern int sparc_mode_class[];
961 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
962 ((hard_regno_mode_classes[REGNO] & sparc_mode_class[MODE]) != 0)
964 /* Value is 1 if it is a good idea to tie two pseudo registers
965 when one has mode MODE1 and one has mode MODE2.
966 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
967 for any hard reg, then this must be 0 for correct output.
969 For V9: SFmode can't be combined with other float modes, because they can't
970 be allocated to the %d registers. Also, DFmode won't fit in odd %f
971 registers, but SFmode will. */
972 #define MODES_TIEABLE_P(MODE1, MODE2) \
973 ((MODE1) == (MODE2) \
974 || (GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2) \
975 && (! TARGET_V9 \
976 || (GET_MODE_CLASS (MODE1) != MODE_FLOAT \
977 || (MODE1 != SFmode && MODE2 != SFmode)))))
979 /* Specify the registers used for certain standard purposes.
980 The values of these macros are register numbers. */
982 /* SPARC pc isn't overloaded on a register that the compiler knows about. */
983 /* #define PC_REGNUM */
985 /* Register to use for pushing function arguments. */
986 #define STACK_POINTER_REGNUM 14
988 /* Actual top-of-stack address is 92/176 greater than the contents of the
989 stack pointer register for !v9/v9. That is:
990 - !v9: 64 bytes for the in and local registers, 4 bytes for structure return
991 address, and 6*4 bytes for the 6 register parameters.
992 - v9: 128 bytes for the in and local registers + 6*8 bytes for the integer
993 parameter regs. */
994 #define STACK_POINTER_OFFSET FIRST_PARM_OFFSET(0)
996 /* The stack bias (amount by which the hardware register is offset by). */
997 #define SPARC_STACK_BIAS ((TARGET_ARCH64 && TARGET_STACK_BIAS) ? 2047 : 0)
999 /* Is stack biased? */
1000 #define STACK_BIAS SPARC_STACK_BIAS
1002 /* Base register for access to local variables of the function. */
1003 #define FRAME_POINTER_REGNUM 30
1005 #if 0
1006 /* Register that is used for the return address for the flat model. */
1007 #define RETURN_ADDR_REGNUM 15
1008 #endif
1010 /* Value should be nonzero if functions must have frame pointers.
1011 Zero means the frame pointer need not be set up (and parms
1012 may be accessed via the stack pointer) in functions that seem suitable.
1013 This is computed in `reload', in reload1.c.
1014 Used in flow.c, global.c, and reload1.c.
1016 Being a non-leaf function does not mean a frame pointer is needed in the
1017 flat window model. However, the debugger won't be able to backtrace through
1018 us with out it. */
1019 #define FRAME_POINTER_REQUIRED \
1020 (TARGET_FLAT ? (current_function_calls_alloca || current_function_varargs \
1021 || !leaf_function_p ()) \
1022 : ! (leaf_function_p () && only_leaf_regs_used ()))
1024 /* C statement to store the difference between the frame pointer
1025 and the stack pointer values immediately after the function prologue.
1027 Note, we always pretend that this is a leaf function because if
1028 it's not, there's no point in trying to eliminate the
1029 frame pointer. If it is a leaf function, we guessed right! */
1030 #define INITIAL_FRAME_POINTER_OFFSET(VAR) \
1031 ((VAR) = (TARGET_FLAT ? sparc_flat_compute_frame_size (get_frame_size ()) \
1032 : compute_frame_size (get_frame_size (), 1)))
1034 /* Base register for access to arguments of the function. */
1035 #define ARG_POINTER_REGNUM FRAME_POINTER_REGNUM
1037 /* Register in which static-chain is passed to a function. This must
1038 not be a register used by the prologue. */
1039 #define STATIC_CHAIN_REGNUM (TARGET_ARCH64 ? 5 : 2)
1041 /* Register which holds offset table for position-independent
1042 data references. */
1044 #define PIC_OFFSET_TABLE_REGNUM 23
1046 #define INITIALIZE_PIC initialize_pic ()
1047 #define FINALIZE_PIC finalize_pic ()
1049 /* Sparc ABI says that quad-precision floats and all structures are returned
1050 in memory.
1051 For v9: unions <= 32 bytes in size are returned in int regs,
1052 structures up to 32 bytes are returned in int and fp regs.
1053 FIXME: wip */
1055 #define RETURN_IN_MEMORY(TYPE) \
1056 (TARGET_ARCH32 \
1057 ? (TYPE_MODE (TYPE) == BLKmode \
1058 || TYPE_MODE (TYPE) == TFmode \
1059 || TYPE_MODE (TYPE) == TCmode) \
1060 : TYPE_MODE (TYPE) == BLKmode)
1062 /* Functions which return large structures get the address
1063 to place the wanted value at offset 64 from the frame.
1064 Must reserve 64 bytes for the in and local registers.
1065 v9: Functions which return large structures get the address to place the
1066 wanted value from an invisible first argument. */
1067 /* Used only in other #defines in this file. */
1068 #define STRUCT_VALUE_OFFSET 64
1070 #define STRUCT_VALUE \
1071 (TARGET_ARCH64 \
1072 ? 0 \
1073 : gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx, \
1074 STRUCT_VALUE_OFFSET)))
1076 #define STRUCT_VALUE_INCOMING \
1077 (TARGET_ARCH64 \
1078 ? 0 \
1079 : gen_rtx_MEM (Pmode, plus_constant (frame_pointer_rtx, \
1080 STRUCT_VALUE_OFFSET)))
1082 /* Define the classes of registers for register constraints in the
1083 machine description. Also define ranges of constants.
1085 One of the classes must always be named ALL_REGS and include all hard regs.
1086 If there is more than one class, another class must be named NO_REGS
1087 and contain no registers.
1089 The name GENERAL_REGS must be the name of a class (or an alias for
1090 another name such as ALL_REGS). This is the class of registers
1091 that is allowed by "g" or "r" in a register constraint.
1092 Also, registers outside this class are allocated only when
1093 instructions express preferences for them.
1095 The classes must be numbered in nondecreasing order; that is,
1096 a larger-numbered class must never be contained completely
1097 in a smaller-numbered class.
1099 For any two classes, it is very desirable that there be another
1100 class that represents their union. */
1102 /* The SPARC has various kinds of registers: general, floating point,
1103 and condition codes [well, it has others as well, but none that we
1104 care directly about].
1106 For v9 we must distinguish between the upper and lower floating point
1107 registers because the upper ones can't hold SFmode values.
1108 HARD_REGNO_MODE_OK won't help here because reload assumes that register(s)
1109 satisfying a group need for a class will also satisfy a single need for
1110 that class. EXTRA_FP_REGS is a bit of a misnomer as it covers all 64 fp
1111 regs.
1113 It is important that one class contains all the general and all the standard
1114 fp regs. Otherwise find_reg() won't properly allocate int regs for moves,
1115 because reg_class_record() will bias the selection in favor of fp regs,
1116 because reg_class_subunion[GENERAL_REGS][FP_REGS] will yield FP_REGS,
1117 because FP_REGS > GENERAL_REGS.
1119 It is also important that one class contain all the general and all the
1120 fp regs. Otherwise when spilling a DFmode reg, it may be from EXTRA_FP_REGS
1121 but find_reloads() may use class GENERAL_OR_FP_REGS. This will cause
1122 allocate_reload_reg() to bypass it causing an abort because the compiler
1123 thinks it doesn't have a spill reg when in fact it does.
1125 v9 also has 4 floating point condition code registers. Since we don't
1126 have a class that is the union of FPCC_REGS with either of the others,
1127 it is important that it appear first. Otherwise the compiler will die
1128 trying to compile _fixunsdfsi because fix_truncdfsi2 won't match its
1129 constraints.
1131 It is important that SPARC_ICC_REG have class NO_REGS. Otherwise combine
1132 may try to use it to hold an SImode value. See register_operand.
1133 ??? Should %fcc[0123] be handled similarly?
1136 enum reg_class { NO_REGS, FPCC_REGS, GENERAL_REGS, FP_REGS, EXTRA_FP_REGS,
1137 GENERAL_OR_FP_REGS, GENERAL_OR_EXTRA_FP_REGS,
1138 ALL_REGS, LIM_REG_CLASSES };
1140 #define N_REG_CLASSES (int) LIM_REG_CLASSES
1142 /* Give names of register classes as strings for dump file. */
1144 #define REG_CLASS_NAMES \
1145 { "NO_REGS", "FPCC_REGS", "GENERAL_REGS", "FP_REGS", "EXTRA_FP_REGS", \
1146 "GENERAL_OR_FP_REGS", "GENERAL_OR_EXTRA_FP_REGS", "ALL_REGS" }
1148 /* Define which registers fit in which classes.
1149 This is an initializer for a vector of HARD_REG_SET
1150 of length N_REG_CLASSES. */
1152 #define REG_CLASS_CONTENTS \
1153 {{0, 0, 0, 0}, {0, 0, 0, 0xf}, \
1154 {-1, 0, 0, 0}, {0, -1, 0, 0}, {0, -1, -1, 0}, \
1155 {-1, -1, 0, 0}, {-1, -1, -1, 0}, {-1, -1, -1, 0x1f}}
1157 /* The same information, inverted:
1158 Return the class number of the smallest class containing
1159 reg number REGNO. This could be a conditional expression
1160 or could index an array. */
1162 extern enum reg_class sparc_regno_reg_class[];
1164 #define REGNO_REG_CLASS(REGNO) sparc_regno_reg_class[(REGNO)]
1166 /* This is the order in which to allocate registers normally.
1168 We put %f0/%f1 last among the float registers, so as to make it more
1169 likely that a pseudo-register which dies in the float return register
1170 will get allocated to the float return register, thus saving a move
1171 instruction at the end of the function. */
1173 #define REG_ALLOC_ORDER \
1174 { 8, 9, 10, 11, 12, 13, 2, 3, \
1175 15, 16, 17, 18, 19, 20, 21, 22, \
1176 23, 24, 25, 26, 27, 28, 29, 31, \
1177 34, 35, 36, 37, 38, 39, /* %f2-%f7 */ \
1178 40, 41, 42, 43, 44, 45, 46, 47, /* %f8-%f15 */ \
1179 48, 49, 50, 51, 52, 53, 54, 55, /* %f16-%f23 */ \
1180 56, 57, 58, 59, 60, 61, 62, 63, /* %f24-%f31 */ \
1181 64, 65, 66, 67, 68, 69, 70, 71, /* %f32-%f39 */ \
1182 72, 73, 74, 75, 76, 77, 78, 79, /* %f40-%f47 */ \
1183 80, 81, 82, 83, 84, 85, 86, 87, /* %f48-%f55 */ \
1184 88, 89, 90, 91, 92, 93, 94, 95, /* %f56-%f63 */ \
1185 32, 33, /* %f0,%f1 */ \
1186 96, 97, 98, 99, 100, /* %fcc0-3, %icc */ \
1187 1, 4, 5, 6, 7, 0, 14, 30}
1189 /* This is the order in which to allocate registers for
1190 leaf functions. If all registers can fit in the "i" registers,
1191 then we have the possibility of having a leaf function. */
1193 #define REG_LEAF_ALLOC_ORDER \
1194 { 2, 3, 24, 25, 26, 27, 28, 29, \
1195 15, 8, 9, 10, 11, 12, 13, \
1196 16, 17, 18, 19, 20, 21, 22, 23, \
1197 34, 35, 36, 37, 38, 39, \
1198 40, 41, 42, 43, 44, 45, 46, 47, \
1199 48, 49, 50, 51, 52, 53, 54, 55, \
1200 56, 57, 58, 59, 60, 61, 62, 63, \
1201 64, 65, 66, 67, 68, 69, 70, 71, \
1202 72, 73, 74, 75, 76, 77, 78, 79, \
1203 80, 81, 82, 83, 84, 85, 86, 87, \
1204 88, 89, 90, 91, 92, 93, 94, 95, \
1205 32, 33, \
1206 96, 97, 98, 99, 100, \
1207 1, 4, 5, 6, 7, 0, 14, 30, 31}
1209 #define ORDER_REGS_FOR_LOCAL_ALLOC order_regs_for_local_alloc ()
1211 /* ??? %g7 is not a leaf register to effectively #undef LEAF_REGISTERS when
1212 -mflat is used. Function only_leaf_regs_used will return 0 if a global
1213 register is used and is not permitted in a leaf function. We make %g7
1214 a global reg if -mflat and voila. Since %g7 is a system register and is
1215 fixed it won't be used by gcc anyway. */
1217 #define LEAF_REGISTERS \
1218 { 1, 1, 1, 1, 1, 1, 1, 0, \
1219 0, 0, 0, 0, 0, 0, 1, 0, \
1220 0, 0, 0, 0, 0, 0, 0, 0, \
1221 1, 1, 1, 1, 1, 1, 0, 1, \
1222 1, 1, 1, 1, 1, 1, 1, 1, \
1223 1, 1, 1, 1, 1, 1, 1, 1, \
1224 1, 1, 1, 1, 1, 1, 1, 1, \
1225 1, 1, 1, 1, 1, 1, 1, 1, \
1226 1, 1, 1, 1, 1, 1, 1, 1, \
1227 1, 1, 1, 1, 1, 1, 1, 1, \
1228 1, 1, 1, 1, 1, 1, 1, 1, \
1229 1, 1, 1, 1, 1, 1, 1, 1, \
1230 1, 1, 1, 1, 1}
1232 extern char leaf_reg_remap[];
1233 #define LEAF_REG_REMAP(REGNO) (leaf_reg_remap[REGNO])
1235 /* The class value for index registers, and the one for base regs. */
1236 #define INDEX_REG_CLASS GENERAL_REGS
1237 #define BASE_REG_CLASS GENERAL_REGS
1239 /* Local macro to handle the two v9 classes of FP regs. */
1240 #define FP_REG_CLASS_P(CLASS) ((CLASS) == FP_REGS || (CLASS) == EXTRA_FP_REGS)
1242 /* Get reg_class from a letter such as appears in the machine description.
1243 In the not-v9 case, coerce v9's 'e' class to 'f', so we can use 'e' in the
1244 .md file for v8 and v9. */
1246 #define REG_CLASS_FROM_LETTER(C) \
1247 (TARGET_V9 \
1248 ? ((C) == 'f' ? FP_REGS \
1249 : (C) == 'e' ? EXTRA_FP_REGS \
1250 : (C) == 'c' ? FPCC_REGS \
1251 : NO_REGS) \
1252 : ((C) == 'f' ? FP_REGS \
1253 : (C) == 'e' ? FP_REGS \
1254 : (C) == 'c' ? FPCC_REGS \
1255 : NO_REGS))
1257 /* The letters I, J, K, L and M in a register constraint string
1258 can be used to stand for particular ranges of immediate operands.
1259 This macro defines what the ranges are.
1260 C is the letter, and VALUE is a constant value.
1261 Return 1 if VALUE is in the range specified by C.
1263 `I' is used for the range of constants an insn can actually contain.
1264 `J' is used for the range which is just zero (since that is R0).
1265 `K' is used for constants which can be loaded with a single sethi insn.
1266 `L' is used for the range of constants supported by the movcc insns.
1267 `M' is used for the range of constants supported by the movrcc insns. */
1269 #define SPARC_SIMM10_P(X) ((unsigned HOST_WIDE_INT) (X) + 0x200 < 0x400)
1270 #define SPARC_SIMM11_P(X) ((unsigned HOST_WIDE_INT) (X) + 0x400 < 0x800)
1271 #define SPARC_SIMM13_P(X) ((unsigned HOST_WIDE_INT) (X) + 0x1000 < 0x2000)
1272 /* 10 and 11 bit immediates are only used for a few specific insns.
1273 SMALL_INT is used throughout the port so we continue to use it. */
1274 #define SMALL_INT(X) (SPARC_SIMM13_P (INTVAL (X)))
1275 #define SPARC_SETHI_P(X) \
1276 (((unsigned HOST_WIDE_INT) (X) & ~(unsigned HOST_WIDE_INT) 0xfffffc00) == 0)
1278 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
1279 ((C) == 'I' ? SPARC_SIMM13_P (VALUE) \
1280 : (C) == 'J' ? (VALUE) == 0 \
1281 : (C) == 'K' ? SPARC_SETHI_P (VALUE) \
1282 : (C) == 'L' ? SPARC_SIMM11_P (VALUE) \
1283 : (C) == 'M' ? SPARC_SIMM10_P (VALUE) \
1284 : 0)
1286 /* Similar, but for floating constants, and defining letters G and H.
1287 Here VALUE is the CONST_DOUBLE rtx itself. */
1289 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
1290 ((C) == 'G' ? fp_zero_operand (VALUE) \
1291 : (C) == 'H' ? arith_double_operand (VALUE, DImode) \
1292 : 0)
1294 /* Given an rtx X being reloaded into a reg required to be
1295 in class CLASS, return the class of reg to actually use.
1296 In general this is just CLASS; but on some machines
1297 in some cases it is preferable to use a more restrictive class. */
1298 /* We can't load constants into FP registers. We can't load any FP constant
1299 if an 'E' constraint fails to match it. */
1300 #define PREFERRED_RELOAD_CLASS(X,CLASS) \
1301 (CONSTANT_P (X) \
1302 && (FP_REG_CLASS_P (CLASS) \
1303 || (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
1304 && (HOST_FLOAT_FORMAT != IEEE_FLOAT_FORMAT \
1305 || HOST_BITS_PER_INT != BITS_PER_WORD))) \
1306 ? NO_REGS : (CLASS))
1308 /* Return the register class of a scratch register needed to load IN into
1309 a register of class CLASS in MODE.
1311 On the SPARC, when PIC, we need a temporary when loading some addresses
1312 into a register.
1314 Also, we need a temporary when loading/storing a HImode/QImode value
1315 between memory and the FPU registers. This can happen when combine puts
1316 a paradoxical subreg in a float/fix conversion insn. */
1318 #define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, IN) \
1319 ((FP_REG_CLASS_P (CLASS) && ((MODE) == HImode || (MODE) == QImode) \
1320 && (GET_CODE (IN) == MEM \
1321 || ((GET_CODE (IN) == REG || GET_CODE (IN) == SUBREG) \
1322 && true_regnum (IN) == -1))) ? GENERAL_REGS : NO_REGS)
1324 #define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, IN) \
1325 ((FP_REG_CLASS_P (CLASS) && ((MODE) == HImode || (MODE) == QImode) \
1326 && (GET_CODE (IN) == MEM \
1327 || ((GET_CODE (IN) == REG || GET_CODE (IN) == SUBREG) \
1328 && true_regnum (IN) == -1))) ? GENERAL_REGS : NO_REGS)
1330 /* On SPARC it is not possible to directly move data between
1331 GENERAL_REGS and FP_REGS. */
1332 #define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \
1333 (FP_REG_CLASS_P (CLASS1) != FP_REG_CLASS_P (CLASS2))
1335 /* Return the stack location to use for secondary memory needed reloads.
1336 We want to use the reserved location just below the frame pointer.
1337 However, we must ensure that there is a frame, so use assign_stack_local
1338 if the frame size is zero. */
1339 #define SECONDARY_MEMORY_NEEDED_RTX(MODE) \
1340 (get_frame_size () == 0 \
1341 ? assign_stack_local (MODE, GET_MODE_SIZE (MODE), 0) \
1342 : gen_rtx_MEM (MODE, plus_constant (frame_pointer_rtx, \
1343 STARTING_FRAME_OFFSET)))
1345 /* Get_secondary_mem widens its argument to BITS_PER_WORD which loses on v9
1346 because the movsi and movsf patterns don't handle r/f moves.
1347 For v8 we copy the default definition. */
1348 #define SECONDARY_MEMORY_NEEDED_MODE(MODE) \
1349 (TARGET_ARCH64 \
1350 ? (GET_MODE_BITSIZE (MODE) < 32 \
1351 ? mode_for_size (32, GET_MODE_CLASS (MODE), 0) \
1352 : MODE) \
1353 : (GET_MODE_BITSIZE (MODE) < BITS_PER_WORD \
1354 ? mode_for_size (BITS_PER_WORD, GET_MODE_CLASS (MODE), 0) \
1355 : MODE))
1357 /* Return the maximum number of consecutive registers
1358 needed to represent mode MODE in a register of class CLASS. */
1359 /* On SPARC, this is the size of MODE in words. */
1360 #define CLASS_MAX_NREGS(CLASS, MODE) \
1361 (FP_REG_CLASS_P (CLASS) ? (GET_MODE_SIZE (MODE) + 3) / 4 \
1362 : (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
1364 /* Stack layout; function entry, exit and calling. */
1366 /* Define the number of register that can hold parameters.
1367 This macro is only used in other macro definitions below and in sparc.c.
1368 MODE is the mode of the argument.
1369 !v9: All args are passed in %o0-%o5.
1370 v9: %o0-%o5 and %f0-%f31 are cumulatively used to pass values.
1371 See the description in sparc.c. */
1372 #define NPARM_REGS(MODE) \
1373 (TARGET_ARCH64 \
1374 ? (GET_MODE_CLASS (MODE) == MODE_FLOAT ? 32 : 6) \
1375 : 6)
1377 /* Define this if pushing a word on the stack
1378 makes the stack pointer a smaller address. */
1379 #define STACK_GROWS_DOWNWARD
1381 /* Define this if the nominal address of the stack frame
1382 is at the high-address end of the local variables;
1383 that is, each additional local variable allocated
1384 goes at a more negative offset in the frame. */
1385 #define FRAME_GROWS_DOWNWARD
1387 /* Offset within stack frame to start allocating local variables at.
1388 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
1389 first local allocated. Otherwise, it is the offset to the BEGINNING
1390 of the first local allocated. */
1391 /* This allows space for one TFmode floating point value. */
1392 #define STARTING_FRAME_OFFSET \
1393 (TARGET_ARCH64 ? (SPARC_STACK_BIAS - 16) \
1394 : (-SPARC_STACK_ALIGN (LONG_DOUBLE_TYPE_SIZE / BITS_PER_UNIT)))
1396 /* If we generate an insn to push BYTES bytes,
1397 this says how many the stack pointer really advances by.
1398 On SPARC, don't define this because there are no push insns. */
1399 /* #define PUSH_ROUNDING(BYTES) */
1401 /* Offset of first parameter from the argument pointer register value.
1402 !v9: This is 64 for the ins and locals, plus 4 for the struct-return reg
1403 even if this function isn't going to use it.
1404 v9: This is 128 for the ins and locals. */
1405 #define FIRST_PARM_OFFSET(FNDECL) \
1406 (TARGET_ARCH64 ? (SPARC_STACK_BIAS + 16 * UNITS_PER_WORD) \
1407 : (STRUCT_VALUE_OFFSET + UNITS_PER_WORD))
1409 /* When a parameter is passed in a register, stack space is still
1410 allocated for it. */
1411 /* This only takes into account the int regs.
1412 fp regs are handled elsewhere. */
1413 #define REG_PARM_STACK_SPACE(DECL) (6 * UNITS_PER_WORD)
1415 /* Keep the stack pointer constant throughout the function.
1416 This is both an optimization and a necessity: longjmp
1417 doesn't behave itself when the stack pointer moves within
1418 the function! */
1419 #define ACCUMULATE_OUTGOING_ARGS
1421 /* Value is the number of bytes of arguments automatically
1422 popped when returning from a subroutine call.
1423 FUNDECL is the declaration node of the function (as a tree),
1424 FUNTYPE is the data type of the function (as a tree),
1425 or for a library call it is an identifier node for the subroutine name.
1426 SIZE is the number of bytes of arguments passed on the stack. */
1428 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
1430 /* Some subroutine macros specific to this machine.
1431 When !TARGET_FPU, put float return values in the general registers,
1432 since we don't have any fp registers. */
1433 #define BASE_RETURN_VALUE_REG(MODE) \
1434 (TARGET_ARCH64 \
1435 ? (TARGET_FPU && GET_MODE_CLASS (MODE) == MODE_FLOAT ? 32 : 8) \
1436 : (((MODE) == SFmode || (MODE) == DFmode) && TARGET_FPU ? 32 : 8))
1437 #define BASE_OUTGOING_VALUE_REG(MODE) \
1438 (TARGET_ARCH64 \
1439 ? (TARGET_FPU && GET_MODE_CLASS (MODE) == MODE_FLOAT ? 32 \
1440 : TARGET_FLAT ? 8 : 24) \
1441 : (((MODE) == SFmode || (MODE) == DFmode) && TARGET_FPU ? 32 \
1442 : (TARGET_FLAT ? 8 : 24)))
1443 #define BASE_PASSING_ARG_REG(MODE) \
1444 (TARGET_ARCH64 \
1445 ? (TARGET_FPU && GET_MODE_CLASS (MODE) == MODE_FLOAT ? 32 : 8) \
1446 : 8)
1447 #define BASE_INCOMING_ARG_REG(MODE) \
1448 (TARGET_ARCH64 \
1449 ? (TARGET_FPU && GET_MODE_CLASS (MODE) == MODE_FLOAT ? 32 \
1450 : TARGET_FLAT ? 8 : 24) \
1451 : (TARGET_FLAT ? 8 : 24))
1453 /* Define this macro if the target machine has "register windows". This
1454 C expression returns the register number as seen by the called function
1455 corresponding to register number OUT as seen by the calling function.
1456 Return OUT if register number OUT is not an outbound register. */
1458 #define INCOMING_REGNO(OUT) \
1459 ((TARGET_FLAT || (OUT) < 8 || (OUT) > 15) ? (OUT) : (OUT) + 16)
1461 /* Define this macro if the target machine has "register windows". This
1462 C expression returns the register number as seen by the calling function
1463 corresponding to register number IN as seen by the called function.
1464 Return IN if register number IN is not an inbound register. */
1466 #define OUTGOING_REGNO(IN) \
1467 ((TARGET_FLAT || (IN) < 24 || (IN) > 31) ? (IN) : (IN) - 16)
1469 /* Define how to find the value returned by a function.
1470 VALTYPE is the data type of the value (as a tree).
1471 If the precise function being called is known, FUNC is its FUNCTION_DECL;
1472 otherwise, FUNC is 0. */
1474 /* On SPARC the value is found in the first "output" register. */
1476 #define FUNCTION_VALUE(VALTYPE, FUNC) \
1477 gen_rtx_REG (TYPE_MODE (VALTYPE), \
1478 BASE_RETURN_VALUE_REG (TYPE_MODE (VALTYPE)))
1480 /* But the called function leaves it in the first "input" register. */
1482 #define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \
1483 gen_rtx_REG (TYPE_MODE (VALTYPE), \
1484 BASE_OUTGOING_VALUE_REG (TYPE_MODE (VALTYPE)))
1486 /* Define how to find the value returned by a library function
1487 assuming the value has mode MODE. */
1489 #define LIBCALL_VALUE(MODE) \
1490 gen_rtx_REG (MODE, BASE_RETURN_VALUE_REG (MODE))
1492 /* 1 if N is a possible register number for a function value
1493 as seen by the caller.
1494 On SPARC, the first "output" reg is used for integer values,
1495 and the first floating point register is used for floating point values. */
1497 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 8 || (N) == 32)
1499 /* Define the size of space to allocate for the return value of an
1500 untyped_call. */
1502 #define APPLY_RESULT_SIZE 16
1504 /* 1 if N is a possible register number for function argument passing.
1505 On SPARC, these are the "output" registers. v9 also uses %f0-%f31. */
1507 #define FUNCTION_ARG_REGNO_P(N) \
1508 (TARGET_ARCH64 \
1509 ? (((N) >= 8 && (N) <= 13) || ((N) >= 32 && (N) <= 63)) \
1510 : ((N) >= 8 && (N) <= 13))
1512 /* Define a data type for recording info about an argument list
1513 during the scan of that argument list. This data type should
1514 hold all necessary information about the function itself
1515 and about the args processed so far, enough to enable macros
1516 such as FUNCTION_ARG to determine where the next arg should go.
1518 On SPARC (!v9), this is a single integer, which is a number of words
1519 of arguments scanned so far (including the invisible argument,
1520 if any, which holds the structure-value-address).
1521 Thus 7 or more means all following args should go on the stack.
1523 For v9, we also need to know whether a prototype is present. */
1525 struct sparc_args {
1526 int words; /* number of words passed so far */
1527 int prototype_p; /* non-zero if a prototype is present */
1528 int libcall_p; /* non-zero if a library call */
1530 #define CUMULATIVE_ARGS struct sparc_args
1532 /* Initialize a variable CUM of type CUMULATIVE_ARGS
1533 for a call to a function whose data type is FNTYPE.
1534 For a library call, FNTYPE is 0. */
1536 extern void init_cumulative_args ();
1537 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) \
1538 init_cumulative_args (& (CUM), (FNTYPE), (LIBNAME), (INDIRECT));
1540 /* Update the data in CUM to advance over an argument
1541 of mode MODE and data type TYPE.
1542 TYPE is null for libcalls where that information may not be available. */
1544 extern void function_arg_advance ();
1545 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
1546 function_arg_advance (& (CUM), (MODE), (TYPE), (NAMED))
1548 /* Determine where to put an argument to a function.
1549 Value is zero to push the argument on the stack,
1550 or a hard register in which to store the argument.
1552 MODE is the argument's machine mode.
1553 TYPE is the data type of the argument (as a tree).
1554 This is null for libcalls where that information may
1555 not be available.
1556 CUM is a variable of type CUMULATIVE_ARGS which gives info about
1557 the preceding args and about the function being called.
1558 NAMED is nonzero if this argument is a named parameter
1559 (otherwise it is an extra parameter matching an ellipsis). */
1561 extern struct rtx_def *function_arg ();
1562 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
1563 function_arg (& (CUM), (MODE), (TYPE), (NAMED), 0)
1565 /* Define where a function finds its arguments.
1566 This is different from FUNCTION_ARG because of register windows. */
1568 #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
1569 function_arg (& (CUM), (MODE), (TYPE), (NAMED), 1)
1571 /* For an arg passed partly in registers and partly in memory,
1572 this is the number of registers used.
1573 For args passed entirely in registers or entirely in memory, zero. */
1575 extern int function_arg_partial_nregs ();
1576 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
1577 function_arg_partial_nregs (& (CUM), (MODE), (TYPE), (NAMED))
1579 /* A C expression that indicates when an argument must be passed by reference.
1580 If nonzero for an argument, a copy of that argument is made in memory and a
1581 pointer to the argument is passed instead of the argument itself.
1582 The pointer is passed in whatever way is appropriate for passing a pointer
1583 to that type. */
1585 extern int function_arg_pass_by_reference ();
1586 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
1587 function_arg_pass_by_reference (& (CUM), (MODE), (TYPE), (NAMED))
1589 /* If defined, a C expression which determines whether, and in which direction,
1590 to pad out an argument with extra space. The value should be of type
1591 `enum direction': either `upward' to pad above the argument,
1592 `downward' to pad below, or `none' to inhibit padding. */
1593 extern enum direction function_arg_padding ();
1594 #define FUNCTION_ARG_PADDING(MODE, TYPE) \
1595 function_arg_padding ((MODE), (TYPE))
1597 /* If defined, a C expression that gives the alignment boundary, in bits,
1598 of an argument with the specified mode and type. If it is not defined,
1599 PARM_BOUNDARY is used for all arguments.
1600 For sparc64, objects requiring 16 byte alignment are passed that way. */
1602 #define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
1603 ((TARGET_ARCH64 \
1604 && (GET_MODE_ALIGNMENT (MODE) == 128 \
1605 || ((TYPE) && TYPE_ALIGN (TYPE) == 128))) \
1606 ? 128 : PARM_BOUNDARY)
1608 /* Initialize data used by insn expanders. This is called from
1609 init_emit, once for each function, before code is generated.
1610 For v9, clear the temp slot used by float/int DImode conversions.
1611 ??? There is the 16 bytes at [%fp-16], however we'd like to delete this
1612 space at some point.
1613 ??? Use assign_stack_temp? */
1615 extern void sparc_init_expanders ();
1616 extern struct rtx_def *sparc64_fpconv_stack_temp ();
1617 #define INIT_EXPANDERS sparc_init_expanders ()
1619 /* Define the information needed to generate branch and scc insns. This is
1620 stored from the compare operation. Note that we can't use "rtx" here
1621 since it hasn't been defined! */
1623 extern struct rtx_def *sparc_compare_op0, *sparc_compare_op1;
1625 /* Define the function that build the compare insn for scc and bcc. */
1627 extern struct rtx_def *gen_compare_reg ();
1629 /* This function handles all v9 scc insns */
1631 extern int gen_v9_scc ();
1633 /* Generate the special assembly code needed to tell the assembler whatever
1634 it might need to know about the return value of a function.
1636 For Sparc assemblers, we need to output a .proc pseudo-op which conveys
1637 information to the assembler relating to peephole optimization (done in
1638 the assembler). */
1640 #define ASM_DECLARE_RESULT(FILE, RESULT) \
1641 fprintf ((FILE), "\t.proc\t0%o\n", sparc_type_code (TREE_TYPE (RESULT)))
1643 /* Output the label for a function definition. */
1645 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
1646 do { \
1647 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
1648 ASM_OUTPUT_LABEL (FILE, NAME); \
1649 } while (0)
1651 /* This macro generates the assembly code for function entry.
1652 FILE is a stdio stream to output the code to.
1653 SIZE is an int: how many units of temporary storage to allocate.
1654 Refer to the array `regs_ever_live' to determine which registers
1655 to save; `regs_ever_live[I]' is nonzero if register number I
1656 is ever used in the function. This macro is responsible for
1657 knowing which registers should not be saved even if used. */
1659 /* On SPARC, move-double insns between fpu and cpu need an 8-byte block
1660 of memory. If any fpu reg is used in the function, we allocate
1661 such a block here, at the bottom of the frame, just in case it's needed.
1663 If this function is a leaf procedure, then we may choose not
1664 to do a "save" insn. The decision about whether or not
1665 to do this is made in regclass.c. */
1667 extern int leaf_function;
1668 #define FUNCTION_PROLOGUE(FILE, SIZE) \
1669 (TARGET_FLAT ? sparc_flat_output_function_prologue (FILE, SIZE) \
1670 : output_function_prologue (FILE, SIZE, leaf_function))
1672 /* Output assembler code to FILE to increment profiler label # LABELNO
1673 for profiling a function entry.
1675 32 bit sparc uses %g2 as the STATIC_CHAIN_REGNUM which gets clobbered
1676 during profiling so we need to save/restore it around the call to mcount.
1677 We're guaranteed that a save has just been done, and we use the space
1678 allocated for intreg/fpreg value passing. */
1680 #define FUNCTION_PROFILER(FILE, LABELNO) \
1681 do { \
1682 char buf[20]; \
1683 ASM_GENERATE_INTERNAL_LABEL (buf, "LP", (LABELNO)); \
1684 if (! TARGET_ARCH64) \
1685 fputs ("\tst %g2,[%fp-4]\n", FILE); \
1686 fputs ("\tsethi %hi(", FILE); \
1687 assemble_name (FILE, buf); \
1688 fputs ("),%o0\n", FILE); \
1689 fputs ("\tcall mcount\n\tadd %o0,%lo(", FILE); \
1690 assemble_name (FILE, buf); \
1691 fputs ("),%o0\n", FILE); \
1692 if (! TARGET_ARCH64) \
1693 fputs ("\tld [%fp-4],%g2\n", FILE); \
1694 } while (0)
1696 /* There are three profiling modes for basic blocks available.
1697 The modes are selected at compile time by using the options
1698 -a or -ax of the gnu compiler.
1699 The variable `profile_block_flag' will be set according to the
1700 selected option.
1702 profile_block_flag == 0, no option used:
1704 No profiling done.
1706 profile_block_flag == 1, -a option used.
1708 Count frequency of execution of every basic block.
1710 profile_block_flag == 2, -ax option used.
1712 Generate code to allow several different profiling modes at run time.
1713 Available modes are:
1714 Produce a trace of all basic blocks.
1715 Count frequency of jump instructions executed.
1716 In every mode it is possible to start profiling upon entering
1717 certain functions and to disable profiling of some other functions.
1719 The result of basic-block profiling will be written to a file `bb.out'.
1720 If the -ax option is used parameters for the profiling will be read
1721 from file `bb.in'.
1725 /* The following macro shall output assembler code to FILE
1726 to initialize basic-block profiling.
1728 If profile_block_flag == 2
1730 Output code to call the subroutine `__bb_init_trace_func'
1731 and pass two parameters to it. The first parameter is
1732 the address of a block allocated in the object module.
1733 The second parameter is the number of the first basic block
1734 of the function.
1736 The name of the block is a local symbol made with this statement:
1738 ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0);
1740 Of course, since you are writing the definition of
1741 `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
1742 can take a short cut in the definition of this macro and use the
1743 name that you know will result.
1745 The number of the first basic block of the function is
1746 passed to the macro in BLOCK_OR_LABEL.
1748 If described in a virtual assembler language the code to be
1749 output looks like:
1751 parameter1 <- LPBX0
1752 parameter2 <- BLOCK_OR_LABEL
1753 call __bb_init_trace_func
1755 else if profile_block_flag != 0
1757 Output code to call the subroutine `__bb_init_func'
1758 and pass one single parameter to it, which is the same
1759 as the first parameter to `__bb_init_trace_func'.
1761 The first word of this parameter is a flag which will be nonzero if
1762 the object module has already been initialized. So test this word
1763 first, and do not call `__bb_init_func' if the flag is nonzero.
1764 Note: When profile_block_flag == 2 the test need not be done
1765 but `__bb_init_trace_func' *must* be called.
1767 BLOCK_OR_LABEL may be used to generate a label number as a
1768 branch destination in case `__bb_init_func' will not be called.
1770 If described in a virtual assembler language the code to be
1771 output looks like:
1773 cmp (LPBX0),0
1774 jne local_label
1775 parameter1 <- LPBX0
1776 call __bb_init_func
1777 local_label:
1781 #define FUNCTION_BLOCK_PROFILER(FILE, BLOCK_OR_LABEL) \
1782 do \
1784 int bol = (BLOCK_OR_LABEL); \
1785 switch (profile_block_flag) \
1787 case 2: \
1788 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",\
1789 bol, bol); \
1790 break; \
1791 default: \
1792 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",\
1793 bol, bol); \
1794 break; \
1797 while (0)
1799 /* The following macro shall output assembler code to FILE
1800 to increment a counter associated with basic block number BLOCKNO.
1802 If profile_block_flag == 2
1804 Output code to initialize the global structure `__bb' and
1805 call the function `__bb_trace_func' which will increment the
1806 counter.
1808 `__bb' consists of two words. In the first word the number
1809 of the basic block has to be stored. In the second word
1810 the address of a block allocated in the object module
1811 has to be stored.
1813 The basic block number is given by BLOCKNO.
1815 The address of the block is given by the label created with
1817 ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0);
1819 by FUNCTION_BLOCK_PROFILER.
1821 Of course, since you are writing the definition of
1822 `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
1823 can take a short cut in the definition of this macro and use the
1824 name that you know will result.
1826 If described in a virtual assembler language the code to be
1827 output looks like:
1829 move BLOCKNO -> (__bb)
1830 move LPBX0 -> (__bb+4)
1831 call __bb_trace_func
1833 Note that function `__bb_trace_func' must not change the
1834 machine state, especially the flag register. To grant
1835 this, you must output code to save and restore registers
1836 either in this macro or in the macros MACHINE_STATE_SAVE
1837 and MACHINE_STATE_RESTORE. The last two macros will be
1838 used in the function `__bb_trace_func', so you must make
1839 sure that the function prologue does not change any
1840 register prior to saving it with MACHINE_STATE_SAVE.
1842 else if profile_block_flag != 0
1844 Output code to increment the counter directly.
1845 Basic blocks are numbered separately from zero within each
1846 compiled object module. The count associated with block number
1847 BLOCKNO is at index BLOCKNO in an array of words; the name of
1848 this array is a local symbol made with this statement:
1850 ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 2);
1852 Of course, since you are writing the definition of
1853 `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
1854 can take a short cut in the definition of this macro and use the
1855 name that you know will result.
1857 If described in a virtual assembler language, the code to be
1858 output looks like:
1860 inc (LPBX2+4*BLOCKNO)
1864 #define BLOCK_PROFILER(FILE, BLOCKNO) \
1865 do \
1867 int blockn = (BLOCKNO); \
1868 switch (profile_block_flag) \
1870 case 2: \
1871 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",\
1872 blockn, blockn); \
1873 break; \
1874 default: \
1875 fprintf (FILE, "\tsethi %%hi(LPBX2+%d),%%g1\n\tld [%%lo(LPBX2+%d)+%%g1],%%g2\n\
1876 \tadd %%g2,1,%%g2\n\tst %%g2,[%%lo(LPBX2+%d)+%%g1]\n", \
1877 4 * blockn, 4 * blockn, 4 * blockn); \
1878 break; \
1881 while(0)
1883 /* The following macro shall output assembler code to FILE
1884 to indicate a return from function during basic-block profiling.
1886 If profiling_block_flag == 2:
1888 Output assembler code to call function `__bb_trace_ret'.
1890 Note that function `__bb_trace_ret' must not change the
1891 machine state, especially the flag register. To grant
1892 this, you must output code to save and restore registers
1893 either in this macro or in the macros MACHINE_STATE_SAVE_RET
1894 and MACHINE_STATE_RESTORE_RET. The last two macros will be
1895 used in the function `__bb_trace_ret', so you must make
1896 sure that the function prologue does not change any
1897 register prior to saving it with MACHINE_STATE_SAVE_RET.
1899 else if profiling_block_flag != 0:
1901 The macro will not be used, so it need not distinguish
1902 these cases.
1905 #define FUNCTION_BLOCK_PROFILER_EXIT(FILE) \
1906 fprintf (FILE, "\tcall ___bb_trace_ret\n\tnop\n" );
1908 /* The function `__bb_trace_func' is called in every basic block
1909 and is not allowed to change the machine state. Saving (restoring)
1910 the state can either be done in the BLOCK_PROFILER macro,
1911 before calling function (rsp. after returning from function)
1912 `__bb_trace_func', or it can be done inside the function by
1913 defining the macros:
1915 MACHINE_STATE_SAVE(ID)
1916 MACHINE_STATE_RESTORE(ID)
1918 In the latter case care must be taken, that the prologue code
1919 of function `__bb_trace_func' does not already change the
1920 state prior to saving it with MACHINE_STATE_SAVE.
1922 The parameter `ID' is a string identifying a unique macro use.
1924 On sparc it is sufficient to save the psw register to memory.
1925 Unfortunately the psw register can be read in supervisor mode only,
1926 so we read only the condition codes by using branch instructions
1927 and hope that this is enough. */
1929 #define MACHINE_STATE_SAVE(ID) \
1930 asm (" mov %g0,%l0");\
1931 asm (" be,a LFLGNZ" ID);\
1932 asm (" or %l0,4,%l0");\
1933 asm ("LFLGNZ" ID ": bcs,a LFLGNC" ID);\
1934 asm (" or %l0,1,%l0");\
1935 asm ("LFLGNC" ID ": bvs,a LFLGNV" ID);\
1936 asm (" or %l0,2,%l0");\
1937 asm ("LFLGNV" ID ": bneg,a LFLGNN" ID);\
1938 asm (" or %l0,8,%l0");\
1939 asm ("LFLGNN" ID ": sethi %hi(LFLAGS" ID "),%l1");\
1940 asm (" st %l0,[%l1+%lo(LFLAGS" ID ")]"); \
1941 asm (" st %g2,[%l1+%lo(LSAVRET" ID ")]");
1943 /* On sparc MACHINE_STATE_RESTORE restores the psw register from memory.
1944 The psw register can be written in supervisor mode only,
1945 which is true even for simple condition codes.
1946 We use some combination of instructions to produce the
1947 proper condition codes, but some flag combinations can not
1948 be generated in this way. If this happens an unimplemented
1949 instruction will be executed to abort the program. */
1951 #define MACHINE_STATE_RESTORE(ID) \
1952 asm (" sethi %hi(LFLGTAB" ID "),%l1");\
1953 asm (" ld [%l1+%lo(LFLGTAB" ID "-(LFLGTAB" ID "-LFLAGS" ID "))],%l0");\
1954 asm (" ld [%l1+%lo(LFLGTAB" ID "-(LFLGTAB" ID "-LSAVRET" ID "))],%g2");\
1955 asm (" sll %l0,2,%l0");\
1956 asm (" add %l0,%l1,%l0");\
1957 asm (" ld [%l0+%lo(LFLGTAB" ID ")],%l1");\
1958 asm (" jmp %l1");\
1959 asm (" nop");\
1960 asm (".data");\
1961 asm (" .align 4");\
1962 asm ("LFLAGS" ID ":");\
1963 asm (" .word 0");\
1964 asm ("LSAVRET" ID ":");\
1965 asm (" .word 0");\
1966 asm ("LFLGTAB" ID ": ");\
1967 asm (" .word LSFLG0" ID);\
1968 asm (" .word LSFLGC" ID);\
1969 asm (" .word LSFLGV" ID);\
1970 asm (" .word LSFLGVC" ID);\
1971 asm (" .word LSFLGZ" ID);\
1972 asm (" .word LSFLGZC" ID);\
1973 asm (" .word LSFLGZV" ID);\
1974 asm (" .word LSFLGZVC" ID);\
1975 asm (" .word LSFLGN" ID);\
1976 asm (" .word LSFLGNC" ID);\
1977 asm (" .word LSFLGNV" ID);\
1978 asm (" .word LSFLGNVC" ID);\
1979 asm (" .word LSFLGNZ" ID);\
1980 asm (" .word LSFLGNZC" ID);\
1981 asm (" .word LSFLGNZV" ID);\
1982 asm (" .word LSFLGNZVC" ID);\
1983 asm (".text");\
1984 asm ("LSFLGVC" ID ": mov -1,%l0");\
1985 asm (" addcc 2,%l0,%g0");\
1986 asm (" sethi %hi(0x80000000),%l0");\
1987 asm (" mov %l0,%l1");\
1988 asm (" ba LFLGRET" ID);\
1989 asm (" addxcc %l0,%l1,%l0");\
1990 asm ("LSFLGC" ID ": mov -1,%l0");\
1991 asm (" ba LFLGRET" ID);\
1992 asm (" addcc 2,%l0,%g0");\
1993 asm ("LSFLGZC" ID ": mov -1,%l0");\
1994 asm (" ba LFLGRET" ID);\
1995 asm (" addcc 1,%l0,%l0");\
1996 asm ("LSFLGZVC" ID ": sethi %hi(0x80000000),%l0");\
1997 asm (" mov %l0,%l1");\
1998 asm (" ba LFLGRET" ID);\
1999 asm (" addcc %l0,%l1,%l0");\
2000 asm ("LSFLGZ" ID ": ba LFLGRET" ID);\
2001 asm (" subcc %g0,%g0,%g0");\
2002 asm ("LSFLGNC" ID ": add %g0,1,%l0");\
2003 asm (" ba LFLGRET" ID);\
2004 asm (" subcc %g0,%l0,%g0");\
2005 asm ("LSFLG0" ID ": ba LFLGRET" ID);\
2006 asm (" orcc 1,%g0,%g0");\
2007 asm ("LSFLGN" ID ": ba LFLGRET" ID);\
2008 asm (" orcc -1,%g0,%g0");\
2009 asm ("LSFLGV" ID ":");\
2010 asm ("LSFLGZV" ID ":");\
2011 asm ("LSFLGNV" ID ":");\
2012 asm ("LSFLGNVC" ID ":");\
2013 asm ("LSFLGNZ" ID ":");\
2014 asm ("LSFLGNZC" ID ":");\
2015 asm ("LSFLGNZV" ID ":");\
2016 asm ("LSFLGNZVC" ID ":");\
2017 asm (" unimp");\
2018 asm ("LFLGRET" ID ":");
2020 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
2021 the stack pointer does not matter. The value is tested only in
2022 functions that have frame pointers.
2023 No definition is equivalent to always zero. */
2025 extern int current_function_calls_alloca;
2026 extern int current_function_outgoing_args_size;
2028 #define EXIT_IGNORE_STACK \
2029 (get_frame_size () != 0 \
2030 || current_function_calls_alloca || current_function_outgoing_args_size)
2032 /* This macro generates the assembly code for function exit,
2033 on machines that need it. If FUNCTION_EPILOGUE is not defined
2034 then individual return instructions are generated for each
2035 return statement. Args are same as for FUNCTION_PROLOGUE.
2037 The function epilogue should not depend on the current stack pointer!
2038 It should use the frame pointer only. This is mandatory because
2039 of alloca; we also take advantage of it to omit stack adjustments
2040 before returning. */
2042 /* This declaration is needed due to traditional/ANSI
2043 incompatibilities which cannot be #ifdefed away
2044 because they occur inside of macros. Sigh. */
2045 extern union tree_node *current_function_decl;
2047 #define FUNCTION_EPILOGUE(FILE, SIZE) \
2048 (TARGET_FLAT ? sparc_flat_output_function_epilogue (FILE, SIZE) \
2049 : output_function_epilogue (FILE, SIZE, leaf_function))
2051 #define DELAY_SLOTS_FOR_EPILOGUE \
2052 (TARGET_FLAT ? sparc_flat_epilogue_delay_slots () : 1)
2053 #define ELIGIBLE_FOR_EPILOGUE_DELAY(trial, slots_filled) \
2054 (TARGET_FLAT ? sparc_flat_eligible_for_epilogue_delay (trial, slots_filled) \
2055 : eligible_for_epilogue_delay (trial, slots_filled))
2057 /* Define registers used by the epilogue and return instruction. */
2058 #define EPILOGUE_USES(REGNO) \
2059 (!TARGET_FLAT && REGNO == 31)
2061 /* Output assembler code for a block containing the constant parts
2062 of a trampoline, leaving space for the variable parts. */
2064 /* On 32 bit sparcs, the trampoline contains five instructions:
2065 sethi #TOP_OF_FUNCTION,%g1
2066 or #BOTTOM_OF_FUNCTION,%g1,%g1
2067 sethi #TOP_OF_STATIC,%g2
2068 jmp g1
2069 or #BOTTOM_OF_STATIC,%g2,%g2
2071 On 64 bit sparcs, the trampoline contains 4 insns and two pseudo-immediate
2072 constants (plus some padding):
2073 rd %pc,%g1
2074 ldx[%g1+20],%g5
2075 ldx[%g1+28],%g1
2076 jmp %g1
2079 .xword context
2080 .xword function */
2081 /* ??? Stack is execute-protected in v9. */
2083 #define TRAMPOLINE_TEMPLATE(FILE) \
2084 do { \
2085 if (TARGET_ARCH64) \
2087 fprintf (FILE, "\trd %%pc,%%g1\n"); \
2088 fprintf (FILE, "\tldx [%%g1+24],%%g5\n"); \
2089 fprintf (FILE, "\tldx [%%g1+32],%%g1\n"); \
2090 fprintf (FILE, "\tjmp %%g1\n"); \
2091 fprintf (FILE, "\tnop\n"); \
2092 fprintf (FILE, "\tnop\n"); \
2093 /* -mmedlow shouldn't generate .xwords, so don't use them at all */ \
2094 fprintf (FILE, "\t.word 0,0,0,0\n"); \
2096 else \
2098 ASM_OUTPUT_INT (FILE, GEN_INT (0x00000000)); \
2099 ASM_OUTPUT_INT (FILE, GEN_INT (0x00000000)); \
2100 ASM_OUTPUT_INT (FILE, GEN_INT (0x00000000)); \
2101 ASM_OUTPUT_INT (FILE, GEN_INT (0x81C04000)); \
2102 ASM_OUTPUT_INT (FILE, GEN_INT (0x00000000)); \
2104 } while (0)
2106 /* Length in units of the trampoline for entering a nested function. */
2108 #define TRAMPOLINE_SIZE (TARGET_ARCH64 ? 40 : 20)
2110 /* Emit RTL insns to initialize the variable parts of a trampoline.
2111 FNADDR is an RTX for the address of the function's pure code.
2112 CXT is an RTX for the static chain value for the function. */
2114 void sparc_initialize_trampoline ();
2115 void sparc64_initialize_trampoline ();
2116 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
2117 do { \
2118 if (TARGET_ARCH64) \
2119 sparc64_initialize_trampoline (TRAMP, FNADDR, CXT); \
2120 else \
2121 sparc_initialize_trampoline (TRAMP, FNADDR, CXT); \
2122 } while (0)
2124 /* Generate necessary RTL for __builtin_saveregs().
2125 ARGLIST is the argument list; see expr.c. */
2127 extern struct rtx_def *sparc_builtin_saveregs ();
2128 #define EXPAND_BUILTIN_SAVEREGS(ARGLIST) sparc_builtin_saveregs (ARGLIST)
2130 /* Define this macro if the location where a function argument is passed
2131 depends on whether or not it is a named argument.
2133 This macro controls how the NAMED argument to FUNCTION_ARG
2134 is set for varargs and stdarg functions. With this macro defined,
2135 the NAMED argument is always true for named arguments, and false for
2136 unnamed arguments. If this is not defined, but SETUP_INCOMING_VARARGS
2137 is defined, then all arguments are treated as named. Otherwise, all named
2138 arguments except the last are treated as named.
2139 For the v9 we want NAMED to mean what it says it means. */
2141 #define STRICT_ARGUMENT_NAMING TARGET_V9
2143 /* Generate RTL to flush the register windows so as to make arbitrary frames
2144 available. */
2145 #define SETUP_FRAME_ADDRESSES() \
2146 emit_insn (gen_flush_register_windows ())
2148 /* Given an rtx for the address of a frame,
2149 return an rtx for the address of the word in the frame
2150 that holds the dynamic chain--the previous frame's address.
2151 ??? -mflat support? */
2152 #define DYNAMIC_CHAIN_ADDRESS(frame) plus_constant (frame, 14 * UNITS_PER_WORD)
2154 /* The return address isn't on the stack, it is in a register, so we can't
2155 access it from the current frame pointer. We can access it from the
2156 previous frame pointer though by reading a value from the register window
2157 save area. */
2158 #define RETURN_ADDR_IN_PREVIOUS_FRAME
2160 /* This is the offset of the return address to the true next instruction to be
2161 executed for the current function. */
2162 #define RETURN_ADDR_OFFSET \
2163 (8 + 4 * (! TARGET_ARCH64 && current_function_returns_struct))
2165 /* The current return address is in %i7. The return address of anything
2166 farther back is in the register window save area at [%fp+60]. */
2167 /* ??? This ignores the fact that the actual return address is +8 for normal
2168 returns, and +12 for structure returns. */
2169 #define RETURN_ADDR_RTX(count, frame) \
2170 ((count == -1) \
2171 ? gen_rtx_REG (Pmode, 31) \
2172 : gen_rtx_MEM (Pmode, \
2173 memory_address (Pmode, plus_constant (frame, \
2174 15 * UNITS_PER_WORD))))
2176 /* Before the prologue, the return address is %o7 + 8. OK, sometimes it's
2177 +12, but always using +8 is close enough for frame unwind purposes.
2178 Actually, just using %o7 is close enough for unwinding, but %o7+8
2179 is something you can return to. */
2180 #define INCOMING_RETURN_ADDR_RTX \
2181 plus_constant (gen_rtx_REG (word_mode, 15), 8)
2183 /* The offset from the incoming value of %sp to the top of the stack frame
2184 for the current function. On sparc64, we have to account for the stack
2185 bias if present. */
2186 #define INCOMING_FRAME_SP_OFFSET SPARC_STACK_BIAS
2188 #define DOESNT_NEED_UNWINDER (! TARGET_FLAT)
2190 /* Addressing modes, and classification of registers for them. */
2192 /* #define HAVE_POST_INCREMENT */
2193 /* #define HAVE_POST_DECREMENT */
2195 /* #define HAVE_PRE_DECREMENT */
2196 /* #define HAVE_PRE_INCREMENT */
2198 /* Macros to check register numbers against specific register classes. */
2200 /* These assume that REGNO is a hard or pseudo reg number.
2201 They give nonzero only if REGNO is a hard reg of the suitable class
2202 or a pseudo reg currently allocated to a suitable hard reg.
2203 Since they use reg_renumber, they are safe only once reg_renumber
2204 has been allocated, which happens in local-alloc.c. */
2206 #define REGNO_OK_FOR_INDEX_P(REGNO) \
2207 ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)
2208 #define REGNO_OK_FOR_BASE_P(REGNO) \
2209 ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)
2210 #define REGNO_OK_FOR_FP_P(REGNO) \
2211 (((unsigned) (REGNO) - 32 < (TARGET_V9 ? 64 : 32)) \
2212 || ((unsigned) reg_renumber[REGNO] - 32 < (TARGET_V9 ? 64 : 32)))
2213 #define REGNO_OK_FOR_CCFP_P(REGNO) \
2214 (TARGET_V9 \
2215 && (((unsigned) (REGNO) - 96 < 4) \
2216 || ((unsigned) reg_renumber[REGNO] - 96 < 4)))
2218 /* Now macros that check whether X is a register and also,
2219 strictly, whether it is in a specified class.
2221 These macros are specific to the SPARC, and may be used only
2222 in code for printing assembler insns and in conditions for
2223 define_optimization. */
2225 /* 1 if X is an fp register. */
2227 #define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
2229 /* Maximum number of registers that can appear in a valid memory address. */
2231 #define MAX_REGS_PER_ADDRESS 2
2233 /* Recognize any constant value that is a valid address.
2234 When PIC, we do not accept an address that would require a scratch reg
2235 to load into a register. */
2237 #define CONSTANT_ADDRESS_P(X) \
2238 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
2239 || GET_CODE (X) == CONST_INT || GET_CODE (X) == HIGH \
2240 || (GET_CODE (X) == CONST \
2241 && ! (flag_pic && pic_address_needs_scratch (X))))
2243 /* Define this, so that when PIC, reload won't try to reload invalid
2244 addresses which require two reload registers. */
2246 #define LEGITIMATE_PIC_OPERAND_P(X) (! pic_address_needs_scratch (X))
2248 /* Nonzero if the constant value X is a legitimate general operand.
2249 Anything can be made to work except floating point constants. */
2251 #define LEGITIMATE_CONSTANT_P(X) \
2252 (GET_CODE (X) != CONST_DOUBLE || GET_MODE (X) == VOIDmode)
2254 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
2255 and check its validity for a certain class.
2256 We have two alternate definitions for each of them.
2257 The usual definition accepts all pseudo regs; the other rejects
2258 them unless they have been allocated suitable hard regs.
2259 The symbol REG_OK_STRICT causes the latter definition to be used.
2261 Most source files want to accept pseudo regs in the hope that
2262 they will get allocated to the class that the insn wants them to be in.
2263 Source files for reload pass need to be strict.
2264 After reload, it makes no difference, since pseudo regs have
2265 been eliminated by then. */
2267 /* Optional extra constraints for this machine. Borrowed from romp.h.
2269 For the SPARC, `Q' means that this is a memory operand but not a
2270 symbolic memory operand. Note that an unassigned pseudo register
2271 is such a memory operand. Needed because reload will generate
2272 these things in insns and then not re-recognize the insns, causing
2273 constrain_operands to fail.
2275 `S' handles constraints for calls. ??? So where is it? */
2277 #ifndef REG_OK_STRICT
2279 /* Nonzero if X is a hard reg that can be used as an index
2280 or if it is a pseudo reg. */
2281 #define REG_OK_FOR_INDEX_P(X) \
2282 (((unsigned) REGNO (X)) - 32 >= (FIRST_PSEUDO_REGISTER - 32))
2283 /* Nonzero if X is a hard reg that can be used as a base reg
2284 or if it is a pseudo reg. */
2285 #define REG_OK_FOR_BASE_P(X) \
2286 (((unsigned) REGNO (X)) - 32 >= (FIRST_PSEUDO_REGISTER - 32))
2288 /* 'T', 'U' are for aligned memory loads which aren't needed for v9. */
2290 #define EXTRA_CONSTRAINT(OP, C) \
2291 ((C) == 'Q' \
2292 ? ((GET_CODE (OP) == MEM \
2293 && memory_address_p (GET_MODE (OP), XEXP (OP, 0)) \
2294 && ! symbolic_memory_operand (OP, VOIDmode)) \
2295 || (reload_in_progress && GET_CODE (OP) == REG \
2296 && REGNO (OP) >= FIRST_PSEUDO_REGISTER)) \
2297 : (! TARGET_ARCH64 && (C) == 'T') \
2298 ? (mem_aligned_8 (OP)) \
2299 : (! TARGET_ARCH64 && (C) == 'U') \
2300 ? (register_ok_for_ldd (OP)) \
2301 : 0)
2303 #else
2305 /* Nonzero if X is a hard reg that can be used as an index. */
2306 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
2307 /* Nonzero if X is a hard reg that can be used as a base reg. */
2308 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
2310 #define EXTRA_CONSTRAINT(OP, C) \
2311 ((C) == 'Q' \
2312 ? (GET_CODE (OP) == REG \
2313 ? (REGNO (OP) >= FIRST_PSEUDO_REGISTER \
2314 && reg_renumber[REGNO (OP)] < 0) \
2315 : GET_CODE (OP) == MEM) \
2316 : (! TARGET_ARCH64 && (C) == 'T') \
2317 ? mem_aligned_8 (OP) && strict_memory_address_p (Pmode, XEXP (OP, 0)) \
2318 : (! TARGET_ARCH64 && (C) == 'U') \
2319 ? (GET_CODE (OP) == REG \
2320 && (REGNO (OP) < FIRST_PSEUDO_REGISTER \
2321 || reg_renumber[REGNO (OP)] >= 0) \
2322 && register_ok_for_ldd (OP)) \
2323 : 0)
2324 #endif
2326 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
2327 that is a valid memory address for an instruction.
2328 The MODE argument is the machine mode for the MEM expression
2329 that wants to use this address.
2331 On SPARC, the actual legitimate addresses must be REG+REG or REG+SMALLINT
2332 ordinarily. This changes a bit when generating PIC.
2334 If you change this, execute "rm explow.o recog.o reload.o". */
2336 #define RTX_OK_FOR_BASE_P(X) \
2337 ((GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
2338 || (GET_CODE (X) == SUBREG \
2339 && GET_CODE (SUBREG_REG (X)) == REG \
2340 && REG_OK_FOR_BASE_P (SUBREG_REG (X))))
2342 #define RTX_OK_FOR_INDEX_P(X) \
2343 ((GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X)) \
2344 || (GET_CODE (X) == SUBREG \
2345 && GET_CODE (SUBREG_REG (X)) == REG \
2346 && REG_OK_FOR_INDEX_P (SUBREG_REG (X))))
2348 #define RTX_OK_FOR_OFFSET_P(X) \
2349 (GET_CODE (X) == CONST_INT && INTVAL (X) >= -0x1000 && INTVAL (X) < 0x1000)
2351 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
2352 { if (RTX_OK_FOR_BASE_P (X)) \
2353 goto ADDR; \
2354 else if (GET_CODE (X) == PLUS) \
2356 register rtx op0 = XEXP (X, 0); \
2357 register rtx op1 = XEXP (X, 1); \
2358 if (flag_pic && op0 == pic_offset_table_rtx) \
2360 if (RTX_OK_FOR_BASE_P (op1)) \
2361 goto ADDR; \
2362 else if (flag_pic == 1 \
2363 && GET_CODE (op1) != REG \
2364 && GET_CODE (op1) != LO_SUM \
2365 && GET_CODE (op1) != MEM \
2366 && (GET_CODE (op1) != CONST_INT \
2367 || SMALL_INT (op1))) \
2368 goto ADDR; \
2370 else if (RTX_OK_FOR_BASE_P (op0)) \
2372 if (RTX_OK_FOR_INDEX_P (op1) \
2373 || RTX_OK_FOR_OFFSET_P (op1)) \
2374 goto ADDR; \
2376 else if (RTX_OK_FOR_BASE_P (op1)) \
2378 if (RTX_OK_FOR_INDEX_P (op0) \
2379 || RTX_OK_FOR_OFFSET_P (op0)) \
2380 goto ADDR; \
2383 else if (GET_CODE (X) == LO_SUM) \
2385 register rtx op0 = XEXP (X, 0); \
2386 register rtx op1 = XEXP (X, 1); \
2387 if (RTX_OK_FOR_BASE_P (op0) \
2388 && CONSTANT_P (op1) \
2389 /* We can't allow TFmode, because an offset \
2390 greater than or equal to the alignment (8) \
2391 may cause the LO_SUM to overflow. */ \
2392 && MODE != TFmode) \
2393 goto ADDR; \
2395 else if (GET_CODE (X) == CONST_INT && SMALL_INT (X)) \
2396 goto ADDR; \
2399 /* Try machine-dependent ways of modifying an illegitimate address
2400 to be legitimate. If we find one, return the new, valid address.
2401 This macro is used in only one place: `memory_address' in explow.c.
2403 OLDX is the address as it was before break_out_memory_refs was called.
2404 In some cases it is useful to look at this to decide what needs to be done.
2406 MODE and WIN are passed so that this macro can use
2407 GO_IF_LEGITIMATE_ADDRESS.
2409 It is always safe for this macro to do nothing. It exists to recognize
2410 opportunities to optimize the output. */
2412 /* On SPARC, change REG+N into REG+REG, and REG+(X*Y) into REG+REG. */
2413 extern struct rtx_def *legitimize_pic_address ();
2414 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
2415 { rtx sparc_x = (X); \
2416 if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == MULT) \
2417 (X) = gen_rtx_PLUS (Pmode, XEXP (X, 1), \
2418 force_operand (XEXP (X, 0), NULL_RTX)); \
2419 if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == MULT) \
2420 (X) = gen_rtx_PLUS (Pmode, XEXP (X, 0), \
2421 force_operand (XEXP (X, 1), NULL_RTX)); \
2422 if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == PLUS) \
2423 (X) = gen_rtx_PLUS (Pmode, force_operand (XEXP (X, 0), NULL_RTX),\
2424 XEXP (X, 1)); \
2425 if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == PLUS) \
2426 (X) = gen_rtx_PLUS (Pmode, XEXP (X, 0), \
2427 force_operand (XEXP (X, 1), NULL_RTX)); \
2428 if (sparc_x != (X) && memory_address_p (MODE, X)) \
2429 goto WIN; \
2430 if (flag_pic) (X) = legitimize_pic_address (X, MODE, 0); \
2431 else if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 1))) \
2432 (X) = gen_rtx_PLUS (Pmode, XEXP (X, 0), \
2433 copy_to_mode_reg (Pmode, XEXP (X, 1))); \
2434 else if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 0))) \
2435 (X) = gen_rtx_PLUS (Pmode, XEXP (X, 1), \
2436 copy_to_mode_reg (Pmode, XEXP (X, 0))); \
2437 else if (GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == CONST \
2438 || GET_CODE (X) == LABEL_REF) \
2439 (X) = gen_rtx_LO_SUM (Pmode, \
2440 copy_to_mode_reg (Pmode, \
2441 gen_rtx_HIGH (Pmode, X)), X); \
2442 if (memory_address_p (MODE, X)) \
2443 goto WIN; }
2445 /* Go to LABEL if ADDR (a legitimate address expression)
2446 has an effect that depends on the machine mode it is used for.
2447 On the SPARC this is never true. */
2449 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
2451 /* If we are referencing a function make the SYMBOL_REF special.
2452 In the Embedded Medium/Anywhere code model, %g4 points to the data segment
2453 so we must not add it to function addresses. */
2455 #define ENCODE_SECTION_INFO(DECL) \
2456 do { \
2457 if (TARGET_CM_EMBMEDANY && TREE_CODE (DECL) == FUNCTION_DECL) \
2458 SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \
2459 } while (0)
2461 /* Specify the machine mode that this machine uses
2462 for the index in the tablejump instruction. */
2463 #define CASE_VECTOR_MODE Pmode
2465 /* Define this if the tablejump instruction expects the table
2466 to contain offsets from the address of the table.
2467 Do not define this if the table should contain absolute addresses. */
2468 /* #define CASE_VECTOR_PC_RELATIVE */
2470 /* Specify the tree operation to be used to convert reals to integers. */
2471 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
2473 /* This is the kind of divide that is easiest to do in the general case. */
2474 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
2476 /* Define this as 1 if `char' should by default be signed; else as 0. */
2477 #define DEFAULT_SIGNED_CHAR 1
2479 /* Max number of bytes we can move from memory to memory
2480 in one reasonably fast instruction. */
2481 #define MOVE_MAX 8
2483 #if 0 /* Sun 4 has matherr, so this is no good. */
2484 /* This is the value of the error code EDOM for this machine,
2485 used by the sqrt instruction. */
2486 #define TARGET_EDOM 33
2488 /* This is how to refer to the variable errno. */
2489 #define GEN_ERRNO_RTX \
2490 gen_rtx_MEM (SImode, gen_rtx_SYMBOL_REF (Pmode, "errno"))
2491 #endif /* 0 */
2493 /* Define if operations between registers always perform the operation
2494 on the full register even if a narrower mode is specified. */
2495 #define WORD_REGISTER_OPERATIONS
2497 /* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
2498 will either zero-extend or sign-extend. The value of this macro should
2499 be the code that says which one of the two operations is implicitly
2500 done, NIL if none. */
2501 #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
2503 /* Nonzero if access to memory by bytes is slow and undesirable.
2504 For RISC chips, it means that access to memory by bytes is no
2505 better than access by words when possible, so grab a whole word
2506 and maybe make use of that. */
2507 #define SLOW_BYTE_ACCESS 1
2509 /* We assume that the store-condition-codes instructions store 0 for false
2510 and some other value for true. This is the value stored for true. */
2512 #define STORE_FLAG_VALUE 1
2514 /* When a prototype says `char' or `short', really pass an `int'. */
2515 #define PROMOTE_PROTOTYPES
2517 /* Define this to be nonzero if shift instructions ignore all but the low-order
2518 few bits. */
2519 #define SHIFT_COUNT_TRUNCATED 1
2521 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
2522 is done just by pretending it is already truncated. */
2523 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
2525 /* Specify the machine mode that pointers have.
2526 After generation of rtl, the compiler makes no further distinction
2527 between pointers and any other objects of this machine mode. */
2528 #define Pmode (TARGET_PTR64 ? DImode : SImode)
2530 /* Generate calls to memcpy, memcmp and memset. */
2531 #define TARGET_MEM_FUNCTIONS
2533 /* Add any extra modes needed to represent the condition code.
2535 On the Sparc, we have a "no-overflow" mode which is used when an add or
2536 subtract insn is used to set the condition code. Different branches are
2537 used in this case for some operations.
2539 We also have two modes to indicate that the relevant condition code is
2540 in the floating-point condition code register. One for comparisons which
2541 will generate an exception if the result is unordered (CCFPEmode) and
2542 one for comparisons which will never trap (CCFPmode).
2544 CCXmode and CCX_NOOVmode are only used by v9. */
2546 #define EXTRA_CC_MODES CCXmode, CC_NOOVmode, CCX_NOOVmode, CCFPmode, CCFPEmode
2548 /* Define the names for the modes specified above. */
2550 #define EXTRA_CC_NAMES "CCX", "CC_NOOV", "CCX_NOOV", "CCFP", "CCFPE"
2552 /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
2553 return the mode to be used for the comparison. For floating-point,
2554 CCFP[E]mode is used. CC_NOOVmode should be used when the first operand is a
2555 PLUS, MINUS, NEG, or ASHIFT. CCmode should be used when no special
2556 processing is needed. */
2557 #define SELECT_CC_MODE(OP,X,Y) \
2558 (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
2559 ? ((OP == EQ || OP == NE) ? CCFPmode : CCFPEmode) \
2560 : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS \
2561 || GET_CODE (X) == NEG || GET_CODE (X) == ASHIFT) \
2562 ? (TARGET_ARCH64 && GET_MODE (X) == DImode ? CCX_NOOVmode : CC_NOOVmode) \
2563 : (TARGET_ARCH64 && GET_MODE (X) == DImode ? CCXmode : CCmode)))
2565 /* Return non-zero if SELECT_CC_MODE will never return MODE for a
2566 floating point inequality comparison. */
2568 #define REVERSIBLE_CC_MODE(MODE) ((MODE) != CCFPEmode)
2570 /* A function address in a call instruction
2571 is a byte address (for indexing purposes)
2572 so give the MEM rtx a byte's mode. */
2573 #define FUNCTION_MODE SImode
2575 /* Define this if addresses of constant functions
2576 shouldn't be put through pseudo regs where they can be cse'd.
2577 Desirable on machines where ordinary constants are expensive
2578 but a CALL with constant address is cheap. */
2579 #define NO_FUNCTION_CSE
2581 /* alloca should avoid clobbering the old register save area. */
2582 #define SETJMP_VIA_SAVE_AREA
2584 /* Define subroutines to call to handle multiply and divide.
2585 Use the subroutines that Sun's library provides.
2586 The `*' prevents an underscore from being prepended by the compiler. */
2588 #define DIVSI3_LIBCALL "*.div"
2589 #define UDIVSI3_LIBCALL "*.udiv"
2590 #define MODSI3_LIBCALL "*.rem"
2591 #define UMODSI3_LIBCALL "*.urem"
2592 /* .umul is a little faster than .mul. */
2593 #define MULSI3_LIBCALL "*.umul"
2595 /* Define library calls for quad FP operations. These are all part of the
2596 SPARC ABI. */
2597 #define ADDTF3_LIBCALL "_Q_add"
2598 #define SUBTF3_LIBCALL "_Q_sub"
2599 #define NEGTF2_LIBCALL "_Q_neg"
2600 #define MULTF3_LIBCALL "_Q_mul"
2601 #define DIVTF3_LIBCALL "_Q_div"
2602 #define FLOATSITF2_LIBCALL "_Q_itoq"
2603 #define FIX_TRUNCTFSI2_LIBCALL "_Q_qtoi"
2604 #define FIXUNS_TRUNCTFSI2_LIBCALL "_Q_qtou"
2605 #define EXTENDSFTF2_LIBCALL "_Q_stoq"
2606 #define TRUNCTFSF2_LIBCALL "_Q_qtos"
2607 #define EXTENDDFTF2_LIBCALL "_Q_dtoq"
2608 #define TRUNCTFDF2_LIBCALL "_Q_qtod"
2609 #define EQTF2_LIBCALL "_Q_feq"
2610 #define NETF2_LIBCALL "_Q_fne"
2611 #define GTTF2_LIBCALL "_Q_fgt"
2612 #define GETF2_LIBCALL "_Q_fge"
2613 #define LTTF2_LIBCALL "_Q_flt"
2614 #define LETF2_LIBCALL "_Q_fle"
2616 /* We can define the TFmode sqrt optab only if TARGET_FPU. This is because
2617 with soft-float, the SFmode and DFmode sqrt instructions will be absent,
2618 and the compiler will notice and try to use the TFmode sqrt instruction
2619 for calls to the builtin function sqrt, but this fails. */
2620 #define INIT_TARGET_OPTABS \
2621 do { \
2622 add_optab->handlers[(int) TFmode].libfunc \
2623 = gen_rtx_SYMBOL_REF (Pmode, ADDTF3_LIBCALL); \
2624 sub_optab->handlers[(int) TFmode].libfunc \
2625 = gen_rtx_SYMBOL_REF (Pmode, SUBTF3_LIBCALL); \
2626 neg_optab->handlers[(int) TFmode].libfunc \
2627 = gen_rtx_SYMBOL_REF (Pmode, NEGTF2_LIBCALL); \
2628 smul_optab->handlers[(int) TFmode].libfunc \
2629 = gen_rtx_SYMBOL_REF (Pmode, MULTF3_LIBCALL); \
2630 flodiv_optab->handlers[(int) TFmode].libfunc \
2631 = gen_rtx_SYMBOL_REF (Pmode, DIVTF3_LIBCALL); \
2632 eqtf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EQTF2_LIBCALL); \
2633 netf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, NETF2_LIBCALL); \
2634 gttf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, GTTF2_LIBCALL); \
2635 getf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, GETF2_LIBCALL); \
2636 lttf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, LTTF2_LIBCALL); \
2637 letf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, LETF2_LIBCALL); \
2638 trunctfsf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, TRUNCTFSF2_LIBCALL); \
2639 trunctfdf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, TRUNCTFDF2_LIBCALL); \
2640 extendsftf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EXTENDSFTF2_LIBCALL); \
2641 extenddftf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EXTENDDFTF2_LIBCALL); \
2642 floatsitf_libfunc = gen_rtx_SYMBOL_REF (Pmode, FLOATSITF2_LIBCALL); \
2643 fixtfsi_libfunc = gen_rtx_SYMBOL_REF (Pmode, FIX_TRUNCTFSI2_LIBCALL); \
2644 fixunstfsi_libfunc \
2645 = gen_rtx_SYMBOL_REF (Pmode, FIXUNS_TRUNCTFSI2_LIBCALL); \
2646 if (TARGET_FPU) \
2647 sqrt_optab->handlers[(int) TFmode].libfunc \
2648 = gen_rtx_SYMBOL_REF (Pmode, "_Q_sqrt"); \
2649 INIT_SUBTARGET_OPTABS; \
2650 } while (0)
2652 /* This is meant to be redefined in the host dependent files */
2653 #define INIT_SUBTARGET_OPTABS
2655 /* Compute the cost of computing a constant rtl expression RTX
2656 whose rtx-code is CODE. The body of this macro is a portion
2657 of a switch statement. If the code is computed here,
2658 return it with a return statement. Otherwise, break from the switch. */
2660 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
2661 case CONST_INT: \
2662 if (INTVAL (RTX) < 0x1000 && INTVAL (RTX) >= -0x1000) \
2663 return 0; \
2664 case HIGH: \
2665 return 2; \
2666 case CONST: \
2667 case LABEL_REF: \
2668 case SYMBOL_REF: \
2669 return 4; \
2670 case CONST_DOUBLE: \
2671 if (GET_MODE (RTX) == DImode) \
2672 if ((XINT (RTX, 3) == 0 \
2673 && (unsigned) XINT (RTX, 2) < 0x1000) \
2674 || (XINT (RTX, 3) == -1 \
2675 && XINT (RTX, 2) < 0 \
2676 && XINT (RTX, 2) >= -0x1000)) \
2677 return 0; \
2678 return 8;
2680 /* Compute the cost of an address. For the sparc, all valid addresses are
2681 the same cost. */
2683 #define ADDRESS_COST(RTX) 1
2685 /* Compute extra cost of moving data between one register class
2686 and another.
2687 ??? v9: We ignore FPCC_REGS on the assumption they'll never be seen. */
2688 #define REGISTER_MOVE_COST(CLASS1, CLASS2) \
2689 (((FP_REG_CLASS_P (CLASS1) && (CLASS2) == GENERAL_REGS) \
2690 || ((CLASS1) == GENERAL_REGS && FP_REG_CLASS_P (CLASS2))) ? 6 : 2)
2692 /* Provide the costs of a rtl expression. This is in the body of a
2693 switch on CODE. The purpose for the cost of MULT is to encourage
2694 `synth_mult' to find a synthetic multiply when reasonable.
2696 If we need more than 12 insns to do a multiply, then go out-of-line,
2697 since the call overhead will be < 10% of the cost of the multiply. */
2699 #define RTX_COSTS(X,CODE,OUTER_CODE) \
2700 case MULT: \
2701 return (TARGET_V8 || TARGET_SPARCLITE) \
2702 ? COSTS_N_INSNS (5) : COSTS_N_INSNS (25); \
2703 case DIV: \
2704 case UDIV: \
2705 case MOD: \
2706 case UMOD: \
2707 return COSTS_N_INSNS (25); \
2708 /* Make FLOAT and FIX more expensive than CONST_DOUBLE,\
2709 so that cse will favor the latter. */ \
2710 case FLOAT: \
2711 case FIX: \
2712 return 19;
2714 /* Adjust the cost of dependencies. */
2715 #define ADJUST_COST(INSN,LINK,DEP,COST) \
2716 if (sparc_cpu == PROCESSOR_SUPERSPARC) \
2717 (COST) = supersparc_adjust_cost (INSN, LINK, DEP, COST)
2719 /* Conditional branches with empty delay slots have a length of two. */
2720 #define ADJUST_INSN_LENGTH(INSN, LENGTH) \
2721 if (GET_CODE (INSN) == CALL_INSN \
2722 || (GET_CODE (INSN) == JUMP_INSN && ! simplejump_p (insn))) \
2723 LENGTH += 1;
2725 /* Control the assembler format that we output. */
2727 /* Output at beginning of assembler file. */
2729 #define ASM_FILE_START(file)
2731 /* A C string constant describing how to begin a comment in the target
2732 assembler language. The compiler assumes that the comment will end at
2733 the end of the line. */
2735 #define ASM_COMMENT_START "!"
2737 /* Output to assembler file text saying following lines
2738 may contain character constants, extra white space, comments, etc. */
2740 #define ASM_APP_ON ""
2742 /* Output to assembler file text saying following lines
2743 no longer contain unusual constructs. */
2745 #define ASM_APP_OFF ""
2747 /* ??? Try to make the style consistent here (_OP?). */
2749 #define ASM_LONGLONG ".xword"
2750 #define ASM_LONG ".word"
2751 #define ASM_SHORT ".half"
2752 #define ASM_BYTE_OP ".byte"
2753 #define ASM_FLOAT ".single"
2754 #define ASM_DOUBLE ".double"
2755 #define ASM_LONGDOUBLE ".xxx" /* ??? Not known (or used yet). */
2757 /* Output before read-only data. */
2759 #define TEXT_SECTION_ASM_OP ".text"
2761 /* Output before writable data. */
2763 #define DATA_SECTION_ASM_OP ".data"
2765 /* How to refer to registers in assembler output.
2766 This sequence is indexed by compiler's hard-register-number (see above). */
2768 #define REGISTER_NAMES \
2769 {"%g0", "%g1", "%g2", "%g3", "%g4", "%g5", "%g6", "%g7", \
2770 "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%sp", "%o7", \
2771 "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", \
2772 "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%fp", "%i7", \
2773 "%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7", \
2774 "%f8", "%f9", "%f10", "%f11", "%f12", "%f13", "%f14", "%f15", \
2775 "%f16", "%f17", "%f18", "%f19", "%f20", "%f21", "%f22", "%f23", \
2776 "%f24", "%f25", "%f26", "%f27", "%f28", "%f29", "%f30", "%f31", \
2777 "%f32", "%f33", "%f34", "%f35", "%f36", "%f37", "%f38", "%f39", \
2778 "%f40", "%f41", "%f42", "%f43", "%f44", "%f45", "%f46", "%f47", \
2779 "%f48", "%f49", "%f50", "%f51", "%f52", "%f53", "%f54", "%f55", \
2780 "%f56", "%f57", "%f58", "%f59", "%f60", "%f61", "%f62", "%f63", \
2781 "%fcc0", "%fcc1", "%fcc2", "%fcc3", "%icc"}
2783 /* Define additional names for use in asm clobbers and asm declarations. */
2785 #define ADDITIONAL_REGISTER_NAMES \
2786 {{"ccr", SPARC_ICC_REG}, {"cc", SPARC_ICC_REG}}
2788 /* How to renumber registers for dbx and gdb. In the flat model, the frame
2789 pointer is really %i7. */
2791 #define DBX_REGISTER_NUMBER(REGNO) \
2792 (TARGET_FLAT && REGNO == FRAME_POINTER_REGNUM ? 31 : REGNO)
2794 /* On Sun 4, this limit is 2048. We use 1000 to be safe, since the length
2795 can run past this up to a continuation point. Once we used 1500, but
2796 a single entry in C++ can run more than 500 bytes, due to the length of
2797 mangled symbol names. dbxout.c should really be fixed to do
2798 continuations when they are actually needed instead of trying to
2799 guess... */
2800 #define DBX_CONTIN_LENGTH 1000
2802 /* This is how to output a note to DBX telling it the line number
2803 to which the following sequence of instructions corresponds.
2805 This is needed for SunOS 4.0, and should not hurt for 3.2
2806 versions either. */
2807 #define ASM_OUTPUT_SOURCE_LINE(file, line) \
2808 { static int sym_lineno = 1; \
2809 fprintf (file, ".stabn 68,0,%d,LM%d\nLM%d:\n", \
2810 line, sym_lineno, sym_lineno); \
2811 sym_lineno += 1; }
2813 /* This is how to output the definition of a user-level label named NAME,
2814 such as the label on a static function or variable NAME. */
2816 #define ASM_OUTPUT_LABEL(FILE,NAME) \
2817 do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
2819 /* This is how to output a command to make the user-level label named NAME
2820 defined for reference from other files. */
2822 #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
2823 do { fputs ("\t.global ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
2825 /* The prefix to add to user-visible assembler symbols. */
2827 #define USER_LABEL_PREFIX "_"
2829 /* This is how to output a definition of an internal numbered label where
2830 PREFIX is the class of label and NUM is the number within the class. */
2832 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
2833 fprintf (FILE, "%s%d:\n", PREFIX, NUM)
2835 /* This is how to store into the string LABEL
2836 the symbol_ref name of an internal numbered label where
2837 PREFIX is the class of label and NUM is the number within the class.
2838 This is suitable for output with `assemble_name'. */
2840 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
2841 sprintf (LABEL, "*%s%d", PREFIX, NUM)
2843 /* This is how to output an assembler line defining a `float' constant.
2844 We always have to use a .long pseudo-op to do this because the native
2845 SVR4 ELF assembler is buggy and it generates incorrect values when we
2846 try to use the .float pseudo-op instead. */
2848 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
2850 long t; \
2851 char str[30]; \
2852 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
2853 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
2854 fprintf (FILE, "\t%s\t0x%lx %s ~%s\n", ASM_LONG, t, \
2855 ASM_COMMENT_START, str); \
2858 /* This is how to output an assembler line defining a `double' constant.
2859 We always have to use a .long pseudo-op to do this because the native
2860 SVR4 ELF assembler is buggy and it generates incorrect values when we
2861 try to use the .float pseudo-op instead. */
2863 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
2865 long t[2]; \
2866 char str[30]; \
2867 REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
2868 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
2869 fprintf (FILE, "\t%s\t0x%lx %s ~%s\n", ASM_LONG, t[0], \
2870 ASM_COMMENT_START, str); \
2871 fprintf (FILE, "\t%s\t0x%lx\n", ASM_LONG, t[1]); \
2874 /* This is how to output an assembler line defining a `long double'
2875 constant. */
2877 #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
2879 long t[4]; \
2880 char str[30]; \
2881 REAL_VALUE_TO_TARGET_LONG_DOUBLE ((VALUE), t); \
2882 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
2883 fprintf (FILE, "\t%s\t0x%lx %s ~%s\n", ASM_LONG, t[0], \
2884 ASM_COMMENT_START, str); \
2885 fprintf (FILE, "\t%s\t0x%lx\n", ASM_LONG, t[1]); \
2886 fprintf (FILE, "\t%s\t0x%lx\n", ASM_LONG, t[2]); \
2887 fprintf (FILE, "\t%s\t0x%lx\n", ASM_LONG, t[3]); \
2890 /* This is how to output an assembler line defining an `int' constant. */
2892 #define ASM_OUTPUT_INT(FILE,VALUE) \
2893 ( fprintf (FILE, "\t%s\t", ASM_LONG), \
2894 output_addr_const (FILE, (VALUE)), \
2895 fprintf (FILE, "\n"))
2897 /* This is how to output an assembler line defining a DImode constant. */
2898 #define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE) \
2899 output_double_int (FILE, VALUE)
2901 /* Likewise for `char' and `short' constants. */
2903 #define ASM_OUTPUT_SHORT(FILE,VALUE) \
2904 ( fprintf (FILE, "\t%s\t", ASM_SHORT), \
2905 output_addr_const (FILE, (VALUE)), \
2906 fprintf (FILE, "\n"))
2908 #define ASM_OUTPUT_CHAR(FILE,VALUE) \
2909 ( fprintf (FILE, "\t%s\t", ASM_BYTE_OP), \
2910 output_addr_const (FILE, (VALUE)), \
2911 fprintf (FILE, "\n"))
2913 /* This is how to output an assembler line for a numeric constant byte. */
2915 #define ASM_OUTPUT_BYTE(FILE,VALUE) \
2916 fprintf (FILE, "\t%s\t0x%x\n", ASM_BYTE_OP, (VALUE))
2918 /* This is how to output an element of a case-vector that is absolute. */
2920 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
2921 do { \
2922 char label[30]; \
2923 ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
2924 if (Pmode == SImode) \
2925 fprintf (FILE, "\t.word\t"); \
2926 else if (TARGET_CM_MEDLOW) \
2927 fprintf (FILE, "\t.word\t0\n\t.word\t"); \
2928 else \
2929 fprintf (FILE, "\t.xword\t"); \
2930 assemble_name (FILE, label); \
2931 fprintf (FILE, "\n"); \
2932 } while (0)
2934 /* This is how to output an element of a case-vector that is relative.
2935 (SPARC uses such vectors only when generating PIC.) */
2937 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
2938 do { \
2939 char label[30]; \
2940 ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
2941 if (Pmode == SImode) \
2942 fprintf (FILE, "\t.word\t"); \
2943 else if (TARGET_CM_MEDLOW) \
2944 fprintf (FILE, "\t.word\t0\n\t.word\t"); \
2945 else \
2946 fprintf (FILE, "\t.xword\t"); \
2947 assemble_name (FILE, label); \
2948 fprintf (FILE, "-1b\n"); \
2949 } while (0)
2951 /* This is how to output an assembler line
2952 that says to advance the location counter
2953 to a multiple of 2**LOG bytes. */
2955 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
2956 if ((LOG) != 0) \
2957 fprintf (FILE, "\t.align %d\n", (1<<(LOG)))
2959 #define ASM_OUTPUT_ALIGN_CODE(FILE) \
2960 ASM_OUTPUT_ALIGN (FILE, sparc_align_jumps)
2962 #define ASM_OUTPUT_LOOP_ALIGN(FILE) \
2963 if (sparc_align_loops >= 2) \
2964 fprintf ((FILE), "\t.align %d, 0x01000000\n", 1 << sparc_align_loops)
2966 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
2967 fprintf (FILE, "\t.skip %u\n", (SIZE))
2969 /* This says how to output an assembler line
2970 to define a global common symbol. */
2972 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
2973 ( fputs ("\t.common ", (FILE)), \
2974 assemble_name ((FILE), (NAME)), \
2975 fprintf ((FILE), ",%u,\"bss\"\n", (SIZE)))
2977 /* This says how to output an assembler line to define a local common
2978 symbol. */
2980 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGNED) \
2981 ( fputs ("\t.reserve ", (FILE)), \
2982 assemble_name ((FILE), (NAME)), \
2983 fprintf ((FILE), ",%u,\"bss\",%u\n", \
2984 (SIZE), ((ALIGNED) / BITS_PER_UNIT)))
2986 /* A C statement (sans semicolon) to output to the stdio stream
2987 FILE the assembler definition of uninitialized global DECL named
2988 NAME whose size is SIZE bytes and alignment is ALIGN bytes.
2989 Try to use asm_output_aligned_bss to implement this macro. */
2991 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
2992 do { \
2993 fputs (".globl ", (FILE)); \
2994 assemble_name ((FILE), (NAME)); \
2995 fputs ("\n", (FILE)); \
2996 ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN); \
2997 } while (0)
2999 /* Store in OUTPUT a string (made with alloca) containing
3000 an assembler-name for a local static variable named NAME.
3001 LABELNO is an integer which is different for each call. */
3003 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
3004 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
3005 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
3007 #define IDENT_ASM_OP ".ident"
3009 /* Output #ident as a .ident. */
3011 #define ASM_OUTPUT_IDENT(FILE, NAME) \
3012 fprintf (FILE, "\t%s\t\"%s\"\n", IDENT_ASM_OP, NAME);
3014 /* Output code to add DELTA to the first argument, and then jump to FUNCTION.
3015 Used for C++ multiple inheritance. */
3016 #define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
3017 do { \
3018 int big_delta = (DELTA) >= 4096 || (DELTA) < -4096; \
3019 if (big_delta) \
3020 fprintf (FILE, "\tset %d,%%g1\n\tadd %%o0,%%g1,%%o0\n", (DELTA)); \
3021 if (flag_pic) \
3023 if (! big_delta) \
3024 fprintf (FILE, "\tadd %%o0,%d,%%o0\n", DELTA); \
3025 fprintf (FILE, "\tsave %%sp,-112,%%sp\n"); \
3026 fprintf (FILE, "\tcall "); \
3027 assemble_name \
3028 (FILE, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (FUNCTION))); \
3029 fprintf (FILE, ",0\n"); \
3031 else if (TARGET_CM_EMBMEDANY) \
3033 fprintf (FILE, "\tsetx "); \
3034 assemble_name \
3035 (FILE, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (FUNCTION))); \
3036 fprintf (FILE, ",%%g5,%%g1\n\tjmp %%g1\n"); \
3038 else \
3040 fprintf (FILE, "\tsethi %%hi("); \
3041 assemble_name \
3042 (FILE, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (FUNCTION))); \
3043 fprintf (FILE, "),%%g1\n\tjmp %%g1+%%lo("); \
3044 assemble_name \
3045 (FILE, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (FUNCTION))); \
3046 fprintf (FILE, ")\n"); \
3048 if (big_delta) \
3049 fprintf (FILE, "\tnop\n"); \
3050 else if (flag_pic) \
3051 fprintf (FILE, "\trestore\n"); \
3052 else \
3053 fprintf (FILE, "\tadd %%o0,%d,%%o0\n", DELTA); \
3054 } while (0)
3056 /* Define the parentheses used to group arithmetic operations
3057 in assembler code. */
3059 #define ASM_OPEN_PAREN "("
3060 #define ASM_CLOSE_PAREN ")"
3062 /* Define results of standard character escape sequences. */
3063 #define TARGET_BELL 007
3064 #define TARGET_BS 010
3065 #define TARGET_TAB 011
3066 #define TARGET_NEWLINE 012
3067 #define TARGET_VT 013
3068 #define TARGET_FF 014
3069 #define TARGET_CR 015
3071 #define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \
3072 ((CHAR) == '#' || (CHAR) == '*' || (CHAR) == '^' || (CHAR) == '(' || (CHAR) == '_')
3074 /* Print operand X (an rtx) in assembler syntax to file FILE.
3075 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
3076 For `%' followed by punctuation, CODE is the punctuation and X is null. */
3078 #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
3080 /* Print a memory address as an operand to reference that memory location. */
3082 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
3083 { register rtx base, index = 0; \
3084 int offset = 0; \
3085 register rtx addr = ADDR; \
3086 if (GET_CODE (addr) == REG) \
3087 fputs (reg_names[REGNO (addr)], FILE); \
3088 else if (GET_CODE (addr) == PLUS) \
3090 if (GET_CODE (XEXP (addr, 0)) == CONST_INT) \
3091 offset = INTVAL (XEXP (addr, 0)), base = XEXP (addr, 1);\
3092 else if (GET_CODE (XEXP (addr, 1)) == CONST_INT) \
3093 offset = INTVAL (XEXP (addr, 1)), base = XEXP (addr, 0);\
3094 else \
3095 base = XEXP (addr, 0), index = XEXP (addr, 1); \
3096 fputs (reg_names[REGNO (base)], FILE); \
3097 if (index == 0) \
3098 fprintf (FILE, "%+d", offset); \
3099 else if (GET_CODE (index) == REG) \
3100 fprintf (FILE, "+%s", reg_names[REGNO (index)]); \
3101 else if (GET_CODE (index) == SYMBOL_REF \
3102 || GET_CODE (index) == CONST) \
3103 fputc ('+', FILE), output_addr_const (FILE, index); \
3104 else abort (); \
3106 else if (GET_CODE (addr) == MINUS \
3107 && GET_CODE (XEXP (addr, 1)) == LABEL_REF) \
3109 output_addr_const (FILE, XEXP (addr, 0)); \
3110 fputs ("-(", FILE); \
3111 output_addr_const (FILE, XEXP (addr, 1)); \
3112 fputs ("-.)", FILE); \
3114 else if (GET_CODE (addr) == LO_SUM) \
3116 output_operand (XEXP (addr, 0), 0); \
3117 fputs ("+%lo(", FILE); \
3118 output_address (XEXP (addr, 1)); \
3119 fputc (')', FILE); \
3121 else if (flag_pic && GET_CODE (addr) == CONST \
3122 && GET_CODE (XEXP (addr, 0)) == MINUS \
3123 && GET_CODE (XEXP (XEXP (addr, 0), 1)) == CONST \
3124 && GET_CODE (XEXP (XEXP (XEXP (addr, 0), 1), 0)) == MINUS \
3125 && XEXP (XEXP (XEXP (XEXP (addr, 0), 1), 0), 1) == pc_rtx) \
3127 addr = XEXP (addr, 0); \
3128 output_addr_const (FILE, XEXP (addr, 0)); \
3129 /* Group the args of the second CONST in parenthesis. */ \
3130 fputs ("-(", FILE); \
3131 /* Skip past the second CONST--it does nothing for us. */\
3132 output_addr_const (FILE, XEXP (XEXP (addr, 1), 0)); \
3133 /* Close the parenthesis. */ \
3134 fputc (')', FILE); \
3136 else \
3138 output_addr_const (FILE, addr); \
3142 /* The number of Pmode words for the setjmp buffer. */
3143 #define JMP_BUF_SIZE 12
3145 #define DONT_ACCESS_GBLS_AFTER_EPILOGUE (flag_pic)
3147 /* Declare functions defined in sparc.c and used in templates. */
3149 extern char *singlemove_string ();
3150 extern char *doublemove_string ();
3151 extern char *output_move_double ();
3152 extern char *output_move_quad ();
3153 extern char *output_fp_move_double ();
3154 extern char *output_fp_move_quad ();
3155 extern char *output_block_move ();
3156 extern char *output_scc_insn ();
3157 extern char *output_cbranch ();
3158 extern char *output_v9branch ();
3159 extern char *output_return ();
3161 /* Defined in flags.h, but insn-emit.c does not include flags.h. */
3163 extern int flag_pic;