* alpha.h: NULL_PTR -> NULL.
[official-gcc.git] / gcc / config / rs6000 / rs6000.h
blobfe48c0afc6a30c2b1270f500fad4043ddb4a4a5e
1 /* Definitions of target machine for GNU compiler, for IBM RS/6000.
2 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 2000, 2001 Free Software Foundation, Inc.
4 Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
24 /* Note that some other tm.h files include this one and then override
25 many of the definitions. */
27 /* Definitions for the object file format. These are set at
28 compile-time. */
30 #define OBJECT_XCOFF 1
31 #define OBJECT_ELF 2
32 #define OBJECT_PEF 3
33 #define OBJECT_MACHO 4
35 #define TARGET_ELF (TARGET_OBJECT_FORMAT == OBJECT_ELF)
36 #define TARGET_AIX (TARGET_OBJECT_FORMAT == OBJECT_XCOFF)
37 #define TARGET_MACOS (TARGET_OBJECT_FORMAT == OBJECT_PEF)
38 #define TARGET_MACHO (TARGET_OBJECT_FORMAT == OBJECT_MACHO)
40 /* Print subsidiary information on the compiler version in use. */
41 #define TARGET_VERSION ;
43 /* Default string to use for cpu if not specified. */
44 #ifndef TARGET_CPU_DEFAULT
45 #define TARGET_CPU_DEFAULT ((char *)0)
46 #endif
48 /* Common CPP definitions used by CPP_SPEC among the various targets
49 for handling -mcpu=xxx switches. */
50 #define CPP_CPU_SPEC \
51 "%{!mcpu*: \
52 %{mpower: %{!mpower2: -D_ARCH_PWR}} \
53 %{mpower2: -D_ARCH_PWR2} \
54 %{mpowerpc*: -D_ARCH_PPC} \
55 %{mno-power: %{!mpowerpc*: -D_ARCH_COM}} \
56 %{!mno-power: %{!mpower2: %(cpp_default)}}} \
57 %{mcpu=common: -D_ARCH_COM} \
58 %{mcpu=power: -D_ARCH_PWR} \
59 %{mcpu=power2: -D_ARCH_PWR2} \
60 %{mcpu=powerpc: -D_ARCH_PPC} \
61 %{mcpu=rios: -D_ARCH_PWR} \
62 %{mcpu=rios1: -D_ARCH_PWR} \
63 %{mcpu=rios2: -D_ARCH_PWR2} \
64 %{mcpu=rsc: -D_ARCH_PWR} \
65 %{mcpu=rsc1: -D_ARCH_PWR} \
66 %{mcpu=401: -D_ARCH_PPC} \
67 %{mcpu=403: -D_ARCH_PPC} \
68 %{mcpu=505: -D_ARCH_PPC} \
69 %{mcpu=601: -D_ARCH_PPC -D_ARCH_PWR} \
70 %{mcpu=602: -D_ARCH_PPC} \
71 %{mcpu=603: -D_ARCH_PPC} \
72 %{mcpu=603e: -D_ARCH_PPC} \
73 %{mcpu=ec603e: -D_ARCH_PPC} \
74 %{mcpu=604: -D_ARCH_PPC} \
75 %{mcpu=604e: -D_ARCH_PPC} \
76 %{mcpu=620: -D_ARCH_PPC} \
77 %{mcpu=740: -D_ARCH_PPC} \
78 %{mcpu=750: -D_ARCH_PPC} \
79 %{mcpu=801: -D_ARCH_PPC} \
80 %{mcpu=821: -D_ARCH_PPC} \
81 %{mcpu=823: -D_ARCH_PPC} \
82 %{mcpu=860: -D_ARCH_PPC}"
84 #define CPP_DEFAULT_SPEC "-D_ARCH_PWR"
86 /* Common ASM definitions used by ASM_SPEC among the various targets
87 for handling -mcpu=xxx switches. */
88 #define ASM_CPU_SPEC \
89 "%{!mcpu*: \
90 %{mpower: %{!mpower2: -mpwr}} \
91 %{mpower2: -mpwrx} \
92 %{mpowerpc*: -mppc} \
93 %{mno-power: %{!mpowerpc*: -mcom}} \
94 %{!mno-power: %{!mpower2: %(asm_default)}}} \
95 %{mcpu=common: -mcom} \
96 %{mcpu=power: -mpwr} \
97 %{mcpu=power2: -mpwrx} \
98 %{mcpu=powerpc: -mppc} \
99 %{mcpu=rios: -mpwr} \
100 %{mcpu=rios1: -mpwr} \
101 %{mcpu=rios2: -mpwrx} \
102 %{mcpu=rsc: -mpwr} \
103 %{mcpu=rsc1: -mpwr} \
104 %{mcpu=401: -mppc} \
105 %{mcpu=403: -mppc} \
106 %{mcpu=505: -mppc} \
107 %{mcpu=601: -m601} \
108 %{mcpu=602: -mppc} \
109 %{mcpu=603: -mppc} \
110 %{mcpu=603e: -mppc} \
111 %{mcpu=ec603e: -mppc} \
112 %{mcpu=604: -mppc} \
113 %{mcpu=604e: -mppc} \
114 %{mcpu=620: -mppc} \
115 %{mcpu=740: -mppc} \
116 %{mcpu=750: -mppc} \
117 %{mcpu=801: -mppc} \
118 %{mcpu=821: -mppc} \
119 %{mcpu=823: -mppc} \
120 %{mcpu=860: -mppc}"
122 #define ASM_DEFAULT_SPEC ""
124 /* This macro defines names of additional specifications to put in the specs
125 that can be used in various specifications like CC1_SPEC. Its definition
126 is an initializer with a subgrouping for each command option.
128 Each subgrouping contains a string constant, that defines the
129 specification name, and a string constant that used by the GNU CC driver
130 program.
132 Do not define this macro if it does not need to do anything. */
134 #define SUBTARGET_EXTRA_SPECS
136 #define EXTRA_SPECS \
137 { "cpp_cpu", CPP_CPU_SPEC }, \
138 { "cpp_default", CPP_DEFAULT_SPEC }, \
139 { "asm_cpu", ASM_CPU_SPEC }, \
140 { "asm_default", ASM_DEFAULT_SPEC }, \
141 SUBTARGET_EXTRA_SPECS
143 /* Architecture type. */
145 extern int target_flags;
147 /* Use POWER architecture instructions and MQ register. */
148 #define MASK_POWER 0x00000001
150 /* Use POWER2 extensions to POWER architecture. */
151 #define MASK_POWER2 0x00000002
153 /* Use PowerPC architecture instructions. */
154 #define MASK_POWERPC 0x00000004
156 /* Use PowerPC General Purpose group optional instructions, e.g. fsqrt. */
157 #define MASK_PPC_GPOPT 0x00000008
159 /* Use PowerPC Graphics group optional instructions, e.g. fsel. */
160 #define MASK_PPC_GFXOPT 0x00000010
162 /* Use PowerPC-64 architecture instructions. */
163 #define MASK_POWERPC64 0x00000020
165 /* Use revised mnemonic names defined for PowerPC architecture. */
166 #define MASK_NEW_MNEMONICS 0x00000040
168 /* Disable placing fp constants in the TOC; can be turned on when the
169 TOC overflows. */
170 #define MASK_NO_FP_IN_TOC 0x00000080
172 /* Disable placing symbol+offset constants in the TOC; can be turned on when
173 the TOC overflows. */
174 #define MASK_NO_SUM_IN_TOC 0x00000100
176 /* Output only one TOC entry per module. Normally linking fails if
177 there are more than 16K unique variables/constants in an executable. With
178 this option, linking fails only if there are more than 16K modules, or
179 if there are more than 16K unique variables/constant in a single module.
181 This is at the cost of having 2 extra loads and one extra store per
182 function, and one less allocable register. */
183 #define MASK_MINIMAL_TOC 0x00000200
185 /* Nonzero for the 64bit model: ints, longs, and pointers are 64 bits. */
186 #define MASK_64BIT 0x00000400
188 /* Disable use of FPRs. */
189 #define MASK_SOFT_FLOAT 0x00000800
191 /* Enable load/store multiple, even on powerpc */
192 #define MASK_MULTIPLE 0x00001000
193 #define MASK_MULTIPLE_SET 0x00002000
195 /* Use string instructions for block moves */
196 #define MASK_STRING 0x00004000
197 #define MASK_STRING_SET 0x00008000
199 /* Disable update form of load/store */
200 #define MASK_NO_UPDATE 0x00010000
202 /* Disable fused multiply/add operations */
203 #define MASK_NO_FUSED_MADD 0x00020000
205 /* Nonzero if we need to schedule the prolog and epilog. */
206 #define MASK_SCHED_PROLOG 0x00040000
208 #define TARGET_POWER (target_flags & MASK_POWER)
209 #define TARGET_POWER2 (target_flags & MASK_POWER2)
210 #define TARGET_POWERPC (target_flags & MASK_POWERPC)
211 #define TARGET_PPC_GPOPT (target_flags & MASK_PPC_GPOPT)
212 #define TARGET_PPC_GFXOPT (target_flags & MASK_PPC_GFXOPT)
213 #define TARGET_NEW_MNEMONICS (target_flags & MASK_NEW_MNEMONICS)
214 #define TARGET_NO_FP_IN_TOC (target_flags & MASK_NO_FP_IN_TOC)
215 #define TARGET_NO_SUM_IN_TOC (target_flags & MASK_NO_SUM_IN_TOC)
216 #define TARGET_MINIMAL_TOC (target_flags & MASK_MINIMAL_TOC)
217 #define TARGET_64BIT (target_flags & MASK_64BIT)
218 #define TARGET_SOFT_FLOAT (target_flags & MASK_SOFT_FLOAT)
219 #define TARGET_MULTIPLE (target_flags & MASK_MULTIPLE)
220 #define TARGET_MULTIPLE_SET (target_flags & MASK_MULTIPLE_SET)
221 #define TARGET_STRING (target_flags & MASK_STRING)
222 #define TARGET_STRING_SET (target_flags & MASK_STRING_SET)
223 #define TARGET_NO_UPDATE (target_flags & MASK_NO_UPDATE)
224 #define TARGET_NO_FUSED_MADD (target_flags & MASK_NO_FUSED_MADD)
225 #define TARGET_SCHED_PROLOG (target_flags & MASK_SCHED_PROLOG)
227 #define TARGET_32BIT (! TARGET_64BIT)
228 #define TARGET_HARD_FLOAT (! TARGET_SOFT_FLOAT)
229 #define TARGET_UPDATE (! TARGET_NO_UPDATE)
230 #define TARGET_FUSED_MADD (! TARGET_NO_FUSED_MADD)
232 #ifdef IN_LIBGCC2
233 /* For libgcc2 we make sure this is a compile time constant */
234 #ifdef __64BIT__
235 #define TARGET_POWERPC64 1
236 #else
237 #define TARGET_POWERPC64 0
238 #endif
239 #else
240 #define TARGET_POWERPC64 (target_flags & MASK_POWERPC64)
241 #endif
243 #define TARGET_XL_CALL 0
245 /* Run-time compilation parameters selecting different hardware subsets.
247 Macro to define tables used to set the flags.
248 This is a list in braces of pairs in braces,
249 each pair being { "NAME", VALUE }
250 where VALUE is the bits to set or minus the bits to clear.
251 An empty string NAME is used to identify the default VALUE. */
253 #define TARGET_SWITCHES \
254 {{"power", MASK_POWER | MASK_MULTIPLE | MASK_STRING, \
255 N_("Use POWER instruction set")}, \
256 {"power2", (MASK_POWER | MASK_MULTIPLE | MASK_STRING \
257 | MASK_POWER2), \
258 N_("Use POWER2 instruction set")}, \
259 {"no-power2", - MASK_POWER2, \
260 N_("Do not use POWER2 instruction set")}, \
261 {"no-power", - (MASK_POWER | MASK_POWER2 | MASK_MULTIPLE \
262 | MASK_STRING), \
263 N_("Do not use POWER instruction set")}, \
264 {"powerpc", MASK_POWERPC, \
265 N_("Use PowerPC instruction set")}, \
266 {"no-powerpc", - (MASK_POWERPC | MASK_PPC_GPOPT \
267 | MASK_PPC_GFXOPT | MASK_POWERPC64), \
268 N_("Do not use PowerPC instruction set")}, \
269 {"powerpc-gpopt", MASK_POWERPC | MASK_PPC_GPOPT, \
270 N_("Use PowerPC General Purpose group optional instructions")},\
271 {"no-powerpc-gpopt", - MASK_PPC_GPOPT, \
272 N_("Don't use PowerPC General Purpose group optional instructions")},\
273 {"powerpc-gfxopt", MASK_POWERPC | MASK_PPC_GFXOPT, \
274 N_("Use PowerPC Graphics group optional instructions")},\
275 {"no-powerpc-gfxopt", - MASK_PPC_GFXOPT, \
276 N_("Don't use PowerPC Graphics group optional instructions")},\
277 {"powerpc64", MASK_POWERPC64, \
278 N_("Use PowerPC-64 instruction set")}, \
279 {"no-powerpc64", - MASK_POWERPC64, \
280 N_("Don't use PowerPC-64 instruction set")}, \
281 {"new-mnemonics", MASK_NEW_MNEMONICS, \
282 N_("Use new mnemonics for PowerPC architecture")},\
283 {"old-mnemonics", -MASK_NEW_MNEMONICS, \
284 N_("Use old mnemonics for PowerPC architecture")},\
285 {"full-toc", - (MASK_NO_FP_IN_TOC | MASK_NO_SUM_IN_TOC \
286 | MASK_MINIMAL_TOC), \
287 N_("Put everything in the regular TOC")}, \
288 {"fp-in-toc", - MASK_NO_FP_IN_TOC, \
289 N_("Place floating point constants in TOC")}, \
290 {"no-fp-in-toc", MASK_NO_FP_IN_TOC, \
291 N_("Don't place floating point constants in TOC")},\
292 {"sum-in-toc", - MASK_NO_SUM_IN_TOC, \
293 N_("Place symbol+offset constants in TOC")}, \
294 {"no-sum-in-toc", MASK_NO_SUM_IN_TOC, \
295 N_("Don't place symbol+offset constants in TOC")},\
296 {"minimal-toc", MASK_MINIMAL_TOC, \
297 "Use only one TOC entry per procedure"}, \
298 {"minimal-toc", - (MASK_NO_FP_IN_TOC | MASK_NO_SUM_IN_TOC), \
299 ""}, \
300 {"no-minimal-toc", - MASK_MINIMAL_TOC, \
301 N_("Place variable addresses in the regular TOC")},\
302 {"hard-float", - MASK_SOFT_FLOAT, \
303 N_("Use hardware fp")}, \
304 {"soft-float", MASK_SOFT_FLOAT, \
305 N_("Do not use hardware fp")}, \
306 {"multiple", MASK_MULTIPLE | MASK_MULTIPLE_SET, \
307 N_("Generate load/store multiple instructions")}, \
308 {"no-multiple", - MASK_MULTIPLE, \
309 N_("Do not generate load/store multiple instructions")},\
310 {"no-multiple", MASK_MULTIPLE_SET, \
311 ""}, \
312 {"string", MASK_STRING | MASK_STRING_SET, \
313 N_("Generate string instructions for block moves")},\
314 {"no-string", - MASK_STRING, \
315 N_("Do not generate string instructions for block moves")},\
316 {"no-string", MASK_STRING_SET, \
317 ""}, \
318 {"update", - MASK_NO_UPDATE, \
319 N_("Generate load/store with update instructions")},\
320 {"no-update", MASK_NO_UPDATE, \
321 N_("Do not generate load/store with update instructions")},\
322 {"fused-madd", - MASK_NO_FUSED_MADD, \
323 N_("Generate fused multiply/add instructions")},\
324 {"no-fused-madd", MASK_NO_FUSED_MADD, \
325 N_("Don't generate fused multiply/add instructions")},\
326 {"sched-prolog", MASK_SCHED_PROLOG, \
327 ""}, \
328 {"no-sched-prolog", -MASK_SCHED_PROLOG, \
329 N_("Don't schedule the start and end of the procedure")},\
330 {"sched-epilog", MASK_SCHED_PROLOG, \
331 ""}, \
332 {"no-sched-epilog", -MASK_SCHED_PROLOG, \
333 ""}, \
334 SUBTARGET_SWITCHES \
335 {"", TARGET_DEFAULT | MASK_SCHED_PROLOG, \
336 ""}}
338 #define TARGET_DEFAULT (MASK_POWER | MASK_MULTIPLE | MASK_STRING)
340 /* This is meant to be redefined in the host dependent files */
341 #define SUBTARGET_SWITCHES
343 /* Processor type. Order must match cpu attribute in MD file. */
344 enum processor_type
346 PROCESSOR_RIOS1,
347 PROCESSOR_RIOS2,
348 PROCESSOR_RS64A,
349 PROCESSOR_MPCCORE,
350 PROCESSOR_PPC403,
351 PROCESSOR_PPC601,
352 PROCESSOR_PPC603,
353 PROCESSOR_PPC604,
354 PROCESSOR_PPC604e,
355 PROCESSOR_PPC620,
356 PROCESSOR_PPC630,
357 PROCESSOR_PPC750
360 extern enum processor_type rs6000_cpu;
362 /* Recast the processor type to the cpu attribute. */
363 #define rs6000_cpu_attr ((enum attr_cpu)rs6000_cpu)
365 /* Define generic processor types based upon current deployment. */
366 #define PROCESSOR_COMMON PROCESSOR_PPC601
367 #define PROCESSOR_POWER PROCESSOR_RIOS1
368 #define PROCESSOR_POWERPC PROCESSOR_PPC604
369 #define PROCESSOR_POWERPC64 PROCESSOR_RS64A
371 /* Define the default processor. This is overridden by other tm.h files. */
372 #define PROCESSOR_DEFAULT PROCESSOR_RIOS1
373 #define PROCESSOR_DEFAULT64 PROCESSOR_RS64A
375 /* Specify the dialect of assembler to use. New mnemonics is dialect one
376 and the old mnemonics are dialect zero. */
377 #define ASSEMBLER_DIALECT (TARGET_NEW_MNEMONICS ? 1 : 0)
379 /* This macro is similar to `TARGET_SWITCHES' but defines names of
380 command options that have values. Its definition is an
381 initializer with a subgrouping for each command option.
383 Each subgrouping contains a string constant, that defines the
384 fixed part of the option name, and the address of a variable.
385 The variable, type `char *', is set to the variable part of the
386 given option if the fixed part matches. The actual option name
387 is made by appending `-m' to the specified name.
389 Here is an example which defines `-mshort-data-NUMBER'. If the
390 given option is `-mshort-data-512', the variable `m88k_short_data'
391 will be set to the string `"512"'.
393 extern char *m88k_short_data;
394 #define TARGET_OPTIONS { { "short-data-", &m88k_short_data } } */
396 /* This is meant to be overridden in target specific files. */
397 #define SUBTARGET_OPTIONS
399 #define TARGET_OPTIONS \
401 {"cpu=", &rs6000_select[1].string, \
402 N_("Use features of and schedule code for given CPU") }, \
403 {"tune=", &rs6000_select[2].string, \
404 N_("Schedule code for given CPU") }, \
405 {"debug=", &rs6000_debug_name, N_("Enable debug output") }, \
406 SUBTARGET_OPTIONS \
409 /* rs6000_select[0] is reserved for the default cpu defined via --with-cpu */
410 struct rs6000_cpu_select
412 const char *string;
413 const char *name;
414 int set_tune_p;
415 int set_arch_p;
418 extern struct rs6000_cpu_select rs6000_select[];
420 /* Debug support */
421 extern const char *rs6000_debug_name; /* Name for -mdebug-xxxx option */
422 extern int rs6000_debug_stack; /* debug stack applications */
423 extern int rs6000_debug_arg; /* debug argument handling */
425 #define TARGET_DEBUG_STACK rs6000_debug_stack
426 #define TARGET_DEBUG_ARG rs6000_debug_arg
428 /* Sometimes certain combinations of command options do not make sense
429 on a particular target machine. You can define a macro
430 `OVERRIDE_OPTIONS' to take account of this. This macro, if
431 defined, is executed once just after all the command options have
432 been parsed.
434 Don't use this macro to turn on various extra optimizations for
435 `-O'. That is what `OPTIMIZATION_OPTIONS' is for.
437 On the RS/6000 this is used to define the target cpu type. */
439 #define OVERRIDE_OPTIONS rs6000_override_options (TARGET_CPU_DEFAULT)
441 /* Define this to change the optimizations performed by default. */
442 #define OPTIMIZATION_OPTIONS(LEVEL,SIZE) optimization_options(LEVEL,SIZE)
444 /* Show we can debug even without a frame pointer. */
445 #define CAN_DEBUG_WITHOUT_FP
447 /* target machine storage layout */
449 /* Define to support cross compilation to an RS6000 target. */
450 #define REAL_ARITHMETIC
452 /* Define this macro if it is advisable to hold scalars in registers
453 in a wider mode than that declared by the program. In such cases,
454 the value is constrained to be within the bounds of the declared
455 type, but kept valid in the wider mode. The signedness of the
456 extension may differ from that of the type. */
458 #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
459 if (GET_MODE_CLASS (MODE) == MODE_INT \
460 && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
461 (MODE) = word_mode;
463 /* Define this if function arguments should also be promoted using the above
464 procedure. */
466 #define PROMOTE_FUNCTION_ARGS
468 /* Likewise, if the function return value is promoted. */
470 #define PROMOTE_FUNCTION_RETURN
472 /* Define this if most significant bit is lowest numbered
473 in instructions that operate on numbered bit-fields. */
474 /* That is true on RS/6000. */
475 #define BITS_BIG_ENDIAN 1
477 /* Define this if most significant byte of a word is the lowest numbered. */
478 /* That is true on RS/6000. */
479 #define BYTES_BIG_ENDIAN 1
481 /* Define this if most significant word of a multiword number is lowest
482 numbered.
484 For RS/6000 we can decide arbitrarily since there are no machine
485 instructions for them. Might as well be consistent with bits and bytes. */
486 #define WORDS_BIG_ENDIAN 1
488 /* number of bits in an addressable storage unit */
489 #define BITS_PER_UNIT 8
491 /* Width in bits of a "word", which is the contents of a machine register.
492 Note that this is not necessarily the width of data type `int';
493 if using 16-bit ints on a 68000, this would still be 32.
494 But on a machine with 16-bit registers, this would be 16. */
495 #define BITS_PER_WORD (! TARGET_POWERPC64 ? 32 : 64)
496 #define MAX_BITS_PER_WORD 64
498 /* Width of a word, in units (bytes). */
499 #define UNITS_PER_WORD (! TARGET_POWERPC64 ? 4 : 8)
500 #define MIN_UNITS_PER_WORD 4
501 #define UNITS_PER_FP_WORD 8
503 /* Type used for ptrdiff_t, as a string used in a declaration. */
504 #define PTRDIFF_TYPE "int"
506 /* Type used for size_t, as a string used in a declaration. */
507 #define SIZE_TYPE "long unsigned int"
509 /* Type used for wchar_t, as a string used in a declaration. */
510 #define WCHAR_TYPE "short unsigned int"
512 /* Width of wchar_t in bits. */
513 #define WCHAR_TYPE_SIZE 16
515 /* A C expression for the size in bits of the type `short' on the
516 target machine. If you don't define this, the default is half a
517 word. (If this would be less than one storage unit, it is
518 rounded up to one unit.) */
519 #define SHORT_TYPE_SIZE 16
521 /* A C expression for the size in bits of the type `int' on the
522 target machine. If you don't define this, the default is one
523 word. */
524 #define INT_TYPE_SIZE 32
526 /* A C expression for the size in bits of the type `long' on the
527 target machine. If you don't define this, the default is one
528 word. */
529 #define LONG_TYPE_SIZE (TARGET_32BIT ? 32 : 64)
530 #define MAX_LONG_TYPE_SIZE 64
532 /* A C expression for the size in bits of the type `long long' on the
533 target machine. If you don't define this, the default is two
534 words. */
535 #define LONG_LONG_TYPE_SIZE 64
537 /* A C expression for the size in bits of the type `char' on the
538 target machine. If you don't define this, the default is one
539 quarter of a word. (If this would be less than one storage unit,
540 it is rounded up to one unit.) */
541 #define CHAR_TYPE_SIZE BITS_PER_UNIT
543 /* A C expression for the size in bits of the type `float' on the
544 target machine. If you don't define this, the default is one
545 word. */
546 #define FLOAT_TYPE_SIZE 32
548 /* A C expression for the size in bits of the type `double' on the
549 target machine. If you don't define this, the default is two
550 words. */
551 #define DOUBLE_TYPE_SIZE 64
553 /* A C expression for the size in bits of the type `long double' on
554 the target machine. If you don't define this, the default is two
555 words. */
556 #define LONG_DOUBLE_TYPE_SIZE 64
558 /* Width in bits of a pointer.
559 See also the macro `Pmode' defined below. */
560 #define POINTER_SIZE (TARGET_32BIT ? 32 : 64)
562 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
563 #define PARM_BOUNDARY (TARGET_32BIT ? 32 : 64)
565 /* Boundary (in *bits*) on which stack pointer should be aligned. */
566 #define STACK_BOUNDARY (TARGET_32BIT ? 64 : 128)
568 /* Allocation boundary (in *bits*) for the code of a function. */
569 #define FUNCTION_BOUNDARY 32
571 /* No data type wants to be aligned rounder than this. */
572 #define BIGGEST_ALIGNMENT 64
574 /* Handle #pragma pack. */
575 #define HANDLE_PRAGMA_PACK 1
577 /* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints. */
578 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
579 (TYPE_MODE (TREE_CODE (TREE_TYPE (FIELD)) == ARRAY_TYPE \
580 ? get_inner_array_type (FIELD) \
581 : TREE_TYPE (FIELD)) == DFmode \
582 ? MIN ((COMPUTED), 32) : (COMPUTED))
584 /* Alignment of field after `int : 0' in a structure. */
585 #define EMPTY_FIELD_BOUNDARY 32
587 /* Every structure's size must be a multiple of this. */
588 #define STRUCTURE_SIZE_BOUNDARY 8
590 /* A bitfield declared as `int' forces `int' alignment for the struct. */
591 #define PCC_BITFIELD_TYPE_MATTERS 1
593 /* AIX increases natural record alignment to doubleword if the first
594 field is an FP double while the FP fields remain word aligned. */
595 #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \
596 ((TREE_CODE (STRUCT) == RECORD_TYPE \
597 || TREE_CODE (STRUCT) == UNION_TYPE \
598 || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \
599 && TYPE_FIELDS (STRUCT) != 0 \
600 && DECL_MODE (TYPE_FIELDS (STRUCT)) == DFmode \
601 ? MAX (MAX ((COMPUTED), (SPECIFIED)), BIGGEST_ALIGNMENT) \
602 : MAX ((COMPUTED), (SPECIFIED)))
604 /* Make strings word-aligned so strcpy from constants will be faster. */
605 #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
606 (TREE_CODE (EXP) == STRING_CST \
607 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
609 /* Make arrays of chars word-aligned for the same reasons. */
610 #define DATA_ALIGNMENT(TYPE, ALIGN) \
611 (TREE_CODE (TYPE) == ARRAY_TYPE \
612 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
613 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
615 /* Non-zero if move instructions will actually fail to work
616 when given unaligned data. */
617 #define STRICT_ALIGNMENT 0
619 /* Define this macro to be the value 1 if unaligned accesses have a cost
620 many times greater than aligned accesses, for example if they are
621 emulated in a trap handler. */
622 #define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) \
623 ((STRICT_ALIGNMENT \
624 || (((MODE) == SFmode || (MODE) == DFmode || (MODE) == DImode) \
625 && (ALIGN) < 32)) ? 1 : 0)
627 /* Standard register usage. */
629 /* Number of actual hardware registers.
630 The hardware registers are assigned numbers for the compiler
631 from 0 to just below FIRST_PSEUDO_REGISTER.
632 All registers that the compiler knows about must be given numbers,
633 even those that are not normally considered general registers.
635 RS/6000 has 32 fixed-point registers, 32 floating-point registers,
636 an MQ register, a count register, a link register, and 8 condition
637 register fields, which we view here as separate registers.
639 In addition, the difference between the frame and argument pointers is
640 a function of the number of registers saved, so we need to have a
641 register for AP that will later be eliminated in favor of SP or FP.
642 This is a normal register, but it is fixed.
644 We also create a pseudo register for float/int conversions, that will
645 really represent the memory location used. It is represented here as
646 a register, in order to work around problems in allocating stack storage
647 in inline functions. */
649 #define FIRST_PSEUDO_REGISTER 77
651 /* This must not decrease, for backwards compatibility. If
652 FIRST_PSEUDO_REGISTER increases, this should as well. */
653 #define DWARF_FRAME_REGISTERS 77
655 /* 1 for registers that have pervasive standard uses
656 and are not available for the register allocator.
658 On RS/6000, r1 is used for the stack and r2 is used as the TOC pointer.
660 cr5 is not supposed to be used.
662 On System V implementations, r13 is fixed and not available for use. */
664 #define FIXED_REGISTERS \
665 {0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, FIXED_R13, 0, 0, \
666 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
667 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
668 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
669 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1}
671 /* 1 for registers not available across function calls.
672 These must include the FIXED_REGISTERS and also any
673 registers that can be used without being saved.
674 The latter must include the registers where values are returned
675 and the register where structure-value addresses are passed.
676 Aside from that, you can include as many other registers as you like. */
678 #define CALL_USED_REGISTERS \
679 {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, FIXED_R13, 0, 0, \
680 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
681 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, \
682 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
683 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1}
685 #define MQ_REGNO 64
686 #define CR0_REGNO 68
687 #define CR1_REGNO 69
688 #define CR2_REGNO 70
689 #define CR3_REGNO 71
690 #define CR4_REGNO 72
691 #define MAX_CR_REGNO 75
692 #define XER_REGNO 76
694 /* List the order in which to allocate registers. Each register must be
695 listed once, even those in FIXED_REGISTERS.
697 We allocate in the following order:
698 fp0 (not saved or used for anything)
699 fp13 - fp2 (not saved; incoming fp arg registers)
700 fp1 (not saved; return value)
701 fp31 - fp14 (saved; order given to save least number)
702 cr7, cr6 (not saved or special)
703 cr1 (not saved, but used for FP operations)
704 cr0 (not saved, but used for arithmetic operations)
705 cr4, cr3, cr2 (saved)
706 r0 (not saved; cannot be base reg)
707 r9 (not saved; best for TImode)
708 r11, r10, r8-r4 (not saved; highest used first to make less conflict)
709 r3 (not saved; return value register)
710 r31 - r13 (saved; order given to save least number)
711 r12 (not saved; if used for DImode or DFmode would use r13)
712 mq (not saved; best to use it if we can)
713 ctr (not saved; when we have the choice ctr is better)
714 lr (saved)
715 cr5, r1, r2, ap, xer (fixed) */
717 #define REG_ALLOC_ORDER \
718 {32, \
719 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, \
720 33, \
721 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, \
722 50, 49, 48, 47, 46, \
723 75, 74, 69, 68, 72, 71, 70, \
724 0, \
725 9, 11, 10, 8, 7, 6, 5, 4, \
726 3, \
727 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, \
728 18, 17, 16, 15, 14, 13, 12, \
729 64, 66, 65, \
730 73, 1, 2, 67, 76}
732 /* True if register is floating-point. */
733 #define FP_REGNO_P(N) ((N) >= 32 && (N) <= 63)
735 /* True if register is a condition register. */
736 #define CR_REGNO_P(N) ((N) >= 68 && (N) <= 75)
738 /* True if register is a condition register, but not cr0. */
739 #define CR_REGNO_NOT_CR0_P(N) ((N) >= 69 && (N) <= 75)
741 /* True if register is an integer register. */
742 #define INT_REGNO_P(N) ((N) <= 31 || (N) == ARG_POINTER_REGNUM)
744 /* True if register is the XER register. */
745 #define XER_REGNO_P(N) ((N) == XER_REGNO)
747 /* Return number of consecutive hard regs needed starting at reg REGNO
748 to hold something of mode MODE.
749 This is ordinarily the length in words of a value of mode MODE
750 but can be less for certain modes in special long registers.
752 POWER and PowerPC GPRs hold 32 bits worth;
753 PowerPC64 GPRs and FPRs point register holds 64 bits worth. */
755 #define HARD_REGNO_NREGS(REGNO, MODE) \
756 (FP_REGNO_P (REGNO) \
757 ? ((GET_MODE_SIZE (MODE) + UNITS_PER_FP_WORD - 1) / UNITS_PER_FP_WORD) \
758 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
760 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
761 For POWER and PowerPC, the GPRs can hold any mode, but the float
762 registers only can hold floating modes and DImode, and CR register only
763 can hold CC modes. We cannot put TImode anywhere except general
764 register and it must be able to fit within the register set. */
766 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
767 (FP_REGNO_P (REGNO) ? \
768 (GET_MODE_CLASS (MODE) == MODE_FLOAT \
769 || (GET_MODE_CLASS (MODE) == MODE_INT \
770 && GET_MODE_SIZE (MODE) == UNITS_PER_FP_WORD)) \
771 : CR_REGNO_P (REGNO) ? GET_MODE_CLASS (MODE) == MODE_CC \
772 : XER_REGNO_P (REGNO) ? (MODE) == PSImode \
773 : ! INT_REGNO_P (REGNO) ? (GET_MODE_CLASS (MODE) == MODE_INT \
774 && GET_MODE_SIZE (MODE) <= UNITS_PER_WORD) \
775 : 1)
777 /* Value is 1 if it is a good idea to tie two pseudo registers
778 when one has mode MODE1 and one has mode MODE2.
779 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
780 for any hard reg, then this must be 0 for correct output. */
781 #define MODES_TIEABLE_P(MODE1, MODE2) \
782 (GET_MODE_CLASS (MODE1) == MODE_FLOAT \
783 ? GET_MODE_CLASS (MODE2) == MODE_FLOAT \
784 : GET_MODE_CLASS (MODE2) == MODE_FLOAT \
785 ? GET_MODE_CLASS (MODE1) == MODE_FLOAT \
786 : GET_MODE_CLASS (MODE1) == MODE_CC \
787 ? GET_MODE_CLASS (MODE2) == MODE_CC \
788 : GET_MODE_CLASS (MODE2) == MODE_CC \
789 ? GET_MODE_CLASS (MODE1) == MODE_CC \
790 : 1)
792 /* A C expression returning the cost of moving data from a register of class
793 CLASS1 to one of CLASS2.
795 On the RS/6000, copying between floating-point and fixed-point
796 registers is expensive. */
798 #define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \
799 ((CLASS1) == FLOAT_REGS && (CLASS2) == FLOAT_REGS ? 2 \
800 : (CLASS1) == FLOAT_REGS && (CLASS2) != FLOAT_REGS ? 10 \
801 : (CLASS1) != FLOAT_REGS && (CLASS2) == FLOAT_REGS ? 10 \
802 : (((CLASS1) == SPECIAL_REGS || (CLASS1) == MQ_REGS \
803 || (CLASS1) == LINK_REGS || (CLASS1) == CTR_REGS \
804 || (CLASS1) == LINK_OR_CTR_REGS) \
805 && ((CLASS2) == SPECIAL_REGS || (CLASS2) == MQ_REGS \
806 || (CLASS2) == LINK_REGS || (CLASS2) == CTR_REGS \
807 || (CLASS2) == LINK_OR_CTR_REGS)) ? 10 \
808 : 2)
810 /* A C expressions returning the cost of moving data of MODE from a register to
811 or from memory.
813 On the RS/6000, bump this up a bit. */
815 #define MEMORY_MOVE_COST(MODE, CLASS, IN) \
816 ((GET_MODE_CLASS (MODE) == MODE_FLOAT \
817 && (rs6000_cpu == PROCESSOR_RIOS1 || rs6000_cpu == PROCESSOR_PPC601) \
818 ? 3 : 2) \
819 + 4)
821 /* Specify the cost of a branch insn; roughly the number of extra insns that
822 should be added to avoid a branch.
824 Set this to 3 on the RS/6000 since that is roughly the average cost of an
825 unscheduled conditional branch. */
827 #define BRANCH_COST 3
829 /* A C statement (sans semicolon) to update the integer variable COST
830 based on the relationship between INSN that is dependent on
831 DEP_INSN through the dependence LINK. The default is to make no
832 adjustment to COST. On the RS/6000, ignore the cost of anti- and
833 output-dependencies. In fact, output dependencies on the CR do have
834 a cost, but it is probably not worthwhile to track it. */
836 #define ADJUST_COST(INSN, LINK, DEP_INSN, COST) \
837 (COST) = rs6000_adjust_cost (INSN,LINK,DEP_INSN,COST)
839 /* A C statement (sans semicolon) to update the integer scheduling priority
840 INSN_PRIORITY (INSN). Reduce the priority to execute the INSN earlier,
841 increase the priority to execute INSN later. Do not define this macro if
842 you do not need to adjust the scheduling priorities of insns. */
844 #define ADJUST_PRIORITY(INSN) \
845 INSN_PRIORITY (INSN) = rs6000_adjust_priority (INSN, INSN_PRIORITY (INSN))
847 /* Define this macro to change register usage conditional on target flags.
848 Set MQ register fixed (already call_used) if not POWER architecture
849 (RIOS1, RIOS2, RSC, and PPC601) so that it will not be allocated.
850 64-bit AIX reserves GPR13 for thread-private data.
851 Conditionally disable FPRs. */
853 #define CONDITIONAL_REGISTER_USAGE \
855 if (! TARGET_POWER) \
856 fixed_regs[64] = 1; \
857 if (TARGET_64BIT) \
858 fixed_regs[13] = call_used_regs[13] = 1; \
859 if (TARGET_SOFT_FLOAT) \
860 for (i = 32; i < 64; i++) \
861 fixed_regs[i] = call_used_regs[i] = 1; \
862 if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) \
863 && flag_pic == 1) \
864 fixed_regs[PIC_OFFSET_TABLE_REGNUM] \
865 = call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
866 if (DEFAULT_ABI == ABI_DARWIN && flag_pic) \
867 global_regs[PIC_OFFSET_TABLE_REGNUM] \
868 = fixed_regs[PIC_OFFSET_TABLE_REGNUM] \
869 = call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
872 /* Specify the registers used for certain standard purposes.
873 The values of these macros are register numbers. */
875 /* RS/6000 pc isn't overloaded on a register that the compiler knows about. */
876 /* #define PC_REGNUM */
878 /* Register to use for pushing function arguments. */
879 #define STACK_POINTER_REGNUM 1
881 /* Base register for access to local variables of the function. */
882 #define FRAME_POINTER_REGNUM 31
884 /* Value should be nonzero if functions must have frame pointers.
885 Zero means the frame pointer need not be set up (and parms
886 may be accessed via the stack pointer) in functions that seem suitable.
887 This is computed in `reload', in reload1.c. */
888 #define FRAME_POINTER_REQUIRED 0
890 /* Base register for access to arguments of the function. */
891 #define ARG_POINTER_REGNUM 67
893 /* Place to put static chain when calling a function that requires it. */
894 #define STATIC_CHAIN_REGNUM 11
896 /* Link register number. */
897 #define LINK_REGISTER_REGNUM 65
899 /* Count register number. */
900 #define COUNT_REGISTER_REGNUM 66
902 /* Place that structure value return address is placed.
904 On the RS/6000, it is passed as an extra parameter. */
905 #define STRUCT_VALUE 0
907 /* Define the classes of registers for register constraints in the
908 machine description. Also define ranges of constants.
910 One of the classes must always be named ALL_REGS and include all hard regs.
911 If there is more than one class, another class must be named NO_REGS
912 and contain no registers.
914 The name GENERAL_REGS must be the name of a class (or an alias for
915 another name such as ALL_REGS). This is the class of registers
916 that is allowed by "g" or "r" in a register constraint.
917 Also, registers outside this class are allocated only when
918 instructions express preferences for them.
920 The classes must be numbered in nondecreasing order; that is,
921 a larger-numbered class must never be contained completely
922 in a smaller-numbered class.
924 For any two classes, it is very desirable that there be another
925 class that represents their union. */
927 /* The RS/6000 has three types of registers, fixed-point, floating-point,
928 and condition registers, plus three special registers, MQ, CTR, and the
929 link register.
931 However, r0 is special in that it cannot be used as a base register.
932 So make a class for registers valid as base registers.
934 Also, cr0 is the only condition code register that can be used in
935 arithmetic insns, so make a separate class for it. */
937 enum reg_class
939 NO_REGS,
940 BASE_REGS,
941 GENERAL_REGS,
942 FLOAT_REGS,
943 NON_SPECIAL_REGS,
944 MQ_REGS,
945 LINK_REGS,
946 CTR_REGS,
947 LINK_OR_CTR_REGS,
948 SPECIAL_REGS,
949 SPEC_OR_GEN_REGS,
950 CR0_REGS,
951 CR_REGS,
952 NON_FLOAT_REGS,
953 XER_REGS,
954 ALL_REGS,
955 LIM_REG_CLASSES
958 #define N_REG_CLASSES (int) LIM_REG_CLASSES
960 /* Give names of register classes as strings for dump file. */
962 #define REG_CLASS_NAMES \
964 "NO_REGS", \
965 "BASE_REGS", \
966 "GENERAL_REGS", \
967 "FLOAT_REGS", \
968 "NON_SPECIAL_REGS", \
969 "MQ_REGS", \
970 "LINK_REGS", \
971 "CTR_REGS", \
972 "LINK_OR_CTR_REGS", \
973 "SPECIAL_REGS", \
974 "SPEC_OR_GEN_REGS", \
975 "CR0_REGS", \
976 "CR_REGS", \
977 "NON_FLOAT_REGS", \
978 "XER_REGS", \
979 "ALL_REGS" \
982 /* Define which registers fit in which classes.
983 This is an initializer for a vector of HARD_REG_SET
984 of length N_REG_CLASSES. */
986 #define REG_CLASS_CONTENTS \
988 { 0x00000000, 0x00000000, 0x00000000 }, /* NO_REGS */ \
989 { 0xfffffffe, 0x00000000, 0x00000008 }, /* BASE_REGS */ \
990 { 0xffffffff, 0x00000000, 0x00000008 }, /* GENERAL_REGS */ \
991 { 0x00000000, 0xffffffff, 0x00000000 }, /* FLOAT_REGS */ \
992 { 0xffffffff, 0xffffffff, 0x00000008 }, /* NON_SPECIAL_REGS */ \
993 { 0x00000000, 0x00000000, 0x00000001 }, /* MQ_REGS */ \
994 { 0x00000000, 0x00000000, 0x00000002 }, /* LINK_REGS */ \
995 { 0x00000000, 0x00000000, 0x00000004 }, /* CTR_REGS */ \
996 { 0x00000000, 0x00000000, 0x00000006 }, /* LINK_OR_CTR_REGS */ \
997 { 0x00000000, 0x00000000, 0x00000007 }, /* SPECIAL_REGS */ \
998 { 0xffffffff, 0x00000000, 0x0000000f }, /* SPEC_OR_GEN_REGS */ \
999 { 0x00000000, 0x00000000, 0x00000010 }, /* CR0_REGS */ \
1000 { 0x00000000, 0x00000000, 0x00000ff0 }, /* CR_REGS */ \
1001 { 0xffffffff, 0x00000000, 0x0000ffff }, /* NON_FLOAT_REGS */ \
1002 { 0x00000000, 0x00000000, 0x00010000 }, /* XER_REGS */ \
1003 { 0xffffffff, 0xffffffff, 0x0001ffff } /* ALL_REGS */ \
1006 /* The same information, inverted:
1007 Return the class number of the smallest class containing
1008 reg number REGNO. This could be a conditional expression
1009 or could index an array. */
1011 #define REGNO_REG_CLASS(REGNO) \
1012 ((REGNO) == 0 ? GENERAL_REGS \
1013 : (REGNO) < 32 ? BASE_REGS \
1014 : FP_REGNO_P (REGNO) ? FLOAT_REGS \
1015 : (REGNO) == CR0_REGNO ? CR0_REGS \
1016 : CR_REGNO_P (REGNO) ? CR_REGS \
1017 : (REGNO) == MQ_REGNO ? MQ_REGS \
1018 : (REGNO) == LINK_REGISTER_REGNUM ? LINK_REGS \
1019 : (REGNO) == COUNT_REGISTER_REGNUM ? CTR_REGS \
1020 : (REGNO) == ARG_POINTER_REGNUM ? BASE_REGS \
1021 : (REGNO) == XER_REGNO ? XER_REGS \
1022 : NO_REGS)
1024 /* The class value for index registers, and the one for base regs. */
1025 #define INDEX_REG_CLASS GENERAL_REGS
1026 #define BASE_REG_CLASS BASE_REGS
1028 /* Get reg_class from a letter such as appears in the machine description. */
1030 #define REG_CLASS_FROM_LETTER(C) \
1031 ((C) == 'f' ? FLOAT_REGS \
1032 : (C) == 'b' ? BASE_REGS \
1033 : (C) == 'h' ? SPECIAL_REGS \
1034 : (C) == 'q' ? MQ_REGS \
1035 : (C) == 'c' ? CTR_REGS \
1036 : (C) == 'l' ? LINK_REGS \
1037 : (C) == 'x' ? CR0_REGS \
1038 : (C) == 'y' ? CR_REGS \
1039 : (C) == 'z' ? XER_REGS \
1040 : NO_REGS)
1042 /* The letters I, J, K, L, M, N, and P in a register constraint string
1043 can be used to stand for particular ranges of immediate operands.
1044 This macro defines what the ranges are.
1045 C is the letter, and VALUE is a constant value.
1046 Return 1 if VALUE is in the range specified by C.
1048 `I' is a signed 16-bit constant
1049 `J' is a constant with only the high-order 16 bits non-zero
1050 `K' is a constant with only the low-order 16 bits non-zero
1051 `L' is a signed 16-bit constant shifted left 16 bits
1052 `M' is a constant that is greater than 31
1053 `N' is a constant that is an exact power of two
1054 `O' is the constant zero
1055 `P' is a constant whose negation is a signed 16-bit constant */
1057 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
1058 ( (C) == 'I' ? (unsigned HOST_WIDE_INT) ((VALUE) + 0x8000) < 0x10000 \
1059 : (C) == 'J' ? ((VALUE) & (~ (unsigned HOST_WIDE_INT) 0xffff0000)) == 0 \
1060 : (C) == 'K' ? ((VALUE) & (~ (HOST_WIDE_INT) 0xffff)) == 0 \
1061 : (C) == 'L' ? (((VALUE) & 0xffff) == 0 \
1062 && ((VALUE) >> 31 == -1 || (VALUE) >> 31 == 0)) \
1063 : (C) == 'M' ? (VALUE) > 31 \
1064 : (C) == 'N' ? exact_log2 (VALUE) >= 0 \
1065 : (C) == 'O' ? (VALUE) == 0 \
1066 : (C) == 'P' ? (unsigned HOST_WIDE_INT) ((- (VALUE)) + 0x8000) < 0x10000 \
1067 : 0)
1069 /* Similar, but for floating constants, and defining letters G and H.
1070 Here VALUE is the CONST_DOUBLE rtx itself.
1072 We flag for special constants when we can copy the constant into
1073 a general register in two insns for DF/DI and one insn for SF.
1075 'H' is used for DI/DF constants that take 3 insns. */
1077 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
1078 ( (C) == 'G' ? (num_insns_constant (VALUE, GET_MODE (VALUE)) \
1079 == ((GET_MODE (VALUE) == SFmode) ? 1 : 2)) \
1080 : (C) == 'H' ? (num_insns_constant (VALUE, GET_MODE (VALUE)) == 3) \
1081 : 0)
1083 /* Optional extra constraints for this machine.
1085 'Q' means that is a memory operand that is just an offset from a reg.
1086 'R' is for AIX TOC entries.
1087 'S' is a constant that can be placed into a 64-bit mask operand
1088 'T' is a consatnt that can be placed into a 32-bit mask operand
1089 'U' is for V.4 small data references. */
1091 #define EXTRA_CONSTRAINT(OP, C) \
1092 ((C) == 'Q' ? GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == REG \
1093 : (C) == 'R' ? LEGITIMATE_CONSTANT_POOL_ADDRESS_P (OP) \
1094 : (C) == 'S' ? mask64_operand (OP, VOIDmode) \
1095 : (C) == 'T' ? mask_operand (OP, VOIDmode) \
1096 : (C) == 'U' ? ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) \
1097 && small_data_operand (OP, GET_MODE (OP))) \
1098 : 0)
1100 /* Given an rtx X being reloaded into a reg required to be
1101 in class CLASS, return the class of reg to actually use.
1102 In general this is just CLASS; but on some machines
1103 in some cases it is preferable to use a more restrictive class.
1105 On the RS/6000, we have to return NO_REGS when we want to reload a
1106 floating-point CONST_DOUBLE to force it to be copied to memory.
1108 We also don't want to reload integer values into floating-point
1109 registers if we can at all help it. In fact, this can
1110 cause reload to abort, if it tries to generate a reload of CTR
1111 into a FP register and discovers it doesn't have the memory location
1112 required.
1114 ??? Would it be a good idea to have reload do the converse, that is
1115 try to reload floating modes into FP registers if possible?
1118 #define PREFERRED_RELOAD_CLASS(X,CLASS) \
1119 (((GET_CODE (X) == CONST_DOUBLE \
1120 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) \
1121 ? NO_REGS \
1122 : (GET_MODE_CLASS (GET_MODE (X)) == MODE_INT \
1123 && (CLASS) == NON_SPECIAL_REGS) \
1124 ? GENERAL_REGS \
1125 : (CLASS)))
1127 /* Return the register class of a scratch register needed to copy IN into
1128 or out of a register in CLASS in MODE. If it can be done directly,
1129 NO_REGS is returned. */
1131 #define SECONDARY_RELOAD_CLASS(CLASS,MODE,IN) \
1132 secondary_reload_class (CLASS, MODE, IN)
1134 /* If we are copying between FP registers and anything else, we need a memory
1135 location. */
1137 #define SECONDARY_MEMORY_NEEDED(CLASS1,CLASS2,MODE) \
1138 ((CLASS1) != (CLASS2) && ((CLASS1) == FLOAT_REGS || (CLASS2) == FLOAT_REGS))
1140 /* Return the maximum number of consecutive registers
1141 needed to represent mode MODE in a register of class CLASS.
1143 On RS/6000, this is the size of MODE in words,
1144 except in the FP regs, where a single reg is enough for two words. */
1145 #define CLASS_MAX_NREGS(CLASS, MODE) \
1146 (((CLASS) == FLOAT_REGS) \
1147 ? ((GET_MODE_SIZE (MODE) + UNITS_PER_FP_WORD - 1) / UNITS_PER_FP_WORD) \
1148 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
1150 /* If defined, gives a class of registers that cannot be used as the
1151 operand of a SUBREG that changes the mode of the object illegally. */
1153 #define CLASS_CANNOT_CHANGE_MODE FLOAT_REGS
1155 /* Defines illegal mode changes for CLASS_CANNOT_CHANGE_MODE. */
1157 #define CLASS_CANNOT_CHANGE_MODE_P(FROM,TO) \
1158 (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO))
1160 /* Stack layout; function entry, exit and calling. */
1162 /* Enumeration to give which calling sequence to use. */
1163 enum rs6000_abi {
1164 ABI_NONE,
1165 ABI_AIX, /* IBM's AIX */
1166 ABI_AIX_NODESC, /* AIX calling sequence minus function descriptors */
1167 ABI_V4, /* System V.4/eabi */
1168 ABI_SOLARIS, /* Solaris */
1169 ABI_DARWIN /* Apple's Darwin (OS X kernel) */
1172 extern enum rs6000_abi rs6000_current_abi; /* available for use by subtarget */
1174 /* Structure used to define the rs6000 stack */
1175 typedef struct rs6000_stack {
1176 int first_gp_reg_save; /* first callee saved GP register used */
1177 int first_fp_reg_save; /* first callee saved FP register used */
1178 int lr_save_p; /* true if the link reg needs to be saved */
1179 int cr_save_p; /* true if the CR reg needs to be saved */
1180 int toc_save_p; /* true if the TOC needs to be saved */
1181 int push_p; /* true if we need to allocate stack space */
1182 int calls_p; /* true if the function makes any calls */
1183 enum rs6000_abi abi; /* which ABI to use */
1184 int gp_save_offset; /* offset to save GP regs from initial SP */
1185 int fp_save_offset; /* offset to save FP regs from initial SP */
1186 int lr_save_offset; /* offset to save LR from initial SP */
1187 int cr_save_offset; /* offset to save CR from initial SP */
1188 int toc_save_offset; /* offset to save the TOC pointer */
1189 int varargs_save_offset; /* offset to save the varargs registers */
1190 int ehrd_offset; /* offset to EH return data */
1191 int reg_size; /* register size (4 or 8) */
1192 int varargs_size; /* size to hold V.4 args passed in regs */
1193 int vars_size; /* variable save area size */
1194 int parm_size; /* outgoing parameter size */
1195 int save_size; /* save area size */
1196 int fixed_size; /* fixed size of stack frame */
1197 int gp_size; /* size of saved GP registers */
1198 int fp_size; /* size of saved FP registers */
1199 int cr_size; /* size to hold CR if not in save_size */
1200 int lr_size; /* size to hold LR if not in save_size */
1201 int toc_size; /* size to hold TOC if not in save_size */
1202 int total_size; /* total bytes allocated for stack */
1203 } rs6000_stack_t;
1205 /* Define this if pushing a word on the stack
1206 makes the stack pointer a smaller address. */
1207 #define STACK_GROWS_DOWNWARD
1209 /* Define this if the nominal address of the stack frame
1210 is at the high-address end of the local variables;
1211 that is, each additional local variable allocated
1212 goes at a more negative offset in the frame.
1214 On the RS/6000, we grow upwards, from the area after the outgoing
1215 arguments. */
1216 /* #define FRAME_GROWS_DOWNWARD */
1218 /* Size of the outgoing register save area */
1219 #define RS6000_REG_SAVE ((DEFAULT_ABI == ABI_AIX \
1220 || DEFAULT_ABI == ABI_AIX_NODESC \
1221 || DEFAULT_ABI == ABI_DARWIN) \
1222 ? (TARGET_64BIT ? 64 : 32) \
1223 : 0)
1225 /* Size of the fixed area on the stack */
1226 #define RS6000_SAVE_AREA \
1227 (((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_DARWIN) ? 24 : 8) \
1228 << (TARGET_64BIT ? 1 : 0))
1230 /* MEM representing address to save the TOC register */
1231 #define RS6000_SAVE_TOC gen_rtx_MEM (Pmode, \
1232 plus_constant (stack_pointer_rtx, \
1233 (TARGET_32BIT ? 20 : 40)))
1235 /* Size of the V.4 varargs area if needed */
1236 #define RS6000_VARARGS_AREA 0
1238 /* Align an address */
1239 #define RS6000_ALIGN(n,a) (((n) + (a) - 1) & ~((a) - 1))
1241 /* Size of V.4 varargs area in bytes */
1242 #define RS6000_VARARGS_SIZE \
1243 ((GP_ARG_NUM_REG * (TARGET_32BIT ? 4 : 8)) + (FP_ARG_NUM_REG * 8) + 8)
1245 /* Offset within stack frame to start allocating local variables at.
1246 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
1247 first local allocated. Otherwise, it is the offset to the BEGINNING
1248 of the first local allocated.
1250 On the RS/6000, the frame pointer is the same as the stack pointer,
1251 except for dynamic allocations. So we start after the fixed area and
1252 outgoing parameter area. */
1254 #define STARTING_FRAME_OFFSET \
1255 (RS6000_ALIGN (current_function_outgoing_args_size, 8) \
1256 + RS6000_VARARGS_AREA \
1257 + RS6000_SAVE_AREA)
1259 /* Offset from the stack pointer register to an item dynamically
1260 allocated on the stack, e.g., by `alloca'.
1262 The default value for this macro is `STACK_POINTER_OFFSET' plus the
1263 length of the outgoing arguments. The default is correct for most
1264 machines. See `function.c' for details. */
1265 #define STACK_DYNAMIC_OFFSET(FUNDECL) \
1266 (RS6000_ALIGN (current_function_outgoing_args_size, 8) \
1267 + (STACK_POINTER_OFFSET))
1269 /* If we generate an insn to push BYTES bytes,
1270 this says how many the stack pointer really advances by.
1271 On RS/6000, don't define this because there are no push insns. */
1272 /* #define PUSH_ROUNDING(BYTES) */
1274 /* Offset of first parameter from the argument pointer register value.
1275 On the RS/6000, we define the argument pointer to the start of the fixed
1276 area. */
1277 #define FIRST_PARM_OFFSET(FNDECL) RS6000_SAVE_AREA
1279 /* Offset from the argument pointer register value to the top of
1280 stack. This is different from FIRST_PARM_OFFSET because of the
1281 register save area. */
1282 #define ARG_POINTER_CFA_OFFSET(FNDECL) 0
1284 /* Define this if stack space is still allocated for a parameter passed
1285 in a register. The value is the number of bytes allocated to this
1286 area. */
1287 #define REG_PARM_STACK_SPACE(FNDECL) RS6000_REG_SAVE
1289 /* Define this if the above stack space is to be considered part of the
1290 space allocated by the caller. */
1291 #define OUTGOING_REG_PARM_STACK_SPACE
1293 /* This is the difference between the logical top of stack and the actual sp.
1295 For the RS/6000, sp points past the fixed area. */
1296 #define STACK_POINTER_OFFSET RS6000_SAVE_AREA
1298 /* Define this if the maximum size of all the outgoing args is to be
1299 accumulated and pushed during the prologue. The amount can be
1300 found in the variable current_function_outgoing_args_size. */
1301 #define ACCUMULATE_OUTGOING_ARGS 1
1303 /* Value is the number of bytes of arguments automatically
1304 popped when returning from a subroutine call.
1305 FUNDECL is the declaration node of the function (as a tree),
1306 FUNTYPE is the data type of the function (as a tree),
1307 or for a library call it is an identifier node for the subroutine name.
1308 SIZE is the number of bytes of arguments passed on the stack. */
1310 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
1312 /* Define how to find the value returned by a function.
1313 VALTYPE is the data type of the value (as a tree).
1314 If the precise function being called is known, FUNC is its FUNCTION_DECL;
1315 otherwise, FUNC is 0.
1317 On RS/6000 an integer value is in r3 and a floating-point value is in
1318 fp1, unless -msoft-float. */
1320 #define FUNCTION_VALUE(VALTYPE, FUNC) \
1321 gen_rtx_REG ((INTEGRAL_TYPE_P (VALTYPE) \
1322 && TYPE_PRECISION (VALTYPE) < BITS_PER_WORD) \
1323 || POINTER_TYPE_P (VALTYPE) \
1324 ? word_mode : TYPE_MODE (VALTYPE), \
1325 TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_HARD_FLOAT ? 33 : 3)
1327 /* Define how to find the value returned by a library function
1328 assuming the value has mode MODE. */
1330 #define LIBCALL_VALUE(MODE) \
1331 gen_rtx_REG (MODE, (GET_MODE_CLASS (MODE) == MODE_FLOAT \
1332 && TARGET_HARD_FLOAT ? 33 : 3))
1334 /* The definition of this macro implies that there are cases where
1335 a scalar value cannot be returned in registers.
1337 For the RS/6000, any structure or union type is returned in memory, except for
1338 Solaris, which returns structures <= 8 bytes in registers. */
1340 #define RETURN_IN_MEMORY(TYPE) \
1341 (TYPE_MODE (TYPE) == BLKmode \
1342 && (DEFAULT_ABI != ABI_SOLARIS || int_size_in_bytes (TYPE) > 8))
1344 /* Mode of stack savearea.
1345 FUNCTION is VOIDmode because calling convention maintains SP.
1346 BLOCK needs Pmode for SP.
1347 NONLOCAL needs twice Pmode to maintain both backchain and SP. */
1348 #define STACK_SAVEAREA_MODE(LEVEL) \
1349 (LEVEL == SAVE_FUNCTION ? VOIDmode \
1350 : LEVEL == SAVE_NONLOCAL ? (TARGET_32BIT ? DImode : TImode) : Pmode)
1352 /* Minimum and maximum general purpose registers used to hold arguments. */
1353 #define GP_ARG_MIN_REG 3
1354 #define GP_ARG_MAX_REG 10
1355 #define GP_ARG_NUM_REG (GP_ARG_MAX_REG - GP_ARG_MIN_REG + 1)
1357 /* Minimum and maximum floating point registers used to hold arguments. */
1358 #define FP_ARG_MIN_REG 33
1359 #define FP_ARG_AIX_MAX_REG 45
1360 #define FP_ARG_V4_MAX_REG 40
1361 #define FP_ARG_MAX_REG ((DEFAULT_ABI == ABI_AIX \
1362 || DEFAULT_ABI == ABI_AIX_NODESC \
1363 || DEFAULT_ABI == ABI_DARWIN) \
1364 ? FP_ARG_AIX_MAX_REG : FP_ARG_V4_MAX_REG)
1365 #define FP_ARG_NUM_REG (FP_ARG_MAX_REG - FP_ARG_MIN_REG + 1)
1367 /* Return registers */
1368 #define GP_ARG_RETURN GP_ARG_MIN_REG
1369 #define FP_ARG_RETURN FP_ARG_MIN_REG
1371 /* Flags for the call/call_value rtl operations set up by function_arg */
1372 #define CALL_NORMAL 0x00000000 /* no special processing */
1373 /* Bits in 0x00000001 are unused. */
1374 #define CALL_V4_CLEAR_FP_ARGS 0x00000002 /* V.4, no FP args passed */
1375 #define CALL_V4_SET_FP_ARGS 0x00000004 /* V.4, FP args were passed */
1376 #define CALL_LONG 0x00000008 /* always call indirect */
1378 /* 1 if N is a possible register number for a function value
1379 as seen by the caller.
1381 On RS/6000, this is r3 and fp1. */
1382 #define FUNCTION_VALUE_REGNO_P(N) ((N) == GP_ARG_RETURN || ((N) == FP_ARG_RETURN))
1384 /* 1 if N is a possible register number for function argument passing.
1385 On RS/6000, these are r3-r10 and fp1-fp13. */
1386 #define FUNCTION_ARG_REGNO_P(N) \
1387 (((unsigned)((N) - GP_ARG_MIN_REG) < (unsigned)(GP_ARG_NUM_REG)) \
1388 || ((unsigned)((N) - FP_ARG_MIN_REG) < (unsigned)(FP_ARG_NUM_REG)))
1391 /* A C structure for machine-specific, per-function data.
1392 This is added to the cfun structure. */
1393 typedef struct machine_function
1395 /* Whether a System V.4 varargs area was created. */
1396 int sysv_varargs_p;
1397 /* Set if a return address rtx for loading from LR was created. */
1398 struct rtx_def *ra_rtx;
1399 /* Flags if __builtin_return_address (n) with n >= 1 was used. */
1400 int ra_needs_full_frame;
1401 } machine_function;
1403 /* Define a data type for recording info about an argument list
1404 during the scan of that argument list. This data type should
1405 hold all necessary information about the function itself
1406 and about the args processed so far, enough to enable macros
1407 such as FUNCTION_ARG to determine where the next arg should go.
1409 On the RS/6000, this is a structure. The first element is the number of
1410 total argument words, the second is used to store the next
1411 floating-point register number, and the third says how many more args we
1412 have prototype types for.
1414 For ABI_V4, we treat these slightly differently -- `sysv_gregno' is
1415 the next availible GP register, `fregno' is the next available FP
1416 register, and `words' is the number of words used on the stack.
1418 The varargs/stdarg support requires that this structure's size
1419 be a multiple of sizeof(int). */
1421 typedef struct rs6000_args
1423 int words; /* # words used for passing GP registers */
1424 int fregno; /* next available FP register */
1425 int nargs_prototype; /* # args left in the current prototype */
1426 int orig_nargs; /* Original value of nargs_prototype */
1427 int prototype; /* Whether a prototype was defined */
1428 int call_cookie; /* Do special things for this call */
1429 int sysv_gregno; /* next available GP register */
1430 } CUMULATIVE_ARGS;
1432 /* Define intermediate macro to compute the size (in registers) of an argument
1433 for the RS/6000. */
1435 #define RS6000_ARG_SIZE(MODE, TYPE) \
1436 ((MODE) != BLKmode \
1437 ? (GET_MODE_SIZE (MODE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD \
1438 : ((unsigned HOST_WIDE_INT) int_size_in_bytes (TYPE) \
1439 + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
1441 /* Initialize a variable CUM of type CUMULATIVE_ARGS
1442 for a call to a function whose data type is FNTYPE.
1443 For a library call, FNTYPE is 0. */
1445 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
1446 init_cumulative_args (&CUM, FNTYPE, LIBNAME, FALSE)
1448 /* Similar, but when scanning the definition of a procedure. We always
1449 set NARGS_PROTOTYPE large so we never return an EXPR_LIST. */
1451 #define INIT_CUMULATIVE_INCOMING_ARGS(CUM,FNTYPE,LIBNAME) \
1452 init_cumulative_args (&CUM, FNTYPE, LIBNAME, TRUE)
1454 /* Update the data in CUM to advance over an argument
1455 of mode MODE and data type TYPE.
1456 (TYPE is null for libcalls where that information may not be available.) */
1458 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
1459 function_arg_advance (&CUM, MODE, TYPE, NAMED)
1461 /* Non-zero if we can use a floating-point register to pass this arg. */
1462 #define USE_FP_FOR_ARG_P(CUM,MODE,TYPE) \
1463 (GET_MODE_CLASS (MODE) == MODE_FLOAT \
1464 && (CUM).fregno <= FP_ARG_MAX_REG \
1465 && TARGET_HARD_FLOAT)
1467 /* Determine where to put an argument to a function.
1468 Value is zero to push the argument on the stack,
1469 or a hard register in which to store the argument.
1471 MODE is the argument's machine mode.
1472 TYPE is the data type of the argument (as a tree).
1473 This is null for libcalls where that information may
1474 not be available.
1475 CUM is a variable of type CUMULATIVE_ARGS which gives info about
1476 the preceding args and about the function being called.
1477 NAMED is nonzero if this argument is a named parameter
1478 (otherwise it is an extra parameter matching an ellipsis).
1480 On RS/6000 the first eight words of non-FP are normally in registers
1481 and the rest are pushed. The first 13 FP args are in registers.
1483 If this is floating-point and no prototype is specified, we use
1484 both an FP and integer register (or possibly FP reg and stack). Library
1485 functions (when TYPE is zero) always have the proper types for args,
1486 so we can pass the FP value just in one register. emit_library_function
1487 doesn't support EXPR_LIST anyway. */
1489 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
1490 function_arg (&CUM, MODE, TYPE, NAMED)
1492 /* For an arg passed partly in registers and partly in memory,
1493 this is the number of registers used.
1494 For args passed entirely in registers or entirely in memory, zero. */
1496 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
1497 function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED)
1499 /* A C expression that indicates when an argument must be passed by
1500 reference. If nonzero for an argument, a copy of that argument is
1501 made in memory and a pointer to the argument is passed instead of
1502 the argument itself. The pointer is passed in whatever way is
1503 appropriate for passing a pointer to that type. */
1505 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
1506 function_arg_pass_by_reference(&CUM, MODE, TYPE, NAMED)
1508 /* If defined, a C expression which determines whether, and in which
1509 direction, to pad out an argument with extra space. The value
1510 should be of type `enum direction': either `upward' to pad above
1511 the argument, `downward' to pad below, or `none' to inhibit
1512 padding. */
1514 #define FUNCTION_ARG_PADDING(MODE, TYPE) function_arg_padding (MODE, TYPE)
1516 /* If defined, a C expression that gives the alignment boundary, in bits,
1517 of an argument with the specified mode and type. If it is not defined,
1518 PARM_BOUNDARY is used for all arguments. */
1520 #define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
1521 function_arg_boundary (MODE, TYPE)
1523 /* Perform any needed actions needed for a function that is receiving a
1524 variable number of arguments.
1526 CUM is as above.
1528 MODE and TYPE are the mode and type of the current parameter.
1530 PRETEND_SIZE is a variable that should be set to the amount of stack
1531 that must be pushed by the prolog to pretend that our caller pushed
1534 Normally, this macro will push all remaining incoming registers on the
1535 stack and set PRETEND_SIZE to the length of the registers pushed. */
1537 #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
1538 setup_incoming_varargs (&CUM, MODE, TYPE, &PRETEND_SIZE, NO_RTL)
1540 /* Define the `__builtin_va_list' type for the ABI. */
1541 #define BUILD_VA_LIST_TYPE(VALIST) \
1542 (VALIST) = rs6000_build_va_list ()
1544 /* Implement `va_start' for varargs and stdarg. */
1545 #define EXPAND_BUILTIN_VA_START(stdarg, valist, nextarg) \
1546 rs6000_va_start (stdarg, valist, nextarg)
1548 /* Implement `va_arg'. */
1549 #define EXPAND_BUILTIN_VA_ARG(valist, type) \
1550 rs6000_va_arg (valist, type)
1552 /* Define this macro to be a nonzero value if the location where a function
1553 argument is passed depends on whether or not it is a named argument. */
1554 #define STRICT_ARGUMENT_NAMING 1
1556 /* This macro generates the assembly code for function entry.
1557 FILE is a stdio stream to output the code to.
1558 SIZE is an int: how many units of temporary storage to allocate.
1559 Refer to the array `regs_ever_live' to determine which registers
1560 to save; `regs_ever_live[I]' is nonzero if register number I
1561 is ever used in the function. This macro is responsible for
1562 knowing which registers should not be saved even if used. */
1564 #define FUNCTION_PROLOGUE(FILE, SIZE) output_prolog (FILE, SIZE)
1566 /* Output assembler code to FILE to increment profiler label # LABELNO
1567 for profiling a function entry. */
1569 #define FUNCTION_PROFILER(FILE, LABELNO) \
1570 output_function_profiler ((FILE), (LABELNO));
1572 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
1573 the stack pointer does not matter. No definition is equivalent to
1574 always zero.
1576 On the RS/6000, this is non-zero because we can restore the stack from
1577 its backpointer, which we maintain. */
1578 #define EXIT_IGNORE_STACK 1
1580 /* Define this macro as a C expression that is nonzero for registers
1581 that are used by the epilogue or the return' pattern. The stack
1582 and frame pointer registers are already be assumed to be used as
1583 needed. */
1585 #define EPILOGUE_USES(REGNO) \
1586 ((reload_completed && (REGNO) == LINK_REGISTER_REGNUM) \
1587 || (current_function_calls_eh_return \
1588 && TARGET_AIX \
1589 && (REGNO) == TOC_REGISTER))
1591 /* This macro generates the assembly code for function exit,
1592 on machines that need it. If FUNCTION_EPILOGUE is not defined
1593 then individual return instructions are generated for each
1594 return statement. Args are same as for FUNCTION_PROLOGUE.
1596 The function epilogue should not depend on the current stack pointer!
1597 It should use the frame pointer only. This is mandatory because
1598 of alloca; we also take advantage of it to omit stack adjustments
1599 before returning. */
1601 #define FUNCTION_EPILOGUE(FILE, SIZE) output_epilog (FILE, SIZE)
1603 /* TRAMPOLINE_TEMPLATE deleted */
1605 /* Length in units of the trampoline for entering a nested function. */
1607 #define TRAMPOLINE_SIZE rs6000_trampoline_size ()
1609 /* Emit RTL insns to initialize the variable parts of a trampoline.
1610 FNADDR is an RTX for the address of the function's pure code.
1611 CXT is an RTX for the static chain value for the function. */
1613 #define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, CXT) \
1614 rs6000_initialize_trampoline (ADDR, FNADDR, CXT)
1616 /* If defined, a C expression whose value is nonzero if IDENTIFIER
1617 with arguments ARGS is a valid machine specific attribute for DECL.
1618 The attributes in ATTRIBUTES have previously been assigned to DECL. */
1620 #define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \
1621 (rs6000_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS))
1623 /* If defined, a C expression whose value is nonzero if IDENTIFIER
1624 with arguments ARGS is a valid machine specific attribute for TYPE.
1625 The attributes in ATTRIBUTES have previously been assigned to TYPE. */
1627 #define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \
1628 (rs6000_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS))
1630 /* If defined, a C expression whose value is zero if the attributes on
1631 TYPE1 and TYPE2 are incompatible, one if they are compatible, and
1632 two if they are nearly compatible (which causes a warning to be
1633 generated). */
1635 #define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
1636 (rs6000_comp_type_attributes (TYPE1, TYPE2))
1638 /* If defined, a C statement that assigns default attributes to newly
1639 defined TYPE. */
1641 #define SET_DEFAULT_TYPE_ATTRIBUTES(TYPE) \
1642 (rs6000_set_default_type_attributes (TYPE))
1645 /* Definitions for __builtin_return_address and __builtin_frame_address.
1646 __builtin_return_address (0) should give link register (65), enable
1647 this. */
1648 /* This should be uncommented, so that the link register is used, but
1649 currently this would result in unmatched insns and spilling fixed
1650 registers so we'll leave it for another day. When these problems are
1651 taken care of one additional fetch will be necessary in RETURN_ADDR_RTX.
1652 (mrs) */
1653 /* #define RETURN_ADDR_IN_PREVIOUS_FRAME */
1655 /* Number of bytes into the frame return addresses can be found. See
1656 rs6000_stack_info in rs6000.c for more information on how the different
1657 abi's store the return address. */
1658 #define RETURN_ADDRESS_OFFSET \
1659 ((DEFAULT_ABI == ABI_AIX \
1660 || DEFAULT_ABI == ABI_DARWIN \
1661 || DEFAULT_ABI == ABI_AIX_NODESC) ? (TARGET_32BIT ? 8 : 16) : \
1662 (DEFAULT_ABI == ABI_V4 \
1663 || DEFAULT_ABI == ABI_SOLARIS) ? (TARGET_32BIT ? 4 : 8) : \
1664 (internal_error ("RETURN_ADDRESS_OFFSET not supported"), 0))
1666 /* The current return address is in link register (65). The return address
1667 of anything farther back is accessed normally at an offset of 8 from the
1668 frame pointer. */
1669 #define RETURN_ADDR_RTX(COUNT, FRAME) \
1670 (rs6000_return_addr (COUNT, FRAME))
1673 /* Definitions for register eliminations.
1675 We have two registers that can be eliminated on the RS/6000. First, the
1676 frame pointer register can often be eliminated in favor of the stack
1677 pointer register. Secondly, the argument pointer register can always be
1678 eliminated; it is replaced with either the stack or frame pointer.
1680 In addition, we use the elimination mechanism to see if r30 is needed
1681 Initially we assume that it isn't. If it is, we spill it. This is done
1682 by making it an eliminable register. We replace it with itself so that
1683 if it isn't needed, then existing uses won't be modified. */
1685 /* This is an array of structures. Each structure initializes one pair
1686 of eliminable registers. The "from" register number is given first,
1687 followed by "to". Eliminations of the same "from" register are listed
1688 in order of preference. */
1689 #define ELIMINABLE_REGS \
1690 {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
1691 { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
1692 { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
1693 { 30, 30} }
1695 /* Given FROM and TO register numbers, say whether this elimination is allowed.
1696 Frame pointer elimination is automatically handled.
1698 For the RS/6000, if frame pointer elimination is being done, we would like
1699 to convert ap into fp, not sp.
1701 We need r30 if -mminimal-toc was specified, and there are constant pool
1702 references. */
1704 #define CAN_ELIMINATE(FROM, TO) \
1705 ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \
1706 ? ! frame_pointer_needed \
1707 : (FROM) == 30 ? ! TARGET_MINIMAL_TOC || TARGET_NO_TOC || get_pool_size () == 0 \
1708 : 1)
1710 /* Define the offset between two registers, one to be eliminated, and the other
1711 its replacement, at the start of a routine. */
1712 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
1714 rs6000_stack_t *info = rs6000_stack_info (); \
1716 if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
1717 (OFFSET) = (info->push_p) ? 0 : - info->total_size; \
1718 else if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \
1719 (OFFSET) = info->total_size; \
1720 else if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
1721 (OFFSET) = (info->push_p) ? info->total_size : 0; \
1722 else if ((FROM) == 30) \
1723 (OFFSET) = 0; \
1724 else \
1725 abort (); \
1728 /* Addressing modes, and classification of registers for them. */
1730 /* #define HAVE_POST_INCREMENT 0 */
1731 /* #define HAVE_POST_DECREMENT 0 */
1733 #define HAVE_PRE_DECREMENT 1
1734 #define HAVE_PRE_INCREMENT 1
1736 /* Macros to check register numbers against specific register classes. */
1738 /* These assume that REGNO is a hard or pseudo reg number.
1739 They give nonzero only if REGNO is a hard reg of the suitable class
1740 or a pseudo reg currently allocated to a suitable hard reg.
1741 Since they use reg_renumber, they are safe only once reg_renumber
1742 has been allocated, which happens in local-alloc.c. */
1744 #define REGNO_OK_FOR_INDEX_P(REGNO) \
1745 ((REGNO) < FIRST_PSEUDO_REGISTER \
1746 ? (REGNO) <= 31 || (REGNO) == 67 \
1747 : (reg_renumber[REGNO] >= 0 \
1748 && (reg_renumber[REGNO] <= 31 || reg_renumber[REGNO] == 67)))
1750 #define REGNO_OK_FOR_BASE_P(REGNO) \
1751 ((REGNO) < FIRST_PSEUDO_REGISTER \
1752 ? ((REGNO) > 0 && (REGNO) <= 31) || (REGNO) == 67 \
1753 : (reg_renumber[REGNO] > 0 \
1754 && (reg_renumber[REGNO] <= 31 || reg_renumber[REGNO] == 67)))
1756 /* Maximum number of registers that can appear in a valid memory address. */
1758 #define MAX_REGS_PER_ADDRESS 2
1760 /* Recognize any constant value that is a valid address. */
1762 #define CONSTANT_ADDRESS_P(X) \
1763 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
1764 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
1765 || GET_CODE (X) == HIGH)
1767 /* Nonzero if the constant value X is a legitimate general operand.
1768 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.
1770 On the RS/6000, all integer constants are acceptable, most won't be valid
1771 for particular insns, though. Only easy FP constants are
1772 acceptable. */
1774 #define LEGITIMATE_CONSTANT_P(X) \
1775 (GET_CODE (X) != CONST_DOUBLE || GET_MODE (X) == VOIDmode \
1776 || (TARGET_POWERPC64 && GET_MODE (X) == DImode) \
1777 || easy_fp_constant (X, GET_MODE (X)))
1779 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1780 and check its validity for a certain class.
1781 We have two alternate definitions for each of them.
1782 The usual definition accepts all pseudo regs; the other rejects
1783 them unless they have been allocated suitable hard regs.
1784 The symbol REG_OK_STRICT causes the latter definition to be used.
1786 Most source files want to accept pseudo regs in the hope that
1787 they will get allocated to the class that the insn wants them to be in.
1788 Source files for reload pass need to be strict.
1789 After reload, it makes no difference, since pseudo regs have
1790 been eliminated by then. */
1792 #ifdef REG_OK_STRICT
1793 # define REG_OK_STRICT_FLAG 1
1794 #else
1795 # define REG_OK_STRICT_FLAG 0
1796 #endif
1798 /* Nonzero if X is a hard reg that can be used as an index
1799 or if it is a pseudo reg in the non-strict case. */
1800 #define INT_REG_OK_FOR_INDEX_P(X, STRICT) \
1801 ((! (STRICT) \
1802 && (REGNO (X) <= 31 \
1803 || REGNO (X) == ARG_POINTER_REGNUM \
1804 || REGNO (X) >= FIRST_PSEUDO_REGISTER)) \
1805 || ((STRICT) && REGNO_OK_FOR_INDEX_P (REGNO (X))))
1807 /* Nonzero if X is a hard reg that can be used as a base reg
1808 or if it is a pseudo reg in the non-strict case. */
1809 #define INT_REG_OK_FOR_BASE_P(X, STRICT) \
1810 (REGNO (X) > 0 && INT_REG_OK_FOR_INDEX_P (X, (STRICT)))
1812 #define REG_OK_FOR_INDEX_P(X) INT_REG_OK_FOR_INDEX_P (X, REG_OK_STRICT_FLAG)
1813 #define REG_OK_FOR_BASE_P(X) INT_REG_OK_FOR_BASE_P (X, REG_OK_STRICT_FLAG)
1815 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1816 that is a valid memory address for an instruction.
1817 The MODE argument is the machine mode for the MEM expression
1818 that wants to use this address.
1820 On the RS/6000, there are four valid address: a SYMBOL_REF that
1821 refers to a constant pool entry of an address (or the sum of it
1822 plus a constant), a short (16-bit signed) constant plus a register,
1823 the sum of two registers, or a register indirect, possibly with an
1824 auto-increment. For DFmode and DImode with an constant plus register,
1825 we must ensure that both words are addressable or PowerPC64 with offset
1826 word aligned.
1828 For modes spanning multiple registers (DFmode in 32-bit GPRs,
1829 32-bit DImode, TImode), indexed addressing cannot be used because
1830 adjacent memory cells are accessed by adding word-sized offsets
1831 during assembly output. */
1833 #define CONSTANT_POOL_EXPR_P(X) (constant_pool_expr_p (X))
1835 #define TOC_RELATIVE_EXPR_P(X) (toc_relative_expr_p (X))
1837 #define LEGITIMATE_CONSTANT_POOL_ADDRESS_P(X) \
1838 (TARGET_TOC \
1839 && GET_CODE (X) == PLUS \
1840 && GET_CODE (XEXP (X, 0)) == REG \
1841 && (TARGET_MINIMAL_TOC || REGNO (XEXP (X, 0)) == TOC_REGISTER) \
1842 && CONSTANT_POOL_EXPR_P (XEXP (X, 1)))
1844 #define LEGITIMATE_SMALL_DATA_P(MODE, X) \
1845 ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) \
1846 && !flag_pic && !TARGET_TOC \
1847 && (GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == CONST) \
1848 && small_data_operand (X, MODE))
1850 #define LEGITIMATE_ADDRESS_INTEGER_P(X, OFFSET) \
1851 (GET_CODE (X) == CONST_INT \
1852 && (unsigned HOST_WIDE_INT) (INTVAL (X) + (OFFSET) + 0x8000) < 0x10000)
1854 #define LEGITIMATE_OFFSET_ADDRESS_P(MODE, X, STRICT) \
1855 (GET_CODE (X) == PLUS \
1856 && GET_CODE (XEXP (X, 0)) == REG \
1857 && INT_REG_OK_FOR_BASE_P (XEXP (X, 0), (STRICT)) \
1858 && LEGITIMATE_ADDRESS_INTEGER_P (XEXP (X, 1), 0) \
1859 && (((MODE) != DFmode && (MODE) != DImode) \
1860 || (TARGET_32BIT \
1861 ? LEGITIMATE_ADDRESS_INTEGER_P (XEXP (X, 1), 4) \
1862 : ! (INTVAL (XEXP (X, 1)) & 3))) \
1863 && ((MODE) != TImode \
1864 || (TARGET_32BIT \
1865 ? LEGITIMATE_ADDRESS_INTEGER_P (XEXP (X, 1), 12) \
1866 : (LEGITIMATE_ADDRESS_INTEGER_P (XEXP (X, 1), 8) \
1867 && ! (INTVAL (XEXP (X, 1)) & 3)))))
1869 #define LEGITIMATE_INDEXED_ADDRESS_P(X, STRICT) \
1870 (GET_CODE (X) == PLUS \
1871 && GET_CODE (XEXP (X, 0)) == REG \
1872 && GET_CODE (XEXP (X, 1)) == REG \
1873 && ((INT_REG_OK_FOR_BASE_P (XEXP (X, 0), (STRICT)) \
1874 && INT_REG_OK_FOR_INDEX_P (XEXP (X, 1), (STRICT))) \
1875 || (INT_REG_OK_FOR_BASE_P (XEXP (X, 1), (STRICT)) \
1876 && INT_REG_OK_FOR_INDEX_P (XEXP (X, 0), (STRICT)))))
1878 #define LEGITIMATE_INDIRECT_ADDRESS_P(X, STRICT) \
1879 (GET_CODE (X) == REG && INT_REG_OK_FOR_BASE_P (X, (STRICT)))
1881 #define LEGITIMATE_LO_SUM_ADDRESS_P(MODE, X, STRICT) \
1882 (TARGET_ELF \
1883 && ! flag_pic && ! TARGET_TOC \
1884 && (MODE) != DImode \
1885 && (MODE) != TImode \
1886 && (TARGET_HARD_FLOAT || (MODE) != DFmode) \
1887 && GET_CODE (X) == LO_SUM \
1888 && GET_CODE (XEXP (X, 0)) == REG \
1889 && INT_REG_OK_FOR_BASE_P (XEXP (X, 0), (STRICT)) \
1890 && CONSTANT_P (XEXP (X, 1)))
1892 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1893 { if (rs6000_legitimate_address (MODE, X, REG_OK_STRICT_FLAG)) \
1894 goto ADDR; \
1897 /* Try machine-dependent ways of modifying an illegitimate address
1898 to be legitimate. If we find one, return the new, valid address.
1899 This macro is used in only one place: `memory_address' in explow.c.
1901 OLDX is the address as it was before break_out_memory_refs was called.
1902 In some cases it is useful to look at this to decide what needs to be done.
1904 MODE and WIN are passed so that this macro can use
1905 GO_IF_LEGITIMATE_ADDRESS.
1907 It is always safe for this macro to do nothing. It exists to recognize
1908 opportunities to optimize the output.
1910 On RS/6000, first check for the sum of a register with a constant
1911 integer that is out of range. If so, generate code to add the
1912 constant with the low-order 16 bits masked to the register and force
1913 this result into another register (this can be done with `cau').
1914 Then generate an address of REG+(CONST&0xffff), allowing for the
1915 possibility of bit 16 being a one.
1917 Then check for the sum of a register and something not constant, try to
1918 load the other things into a register and return the sum. */
1920 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
1921 { rtx result = rs6000_legitimize_address (X, OLDX, MODE); \
1922 if (result != NULL_RTX) \
1924 (X) = result; \
1925 goto WIN; \
1929 /* Try a machine-dependent way of reloading an illegitimate address
1930 operand. If we find one, push the reload and jump to WIN. This
1931 macro is used in only one place: `find_reloads_address' in reload.c.
1933 For RS/6000, we wish to handle large displacements off a base
1934 register by splitting the addend across an addiu/addis and the mem insn.
1935 This cuts number of extra insns needed from 3 to 1. */
1937 #define LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OPNUM,TYPE,IND_LEVELS,WIN) \
1938 do { \
1939 /* We must recognize output that we have already generated ourselves. */ \
1940 if (GET_CODE (X) == PLUS \
1941 && GET_CODE (XEXP (X, 0)) == PLUS \
1942 && GET_CODE (XEXP (XEXP (X, 0), 0)) == REG \
1943 && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT \
1944 && GET_CODE (XEXP (X, 1)) == CONST_INT) \
1946 push_reload (XEXP (X, 0), NULL_RTX, &XEXP (X, 0), NULL, \
1947 BASE_REG_CLASS, GET_MODE (X), VOIDmode, 0, 0, \
1948 OPNUM, TYPE); \
1949 goto WIN; \
1951 if (GET_CODE (X) == PLUS \
1952 && GET_CODE (XEXP (X, 0)) == REG \
1953 && REGNO (XEXP (X, 0)) < FIRST_PSEUDO_REGISTER \
1954 && REG_MODE_OK_FOR_BASE_P (XEXP (X, 0), MODE) \
1955 && GET_CODE (XEXP (X, 1)) == CONST_INT) \
1957 HOST_WIDE_INT val = INTVAL (XEXP (X, 1)); \
1958 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000; \
1959 HOST_WIDE_INT high \
1960 = (((val - low) & 0xffffffff) ^ 0x80000000) - 0x80000000; \
1962 /* Check for 32-bit overflow. */ \
1963 if (high + low != val) \
1964 break; \
1966 /* Reload the high part into a base reg; leave the low part \
1967 in the mem directly. */ \
1969 X = gen_rtx_PLUS (GET_MODE (X), \
1970 gen_rtx_PLUS (GET_MODE (X), XEXP (X, 0), \
1971 GEN_INT (high)), \
1972 GEN_INT (low)); \
1974 push_reload (XEXP (X, 0), NULL_RTX, &XEXP (X, 0), NULL, \
1975 BASE_REG_CLASS, GET_MODE (X), VOIDmode, 0, 0, \
1976 OPNUM, TYPE); \
1977 goto WIN; \
1979 else if (TARGET_TOC \
1980 && CONSTANT_POOL_EXPR_P (X) \
1981 && ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (get_pool_constant (X), MODE)) \
1983 (X) = create_TOC_reference (X); \
1984 goto WIN; \
1986 } while (0)
1988 /* Go to LABEL if ADDR (a legitimate address expression)
1989 has an effect that depends on the machine mode it is used for.
1991 On the RS/6000 this is true if the address is valid with a zero offset
1992 but not with an offset of four (this means it cannot be used as an
1993 address for DImode or DFmode) or is a pre-increment or decrement. Since
1994 we know it is valid, we just check for an address that is not valid with
1995 an offset of four. */
1997 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1998 { if (GET_CODE (ADDR) == PLUS \
1999 && LEGITIMATE_ADDRESS_INTEGER_P (XEXP (ADDR, 1), 0) \
2000 && ! LEGITIMATE_ADDRESS_INTEGER_P (XEXP (ADDR, 1), \
2001 (TARGET_32BIT ? 4 : 8))) \
2002 goto LABEL; \
2003 if (TARGET_UPDATE && GET_CODE (ADDR) == PRE_INC) \
2004 goto LABEL; \
2005 if (TARGET_UPDATE && GET_CODE (ADDR) == PRE_DEC) \
2006 goto LABEL; \
2007 if (GET_CODE (ADDR) == LO_SUM) \
2008 goto LABEL; \
2011 /* The register number of the register used to address a table of
2012 static data addresses in memory. In some cases this register is
2013 defined by a processor's "application binary interface" (ABI).
2014 When this macro is defined, RTL is generated for this register
2015 once, as with the stack pointer and frame pointer registers. If
2016 this macro is not defined, it is up to the machine-dependent files
2017 to allocate such a register (if necessary). */
2019 #define PIC_OFFSET_TABLE_REGNUM 30
2021 #define TOC_REGISTER (TARGET_MINIMAL_TOC ? 30 : 2)
2023 /* Define this macro if the register defined by
2024 `PIC_OFFSET_TABLE_REGNUM' is clobbered by calls. Do not define
2025 this macro if `PPIC_OFFSET_TABLE_REGNUM' is not defined. */
2027 /* #define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED */
2029 /* By generating position-independent code, when two different
2030 programs (A and B) share a common library (libC.a), the text of
2031 the library can be shared whether or not the library is linked at
2032 the same address for both programs. In some of these
2033 environments, position-independent code requires not only the use
2034 of different addressing modes, but also special code to enable the
2035 use of these addressing modes.
2037 The `FINALIZE_PIC' macro serves as a hook to emit these special
2038 codes once the function is being compiled into assembly code, but
2039 not before. (It is not done before, because in the case of
2040 compiling an inline function, it would lead to multiple PIC
2041 prologues being included in functions which used inline functions
2042 and were compiled to assembly language.) */
2044 /* #define FINALIZE_PIC */
2046 /* A C expression that is nonzero if X is a legitimate immediate
2047 operand on the target machine when generating position independent
2048 code. You can assume that X satisfies `CONSTANT_P', so you need
2049 not check this. You can also assume FLAG_PIC is true, so you need
2050 not check it either. You need not define this macro if all
2051 constants (including `SYMBOL_REF') can be immediate operands when
2052 generating position independent code. */
2054 /* #define LEGITIMATE_PIC_OPERAND_P (X) */
2056 /* In rare cases, correct code generation requires extra machine
2057 dependent processing between the second jump optimization pass and
2058 delayed branch scheduling. On those machines, define this macro
2059 as a C statement to act on the code starting at INSN. */
2061 /* #define MACHINE_DEPENDENT_REORG(INSN) */
2064 /* Define this if some processing needs to be done immediately before
2065 emitting code for an insn. */
2067 /* #define FINAL_PRESCAN_INSN(INSN,OPERANDS,NOPERANDS) */
2069 /* Specify the machine mode that this machine uses
2070 for the index in the tablejump instruction. */
2071 #define CASE_VECTOR_MODE SImode
2073 /* Define as C expression which evaluates to nonzero if the tablejump
2074 instruction expects the table to contain offsets from the address of the
2075 table.
2076 Do not define this if the table should contain absolute addresses. */
2077 #define CASE_VECTOR_PC_RELATIVE 1
2079 /* Specify the tree operation to be used to convert reals to integers. */
2080 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
2082 /* This is the kind of divide that is easiest to do in the general case. */
2083 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
2085 /* Define this as 1 if `char' should by default be signed; else as 0. */
2086 #define DEFAULT_SIGNED_CHAR 0
2088 /* This flag, if defined, says the same insns that convert to a signed fixnum
2089 also convert validly to an unsigned one. */
2091 /* #define FIXUNS_TRUNC_LIKE_FIX_TRUNC */
2093 /* Max number of bytes we can move from memory to memory
2094 in one reasonably fast instruction. */
2095 #define MOVE_MAX (! TARGET_POWERPC64 ? 4 : 8)
2096 #define MAX_MOVE_MAX 8
2098 /* Nonzero if access to memory by bytes is no faster than for words.
2099 Also non-zero if doing byte operations (specifically shifts) in registers
2100 is undesirable. */
2101 #define SLOW_BYTE_ACCESS 1
2103 /* Define if operations between registers always perform the operation
2104 on the full register even if a narrower mode is specified. */
2105 #define WORD_REGISTER_OPERATIONS
2107 /* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
2108 will either zero-extend or sign-extend. The value of this macro should
2109 be the code that says which one of the two operations is implicitly
2110 done, NIL if none. */
2111 #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
2113 /* Define if loading short immediate values into registers sign extends. */
2114 #define SHORT_IMMEDIATES_SIGN_EXTEND
2116 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
2117 is done just by pretending it is already truncated. */
2118 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
2120 /* Specify the machine mode that pointers have.
2121 After generation of rtl, the compiler makes no further distinction
2122 between pointers and any other objects of this machine mode. */
2123 #define Pmode (TARGET_32BIT ? SImode : DImode)
2125 /* Mode of a function address in a call instruction (for indexing purposes).
2126 Doesn't matter on RS/6000. */
2127 #define FUNCTION_MODE (TARGET_32BIT ? SImode : DImode)
2129 /* Define this if addresses of constant functions
2130 shouldn't be put through pseudo regs where they can be cse'd.
2131 Desirable on machines where ordinary constants are expensive
2132 but a CALL with constant address is cheap. */
2133 #define NO_FUNCTION_CSE
2135 /* Define this to be nonzero if shift instructions ignore all but the low-order
2136 few bits.
2138 The sle and sre instructions which allow SHIFT_COUNT_TRUNCATED
2139 have been dropped from the PowerPC architecture. */
2141 #define SHIFT_COUNT_TRUNCATED (TARGET_POWER ? 1 : 0)
2143 /* Compute the cost of computing a constant rtl expression RTX
2144 whose rtx-code is CODE. The body of this macro is a portion
2145 of a switch statement. If the code is computed here,
2146 return it with a return statement. Otherwise, break from the switch.
2148 On the RS/6000, if it is valid in the insn, it is free. So this
2149 always returns 0. */
2151 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
2152 case CONST_INT: \
2153 case CONST: \
2154 case LABEL_REF: \
2155 case SYMBOL_REF: \
2156 case CONST_DOUBLE: \
2157 case HIGH: \
2158 return 0;
2160 /* Provide the costs of a rtl expression. This is in the body of a
2161 switch on CODE. */
2163 #define RTX_COSTS(X,CODE,OUTER_CODE) \
2164 case PLUS: \
2165 return ((GET_CODE (XEXP (X, 1)) == CONST_INT \
2166 && ((unsigned HOST_WIDE_INT) (INTVAL (XEXP (X, 1)) \
2167 + 0x8000) >= 0x10000) \
2168 && ((INTVAL (XEXP (X, 1)) & 0xffff) != 0)) \
2169 ? COSTS_N_INSNS (2) \
2170 : COSTS_N_INSNS (1)); \
2171 case AND: \
2172 case IOR: \
2173 case XOR: \
2174 return ((GET_CODE (XEXP (X, 1)) == CONST_INT \
2175 && (INTVAL (XEXP (X, 1)) & (~ (HOST_WIDE_INT) 0xffff)) != 0 \
2176 && ((INTVAL (XEXP (X, 1)) & 0xffff) != 0)) \
2177 ? COSTS_N_INSNS (2) \
2178 : COSTS_N_INSNS (1)); \
2179 case MULT: \
2180 switch (rs6000_cpu) \
2182 case PROCESSOR_RIOS1: \
2183 return (GET_CODE (XEXP (X, 1)) != CONST_INT \
2184 ? COSTS_N_INSNS (5) \
2185 : INTVAL (XEXP (X, 1)) >= -256 && INTVAL (XEXP (X, 1)) <= 255 \
2186 ? COSTS_N_INSNS (3) : COSTS_N_INSNS (4)); \
2187 case PROCESSOR_RS64A: \
2188 return (GET_CODE (XEXP (X, 1)) != CONST_INT \
2189 ? GET_MODE (XEXP (X, 1)) != DImode \
2190 ? COSTS_N_INSNS (20) : COSTS_N_INSNS (34) \
2191 : INTVAL (XEXP (X, 1)) >= -256 && INTVAL (XEXP (X, 1)) <= 255 \
2192 ? COSTS_N_INSNS (12) : COSTS_N_INSNS (14)); \
2193 case PROCESSOR_RIOS2: \
2194 case PROCESSOR_MPCCORE: \
2195 case PROCESSOR_PPC604e: \
2196 return COSTS_N_INSNS (2); \
2197 case PROCESSOR_PPC601: \
2198 return COSTS_N_INSNS (5); \
2199 case PROCESSOR_PPC603: \
2200 case PROCESSOR_PPC750: \
2201 return (GET_CODE (XEXP (X, 1)) != CONST_INT \
2202 ? COSTS_N_INSNS (5) \
2203 : INTVAL (XEXP (X, 1)) >= -256 && INTVAL (XEXP (X, 1)) <= 255 \
2204 ? COSTS_N_INSNS (2) : COSTS_N_INSNS (3)); \
2205 case PROCESSOR_PPC403: \
2206 case PROCESSOR_PPC604: \
2207 return COSTS_N_INSNS (4); \
2208 case PROCESSOR_PPC620: \
2209 case PROCESSOR_PPC630: \
2210 return (GET_CODE (XEXP (X, 1)) != CONST_INT \
2211 ? GET_MODE (XEXP (X, 1)) != DImode \
2212 ? COSTS_N_INSNS (4) : COSTS_N_INSNS (7) \
2213 : INTVAL (XEXP (X, 1)) >= -256 && INTVAL (XEXP (X, 1)) <= 255 \
2214 ? COSTS_N_INSNS (3) : COSTS_N_INSNS (4)); \
2216 case DIV: \
2217 case MOD: \
2218 if (GET_CODE (XEXP (X, 1)) == CONST_INT \
2219 && exact_log2 (INTVAL (XEXP (X, 1))) >= 0) \
2220 return COSTS_N_INSNS (2); \
2221 /* otherwise fall through to normal divide. */ \
2222 case UDIV: \
2223 case UMOD: \
2224 switch (rs6000_cpu) \
2226 case PROCESSOR_RIOS1: \
2227 return COSTS_N_INSNS (19); \
2228 case PROCESSOR_RIOS2: \
2229 return COSTS_N_INSNS (13); \
2230 case PROCESSOR_RS64A: \
2231 return (GET_MODE (XEXP (X, 1)) != DImode \
2232 ? COSTS_N_INSNS (65) \
2233 : COSTS_N_INSNS (67)); \
2234 case PROCESSOR_MPCCORE: \
2235 return COSTS_N_INSNS (6); \
2236 case PROCESSOR_PPC403: \
2237 return COSTS_N_INSNS (33); \
2238 case PROCESSOR_PPC601: \
2239 return COSTS_N_INSNS (36); \
2240 case PROCESSOR_PPC603: \
2241 return COSTS_N_INSNS (37); \
2242 case PROCESSOR_PPC604: \
2243 case PROCESSOR_PPC604e: \
2244 return COSTS_N_INSNS (20); \
2245 case PROCESSOR_PPC620: \
2246 case PROCESSOR_PPC630: \
2247 return (GET_MODE (XEXP (X, 1)) != DImode \
2248 ? COSTS_N_INSNS (21) \
2249 : COSTS_N_INSNS (37)); \
2250 case PROCESSOR_PPC750: \
2251 return COSTS_N_INSNS (19); \
2253 case FFS: \
2254 return COSTS_N_INSNS (4); \
2255 case MEM: \
2256 /* MEM should be slightly more expensive than (plus (reg) (const)) */ \
2257 return 5;
2259 /* Compute the cost of an address. This is meant to approximate the size
2260 and/or execution delay of an insn using that address. If the cost is
2261 approximated by the RTL complexity, including CONST_COSTS above, as
2262 is usually the case for CISC machines, this macro should not be defined.
2263 For aggressively RISCy machines, only one insn format is allowed, so
2264 this macro should be a constant. The value of this macro only matters
2265 for valid addresses.
2267 For the RS/6000, everything is cost 0. */
2269 #define ADDRESS_COST(RTX) 0
2271 /* Adjust the length of an INSN. LENGTH is the currently-computed length and
2272 should be adjusted to reflect any required changes. This macro is used when
2273 there is some systematic length adjustment required that would be difficult
2274 to express in the length attribute. */
2276 /* #define ADJUST_INSN_LENGTH(X,LENGTH) */
2278 /* Add any extra modes needed to represent the condition code.
2280 For the RS/6000, we need separate modes when unsigned (logical) comparisons
2281 are being done and we need a separate mode for floating-point. We also
2282 use a mode for the case when we are comparing the results of two
2283 comparisons, as then only the EQ bit is valid in the register. */
2285 #define EXTRA_CC_MODES \
2286 CC(CCUNSmode, "CCUNS") \
2287 CC(CCFPmode, "CCFP") \
2288 CC(CCEQmode, "CCEQ")
2290 /* Given a comparison code (EQ, NE, etc.) and the first operand of a
2291 COMPARE, return the mode to be used for the comparison. For
2292 floating-point, CCFPmode should be used. CCUNSmode should be used
2293 for unsigned comparisons. CCEQmode should be used when we are
2294 doing an inequality comparison on the result of a
2295 comparison. CCmode should be used in all other cases. */
2297 #define SELECT_CC_MODE(OP,X,Y) \
2298 (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT ? CCFPmode \
2299 : (OP) == GTU || (OP) == LTU || (OP) == GEU || (OP) == LEU ? CCUNSmode \
2300 : (((OP) == EQ || (OP) == NE) && GET_RTX_CLASS (GET_CODE (X)) == '<' \
2301 ? CCEQmode : CCmode))
2303 /* Define the information needed to generate branch and scc insns. This is
2304 stored from the compare operation. Note that we can't use "rtx" here
2305 since it hasn't been defined! */
2307 extern struct rtx_def *rs6000_compare_op0, *rs6000_compare_op1;
2308 extern int rs6000_compare_fp_p;
2310 /* Control the assembler format that we output. */
2312 /* A C string constant describing how to begin a comment in the target
2313 assembler language. The compiler assumes that the comment will end at
2314 the end of the line. */
2315 #define ASM_COMMENT_START " #"
2317 /* Implicit library calls should use memcpy, not bcopy, etc. */
2319 #define TARGET_MEM_FUNCTIONS
2321 /* Define the name of the section to use for the exception tables.
2322 TODO: test and see if we can use read_only_data_section, if so,
2323 remove this. */
2325 #define EXCEPTION_SECTION data_section
2327 /* Flag to say the TOC is initialized */
2328 extern int toc_initialized;
2330 /* Macro to output a special constant pool entry. Go to WIN if we output
2331 it. Otherwise, it is written the usual way.
2333 On the RS/6000, toc entries are handled this way. */
2335 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY(FILE, X, MODE, ALIGN, LABELNO, WIN) \
2336 { if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (X, MODE)) \
2338 output_toc (FILE, X, LABELNO, MODE); \
2339 goto WIN; \
2343 /* This is how we tell the assembler that two symbols have the same value. */
2345 #define SET_ASM_OP "\t.set\t"
2347 /* This implementes the `alias' attribute. */
2349 #define ASM_OUTPUT_DEF_FROM_DECLS(FILE,decl,target) \
2350 do { \
2351 const char * alias = XSTR (XEXP (DECL_RTL (decl), 0), 0); \
2352 char * name = IDENTIFIER_POINTER (target); \
2353 if (TREE_CODE (decl) == FUNCTION_DECL \
2354 && DEFAULT_ABI == ABI_AIX) \
2356 if (TREE_PUBLIC (decl)) \
2358 fputs ("\t.globl .", FILE); \
2359 assemble_name (FILE, alias); \
2360 putc ('\n', FILE); \
2362 else \
2364 fputs ("\t.lglobl .", FILE); \
2365 assemble_name (FILE, alias); \
2366 putc ('\n', FILE); \
2368 fputs ("\t.set .", FILE); \
2369 assemble_name (FILE, alias); \
2370 fputs (",.", FILE); \
2371 assemble_name (FILE, name); \
2372 fputc ('\n', FILE); \
2374 ASM_OUTPUT_DEF (FILE, alias, name); \
2375 } while (0)
2377 /* Output to assembler file text saying following lines
2378 may contain character constants, extra white space, comments, etc. */
2380 #define ASM_APP_ON ""
2382 /* Output to assembler file text saying following lines
2383 no longer contain unusual constructs. */
2385 #define ASM_APP_OFF ""
2387 /* How to refer to registers in assembler output.
2388 This sequence is indexed by compiler's hard-register-number (see above). */
2390 extern char rs6000_reg_names[][8]; /* register names (0 vs. %r0). */
2392 #define REGISTER_NAMES \
2394 &rs6000_reg_names[ 0][0], /* r0 */ \
2395 &rs6000_reg_names[ 1][0], /* r1 */ \
2396 &rs6000_reg_names[ 2][0], /* r2 */ \
2397 &rs6000_reg_names[ 3][0], /* r3 */ \
2398 &rs6000_reg_names[ 4][0], /* r4 */ \
2399 &rs6000_reg_names[ 5][0], /* r5 */ \
2400 &rs6000_reg_names[ 6][0], /* r6 */ \
2401 &rs6000_reg_names[ 7][0], /* r7 */ \
2402 &rs6000_reg_names[ 8][0], /* r8 */ \
2403 &rs6000_reg_names[ 9][0], /* r9 */ \
2404 &rs6000_reg_names[10][0], /* r10 */ \
2405 &rs6000_reg_names[11][0], /* r11 */ \
2406 &rs6000_reg_names[12][0], /* r12 */ \
2407 &rs6000_reg_names[13][0], /* r13 */ \
2408 &rs6000_reg_names[14][0], /* r14 */ \
2409 &rs6000_reg_names[15][0], /* r15 */ \
2410 &rs6000_reg_names[16][0], /* r16 */ \
2411 &rs6000_reg_names[17][0], /* r17 */ \
2412 &rs6000_reg_names[18][0], /* r18 */ \
2413 &rs6000_reg_names[19][0], /* r19 */ \
2414 &rs6000_reg_names[20][0], /* r20 */ \
2415 &rs6000_reg_names[21][0], /* r21 */ \
2416 &rs6000_reg_names[22][0], /* r22 */ \
2417 &rs6000_reg_names[23][0], /* r23 */ \
2418 &rs6000_reg_names[24][0], /* r24 */ \
2419 &rs6000_reg_names[25][0], /* r25 */ \
2420 &rs6000_reg_names[26][0], /* r26 */ \
2421 &rs6000_reg_names[27][0], /* r27 */ \
2422 &rs6000_reg_names[28][0], /* r28 */ \
2423 &rs6000_reg_names[29][0], /* r29 */ \
2424 &rs6000_reg_names[30][0], /* r30 */ \
2425 &rs6000_reg_names[31][0], /* r31 */ \
2427 &rs6000_reg_names[32][0], /* fr0 */ \
2428 &rs6000_reg_names[33][0], /* fr1 */ \
2429 &rs6000_reg_names[34][0], /* fr2 */ \
2430 &rs6000_reg_names[35][0], /* fr3 */ \
2431 &rs6000_reg_names[36][0], /* fr4 */ \
2432 &rs6000_reg_names[37][0], /* fr5 */ \
2433 &rs6000_reg_names[38][0], /* fr6 */ \
2434 &rs6000_reg_names[39][0], /* fr7 */ \
2435 &rs6000_reg_names[40][0], /* fr8 */ \
2436 &rs6000_reg_names[41][0], /* fr9 */ \
2437 &rs6000_reg_names[42][0], /* fr10 */ \
2438 &rs6000_reg_names[43][0], /* fr11 */ \
2439 &rs6000_reg_names[44][0], /* fr12 */ \
2440 &rs6000_reg_names[45][0], /* fr13 */ \
2441 &rs6000_reg_names[46][0], /* fr14 */ \
2442 &rs6000_reg_names[47][0], /* fr15 */ \
2443 &rs6000_reg_names[48][0], /* fr16 */ \
2444 &rs6000_reg_names[49][0], /* fr17 */ \
2445 &rs6000_reg_names[50][0], /* fr18 */ \
2446 &rs6000_reg_names[51][0], /* fr19 */ \
2447 &rs6000_reg_names[52][0], /* fr20 */ \
2448 &rs6000_reg_names[53][0], /* fr21 */ \
2449 &rs6000_reg_names[54][0], /* fr22 */ \
2450 &rs6000_reg_names[55][0], /* fr23 */ \
2451 &rs6000_reg_names[56][0], /* fr24 */ \
2452 &rs6000_reg_names[57][0], /* fr25 */ \
2453 &rs6000_reg_names[58][0], /* fr26 */ \
2454 &rs6000_reg_names[59][0], /* fr27 */ \
2455 &rs6000_reg_names[60][0], /* fr28 */ \
2456 &rs6000_reg_names[61][0], /* fr29 */ \
2457 &rs6000_reg_names[62][0], /* fr30 */ \
2458 &rs6000_reg_names[63][0], /* fr31 */ \
2460 &rs6000_reg_names[64][0], /* mq */ \
2461 &rs6000_reg_names[65][0], /* lr */ \
2462 &rs6000_reg_names[66][0], /* ctr */ \
2463 &rs6000_reg_names[67][0], /* ap */ \
2465 &rs6000_reg_names[68][0], /* cr0 */ \
2466 &rs6000_reg_names[69][0], /* cr1 */ \
2467 &rs6000_reg_names[70][0], /* cr2 */ \
2468 &rs6000_reg_names[71][0], /* cr3 */ \
2469 &rs6000_reg_names[72][0], /* cr4 */ \
2470 &rs6000_reg_names[73][0], /* cr5 */ \
2471 &rs6000_reg_names[74][0], /* cr6 */ \
2472 &rs6000_reg_names[75][0], /* cr7 */ \
2474 &rs6000_reg_names[76][0], /* xer */ \
2477 /* print-rtl can't handle the above REGISTER_NAMES, so define the
2478 following for it. Switch to use the alternate names since
2479 they are more mnemonic. */
2481 #define DEBUG_REGISTER_NAMES \
2483 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
2484 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
2485 "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \
2486 "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", \
2487 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
2488 "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
2489 "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \
2490 "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \
2491 "mq", "lr", "ctr", "ap", \
2492 "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
2493 "xer" \
2496 /* Table of additional register names to use in user input. */
2498 #define ADDITIONAL_REGISTER_NAMES \
2499 {{"r0", 0}, {"r1", 1}, {"r2", 2}, {"r3", 3}, \
2500 {"r4", 4}, {"r5", 5}, {"r6", 6}, {"r7", 7}, \
2501 {"r8", 8}, {"r9", 9}, {"r10", 10}, {"r11", 11}, \
2502 {"r12", 12}, {"r13", 13}, {"r14", 14}, {"r15", 15}, \
2503 {"r16", 16}, {"r17", 17}, {"r18", 18}, {"r19", 19}, \
2504 {"r20", 20}, {"r21", 21}, {"r22", 22}, {"r23", 23}, \
2505 {"r24", 24}, {"r25", 25}, {"r26", 26}, {"r27", 27}, \
2506 {"r28", 28}, {"r29", 29}, {"r30", 30}, {"r31", 31}, \
2507 {"fr0", 32}, {"fr1", 33}, {"fr2", 34}, {"fr3", 35}, \
2508 {"fr4", 36}, {"fr5", 37}, {"fr6", 38}, {"fr7", 39}, \
2509 {"fr8", 40}, {"fr9", 41}, {"fr10", 42}, {"fr11", 43}, \
2510 {"fr12", 44}, {"fr13", 45}, {"fr14", 46}, {"fr15", 47}, \
2511 {"fr16", 48}, {"fr17", 49}, {"fr18", 50}, {"fr19", 51}, \
2512 {"fr20", 52}, {"fr21", 53}, {"fr22", 54}, {"fr23", 55}, \
2513 {"fr24", 56}, {"fr25", 57}, {"fr26", 58}, {"fr27", 59}, \
2514 {"fr28", 60}, {"fr29", 61}, {"fr30", 62}, {"fr31", 63}, \
2515 /* no additional names for: mq, lr, ctr, ap */ \
2516 {"cr0", 68}, {"cr1", 69}, {"cr2", 70}, {"cr3", 71}, \
2517 {"cr4", 72}, {"cr5", 73}, {"cr6", 74}, {"cr7", 75}, \
2518 {"cc", 68}, {"sp", 1}, {"toc", 2} }
2520 /* How to renumber registers for dbx and gdb. */
2522 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
2524 /* Text to write out after a CALL that may be replaced by glue code by
2525 the loader. This depends on the AIX version. */
2526 #define RS6000_CALL_GLUE "cror 31,31,31"
2528 /* This is how to output an assembler line defining a `double' constant. */
2530 #define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
2532 long t[2]; \
2533 REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
2534 fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n", \
2535 t[0] & 0xffffffff, t[1] & 0xffffffff); \
2538 /* This is how to output an assembler line defining a `float' constant. */
2540 #define ASM_OUTPUT_FLOAT(FILE, VALUE) \
2542 long t; \
2543 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
2544 fprintf (FILE, "\t.long 0x%lx\n", t & 0xffffffff); \
2547 /* This is how to output an assembler line defining an `int' constant. */
2549 #define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE) \
2550 do { \
2551 if (TARGET_32BIT) \
2553 assemble_integer (operand_subword ((VALUE), 0, 0, DImode), \
2554 UNITS_PER_WORD, 1); \
2555 assemble_integer (operand_subword ((VALUE), 1, 0, DImode), \
2556 UNITS_PER_WORD, 1); \
2558 else \
2560 fputs ("\t.llong ", FILE); \
2561 output_addr_const (FILE, (VALUE)); \
2562 putc ('\n', FILE); \
2564 } while (0)
2566 #define ASM_OUTPUT_INT(FILE,VALUE) \
2567 ( fputs ("\t.long ", FILE), \
2568 output_addr_const (FILE, (VALUE)), \
2569 putc ('\n', FILE))
2571 /* Likewise for `char' and `short' constants. */
2573 #define ASM_OUTPUT_SHORT(FILE,VALUE) \
2574 ( fputs ("\t.short ", FILE), \
2575 output_addr_const (FILE, (VALUE)), \
2576 putc ('\n', FILE))
2578 #define ASM_OUTPUT_CHAR(FILE,VALUE) \
2579 ( fputs ("\t.byte ", FILE), \
2580 output_addr_const (FILE, (VALUE)), \
2581 putc ('\n', FILE))
2583 /* This is how to output an assembler line for a numeric constant byte. */
2585 #define ASM_OUTPUT_BYTE(FILE,VALUE) \
2586 fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
2588 /* This is used by the definition of ASM_OUTPUT_ADDR_ELT in defaults.h. */
2589 #define ASM_LONG (TARGET_32BIT ? ".long" : ".quad")
2591 /* This is how to output an element of a case-vector that is relative. */
2593 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
2594 do { char buf[100]; \
2595 fputs ("\t.long ", FILE); \
2596 ASM_GENERATE_INTERNAL_LABEL (buf, "L", VALUE); \
2597 assemble_name (FILE, buf); \
2598 putc ('-', FILE); \
2599 ASM_GENERATE_INTERNAL_LABEL (buf, "L", REL); \
2600 assemble_name (FILE, buf); \
2601 putc ('\n', FILE); \
2602 } while (0)
2604 /* This is how to output an assembler line
2605 that says to advance the location counter
2606 to a multiple of 2**LOG bytes. */
2608 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
2609 if ((LOG) != 0) \
2610 fprintf (FILE, "\t.align %d\n", (LOG))
2612 /* This says how to output an assembler line
2613 to define a local common symbol.
2614 Alignment cannot be specified, but we can try to maintain
2615 alignment after preceding TOC section if it was aligned
2616 for 64-bit mode. */
2618 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
2619 do { fputs (".lcomm ", (FILE)); \
2620 RS6000_OUTPUT_BASENAME ((FILE), (NAME)); \
2621 fprintf ((FILE), ",%d,%s\n", (TARGET_32BIT ? (SIZE) : (ROUNDED)), \
2622 xcoff_bss_section_name); \
2623 } while (0)
2625 /* Store in OUTPUT a string (made with alloca) containing
2626 an assembler-name for a local static variable named NAME.
2627 LABELNO is an integer which is different for each call. */
2629 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
2630 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
2631 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
2633 /* Define the parentheses used to group arithmetic operations
2634 in assembler code. */
2636 #define ASM_OPEN_PAREN "("
2637 #define ASM_CLOSE_PAREN ")"
2639 /* Pick up the return address upon entry to a procedure. Used for
2640 dwarf2 unwind information. This also enables the table driven
2641 mechanism. */
2643 #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM)
2644 #define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (LINK_REGISTER_REGNUM)
2646 /* Describe how we implement __builtin_eh_return. */
2647 #define EH_RETURN_DATA_REGNO(N) ((N) < 4 ? (N) + 3 : INVALID_REGNUM)
2648 #define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, 10)
2650 /* Define results of standard character escape sequences. */
2651 #define TARGET_BELL 007
2652 #define TARGET_BS 010
2653 #define TARGET_TAB 011
2654 #define TARGET_NEWLINE 012
2655 #define TARGET_VT 013
2656 #define TARGET_FF 014
2657 #define TARGET_CR 015
2659 /* Print operand X (an rtx) in assembler syntax to file FILE.
2660 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
2661 For `%' followed by punctuation, CODE is the punctuation and X is null. */
2663 #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
2665 /* Define which CODE values are valid. */
2667 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
2668 ((CODE) == '.' || (CODE) == '*' || (CODE) == '$')
2670 /* Print a memory address as an operand to reference that memory location. */
2672 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
2674 /* Define the codes that are matched by predicates in rs6000.c. */
2676 #define PREDICATE_CODES \
2677 {"short_cint_operand", {CONST_INT}}, \
2678 {"u_short_cint_operand", {CONST_INT}}, \
2679 {"non_short_cint_operand", {CONST_INT}}, \
2680 {"gpc_reg_operand", {SUBREG, REG}}, \
2681 {"cc_reg_operand", {SUBREG, REG}}, \
2682 {"cc_reg_not_cr0_operand", {SUBREG, REG}}, \
2683 {"reg_or_short_operand", {SUBREG, REG, CONST_INT}}, \
2684 {"reg_or_neg_short_operand", {SUBREG, REG, CONST_INT}}, \
2685 {"reg_or_u_short_operand", {SUBREG, REG, CONST_INT}}, \
2686 {"reg_or_cint_operand", {SUBREG, REG, CONST_INT}}, \
2687 {"reg_or_arith_cint_operand", {SUBREG, REG, CONST_INT}}, \
2688 {"reg_or_logical_cint_operand", {SUBREG, REG, CONST_INT, CONST_DOUBLE}}, \
2689 {"got_operand", {SYMBOL_REF, CONST, LABEL_REF}}, \
2690 {"got_no_const_operand", {SYMBOL_REF, LABEL_REF}}, \
2691 {"easy_fp_constant", {CONST_DOUBLE}}, \
2692 {"reg_or_mem_operand", {SUBREG, MEM, REG}}, \
2693 {"lwa_operand", {SUBREG, MEM, REG}}, \
2694 {"volatile_mem_operand", {MEM}}, \
2695 {"offsettable_mem_operand", {MEM}}, \
2696 {"mem_or_easy_const_operand", {SUBREG, MEM, CONST_DOUBLE}}, \
2697 {"add_operand", {SUBREG, REG, CONST_INT}}, \
2698 {"non_add_cint_operand", {CONST_INT}}, \
2699 {"and_operand", {SUBREG, REG, CONST_INT}}, \
2700 {"and64_operand", {SUBREG, REG, CONST_INT, CONST_DOUBLE}}, \
2701 {"logical_operand", {SUBREG, REG, CONST_INT, CONST_DOUBLE}}, \
2702 {"non_logical_cint_operand", {CONST_INT, CONST_DOUBLE}}, \
2703 {"mask_operand", {CONST_INT}}, \
2704 {"mask64_operand", {CONST_INT, CONST_DOUBLE}}, \
2705 {"rldic_operand", {CONST_INT, CONST_DOUBLE}}, \
2706 {"count_register_operand", {REG}}, \
2707 {"xer_operand", {REG}}, \
2708 {"call_operand", {SYMBOL_REF, REG}}, \
2709 {"current_file_function_operand", {SYMBOL_REF}}, \
2710 {"input_operand", {SUBREG, MEM, REG, CONST_INT, \
2711 CONST_DOUBLE, SYMBOL_REF}}, \
2712 {"load_multiple_operation", {PARALLEL}}, \
2713 {"store_multiple_operation", {PARALLEL}}, \
2714 {"branch_comparison_operator", {EQ, NE, LE, LT, GE, \
2715 GT, LEU, LTU, GEU, GTU, \
2716 UNORDERED, ORDERED, \
2717 UNGE, UNLE }}, \
2718 {"branch_positive_comparison_operator", {EQ, LT, GT, LTU, GTU, \
2719 UNORDERED }}, \
2720 {"scc_comparison_operator", {EQ, NE, LE, LT, GE, \
2721 GT, LEU, LTU, GEU, GTU, \
2722 UNORDERED, ORDERED, \
2723 UNGE, UNLE }}, \
2724 {"trap_comparison_operator", {EQ, NE, LE, LT, GE, \
2725 GT, LEU, LTU, GEU, GTU}}, \
2726 {"boolean_operator", {AND, IOR, XOR}}, \
2727 {"boolean_or_operator", {IOR, XOR}},
2729 /* uncomment for disabling the corresponding default options */
2730 /* #define MACHINE_no_sched_interblock */
2731 /* #define MACHINE_no_sched_speculative */
2732 /* #define MACHINE_no_sched_speculative_load */
2734 /* indicate that issue rate is defined for this machine
2735 (no need to use the default) */
2736 #define ISSUE_RATE get_issue_rate ()
2738 /* General flags. */
2739 extern int flag_pic;
2740 extern int optimize;
2741 extern int flag_expensive_optimizations;
2742 extern int frame_pointer_needed;