* Check in merge from gcc2. See ChangeLog.11 and ChangeLog.12
[gcc.git] / gcc / config / rs6000 / rs6000.h
1 /* Definitions of target machine for GNU compiler, for IBM RS/6000.
2 Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
3 Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
4
5 This file is part of GNU CC.
6
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22
23 /* Note that some other tm.h files include this one and then override
24 many of the definitions that relate to assembler syntax. */
25
26
27 /* Names to predefine in the preprocessor for this target machine. */
28
29 #define CPP_PREDEFINES "-D_IBMR2 -D_POWER -D_AIX -D_AIX32 \
30 -Asystem(unix) -Asystem(aix) -Acpu(rs6000) -Amachine(rs6000)"
31
32 /* Print subsidiary information on the compiler version in use. */
33 #define TARGET_VERSION ;
34
35 /* Default string to use for cpu if not specified. */
36 #ifndef TARGET_CPU_DEFAULT
37 #define TARGET_CPU_DEFAULT ((char *)0)
38 #endif
39
40 /* Tell the assembler to assume that all undefined names are external.
41
42 Don't do this until the fixed IBM assembler is more generally available.
43 When this becomes permanently defined, the ASM_OUTPUT_EXTERNAL,
44 ASM_OUTPUT_EXTERNAL_LIBCALL, and RS6000_OUTPUT_BASENAME macros will no
45 longer be needed. Also, the extern declaration of mcount in ASM_FILE_START
46 will no longer be needed. */
47
48 /* #define ASM_SPEC "-u %(asm_cpu)" */
49
50 /* Define appropriate architecture macros for preprocessor depending on
51 target switches. */
52
53 #define CPP_SPEC "%{posix: -D_POSIX_SOURCE} %(cpp_cpu)"
54
55 /* Common CPP definitions used by CPP_SPEC among the various targets
56 for handling -mcpu=xxx switches. */
57 #define CPP_CPU_SPEC \
58 "%{!mcpu*: \
59 %{mpower: %{!mpower2: -D_ARCH_PWR}} \
60 %{mpower2: -D_ARCH_PWR2} \
61 %{mpowerpc*: -D_ARCH_PPC} \
62 %{mno-power: %{!mpowerpc*: -D_ARCH_COM}} \
63 %{!mno-power: %{!mpower2: %(cpp_default)}}} \
64 %{mcpu=common: -D_ARCH_COM} \
65 %{mcpu=power: -D_ARCH_PWR} \
66 %{mcpu=power2: -D_ARCH_PWR2} \
67 %{mcpu=powerpc: -D_ARCH_PPC} \
68 %{mcpu=rios: -D_ARCH_PWR} \
69 %{mcpu=rios1: -D_ARCH_PWR} \
70 %{mcpu=rios2: -D_ARCH_PWR2} \
71 %{mcpu=rsc: -D_ARCH_PWR} \
72 %{mcpu=rsc1: -D_ARCH_PWR} \
73 %{mcpu=403: -D_ARCH_PPC} \
74 %{mcpu=505: -D_ARCH_PPC} \
75 %{mcpu=601: -D_ARCH_PPC -D_ARCH_PWR} \
76 %{mcpu=602: -D_ARCH_PPC} \
77 %{mcpu=603: -D_ARCH_PPC} \
78 %{mcpu=603e: -D_ARCH_PPC} \
79 %{mcpu=604: -D_ARCH_PPC} \
80 %{mcpu=620: -D_ARCH_PPC} \
81 %{mcpu=821: -D_ARCH_PPC} \
82 %{mcpu=860: -D_ARCH_PPC}"
83
84 #ifndef CPP_DEFAULT_SPEC
85 #define CPP_DEFAULT_SPEC "-D_ARCH_PWR"
86 #endif
87
88 #ifndef CPP_SYSV_SPEC
89 #define CPP_SYSV_SPEC ""
90 #endif
91
92 #ifndef CPP_ENDIAN_SPEC
93 #define CPP_ENDIAN_SPEC ""
94 #endif
95
96 #ifndef CPP_ENDIAN_DEFAULT_SPEC
97 #define CPP_ENDIAN_DEFAULT_SPEC ""
98 #endif
99
100 #ifndef CPP_SYSV_DEFAULT_SPEC
101 #define CPP_SYSV_DEFAULT_SPEC ""
102 #endif
103
104 /* Common ASM definitions used by ASM_SPEC among the various targets
105 for handling -mcpu=xxx switches. */
106 #define ASM_CPU_SPEC \
107 "%{!mcpu*: \
108 %{mpower: %{!mpower2: -mpwr}} \
109 %{mpower2: -mpwrx} \
110 %{mpowerpc*: -mppc} \
111 %{mno-power: %{!mpowerpc*: -mcom}} \
112 %{!mno-power: %{!mpower2: %(asm_default)}}} \
113 %{mcpu=common: -mcom} \
114 %{mcpu=power: -mpwr} \
115 %{mcpu=power2: -mpwrx} \
116 %{mcpu=powerpc: -mppc} \
117 %{mcpu=rios: -mpwr} \
118 %{mcpu=rios1: -mpwr} \
119 %{mcpu=rios2: -mpwrx} \
120 %{mcpu=rsc: -mpwr} \
121 %{mcpu=rsc1: -mpwr} \
122 %{mcpu=403: -mppc} \
123 %{mcpu=505: -mppc} \
124 %{mcpu=601: -m601} \
125 %{mcpu=602: -mppc} \
126 %{mcpu=603: -mppc} \
127 %{mcpu=603e: -mppc} \
128 %{mcpu=604: -mppc} \
129 %{mcpu=620: -mppc} \
130 %{mcpu=821: -mppc} \
131 %{mcpu=860: -mppc}"
132
133 #ifndef ASM_DEFAULT_SPEC
134 #define ASM_DEFAULT_SPEC ""
135 #endif
136
137 /* This macro defines names of additional specifications to put in the specs
138 that can be used in various specifications like CC1_SPEC. Its definition
139 is an initializer with a subgrouping for each command option.
140
141 Each subgrouping contains a string constant, that defines the
142 specification name, and a string constant that used by the GNU CC driver
143 program.
144
145 Do not define this macro if it does not need to do anything. */
146
147 #ifndef SUBTARGET_EXTRA_SPECS
148 #define SUBTARGET_EXTRA_SPECS
149 #endif
150
151 #define EXTRA_SPECS \
152 { "cpp_cpu", CPP_CPU_SPEC }, \
153 { "cpp_default", CPP_DEFAULT_SPEC }, \
154 { "cpp_sysv", CPP_SYSV_SPEC }, \
155 { "cpp_sysv_default", CPP_SYSV_DEFAULT_SPEC }, \
156 { "cpp_endian_default", CPP_ENDIAN_DEFAULT_SPEC }, \
157 { "cpp_endian", CPP_ENDIAN_SPEC }, \
158 { "asm_cpu", ASM_CPU_SPEC }, \
159 { "asm_default", ASM_DEFAULT_SPEC }, \
160 { "link_syscalls", LINK_SYSCALLS_SPEC }, \
161 { "link_libg", LINK_LIBG_SPEC }, \
162 SUBTARGET_EXTRA_SPECS
163
164 /* Default location of syscalls.exp under AIX */
165 #ifndef CROSS_COMPILE
166 #define LINK_SYSCALLS_SPEC "-bI:/lib/syscalls.exp"
167 #else
168 #define LINK_SYSCALLS_SPEC ""
169 #endif
170
171 /* Default location of libg.exp under AIX */
172 #ifndef CROSS_COMPILE
173 #define LINK_LIBG_SPEC "-bexport:/usr/lib/libg.exp"
174 #else
175 #define LINK_LIBG_SPEC ""
176 #endif
177
178 /* Define the options for the binder: Start text at 512, align all segments
179 to 512 bytes, and warn if there is text relocation.
180
181 The -bhalt:4 option supposedly changes the level at which ld will abort,
182 but it also suppresses warnings about multiply defined symbols and is
183 used by the AIX cc command. So we use it here.
184
185 -bnodelcsect undoes a poor choice of default relating to multiply-defined
186 csects. See AIX documentation for more information about this.
187
188 -bM:SRE tells the linker that the output file is Shared REusable. Note
189 that to actually build a shared library you will also need to specify an
190 export list with the -Wl,-bE option. */
191
192 #define LINK_SPEC "-T512 -H512 %{!r:-btextro} -bhalt:4 -bnodelcsect\
193 %{static:-bnso %(link_syscalls) } \
194 %{!shared:%{g*: %(link_libg) }} %{shared:-bM:SRE}"
195
196 /* Profiled library versions are used by linking with special directories. */
197 #define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\
198 %{p:-L/lib/profiled -L/usr/lib/profiled} %{!shared:%{g*:-lg}} -lc"
199
200 /* gcc must do the search itself to find libgcc.a, not use -l. */
201 #define LIBGCC_SPEC "libgcc.a%s"
202
203 /* Don't turn -B into -L if the argument specifies a relative file name. */
204 #define RELATIVE_PREFIX_NOT_LINKDIR
205
206 /* Architecture type. */
207
208 extern int target_flags;
209
210 /* Use POWER architecture instructions and MQ register. */
211 #define MASK_POWER 0x00000001
212
213 /* Use POWER2 extensions to POWER architecture. */
214 #define MASK_POWER2 0x00000002
215
216 /* Use PowerPC architecture instructions. */
217 #define MASK_POWERPC 0x00000004
218
219 /* Use PowerPC General Purpose group optional instructions, e.g. fsqrt. */
220 #define MASK_PPC_GPOPT 0x00000008
221
222 /* Use PowerPC Graphics group optional instructions, e.g. fsel. */
223 #define MASK_PPC_GFXOPT 0x00000010
224
225 /* Use PowerPC-64 architecture instructions. */
226 #define MASK_POWERPC64 0x00000020
227
228 /* Use revised mnemonic names defined for PowerPC architecture. */
229 #define MASK_NEW_MNEMONICS 0x00000040
230
231 /* Disable placing fp constants in the TOC; can be turned on when the
232 TOC overflows. */
233 #define MASK_NO_FP_IN_TOC 0x00000080
234
235 /* Disable placing symbol+offset constants in the TOC; can be turned on when
236 the TOC overflows. */
237 #define MASK_NO_SUM_IN_TOC 0x00000100
238
239 /* Output only one TOC entry per module. Normally linking fails if
240 there are more than 16K unique variables/constants in an executable. With
241 this option, linking fails only if there are more than 16K modules, or
242 if there are more than 16K unique variables/constant in a single module.
243
244 This is at the cost of having 2 extra loads and one extra store per
245 function, and one less allocable register. */
246 #define MASK_MINIMAL_TOC 0x00000200
247
248 /* Nonzero for the 64bit model: ints, longs, and pointers are 64 bits. */
249 #define MASK_64BIT 0x00000400
250
251 /* Disable use of FPRs. */
252 #define MASK_SOFT_FLOAT 0x00000800
253
254 /* Enable load/store multiple, even on powerpc */
255 #define MASK_MULTIPLE 0x00001000
256 #define MASK_MULTIPLE_SET 0x00002000
257
258 /* Use string instructions for block moves */
259 #define MASK_STRING 0x00004000
260 #define MASK_STRING_SET 0x00008000
261
262 /* Disable update form of load/store */
263 #define MASK_NO_UPDATE 0x00010000
264
265 /* Disable fused multiply/add operations */
266 #define MASK_NO_FUSED_MADD 0x00020000
267
268 #define TARGET_POWER (target_flags & MASK_POWER)
269 #define TARGET_POWER2 (target_flags & MASK_POWER2)
270 #define TARGET_POWERPC (target_flags & MASK_POWERPC)
271 #define TARGET_PPC_GPOPT (target_flags & MASK_PPC_GPOPT)
272 #define TARGET_PPC_GFXOPT (target_flags & MASK_PPC_GFXOPT)
273 #define TARGET_POWERPC64 (target_flags & MASK_POWERPC64)
274 #define TARGET_NEW_MNEMONICS (target_flags & MASK_NEW_MNEMONICS)
275 #define TARGET_NO_FP_IN_TOC (target_flags & MASK_NO_FP_IN_TOC)
276 #define TARGET_NO_SUM_IN_TOC (target_flags & MASK_NO_SUM_IN_TOC)
277 #define TARGET_MINIMAL_TOC (target_flags & MASK_MINIMAL_TOC)
278 #define TARGET_64BIT (target_flags & MASK_64BIT)
279 #define TARGET_SOFT_FLOAT (target_flags & MASK_SOFT_FLOAT)
280 #define TARGET_MULTIPLE (target_flags & MASK_MULTIPLE)
281 #define TARGET_MULTIPLE_SET (target_flags & MASK_MULTIPLE_SET)
282 #define TARGET_STRING (target_flags & MASK_STRING)
283 #define TARGET_STRING_SET (target_flags & MASK_STRING_SET)
284 #define TARGET_NO_UPDATE (target_flags & MASK_NO_UPDATE)
285 #define TARGET_NO_FUSED_MADD (target_flags & MASK_NO_FUSED_MADD)
286
287 #define TARGET_32BIT (! TARGET_64BIT)
288 #define TARGET_HARD_FLOAT (! TARGET_SOFT_FLOAT)
289 #define TARGET_UPDATE (! TARGET_NO_UPDATE)
290 #define TARGET_FUSED_MADD (! TARGET_NO_FUSED_MADD)
291
292 /* Pseudo target to indicate whether the object format is ELF
293 (to get around not having conditional compilation in the md file) */
294 #ifndef TARGET_ELF
295 #define TARGET_ELF 0
296 #endif
297
298 /* If this isn't V.4, don't support -mno-toc. */
299 #ifndef TARGET_NO_TOC
300 #define TARGET_NO_TOC 0
301 #define TARGET_TOC 1
302 #endif
303
304 /* Pseudo target to say whether this is Windows NT */
305 #ifndef TARGET_WINDOWS_NT
306 #define TARGET_WINDOWS_NT 0
307 #endif
308
309 /* Pseudo target to say whether this is MAC */
310 #ifndef TARGET_MACOS
311 #define TARGET_MACOS 0
312 #endif
313
314 /* Pseudo target to say whether this is AIX */
315 #ifndef TARGET_AIX
316 #if (TARGET_ELF || TARGET_WINDOWS_NT || TARGET_MACOS)
317 #define TARGET_AIX 0
318 #else
319 #define TARGET_AIX 1
320 #endif
321 #endif
322
323 #ifndef TARGET_XL_CALL
324 #define TARGET_XL_CALL 0
325 #endif
326
327 /* Run-time compilation parameters selecting different hardware subsets.
328
329 Macro to define tables used to set the flags.
330 This is a list in braces of pairs in braces,
331 each pair being { "NAME", VALUE }
332 where VALUE is the bits to set or minus the bits to clear.
333 An empty string NAME is used to identify the default VALUE. */
334
335 /* This is meant to be redefined in the host dependent files */
336 #ifndef SUBTARGET_SWITCHES
337 #define SUBTARGET_SWITCHES
338 #endif
339
340 #define TARGET_SWITCHES \
341 {{"power", MASK_POWER | MASK_MULTIPLE | MASK_STRING}, \
342 {"power2", (MASK_POWER | MASK_MULTIPLE | MASK_STRING \
343 | MASK_POWER2)}, \
344 {"no-power2", - MASK_POWER2}, \
345 {"no-power", - (MASK_POWER | MASK_POWER2 | MASK_MULTIPLE \
346 | MASK_STRING)}, \
347 {"powerpc", MASK_POWERPC}, \
348 {"no-powerpc", - (MASK_POWERPC | MASK_PPC_GPOPT \
349 | MASK_PPC_GFXOPT | MASK_POWERPC64)}, \
350 {"powerpc-gpopt", MASK_POWERPC | MASK_PPC_GPOPT}, \
351 {"no-powerpc-gpopt", - MASK_PPC_GPOPT}, \
352 {"powerpc-gfxopt", MASK_POWERPC | MASK_PPC_GFXOPT}, \
353 {"no-powerpc-gfxopt", - MASK_PPC_GFXOPT}, \
354 {"new-mnemonics", MASK_NEW_MNEMONICS}, \
355 {"old-mnemonics", -MASK_NEW_MNEMONICS}, \
356 {"full-toc", - (MASK_NO_FP_IN_TOC | MASK_NO_SUM_IN_TOC \
357 | MASK_MINIMAL_TOC)}, \
358 {"fp-in-toc", - MASK_NO_FP_IN_TOC}, \
359 {"no-fp-in-toc", MASK_NO_FP_IN_TOC}, \
360 {"sum-in-toc", - MASK_NO_SUM_IN_TOC}, \
361 {"no-sum-in-toc", MASK_NO_SUM_IN_TOC}, \
362 {"minimal-toc", MASK_MINIMAL_TOC}, \
363 {"minimal-toc", - (MASK_NO_FP_IN_TOC | MASK_NO_SUM_IN_TOC)}, \
364 {"no-minimal-toc", - MASK_MINIMAL_TOC}, \
365 {"hard-float", - MASK_SOFT_FLOAT}, \
366 {"soft-float", MASK_SOFT_FLOAT}, \
367 {"multiple", MASK_MULTIPLE | MASK_MULTIPLE_SET}, \
368 {"no-multiple", - MASK_MULTIPLE}, \
369 {"no-multiple", MASK_MULTIPLE_SET}, \
370 {"string", MASK_STRING | MASK_STRING_SET}, \
371 {"no-string", - MASK_STRING}, \
372 {"no-string", MASK_STRING_SET}, \
373 {"update", - MASK_NO_UPDATE}, \
374 {"no-update", MASK_NO_UPDATE}, \
375 {"fused-madd", - MASK_NO_FUSED_MADD}, \
376 {"no-fused-madd", MASK_NO_FUSED_MADD}, \
377 SUBTARGET_SWITCHES \
378 {"", TARGET_DEFAULT}}
379
380 #define TARGET_DEFAULT (MASK_POWER | MASK_MULTIPLE | MASK_STRING)
381
382 /* Processor type. */
383 enum processor_type
384 {PROCESSOR_RIOS1,
385 PROCESSOR_RIOS2,
386 PROCESSOR_MPCCORE,
387 PROCESSOR_PPC403,
388 PROCESSOR_PPC601,
389 PROCESSOR_PPC603,
390 PROCESSOR_PPC604,
391 PROCESSOR_PPC620};
392
393 extern enum processor_type rs6000_cpu;
394
395 /* Recast the processor type to the cpu attribute. */
396 #define rs6000_cpu_attr ((enum attr_cpu)rs6000_cpu)
397
398 /* Define generic processor types based upon current deployment. */
399 #define PROCESSOR_COMMON PROCESSOR_PPC601
400 #define PROCESSOR_POWER PROCESSOR_RIOS1
401 #define PROCESSOR_POWERPC PROCESSOR_PPC604
402
403 /* Define the default processor. This is overridden by other tm.h files. */
404 #define PROCESSOR_DEFAULT PROCESSOR_RIOS1
405
406 /* Specify the dialect of assembler to use. New mnemonics is dialect one
407 and the old mnemonics are dialect zero. */
408 #define ASSEMBLER_DIALECT TARGET_NEW_MNEMONICS ? 1 : 0
409
410 /* This macro is similar to `TARGET_SWITCHES' but defines names of
411 command options that have values. Its definition is an
412 initializer with a subgrouping for each command option.
413
414 Each subgrouping contains a string constant, that defines the
415 fixed part of the option name, and the address of a variable.
416 The variable, type `char *', is set to the variable part of the
417 given option if the fixed part matches. The actual option name
418 is made by appending `-m' to the specified name.
419
420 Here is an example which defines `-mshort-data-NUMBER'. If the
421 given option is `-mshort-data-512', the variable `m88k_short_data'
422 will be set to the string `"512"'.
423
424 extern char *m88k_short_data;
425 #define TARGET_OPTIONS { { "short-data-", &m88k_short_data } } */
426
427 /* This is meant to be overridden in target specific files. */
428 #ifndef SUBTARGET_OPTIONS
429 #define SUBTARGET_OPTIONS
430 #endif
431
432 #define TARGET_OPTIONS \
433 { \
434 {"cpu=", &rs6000_select[1].string}, \
435 {"tune=", &rs6000_select[2].string}, \
436 {"debug-", &rs6000_debug_name}, \
437 {"debug=", &rs6000_debug_name}, \
438 SUBTARGET_OPTIONS \
439 }
440
441 /* rs6000_select[0] is reserved for the default cpu defined via --with-cpu */
442 struct rs6000_cpu_select
443 {
444 char *string;
445 char *name;
446 int set_tune_p;
447 int set_arch_p;
448 };
449
450 extern struct rs6000_cpu_select rs6000_select[];
451
452 /* Debug support */
453 extern char *rs6000_debug_name; /* Name for -mdebug-xxxx option */
454 extern int rs6000_debug_stack; /* debug stack applications */
455 extern int rs6000_debug_arg; /* debug argument handling */
456
457 #define TARGET_DEBUG_STACK rs6000_debug_stack
458 #define TARGET_DEBUG_ARG rs6000_debug_arg
459
460 /* Sometimes certain combinations of command options do not make sense
461 on a particular target machine. You can define a macro
462 `OVERRIDE_OPTIONS' to take account of this. This macro, if
463 defined, is executed once just after all the command options have
464 been parsed.
465
466 On the RS/6000 this is used to define the target cpu type. */
467
468 #define OVERRIDE_OPTIONS rs6000_override_options (TARGET_CPU_DEFAULT)
469
470 /* Show we can debug even without a frame pointer. */
471 #define CAN_DEBUG_WITHOUT_FP
472 \f
473 /* target machine storage layout */
474
475 /* Define to support cross compilation to an RS6000 target. */
476 #define REAL_ARITHMETIC
477
478 /* Define this macro if it is advisable to hold scalars in registers
479 in a wider mode than that declared by the program. In such cases,
480 the value is constrained to be within the bounds of the declared
481 type, but kept valid in the wider mode. The signedness of the
482 extension may differ from that of the type. */
483
484 #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
485 if (GET_MODE_CLASS (MODE) == MODE_INT \
486 && GET_MODE_SIZE (MODE) < 4) \
487 (MODE) = SImode;
488
489 /* Define this if most significant bit is lowest numbered
490 in instructions that operate on numbered bit-fields. */
491 /* That is true on RS/6000. */
492 #define BITS_BIG_ENDIAN 1
493
494 /* Define this if most significant byte of a word is the lowest numbered. */
495 /* That is true on RS/6000. */
496 #define BYTES_BIG_ENDIAN 1
497
498 /* Define this if most significant word of a multiword number is lowest
499 numbered.
500
501 For RS/6000 we can decide arbitrarily since there are no machine
502 instructions for them. Might as well be consistent with bits and bytes. */
503 #define WORDS_BIG_ENDIAN 1
504
505 /* number of bits in an addressable storage unit */
506 #define BITS_PER_UNIT 8
507
508 /* Width in bits of a "word", which is the contents of a machine register.
509 Note that this is not necessarily the width of data type `int';
510 if using 16-bit ints on a 68000, this would still be 32.
511 But on a machine with 16-bit registers, this would be 16. */
512 #define BITS_PER_WORD (! TARGET_POWERPC64 ? 32 : 64)
513 #define MAX_BITS_PER_WORD 64
514
515 /* Width of a word, in units (bytes). */
516 #define UNITS_PER_WORD (! TARGET_POWERPC64 ? 4 : 8)
517 #define MIN_UNITS_PER_WORD 4
518 #define UNITS_PER_FP_WORD 8
519
520 /* Type used for ptrdiff_t, as a string used in a declaration. */
521 #define PTRDIFF_TYPE "int"
522
523 /* Type used for wchar_t, as a string used in a declaration. */
524 #define WCHAR_TYPE "short unsigned int"
525
526 /* Width of wchar_t in bits. */
527 #define WCHAR_TYPE_SIZE 16
528
529 /* A C expression for the size in bits of the type `short' on the
530 target machine. If you don't define this, the default is half a
531 word. (If this would be less than one storage unit, it is
532 rounded up to one unit.) */
533 #define SHORT_TYPE_SIZE 16
534
535 /* A C expression for the size in bits of the type `int' on the
536 target machine. If you don't define this, the default is one
537 word. */
538 #define INT_TYPE_SIZE 32
539
540 /* A C expression for the size in bits of the type `long' on the
541 target machine. If you don't define this, the default is one
542 word. */
543 #define LONG_TYPE_SIZE (TARGET_32BIT ? 32 : 64)
544 #define MAX_LONG_TYPE_SIZE 64
545
546 /* A C expression for the size in bits of the type `long long' on the
547 target machine. If you don't define this, the default is two
548 words. */
549 #define LONG_LONG_TYPE_SIZE 64
550
551 /* A C expression for the size in bits of the type `char' on the
552 target machine. If you don't define this, the default is one
553 quarter of a word. (If this would be less than one storage unit,
554 it is rounded up to one unit.) */
555 #define CHAR_TYPE_SIZE BITS_PER_UNIT
556
557 /* A C expression for the size in bits of the type `float' on the
558 target machine. If you don't define this, the default is one
559 word. */
560 #define FLOAT_TYPE_SIZE 32
561
562 /* A C expression for the size in bits of the type `double' on the
563 target machine. If you don't define this, the default is two
564 words. */
565 #define DOUBLE_TYPE_SIZE 64
566
567 /* A C expression for the size in bits of the type `long double' on
568 the target machine. If you don't define this, the default is two
569 words. */
570 #define LONG_DOUBLE_TYPE_SIZE 64
571
572 /* Width in bits of a pointer.
573 See also the macro `Pmode' defined below. */
574 #define POINTER_SIZE (TARGET_32BIT ? 32 : 64)
575
576 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
577 #define PARM_BOUNDARY (TARGET_32BIT ? 32 : 64)
578
579 /* Boundary (in *bits*) on which stack pointer should be aligned. */
580 #define STACK_BOUNDARY 64
581
582 /* Allocation boundary (in *bits*) for the code of a function. */
583 #define FUNCTION_BOUNDARY 32
584
585 /* No data type wants to be aligned rounder than this. */
586 #define BIGGEST_ALIGNMENT 64
587
588 /* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints. */
589 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
590 (DECL_MODE (FIELD) != DFmode ? (COMPUTED) : MIN ((COMPUTED), 32))
591
592 /* Alignment of field after `int : 0' in a structure. */
593 #define EMPTY_FIELD_BOUNDARY 32
594
595 /* Every structure's size must be a multiple of this. */
596 #define STRUCTURE_SIZE_BOUNDARY 8
597
598 /* A bitfield declared as `int' forces `int' alignment for the struct. */
599 #define PCC_BITFIELD_TYPE_MATTERS 1
600
601 /* AIX increases natural record alignment to doubleword if the first
602 field is an FP double while the FP fields remain word aligned. */
603 #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \
604 ((TREE_CODE (STRUCT) == RECORD_TYPE \
605 || TREE_CODE (STRUCT) == UNION_TYPE \
606 || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \
607 && TYPE_FIELDS (STRUCT) != 0 \
608 && DECL_MODE (TYPE_FIELDS (STRUCT)) == DFmode \
609 ? MAX (MAX ((COMPUTED), (SPECIFIED)), BIGGEST_ALIGNMENT) \
610 : MAX ((COMPUTED), (SPECIFIED)))
611
612 /* Make strings word-aligned so strcpy from constants will be faster. */
613 #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
614 (TREE_CODE (EXP) == STRING_CST \
615 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
616
617 /* Make arrays of chars word-aligned for the same reasons. */
618 #define DATA_ALIGNMENT(TYPE, ALIGN) \
619 (TREE_CODE (TYPE) == ARRAY_TYPE \
620 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
621 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
622
623 /* Non-zero if move instructions will actually fail to work
624 when given unaligned data. */
625 #define STRICT_ALIGNMENT 0
626 \f
627 /* Standard register usage. */
628
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.
634
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.
638
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.
643
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. */
648
649 #define FIRST_PSEUDO_REGISTER 77
650
651 /* 1 for registers that have pervasive standard uses
652 and are not available for the register allocator.
653
654 On RS/6000, r1 is used for the stack and r2 is used as the TOC pointer.
655
656 cr5 is not supposed to be used.
657
658 On System V implementations, r13 is fixed and not available for use. */
659
660 #ifndef FIXED_R13
661 #define FIXED_R13 0
662 #endif
663
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}
670
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. */
677
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}
684
685 /* List the order in which to allocate registers. Each register must be
686 listed once, even those in FIXED_REGISTERS.
687
688 We allocate in the following order:
689 fp0 (not saved or used for anything)
690 fp13 - fp2 (not saved; incoming fp arg registers)
691 fp1 (not saved; return value)
692 fp31 - fp14 (saved; order given to save least number)
693 cr1, cr6, cr7 (not saved or special)
694 cr0 (not saved, but used for arithmetic operations)
695 cr2, cr3, cr4 (saved)
696 r0 (not saved; cannot be base reg)
697 r9 (not saved; best for TImode)
698 r11, r10, r8-r4 (not saved; highest used first to make less conflict)
699 r3 (not saved; return value register)
700 r31 - r13 (saved; order given to save least number)
701 r12 (not saved; if used for DImode or DFmode would use r13)
702 mq (not saved; best to use it if we can)
703 ctr (not saved; when we have the choice ctr is better)
704 lr (saved)
705 cr5, r1, r2, ap (fixed) */
706
707 #define REG_ALLOC_ORDER \
708 {32, \
709 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, \
710 33, \
711 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, \
712 50, 49, 48, 47, 46, \
713 69, 74, 75, 68, 70, 71, 72, \
714 0, \
715 9, 11, 10, 8, 7, 6, 5, 4, \
716 3, \
717 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, \
718 18, 17, 16, 15, 14, 13, 12, \
719 64, 66, 65, \
720 73, 1, 2, 67, 76}
721
722 /* True if register is floating-point. */
723 #define FP_REGNO_P(N) ((N) >= 32 && (N) <= 63)
724
725 /* True if register is a condition register. */
726 #define CR_REGNO_P(N) ((N) >= 68 && (N) <= 75)
727
728 /* True if register is an integer register. */
729 #define INT_REGNO_P(N) ((N) <= 31 || (N) == 67)
730
731 /* True if register is the temporary memory location used for int/float
732 conversion. */
733 #define FPMEM_REGNO_P(N) ((N) == FPMEM_REGNUM)
734
735 /* Return number of consecutive hard regs needed starting at reg REGNO
736 to hold something of mode MODE.
737 This is ordinarily the length in words of a value of mode MODE
738 but can be less for certain modes in special long registers.
739
740 On RS/6000, ordinary registers hold 32 bits worth;
741 a single floating point register holds 64 bits worth. */
742
743 #define HARD_REGNO_NREGS(REGNO, MODE) \
744 (FP_REGNO_P (REGNO) || FPMEM_REGNO_P (REGNO) \
745 ? ((GET_MODE_SIZE (MODE) + UNITS_PER_FP_WORD - 1) / UNITS_PER_FP_WORD) \
746 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
747
748 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
749 For POWER and PowerPC, the GPRs can hold any mode, but the float
750 registers only can hold floating modes and DImode, and CR register only
751 can hold CC modes. We cannot put TImode anywhere except general
752 register and it must be able to fit within the register set. */
753
754 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
755 (FP_REGNO_P (REGNO) ? \
756 (GET_MODE_CLASS (MODE) == MODE_FLOAT \
757 || (GET_MODE_CLASS (MODE) == MODE_INT \
758 && GET_MODE_SIZE (MODE) == UNITS_PER_FP_WORD)) \
759 : CR_REGNO_P (REGNO) ? GET_MODE_CLASS (MODE) == MODE_CC \
760 : FPMEM_REGNO_P (REGNO) ? ((MODE) == DImode || (MODE) == DFmode) \
761 : ! INT_REGNO_P (REGNO) ? (GET_MODE_CLASS (MODE) == MODE_INT \
762 && GET_MODE_SIZE (MODE) <= UNITS_PER_WORD) \
763 : 1)
764
765 /* Value is 1 if it is a good idea to tie two pseudo registers
766 when one has mode MODE1 and one has mode MODE2.
767 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
768 for any hard reg, then this must be 0 for correct output. */
769 #define MODES_TIEABLE_P(MODE1, MODE2) \
770 (GET_MODE_CLASS (MODE1) == MODE_FLOAT \
771 ? GET_MODE_CLASS (MODE2) == MODE_FLOAT \
772 : GET_MODE_CLASS (MODE2) == MODE_FLOAT \
773 ? GET_MODE_CLASS (MODE1) == MODE_FLOAT \
774 : GET_MODE_CLASS (MODE1) == MODE_CC \
775 ? GET_MODE_CLASS (MODE2) == MODE_CC \
776 : GET_MODE_CLASS (MODE2) == MODE_CC \
777 ? GET_MODE_CLASS (MODE1) == MODE_CC \
778 : 1)
779
780 /* A C expression returning the cost of moving data from a register of class
781 CLASS1 to one of CLASS2.
782
783 On the RS/6000, copying between floating-point and fixed-point
784 registers is expensive. */
785
786 #define REGISTER_MOVE_COST(CLASS1, CLASS2) \
787 ((CLASS1) == FLOAT_REGS && (CLASS2) == FLOAT_REGS ? 2 \
788 : (CLASS1) == FLOAT_REGS && (CLASS2) != FLOAT_REGS ? 10 \
789 : (CLASS1) != FLOAT_REGS && (CLASS2) == FLOAT_REGS ? 10 \
790 : (((CLASS1) == SPECIAL_REGS || (CLASS1) == MQ_REGS \
791 || (CLASS1) == LINK_REGS || (CLASS1) == CTR_REGS \
792 || (CLASS1) == LINK_OR_CTR_REGS) \
793 && ((CLASS2) == SPECIAL_REGS || (CLASS2) == MQ_REGS \
794 || (CLASS2) == LINK_REGS || (CLASS2) == CTR_REGS \
795 || (CLASS2) == LINK_OR_CTR_REGS)) ? 10 \
796 : 2)
797
798 /* A C expressions returning the cost of moving data of MODE from a register to
799 or from memory.
800
801 On the RS/6000, bump this up a bit. */
802
803 #define MEMORY_MOVE_COST(MODE,CLASS,IN) \
804 ((GET_MODE_CLASS (MODE) == MODE_FLOAT \
805 && (rs6000_cpu == PROCESSOR_RIOS1 || rs6000_cpu == PROCESSOR_PPC601) \
806 ? 3 : 2) \
807 + 4)
808
809 /* Specify the cost of a branch insn; roughly the number of extra insns that
810 should be added to avoid a branch.
811
812 Set this to 3 on the RS/6000 since that is roughly the average cost of an
813 unscheduled conditional branch. */
814
815 #define BRANCH_COST 3
816
817 /* A C statement (sans semicolon) to update the integer variable COST
818 based on the relationship between INSN that is dependent on
819 DEP_INSN through the dependence LINK. The default is to make no
820 adjustment to COST. On the RS/6000, ignore the cost of anti- and
821 output-dependencies. In fact, output dependencies on the CR do have
822 a cost, but it is probably not worthwhile to track it. */
823
824 #define ADJUST_COST(INSN,LINK,DEP_INSN,COST) \
825 (COST) = rs6000_adjust_cost (INSN,LINK,DEP_INSN,COST)
826
827 /* Define this macro to change register usage conditional on target flags.
828 Set MQ register fixed (already call_used) if not POWER architecture
829 (RIOS1, RIOS2, RSC, and PPC601) so that it will not be allocated.
830 Conditionally disable FPRs. */
831
832 #define CONDITIONAL_REGISTER_USAGE \
833 { \
834 if (! TARGET_POWER) \
835 fixed_regs[64] = 1; \
836 if (TARGET_SOFT_FLOAT) \
837 for (i = 32; i < 64; i++) \
838 fixed_regs[i] = call_used_regs[i] = 1; \
839 }
840
841 /* Specify the registers used for certain standard purposes.
842 The values of these macros are register numbers. */
843
844 /* RS/6000 pc isn't overloaded on a register that the compiler knows about. */
845 /* #define PC_REGNUM */
846
847 /* Register to use for pushing function arguments. */
848 #define STACK_POINTER_REGNUM 1
849
850 /* Base register for access to local variables of the function. */
851 #define FRAME_POINTER_REGNUM 31
852
853 /* Value should be nonzero if functions must have frame pointers.
854 Zero means the frame pointer need not be set up (and parms
855 may be accessed via the stack pointer) in functions that seem suitable.
856 This is computed in `reload', in reload1.c. */
857 #define FRAME_POINTER_REQUIRED 0
858
859 /* Base register for access to arguments of the function. */
860 #define ARG_POINTER_REGNUM 67
861
862 /* Place to put static chain when calling a function that requires it. */
863 #define STATIC_CHAIN_REGNUM 11
864
865 /* count register number for special purposes */
866 #define COUNT_REGISTER_REGNUM 66
867
868 /* Special register that represents memory, used for float/int conversions. */
869 #define FPMEM_REGNUM 76
870
871 /* Register to use as a placeholder for the GOT/allocated TOC register.
872 FINALIZE_PIC will change all uses of this register to a an appropriate
873 pseudo register when it adds the code to setup the GOT. We use r2
874 because it is a reserved register in all of the ABI's. */
875 #define GOT_TOC_REGNUM 2
876
877 /* Place that structure value return address is placed.
878
879 On the RS/6000, it is passed as an extra parameter. */
880 #define STRUCT_VALUE 0
881 \f
882 /* Define the classes of registers for register constraints in the
883 machine description. Also define ranges of constants.
884
885 One of the classes must always be named ALL_REGS and include all hard regs.
886 If there is more than one class, another class must be named NO_REGS
887 and contain no registers.
888
889 The name GENERAL_REGS must be the name of a class (or an alias for
890 another name such as ALL_REGS). This is the class of registers
891 that is allowed by "g" or "r" in a register constraint.
892 Also, registers outside this class are allocated only when
893 instructions express preferences for them.
894
895 The classes must be numbered in nondecreasing order; that is,
896 a larger-numbered class must never be contained completely
897 in a smaller-numbered class.
898
899 For any two classes, it is very desirable that there be another
900 class that represents their union. */
901
902 /* The RS/6000 has three types of registers, fixed-point, floating-point,
903 and condition registers, plus three special registers, MQ, CTR, and the
904 link register.
905
906 However, r0 is special in that it cannot be used as a base register.
907 So make a class for registers valid as base registers.
908
909 Also, cr0 is the only condition code register that can be used in
910 arithmetic insns, so make a separate class for it.
911
912 There is a special 'register' (76), which is not a register, but a
913 placeholder for memory allocated to convert between floating point and
914 integral types. This works around a problem where if we allocate memory
915 with allocate_stack_{local,temp} and the function is an inline function, the
916 memory allocated will clobber memory in the caller. So we use a special
917 register, and if that is used, we allocate stack space for it. */
918
919 enum reg_class
920 {
921 NO_REGS,
922 BASE_REGS,
923 GENERAL_REGS,
924 FLOAT_REGS,
925 NON_SPECIAL_REGS,
926 MQ_REGS,
927 LINK_REGS,
928 CTR_REGS,
929 LINK_OR_CTR_REGS,
930 SPECIAL_REGS,
931 SPEC_OR_GEN_REGS,
932 CR0_REGS,
933 CR_REGS,
934 NON_FLOAT_REGS,
935 FPMEM_REGS,
936 FLOAT_OR_FPMEM_REGS,
937 ALL_REGS,
938 LIM_REG_CLASSES
939 };
940
941 #define N_REG_CLASSES (int) LIM_REG_CLASSES
942
943 /* Give names of register classes as strings for dump file. */
944
945 #define REG_CLASS_NAMES \
946 { \
947 "NO_REGS", \
948 "BASE_REGS", \
949 "GENERAL_REGS", \
950 "FLOAT_REGS", \
951 "NON_SPECIAL_REGS", \
952 "MQ_REGS", \
953 "LINK_REGS", \
954 "CTR_REGS", \
955 "LINK_OR_CTR_REGS", \
956 "SPECIAL_REGS", \
957 "SPEC_OR_GEN_REGS", \
958 "CR0_REGS", \
959 "CR_REGS", \
960 "NON_FLOAT_REGS", \
961 "FPMEM_REGS", \
962 "FLOAT_OR_FPMEM_REGS", \
963 "ALL_REGS" \
964 }
965
966 /* Define which registers fit in which classes.
967 This is an initializer for a vector of HARD_REG_SET
968 of length N_REG_CLASSES. */
969
970 #define REG_CLASS_CONTENTS \
971 { \
972 { 0x00000000, 0x00000000, 0x00000000 }, /* NO_REGS */ \
973 { 0xfffffffe, 0x00000000, 0x00000008 }, /* BASE_REGS */ \
974 { 0xffffffff, 0x00000000, 0x00000008 }, /* GENERAL_REGS */ \
975 { 0x00000000, 0xffffffff, 0x00000000 }, /* FLOAT_REGS */ \
976 { 0xffffffff, 0xffffffff, 0x00000008 }, /* NON_SPECIAL_REGS */ \
977 { 0x00000000, 0x00000000, 0x00000001 }, /* MQ_REGS */ \
978 { 0x00000000, 0x00000000, 0x00000002 }, /* LINK_REGS */ \
979 { 0x00000000, 0x00000000, 0x00000004 }, /* CTR_REGS */ \
980 { 0x00000000, 0x00000000, 0x00000006 }, /* LINK_OR_CTR_REGS */ \
981 { 0x00000000, 0x00000000, 0x00000007 }, /* SPECIAL_REGS */ \
982 { 0xffffffff, 0x00000000, 0x0000000f }, /* SPEC_OR_GEN_REGS */ \
983 { 0x00000000, 0x00000000, 0x00000010 }, /* CR0_REGS */ \
984 { 0x00000000, 0x00000000, 0x00000ff0 }, /* CR_REGS */ \
985 { 0xffffffff, 0x00000000, 0x0000ffff }, /* NON_FLOAT_REGS */ \
986 { 0x00000000, 0x00000000, 0x00010000 }, /* FPMEM_REGS */ \
987 { 0x00000000, 0xffffffff, 0x00010000 }, /* FLOAT_OR_FPMEM_REGS */ \
988 { 0xffffffff, 0xffffffff, 0x0001ffff } /* ALL_REGS */ \
989 }
990
991 /* The same information, inverted:
992 Return the class number of the smallest class containing
993 reg number REGNO. This could be a conditional expression
994 or could index an array. */
995
996 #define REGNO_REG_CLASS(REGNO) \
997 ((REGNO) == 0 ? GENERAL_REGS \
998 : (REGNO) < 32 ? BASE_REGS \
999 : FP_REGNO_P (REGNO) ? FLOAT_REGS \
1000 : (REGNO) == 68 ? CR0_REGS \
1001 : CR_REGNO_P (REGNO) ? CR_REGS \
1002 : (REGNO) == 64 ? MQ_REGS \
1003 : (REGNO) == 65 ? LINK_REGS \
1004 : (REGNO) == 66 ? CTR_REGS \
1005 : (REGNO) == 67 ? BASE_REGS \
1006 : (REGNO) == 76 ? FPMEM_REGS \
1007 : NO_REGS)
1008
1009 /* The class value for index registers, and the one for base regs. */
1010 #define INDEX_REG_CLASS GENERAL_REGS
1011 #define BASE_REG_CLASS BASE_REGS
1012
1013 /* Get reg_class from a letter such as appears in the machine description. */
1014
1015 #define REG_CLASS_FROM_LETTER(C) \
1016 ((C) == 'f' ? FLOAT_REGS \
1017 : (C) == 'b' ? BASE_REGS \
1018 : (C) == 'h' ? SPECIAL_REGS \
1019 : (C) == 'q' ? MQ_REGS \
1020 : (C) == 'c' ? CTR_REGS \
1021 : (C) == 'l' ? LINK_REGS \
1022 : (C) == 'x' ? CR0_REGS \
1023 : (C) == 'y' ? CR_REGS \
1024 : (C) == 'z' ? FPMEM_REGS \
1025 : NO_REGS)
1026
1027 /* The letters I, J, K, L, M, N, and P in a register constraint string
1028 can be used to stand for particular ranges of immediate operands.
1029 This macro defines what the ranges are.
1030 C is the letter, and VALUE is a constant value.
1031 Return 1 if VALUE is in the range specified by C.
1032
1033 `I' is signed 16-bit constants
1034 `J' is a constant with only the high-order 16 bits non-zero
1035 `K' is a constant with only the low-order 16 bits non-zero
1036 `L' is a constant that can be placed into a mask operand
1037 `M' is a constant that is greater than 31
1038 `N' is a constant that is an exact power of two
1039 `O' is the constant zero
1040 `P' is a constant whose negation is a signed 16-bit constant */
1041
1042 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
1043 ( (C) == 'I' ? (unsigned HOST_WIDE_INT) ((VALUE) + 0x8000) < 0x10000 \
1044 : (C) == 'J' ? ((VALUE) & 0xffff) == 0 \
1045 : (C) == 'K' ? ((VALUE) & 0xffff0000) == 0 \
1046 : (C) == 'L' ? mask_constant (VALUE) \
1047 : (C) == 'M' ? (VALUE) > 31 \
1048 : (C) == 'N' ? exact_log2 (VALUE) >= 0 \
1049 : (C) == 'O' ? (VALUE) == 0 \
1050 : (C) == 'P' ? (unsigned HOST_WIDE_INT) ((- (VALUE)) + 0x8000) < 0x1000 \
1051 : 0)
1052
1053 /* Similar, but for floating constants, and defining letters G and H.
1054 Here VALUE is the CONST_DOUBLE rtx itself.
1055
1056 We flag for special constants when we can copy the constant into
1057 a general register in two insns for DF/DI and one insn for SF.
1058
1059 'H' is used for DI/DF constants that take 3 insns. */
1060
1061 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
1062 ( (C) == 'G' ? (num_insns_constant (VALUE, GET_MODE (VALUE)) \
1063 == ((GET_MODE (VALUE) == SFmode) ? 1 : 2)) \
1064 : (C) == 'H' ? (num_insns_constant (VALUE, GET_MODE (VALUE)) == 3) \
1065 : 0)
1066
1067 /* Optional extra constraints for this machine.
1068
1069 'Q' means that is a memory operand that is just an offset from a reg.
1070 'R' is for AIX TOC entries.
1071 'S' is for Windows NT SYMBOL_REFs
1072 'T' is for Windows NT LABEL_REFs.
1073 'U' is for V.4 small data references. */
1074
1075 #define EXTRA_CONSTRAINT(OP, C) \
1076 ((C) == 'Q' ? GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == REG \
1077 : (C) == 'R' ? LEGITIMATE_CONSTANT_POOL_ADDRESS_P (OP) \
1078 : (C) == 'S' ? (TARGET_WINDOWS_NT && DEFAULT_ABI == ABI_NT && GET_CODE (OP) == SYMBOL_REF)\
1079 : (C) == 'T' ? (TARGET_WINDOWS_NT && DEFAULT_ABI == ABI_NT && GET_CODE (OP) == LABEL_REF) \
1080 : (C) == 'U' ? ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) \
1081 && small_data_operand (OP, GET_MODE (OP))) \
1082 : 0)
1083
1084 /* Given an rtx X being reloaded into a reg required to be
1085 in class CLASS, return the class of reg to actually use.
1086 In general this is just CLASS; but on some machines
1087 in some cases it is preferable to use a more restrictive class.
1088
1089 On the RS/6000, we have to return NO_REGS when we want to reload a
1090 floating-point CONST_DOUBLE to force it to be copied to memory. */
1091
1092 #define PREFERRED_RELOAD_CLASS(X,CLASS) \
1093 ((GET_CODE (X) == CONST_DOUBLE \
1094 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) \
1095 ? NO_REGS : (CLASS))
1096
1097 /* Return the register class of a scratch register needed to copy IN into
1098 or out of a register in CLASS in MODE. If it can be done directly,
1099 NO_REGS is returned. */
1100
1101 #define SECONDARY_RELOAD_CLASS(CLASS,MODE,IN) \
1102 secondary_reload_class (CLASS, MODE, IN)
1103
1104 /* If we are copying between FP registers and anything else, we need a memory
1105 location. */
1106
1107 #define SECONDARY_MEMORY_NEEDED(CLASS1,CLASS2,MODE) \
1108 ((CLASS1) != (CLASS2) && ((CLASS1) == FLOAT_REGS || (CLASS2) == FLOAT_REGS))
1109
1110 /* Return the maximum number of consecutive registers
1111 needed to represent mode MODE in a register of class CLASS.
1112
1113 On RS/6000, this is the size of MODE in words,
1114 except in the FP regs, where a single reg is enough for two words. */
1115 #define CLASS_MAX_NREGS(CLASS, MODE) \
1116 (((CLASS) == FLOAT_REGS || (CLASS) == FPMEM_REGS \
1117 || (CLASS) == FLOAT_OR_FPMEM_REGS) \
1118 ? ((GET_MODE_SIZE (MODE) + UNITS_PER_FP_WORD - 1) / UNITS_PER_FP_WORD) \
1119 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
1120
1121 /* If defined, gives a class of registers that cannot be used as the
1122 operand of a SUBREG that changes the size of the object. */
1123
1124 #define CLASS_CANNOT_CHANGE_SIZE FLOAT_OR_FPMEM_REGS
1125 \f
1126 /* Stack layout; function entry, exit and calling. */
1127
1128 /* Enumeration to give which calling sequence to use. */
1129 enum rs6000_abi {
1130 ABI_NONE,
1131 ABI_AIX, /* IBM's AIX */
1132 ABI_AIX_NODESC, /* AIX calling sequence minus function descriptors */
1133 ABI_V4, /* System V.4/eabi */
1134 ABI_NT, /* Windows/NT */
1135 ABI_SOLARIS /* Solaris */
1136 };
1137
1138 extern enum rs6000_abi rs6000_current_abi; /* available for use by subtarget */
1139
1140 /* Default ABI to compile code for */
1141 #ifndef DEFAULT_ABI
1142 #define DEFAULT_ABI ABI_AIX
1143 /* The prefix to add to user-visible assembler symbols. */
1144 #define USER_LABEL_PREFIX "."
1145 #endif
1146
1147 /* Structure used to define the rs6000 stack */
1148 typedef struct rs6000_stack {
1149 int first_gp_reg_save; /* first callee saved GP register used */
1150 int first_fp_reg_save; /* first callee saved FP register used */
1151 int lr_save_p; /* true if the link reg needs to be saved */
1152 int cr_save_p; /* true if the CR reg needs to be saved */
1153 int toc_save_p; /* true if the TOC needs to be saved */
1154 int push_p; /* true if we need to allocate stack space */
1155 int calls_p; /* true if the function makes any calls */
1156 int main_p; /* true if this is main */
1157 int main_save_p; /* true if this is main and we need to save args */
1158 int fpmem_p; /* true if float/int conversion temp needed */
1159 enum rs6000_abi abi; /* which ABI to use */
1160 int gp_save_offset; /* offset to save GP regs from initial SP */
1161 int fp_save_offset; /* offset to save FP regs from initial SP */
1162 int lr_save_offset; /* offset to save LR from initial SP */
1163 int cr_save_offset; /* offset to save CR from initial SP */
1164 int toc_save_offset; /* offset to save the TOC pointer */
1165 int varargs_save_offset; /* offset to save the varargs registers */
1166 int main_save_offset; /* offset to save main's args */
1167 int fpmem_offset; /* offset for float/int conversion temp */
1168 int reg_size; /* register size (4 or 8) */
1169 int varargs_size; /* size to hold V.4 args passed in regs */
1170 int vars_size; /* variable save area size */
1171 int parm_size; /* outgoing parameter size */
1172 int main_size; /* size to hold saving main's args */
1173 int save_size; /* save area size */
1174 int fixed_size; /* fixed size of stack frame */
1175 int gp_size; /* size of saved GP registers */
1176 int fp_size; /* size of saved FP registers */
1177 int cr_size; /* size to hold CR if not in save_size */
1178 int lr_size; /* size to hold LR if not in save_size */
1179 int fpmem_size; /* size to hold float/int conversion */
1180 int toc_size; /* size to hold TOC if not in save_size */
1181 int total_size; /* total bytes allocated for stack */
1182 } rs6000_stack_t;
1183
1184 /* Define this if pushing a word on the stack
1185 makes the stack pointer a smaller address. */
1186 #define STACK_GROWS_DOWNWARD
1187
1188 /* Define this if the nominal address of the stack frame
1189 is at the high-address end of the local variables;
1190 that is, each additional local variable allocated
1191 goes at a more negative offset in the frame.
1192
1193 On the RS/6000, we grow upwards, from the area after the outgoing
1194 arguments. */
1195 /* #define FRAME_GROWS_DOWNWARD */
1196
1197 /* Size of the outgoing register save area */
1198 #define RS6000_REG_SAVE (TARGET_32BIT ? 32 : 64)
1199
1200 /* Size of the fixed area on the stack */
1201 #define RS6000_SAVE_AREA (TARGET_32BIT ? 24 : 48)
1202
1203 /* Address to save the TOC register */
1204 #define RS6000_SAVE_TOC plus_constant (stack_pointer_rtx, 20)
1205
1206 /* Offset & size for fpmem stack locations used for converting between
1207 float and integral types. */
1208 extern int rs6000_fpmem_offset;
1209 extern int rs6000_fpmem_size;
1210
1211 /* Size of the V.4 varargs area if needed */
1212 #define RS6000_VARARGS_AREA 0
1213
1214 /* Whether a V.4 varargs area is needed */
1215 extern int rs6000_sysv_varargs_p;
1216
1217 /* Align an address */
1218 #define RS6000_ALIGN(n,a) (((n) + (a) - 1) & ~((a) - 1))
1219
1220 /* Initialize data used by insn expanders. This is called from
1221 init_emit, once for each function, before code is generated. */
1222 #define INIT_EXPANDERS rs6000_init_expanders ()
1223
1224 /* Size of V.4 varargs area in bytes */
1225 #define RS6000_VARARGS_SIZE \
1226 ((GP_ARG_NUM_REG * (TARGET_32BIT ? 4 : 8)) + (FP_ARG_NUM_REG * 8) + 8)
1227
1228 /* Offset of V.4 varargs area */
1229 #define RS6000_VARARGS_OFFSET \
1230 (RS6000_ALIGN (current_function_outgoing_args_size, 8) \
1231 + RS6000_SAVE_AREA)
1232
1233 /* Offset within stack frame to start allocating local variables at.
1234 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
1235 first local allocated. Otherwise, it is the offset to the BEGINNING
1236 of the first local allocated.
1237
1238 On the RS/6000, the frame pointer is the same as the stack pointer,
1239 except for dynamic allocations. So we start after the fixed area and
1240 outgoing parameter area. */
1241
1242 #define STARTING_FRAME_OFFSET \
1243 (RS6000_ALIGN (current_function_outgoing_args_size, 8) \
1244 + RS6000_VARARGS_AREA \
1245 + RS6000_SAVE_AREA)
1246
1247 /* Offset from the stack pointer register to an item dynamically
1248 allocated on the stack, e.g., by `alloca'.
1249
1250 The default value for this macro is `STACK_POINTER_OFFSET' plus the
1251 length of the outgoing arguments. The default is correct for most
1252 machines. See `function.c' for details. */
1253 #define STACK_DYNAMIC_OFFSET(FUNDECL) \
1254 (RS6000_ALIGN (current_function_outgoing_args_size, 8) \
1255 + (STACK_POINTER_OFFSET))
1256
1257 /* If we generate an insn to push BYTES bytes,
1258 this says how many the stack pointer really advances by.
1259 On RS/6000, don't define this because there are no push insns. */
1260 /* #define PUSH_ROUNDING(BYTES) */
1261
1262 /* Offset of first parameter from the argument pointer register value.
1263 On the RS/6000, we define the argument pointer to the start of the fixed
1264 area. */
1265 #define FIRST_PARM_OFFSET(FNDECL) RS6000_SAVE_AREA
1266
1267 /* Define this if stack space is still allocated for a parameter passed
1268 in a register. The value is the number of bytes allocated to this
1269 area. */
1270 #define REG_PARM_STACK_SPACE(FNDECL) RS6000_REG_SAVE
1271
1272 /* Define this if the above stack space is to be considered part of the
1273 space allocated by the caller. */
1274 #define OUTGOING_REG_PARM_STACK_SPACE
1275
1276 /* This is the difference between the logical top of stack and the actual sp.
1277
1278 For the RS/6000, sp points past the fixed area. */
1279 #define STACK_POINTER_OFFSET RS6000_SAVE_AREA
1280
1281 /* Define this if the maximum size of all the outgoing args is to be
1282 accumulated and pushed during the prologue. The amount can be
1283 found in the variable current_function_outgoing_args_size. */
1284 #define ACCUMULATE_OUTGOING_ARGS
1285
1286 /* Value is the number of bytes of arguments automatically
1287 popped when returning from a subroutine call.
1288 FUNDECL is the declaration node of the function (as a tree),
1289 FUNTYPE is the data type of the function (as a tree),
1290 or for a library call it is an identifier node for the subroutine name.
1291 SIZE is the number of bytes of arguments passed on the stack. */
1292
1293 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
1294
1295 /* Define how to find the value returned by a function.
1296 VALTYPE is the data type of the value (as a tree).
1297 If the precise function being called is known, FUNC is its FUNCTION_DECL;
1298 otherwise, FUNC is 0.
1299
1300 On RS/6000 an integer value is in r3 and a floating-point value is in
1301 fp1, unless -msoft-float. */
1302
1303 #define FUNCTION_VALUE(VALTYPE, FUNC) \
1304 gen_rtx (REG, TYPE_MODE (VALTYPE), \
1305 TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_HARD_FLOAT ? 33 : 3)
1306
1307 /* Define how to find the value returned by a library function
1308 assuming the value has mode MODE. */
1309
1310 #define LIBCALL_VALUE(MODE) \
1311 gen_rtx (REG, MODE, GET_MODE_CLASS (MODE) == MODE_FLOAT && TARGET_HARD_FLOAT ? 33 : 3)
1312
1313 /* The definition of this macro implies that there are cases where
1314 a scalar value cannot be returned in registers.
1315
1316 For the RS/6000, any structure or union type is returned in memory, except for
1317 Solaris, which returns structures <= 8 bytes in registers. */
1318
1319 #define RETURN_IN_MEMORY(TYPE) \
1320 (TYPE_MODE (TYPE) == BLKmode \
1321 && (DEFAULT_ABI != ABI_SOLARIS || int_size_in_bytes (TYPE) > 8))
1322
1323 /* Minimum and maximum general purpose registers used to hold arguments. */
1324 #define GP_ARG_MIN_REG 3
1325 #define GP_ARG_MAX_REG 10
1326 #define GP_ARG_NUM_REG (GP_ARG_MAX_REG - GP_ARG_MIN_REG + 1)
1327
1328 /* Minimum and maximum floating point registers used to hold arguments. */
1329 #define FP_ARG_MIN_REG 33
1330 #define FP_ARG_AIX_MAX_REG 45
1331 #define FP_ARG_V4_MAX_REG 40
1332 #define FP_ARG_MAX_REG FP_ARG_AIX_MAX_REG
1333 #define FP_ARG_NUM_REG (FP_ARG_MAX_REG - FP_ARG_MIN_REG + 1)
1334
1335 /* Return registers */
1336 #define GP_ARG_RETURN GP_ARG_MIN_REG
1337 #define FP_ARG_RETURN FP_ARG_MIN_REG
1338
1339 /* Flags for the call/call_value rtl operations set up by function_arg */
1340 #define CALL_NORMAL 0x00000000 /* no special processing */
1341 #define CALL_NT_DLLIMPORT 0x00000001 /* NT, this is a DLL import call */
1342 #define CALL_V4_CLEAR_FP_ARGS 0x00000002 /* V.4, no FP args passed */
1343 #define CALL_V4_SET_FP_ARGS 0x00000004 /* V.4, FP args were passed */
1344 #define CALL_LONG 0x00000008 /* always call indirect */
1345
1346 /* Define cutoff for using external functions to save floating point */
1347 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == 62 || (FIRST_REG) == 63)
1348
1349 /* 1 if N is a possible register number for a function value
1350 as seen by the caller.
1351
1352 On RS/6000, this is r3 and fp1. */
1353 #define FUNCTION_VALUE_REGNO_P(N) ((N) == GP_ARG_RETURN || ((N) == FP_ARG_RETURN))
1354
1355 /* 1 if N is a possible register number for function argument passing.
1356 On RS/6000, these are r3-r10 and fp1-fp13. */
1357 #define FUNCTION_ARG_REGNO_P(N) \
1358 (((unsigned)((N) - GP_ARG_MIN_REG) < (unsigned)(GP_ARG_NUM_REG)) \
1359 || ((unsigned)((N) - FP_ARG_MIN_REG) < (unsigned)(FP_ARG_NUM_REG)))
1360
1361 \f
1362 /* Define a data type for recording info about an argument list
1363 during the scan of that argument list. This data type should
1364 hold all necessary information about the function itself
1365 and about the args processed so far, enough to enable macros
1366 such as FUNCTION_ARG to determine where the next arg should go.
1367
1368 On the RS/6000, this is a structure. The first element is the number of
1369 total argument words, the second is used to store the next
1370 floating-point register number, and the third says how many more args we
1371 have prototype types for.
1372
1373 The System V.4 varargs/stdarg support requires that this structure's size
1374 be a multiple of sizeof(int), and that WORDS, FREGNO, NARGS_PROTOTYPE,
1375 ORIG_NARGS, and VARARGS_OFFSET be the first five ints. */
1376
1377 typedef struct rs6000_args
1378 {
1379 int words; /* # words uses for passing GP registers */
1380 int fregno; /* next available FP register */
1381 int nargs_prototype; /* # args left in the current prototype */
1382 int orig_nargs; /* Original value of nargs_prototype */
1383 int varargs_offset; /* offset of the varargs save area */
1384 int prototype; /* Whether a prototype was defined */
1385 int call_cookie; /* Do special things for this call */
1386 } CUMULATIVE_ARGS;
1387
1388 /* Define intermediate macro to compute the size (in registers) of an argument
1389 for the RS/6000. */
1390
1391 #define RS6000_ARG_SIZE(MODE, TYPE, NAMED) \
1392 (! (NAMED) ? 0 \
1393 : (MODE) != BLKmode \
1394 ? (GET_MODE_SIZE (MODE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD \
1395 : (int_size_in_bytes (TYPE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
1396
1397 /* Initialize a variable CUM of type CUMULATIVE_ARGS
1398 for a call to a function whose data type is FNTYPE.
1399 For a library call, FNTYPE is 0. */
1400
1401 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
1402 init_cumulative_args (&CUM, FNTYPE, LIBNAME, FALSE)
1403
1404 /* Similar, but when scanning the definition of a procedure. We always
1405 set NARGS_PROTOTYPE large so we never return an EXPR_LIST. */
1406
1407 #define INIT_CUMULATIVE_INCOMING_ARGS(CUM,FNTYPE,LIBNAME) \
1408 init_cumulative_args (&CUM, FNTYPE, LIBNAME, TRUE)
1409
1410 /* Update the data in CUM to advance over an argument
1411 of mode MODE and data type TYPE.
1412 (TYPE is null for libcalls where that information may not be available.) */
1413
1414 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
1415 function_arg_advance (&CUM, MODE, TYPE, NAMED)
1416
1417 /* Non-zero if we can use a floating-point register to pass this arg. */
1418 #define USE_FP_FOR_ARG_P(CUM,MODE,TYPE) \
1419 (GET_MODE_CLASS (MODE) == MODE_FLOAT \
1420 && (CUM).fregno <= FP_ARG_MAX_REG \
1421 && TARGET_HARD_FLOAT)
1422
1423 /* Determine where to put an argument to a function.
1424 Value is zero to push the argument on the stack,
1425 or a hard register in which to store the argument.
1426
1427 MODE is the argument's machine mode.
1428 TYPE is the data type of the argument (as a tree).
1429 This is null for libcalls where that information may
1430 not be available.
1431 CUM is a variable of type CUMULATIVE_ARGS which gives info about
1432 the preceding args and about the function being called.
1433 NAMED is nonzero if this argument is a named parameter
1434 (otherwise it is an extra parameter matching an ellipsis).
1435
1436 On RS/6000 the first eight words of non-FP are normally in registers
1437 and the rest are pushed. The first 13 FP args are in registers.
1438
1439 If this is floating-point and no prototype is specified, we use
1440 both an FP and integer register (or possibly FP reg and stack). Library
1441 functions (when TYPE is zero) always have the proper types for args,
1442 so we can pass the FP value just in one register. emit_library_function
1443 doesn't support EXPR_LIST anyway. */
1444
1445 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
1446 function_arg (&CUM, MODE, TYPE, NAMED)
1447
1448 /* For an arg passed partly in registers and partly in memory,
1449 this is the number of registers used.
1450 For args passed entirely in registers or entirely in memory, zero. */
1451
1452 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
1453 function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED)
1454
1455 /* A C expression that indicates when an argument must be passed by
1456 reference. If nonzero for an argument, a copy of that argument is
1457 made in memory and a pointer to the argument is passed instead of
1458 the argument itself. The pointer is passed in whatever way is
1459 appropriate for passing a pointer to that type. */
1460
1461 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
1462 function_arg_pass_by_reference(&CUM, MODE, TYPE, NAMED)
1463
1464 /* If defined, a C expression which determines whether, and in which
1465 direction, to pad out an argument with extra space. The value
1466 should be of type `enum direction': either `upward' to pad above
1467 the argument, `downward' to pad below, or `none' to inhibit
1468 padding. */
1469
1470 #define FUNCTION_ARG_PADDING(MODE, TYPE) \
1471 (enum direction) function_arg_padding (MODE, TYPE)
1472
1473 /* If defined, a C expression that gives the alignment boundary, in bits,
1474 of an argument with the specified mode and type. If it is not defined,
1475 PARM_BOUNDARY is used for all arguments. */
1476
1477 #define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
1478 function_arg_boundary (MODE, TYPE)
1479
1480 /* Perform any needed actions needed for a function that is receiving a
1481 variable number of arguments.
1482
1483 CUM is as above.
1484
1485 MODE and TYPE are the mode and type of the current parameter.
1486
1487 PRETEND_SIZE is a variable that should be set to the amount of stack
1488 that must be pushed by the prolog to pretend that our caller pushed
1489 it.
1490
1491 Normally, this macro will push all remaining incoming registers on the
1492 stack and set PRETEND_SIZE to the length of the registers pushed. */
1493
1494 #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
1495 setup_incoming_varargs (&CUM, MODE, TYPE, &PRETEND_SIZE, NO_RTL)
1496
1497 /* If defined, is a C expression that produces the machine-specific
1498 code for a call to `__builtin_saveregs'. This code will be moved
1499 to the very beginning of the function, before any parameter access
1500 are made. The return value of this function should be an RTX that
1501 contains the value to use as the return of `__builtin_saveregs'.
1502
1503 The argument ARGS is a `tree_list' containing the arguments that
1504 were passed to `__builtin_saveregs'.
1505
1506 If this macro is not defined, the compiler will output an ordinary
1507 call to the library function `__builtin_saveregs'. */
1508
1509 #define EXPAND_BUILTIN_SAVEREGS(ARGS) \
1510 expand_builtin_saveregs (ARGS)
1511
1512 /* This macro generates the assembly code for function entry.
1513 FILE is a stdio stream to output the code to.
1514 SIZE is an int: how many units of temporary storage to allocate.
1515 Refer to the array `regs_ever_live' to determine which registers
1516 to save; `regs_ever_live[I]' is nonzero if register number I
1517 is ever used in the function. This macro is responsible for
1518 knowing which registers should not be saved even if used. */
1519
1520 #define FUNCTION_PROLOGUE(FILE, SIZE) output_prolog (FILE, SIZE)
1521
1522 /* Output assembler code to FILE to increment profiler label # LABELNO
1523 for profiling a function entry. */
1524
1525 #define FUNCTION_PROFILER(FILE, LABELNO) \
1526 output_function_profiler ((FILE), (LABELNO));
1527
1528 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
1529 the stack pointer does not matter. No definition is equivalent to
1530 always zero.
1531
1532 On the RS/6000, this is non-zero because we can restore the stack from
1533 its backpointer, which we maintain. */
1534 #define EXIT_IGNORE_STACK 1
1535
1536 /* This macro generates the assembly code for function exit,
1537 on machines that need it. If FUNCTION_EPILOGUE is not defined
1538 then individual return instructions are generated for each
1539 return statement. Args are same as for FUNCTION_PROLOGUE.
1540
1541 The function epilogue should not depend on the current stack pointer!
1542 It should use the frame pointer only. This is mandatory because
1543 of alloca; we also take advantage of it to omit stack adjustments
1544 before returning. */
1545
1546 #define FUNCTION_EPILOGUE(FILE, SIZE) output_epilog (FILE, SIZE)
1547 \f
1548 /* TRAMPOLINE_TEMPLATE deleted */
1549
1550 /* Length in units of the trampoline for entering a nested function. */
1551
1552 #define TRAMPOLINE_SIZE rs6000_trampoline_size ()
1553
1554 /* Emit RTL insns to initialize the variable parts of a trampoline.
1555 FNADDR is an RTX for the address of the function's pure code.
1556 CXT is an RTX for the static chain value for the function. */
1557
1558 #define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, CXT) \
1559 rs6000_initialize_trampoline (ADDR, FNADDR, CXT)
1560 \f
1561 /* If defined, a C expression whose value is nonzero if IDENTIFIER
1562 with arguments ARGS is a valid machine specific attribute for DECL.
1563 The attributes in ATTRIBUTES have previously been assigned to DECL. */
1564
1565 #define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \
1566 (rs6000_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS))
1567
1568 /* If defined, a C expression whose value is nonzero if IDENTIFIER
1569 with arguments ARGS is a valid machine specific attribute for TYPE.
1570 The attributes in ATTRIBUTES have previously been assigned to TYPE. */
1571
1572 #define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \
1573 (rs6000_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS))
1574
1575 /* If defined, a C expression whose value is zero if the attributes on
1576 TYPE1 and TYPE2 are incompatible, one if they are compatible, and
1577 two if they are nearly compatible (which causes a warning to be
1578 generated). */
1579
1580 #define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
1581 (rs6000_comp_type_attributes (TYPE1, TYPE2))
1582
1583 /* If defined, a C statement that assigns default attributes to newly
1584 defined TYPE. */
1585
1586 #define SET_DEFAULT_TYPE_ATTRIBUTES(TYPE) \
1587 (rs6000_set_default_type_attributes (TYPE))
1588
1589 \f
1590 /* Definitions for __builtin_return_address and __builtin_frame_address.
1591 __builtin_return_address (0) should give link register (65), enable
1592 this. */
1593 /* This should be uncommented, so that the link register is used, but
1594 currently this would result in unmatched insns and spilling fixed
1595 registers so we'll leave it for another day. When these problems are
1596 taken care of one additional fetch will be necessary in RETURN_ADDR_RTX.
1597 (mrs) */
1598 /* #define RETURN_ADDR_IN_PREVIOUS_FRAME */
1599
1600 /* Number of bytes into the frame return addresses can be found. See
1601 rs6000_stack_info in rs6000.c for more information on how the different
1602 abi's store the return address. */
1603 #define RETURN_ADDRESS_OFFSET \
1604 ((DEFAULT_ABI == ABI_AIX \
1605 || DEFAULT_ABI == ABI_AIX_NODESC) ? 8 : \
1606 (DEFAULT_ABI == ABI_V4 \
1607 || DEFAULT_ABI == ABI_SOLARIS) ? (TARGET_32BIT ? 4 : 8) : \
1608 (DEFAULT_ABI == ABI_NT) ? -4 : \
1609 (fatal ("RETURN_ADDRESS_OFFSET not supported"), 0))
1610
1611 /* The current return address is in link register (65). The return address
1612 of anything farther back is accessed normally at an offset of 8 from the
1613 frame pointer. */
1614 #define RETURN_ADDR_RTX(count, frame) \
1615 ((count == -1) \
1616 ? gen_rtx (REG, Pmode, 65) \
1617 : gen_rtx (MEM, Pmode, \
1618 memory_address (Pmode, \
1619 plus_constant (copy_to_reg (gen_rtx (MEM, Pmode, \
1620 memory_address (Pmode, frame))), \
1621 RETURN_ADDRESS_OFFSET))))
1622 \f
1623 /* Definitions for register eliminations.
1624
1625 We have two registers that can be eliminated on the RS/6000. First, the
1626 frame pointer register can often be eliminated in favor of the stack
1627 pointer register. Secondly, the argument pointer register can always be
1628 eliminated; it is replaced with either the stack or frame pointer.
1629
1630 In addition, we use the elimination mechanism to see if r30 is needed
1631 Initially we assume that it isn't. If it is, we spill it. This is done
1632 by making it an eliminable register. We replace it with itself so that
1633 if it isn't needed, then existing uses won't be modified. */
1634
1635 /* This is an array of structures. Each structure initializes one pair
1636 of eliminable registers. The "from" register number is given first,
1637 followed by "to". Eliminations of the same "from" register are listed
1638 in order of preference. */
1639 #define ELIMINABLE_REGS \
1640 {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
1641 { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
1642 { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
1643 { 30, 30} }
1644
1645 /* Given FROM and TO register numbers, say whether this elimination is allowed.
1646 Frame pointer elimination is automatically handled.
1647
1648 For the RS/6000, if frame pointer elimination is being done, we would like
1649 to convert ap into fp, not sp.
1650
1651 We need r30 if -mminimal-toc was specified, and there are constant pool
1652 references. */
1653
1654 #define CAN_ELIMINATE(FROM, TO) \
1655 ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \
1656 ? ! frame_pointer_needed \
1657 : (FROM) == 30 ? ! TARGET_MINIMAL_TOC || TARGET_NO_TOC || get_pool_size () == 0 \
1658 : 1)
1659
1660 /* Define the offset between two registers, one to be eliminated, and the other
1661 its replacement, at the start of a routine. */
1662 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
1663 { \
1664 rs6000_stack_t *info = rs6000_stack_info (); \
1665 \
1666 if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
1667 (OFFSET) = (info->push_p) ? 0 : - info->total_size; \
1668 else if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \
1669 (OFFSET) = info->total_size; \
1670 else if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
1671 (OFFSET) = (info->push_p) ? info->total_size : 0; \
1672 else if ((FROM) == 30) \
1673 (OFFSET) = 0; \
1674 else \
1675 abort (); \
1676 }
1677 \f
1678 /* Addressing modes, and classification of registers for them. */
1679
1680 /* #define HAVE_POST_INCREMENT */
1681 /* #define HAVE_POST_DECREMENT */
1682
1683 #define HAVE_PRE_DECREMENT
1684 #define HAVE_PRE_INCREMENT
1685
1686 /* Macros to check register numbers against specific register classes. */
1687
1688 /* These assume that REGNO is a hard or pseudo reg number.
1689 They give nonzero only if REGNO is a hard reg of the suitable class
1690 or a pseudo reg currently allocated to a suitable hard reg.
1691 Since they use reg_renumber, they are safe only once reg_renumber
1692 has been allocated, which happens in local-alloc.c. */
1693
1694 #define REGNO_OK_FOR_INDEX_P(REGNO) \
1695 ((REGNO) < FIRST_PSEUDO_REGISTER \
1696 ? (REGNO) <= 31 || (REGNO) == 67 \
1697 : (reg_renumber[REGNO] >= 0 \
1698 && (reg_renumber[REGNO] <= 31 || reg_renumber[REGNO] == 67)))
1699
1700 #define REGNO_OK_FOR_BASE_P(REGNO) \
1701 ((REGNO) < FIRST_PSEUDO_REGISTER \
1702 ? ((REGNO) > 0 && (REGNO) <= 31) || (REGNO) == 67 \
1703 : (reg_renumber[REGNO] > 0 \
1704 && (reg_renumber[REGNO] <= 31 || reg_renumber[REGNO] == 67)))
1705 \f
1706 /* Maximum number of registers that can appear in a valid memory address. */
1707
1708 #define MAX_REGS_PER_ADDRESS 2
1709
1710 /* Recognize any constant value that is a valid address. */
1711
1712 #define CONSTANT_ADDRESS_P(X) \
1713 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
1714 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
1715 || GET_CODE (X) == HIGH)
1716
1717 /* Nonzero if the constant value X is a legitimate general operand.
1718 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.
1719
1720 On the RS/6000, all integer constants are acceptable, most won't be valid
1721 for particular insns, though. Only easy FP constants are
1722 acceptable. */
1723
1724 #define LEGITIMATE_CONSTANT_P(X) \
1725 (GET_CODE (X) != CONST_DOUBLE || GET_MODE (X) == VOIDmode \
1726 || easy_fp_constant (X, GET_MODE (X)))
1727
1728 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1729 and check its validity for a certain class.
1730 We have two alternate definitions for each of them.
1731 The usual definition accepts all pseudo regs; the other rejects
1732 them unless they have been allocated suitable hard regs.
1733 The symbol REG_OK_STRICT causes the latter definition to be used.
1734
1735 Most source files want to accept pseudo regs in the hope that
1736 they will get allocated to the class that the insn wants them to be in.
1737 Source files for reload pass need to be strict.
1738 After reload, it makes no difference, since pseudo regs have
1739 been eliminated by then. */
1740
1741 #ifndef REG_OK_STRICT
1742
1743 /* Nonzero if X is a hard reg that can be used as an index
1744 or if it is a pseudo reg. */
1745 #define REG_OK_FOR_INDEX_P(X) \
1746 (REGNO (X) <= 31 || REGNO (X) == 67 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
1747
1748 /* Nonzero if X is a hard reg that can be used as a base reg
1749 or if it is a pseudo reg. */
1750 #define REG_OK_FOR_BASE_P(X) \
1751 (REGNO (X) > 0 && REG_OK_FOR_INDEX_P (X))
1752
1753 #else
1754
1755 /* Nonzero if X is a hard reg that can be used as an index. */
1756 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
1757 /* Nonzero if X is a hard reg that can be used as a base reg. */
1758 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1759
1760 #endif
1761 \f
1762 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1763 that is a valid memory address for an instruction.
1764 The MODE argument is the machine mode for the MEM expression
1765 that wants to use this address.
1766
1767 On the RS/6000, there are four valid address: a SYMBOL_REF that
1768 refers to a constant pool entry of an address (or the sum of it
1769 plus a constant), a short (16-bit signed) constant plus a register,
1770 the sum of two registers, or a register indirect, possibly with an
1771 auto-increment. For DFmode and DImode with an constant plus register,
1772 we must ensure that both words are addressable or PowerPC64 with offset
1773 word aligned. */
1774
1775 #define LEGITIMATE_CONSTANT_POOL_BASE_P(X) \
1776 (TARGET_TOC && GET_CODE (X) == SYMBOL_REF \
1777 && CONSTANT_POOL_ADDRESS_P (X) \
1778 && ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (get_pool_constant (X)))
1779
1780 /* TARGET_64BIT TOC64 guaranteed to have 64 bit alignment. */
1781 #define LEGITIMATE_CONSTANT_POOL_ADDRESS_P(X) \
1782 (LEGITIMATE_CONSTANT_POOL_BASE_P (X) \
1783 || (TARGET_TOC \
1784 && GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
1785 && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT \
1786 && LEGITIMATE_CONSTANT_POOL_BASE_P (XEXP (XEXP (X, 0), 0))))
1787
1788 #define LEGITIMATE_SMALL_DATA_P(MODE, X) \
1789 ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) \
1790 && !flag_pic && !TARGET_TOC \
1791 && (GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == CONST) \
1792 && small_data_operand (X, MODE))
1793
1794 #define LEGITIMATE_ADDRESS_INTEGER_P(X,OFFSET) \
1795 (GET_CODE (X) == CONST_INT \
1796 && (unsigned HOST_WIDE_INT) (INTVAL (X) + (OFFSET) + 0x8000) < 0x10000)
1797
1798 #define LEGITIMATE_OFFSET_ADDRESS_P(MODE,X) \
1799 (GET_CODE (X) == PLUS \
1800 && GET_CODE (XEXP (X, 0)) == REG \
1801 && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
1802 && LEGITIMATE_ADDRESS_INTEGER_P (XEXP (X, 1), 0) \
1803 && (((MODE) != DFmode && (MODE) != DImode) \
1804 || (TARGET_32BIT \
1805 ? LEGITIMATE_ADDRESS_INTEGER_P (XEXP (X, 1), 4) \
1806 : ! (INTVAL (XEXP (X, 1)) & 3))) \
1807 && ((MODE) != TImode \
1808 || (TARGET_32BIT \
1809 ? LEGITIMATE_ADDRESS_INTEGER_P (XEXP (X, 1), 12) \
1810 : (LEGITIMATE_ADDRESS_INTEGER_P (XEXP (X, 1), 8) \
1811 && ! (INTVAL (XEXP (X, 1)) & 3)))))
1812
1813 #define LEGITIMATE_INDEXED_ADDRESS_P(X) \
1814 (GET_CODE (X) == PLUS \
1815 && GET_CODE (XEXP (X, 0)) == REG \
1816 && GET_CODE (XEXP (X, 1)) == REG \
1817 && ((REG_OK_FOR_BASE_P (XEXP (X, 0)) \
1818 && REG_OK_FOR_INDEX_P (XEXP (X, 1))) \
1819 || (REG_OK_FOR_BASE_P (XEXP (X, 1)) \
1820 && REG_OK_FOR_INDEX_P (XEXP (X, 0)))))
1821
1822 #define LEGITIMATE_INDIRECT_ADDRESS_P(X) \
1823 (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))
1824
1825 #define LEGITIMATE_LO_SUM_ADDRESS_P(MODE, X) \
1826 (TARGET_ELF \
1827 && !flag_pic && !TARGET_TOC \
1828 && (MODE) != DImode \
1829 && (MODE) != TImode \
1830 && (TARGET_HARD_FLOAT || (MODE) != DFmode) \
1831 && GET_CODE (X) == LO_SUM \
1832 && GET_CODE (XEXP (X, 0)) == REG \
1833 && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
1834 && CONSTANT_P (XEXP (X, 1)))
1835
1836 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1837 { if (LEGITIMATE_INDIRECT_ADDRESS_P (X)) \
1838 goto ADDR; \
1839 if ((GET_CODE (X) == PRE_INC || GET_CODE (X) == PRE_DEC) \
1840 && TARGET_UPDATE \
1841 && LEGITIMATE_INDIRECT_ADDRESS_P (XEXP (X, 0))) \
1842 goto ADDR; \
1843 if (LEGITIMATE_SMALL_DATA_P (MODE, X)) \
1844 goto ADDR; \
1845 if (LEGITIMATE_CONSTANT_POOL_ADDRESS_P (X)) \
1846 goto ADDR; \
1847 if (LEGITIMATE_OFFSET_ADDRESS_P (MODE, X)) \
1848 goto ADDR; \
1849 if ((MODE) != TImode \
1850 && (TARGET_HARD_FLOAT || TARGET_64BIT || (MODE) != DFmode) \
1851 && (TARGET_64BIT || (MODE) != DImode) \
1852 && LEGITIMATE_INDEXED_ADDRESS_P (X)) \
1853 goto ADDR; \
1854 if (LEGITIMATE_LO_SUM_ADDRESS_P (MODE, X)) \
1855 goto ADDR; \
1856 }
1857 \f
1858 /* Try machine-dependent ways of modifying an illegitimate address
1859 to be legitimate. If we find one, return the new, valid address.
1860 This macro is used in only one place: `memory_address' in explow.c.
1861
1862 OLDX is the address as it was before break_out_memory_refs was called.
1863 In some cases it is useful to look at this to decide what needs to be done.
1864
1865 MODE and WIN are passed so that this macro can use
1866 GO_IF_LEGITIMATE_ADDRESS.
1867
1868 It is always safe for this macro to do nothing. It exists to recognize
1869 opportunities to optimize the output.
1870
1871 On RS/6000, first check for the sum of a register with a constant
1872 integer that is out of range. If so, generate code to add the
1873 constant with the low-order 16 bits masked to the register and force
1874 this result into another register (this can be done with `cau').
1875 Then generate an address of REG+(CONST&0xffff), allowing for the
1876 possibility of bit 16 being a one.
1877
1878 Then check for the sum of a register and something not constant, try to
1879 load the other things into a register and return the sum. */
1880
1881 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
1882 { if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == REG \
1883 && GET_CODE (XEXP (X, 1)) == CONST_INT \
1884 && (unsigned HOST_WIDE_INT) (INTVAL (XEXP (X, 1)) + 0x8000) >= 0x10000) \
1885 { HOST_WIDE_INT high_int, low_int; \
1886 rtx sum; \
1887 high_int = INTVAL (XEXP (X, 1)) & (~ (HOST_WIDE_INT) 0xffff); \
1888 low_int = INTVAL (XEXP (X, 1)) & 0xffff; \
1889 if (low_int & 0x8000) \
1890 high_int += 0x10000, low_int |= ((HOST_WIDE_INT) -1) << 16; \
1891 sum = force_operand (gen_rtx (PLUS, Pmode, XEXP (X, 0), \
1892 GEN_INT (high_int)), 0); \
1893 (X) = gen_rtx (PLUS, Pmode, sum, GEN_INT (low_int)); \
1894 goto WIN; \
1895 } \
1896 else if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == REG \
1897 && GET_CODE (XEXP (X, 1)) != CONST_INT \
1898 && (TARGET_HARD_FLOAT || TARGET_64BIT || (MODE) != DFmode) \
1899 && (TARGET_64BIT || (MODE) != DImode) \
1900 && (MODE) != TImode) \
1901 { \
1902 (X) = gen_rtx (PLUS, Pmode, XEXP (X, 0), \
1903 force_reg (Pmode, force_operand (XEXP (X, 1), 0))); \
1904 goto WIN; \
1905 } \
1906 else if (TARGET_ELF && TARGET_32BIT && TARGET_NO_TOC \
1907 && !flag_pic \
1908 && GET_CODE (X) != CONST_INT \
1909 && GET_CODE (X) != CONST_DOUBLE && CONSTANT_P (X) \
1910 && (TARGET_HARD_FLOAT || (MODE) != DFmode) \
1911 && (MODE) != DImode && (MODE) != TImode) \
1912 { \
1913 rtx reg = gen_reg_rtx (Pmode); \
1914 emit_insn (gen_elf_high (reg, (X))); \
1915 (X) = gen_rtx (LO_SUM, Pmode, reg, (X)); \
1916 } \
1917 }
1918
1919 /* Go to LABEL if ADDR (a legitimate address expression)
1920 has an effect that depends on the machine mode it is used for.
1921
1922 On the RS/6000 this is true if the address is valid with a zero offset
1923 but not with an offset of four (this means it cannot be used as an
1924 address for DImode or DFmode) or is a pre-increment or decrement. Since
1925 we know it is valid, we just check for an address that is not valid with
1926 an offset of four. */
1927
1928 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1929 { if (GET_CODE (ADDR) == PLUS \
1930 && LEGITIMATE_ADDRESS_INTEGER_P (XEXP (ADDR, 1), 0) \
1931 && ! LEGITIMATE_ADDRESS_INTEGER_P (XEXP (ADDR, 1), \
1932 (TARGET_32BIT ? 4 : 8))) \
1933 goto LABEL; \
1934 if (TARGET_UPDATE && GET_CODE (ADDR) == PRE_INC) \
1935 goto LABEL; \
1936 if (TARGET_UPDATE && GET_CODE (ADDR) == PRE_DEC) \
1937 goto LABEL; \
1938 if (GET_CODE (ADDR) == LO_SUM) \
1939 goto LABEL; \
1940 }
1941 \f
1942 /* The register number of the register used to address a table of
1943 static data addresses in memory. In some cases this register is
1944 defined by a processor's "application binary interface" (ABI).
1945 When this macro is defined, RTL is generated for this register
1946 once, as with the stack pointer and frame pointer registers. If
1947 this macro is not defined, it is up to the machine-dependent files
1948 to allocate such a register (if necessary). */
1949
1950 /* #define PIC_OFFSET_TABLE_REGNUM */
1951
1952 /* Define this macro if the register defined by
1953 `PIC_OFFSET_TABLE_REGNUM' is clobbered by calls. Do not define
1954 this macro if `PPIC_OFFSET_TABLE_REGNUM' is not defined. */
1955
1956 /* #define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED */
1957
1958 /* By generating position-independent code, when two different
1959 programs (A and B) share a common library (libC.a), the text of
1960 the library can be shared whether or not the library is linked at
1961 the same address for both programs. In some of these
1962 environments, position-independent code requires not only the use
1963 of different addressing modes, but also special code to enable the
1964 use of these addressing modes.
1965
1966 The `FINALIZE_PIC' macro serves as a hook to emit these special
1967 codes once the function is being compiled into assembly code, but
1968 not before. (It is not done before, because in the case of
1969 compiling an inline function, it would lead to multiple PIC
1970 prologues being included in functions which used inline functions
1971 and were compiled to assembly language.) */
1972
1973 #define FINALIZE_PIC rs6000_finalize_pic ()
1974
1975 /* A C expression that is nonzero if X is a legitimate immediate
1976 operand on the target machine when generating position independent
1977 code. You can assume that X satisfies `CONSTANT_P', so you need
1978 not check this. You can also assume FLAG_PIC is true, so you need
1979 not check it either. You need not define this macro if all
1980 constants (including `SYMBOL_REF') can be immediate operands when
1981 generating position independent code. */
1982
1983 /* #define LEGITIMATE_PIC_OPERAND_P (X) */
1984
1985 /* In rare cases, correct code generation requires extra machine
1986 dependent processing between the second jump optimization pass and
1987 delayed branch scheduling. On those machines, define this macro
1988 as a C statement to act on the code starting at INSN.
1989
1990 On the RS/6000, we use it to make sure the GOT_TOC register marker
1991 that FINALIZE_PIC is supposed to remove actually got removed. */
1992
1993 #define MACHINE_DEPENDENT_REORG(INSN) rs6000_reorg (INSN)
1994
1995 \f
1996 /* Define this if some processing needs to be done immediately before
1997 emitting code for an insn. */
1998
1999 /* #define FINAL_PRESCAN_INSN(INSN,OPERANDS,NOPERANDS) */
2000
2001 /* Specify the machine mode that this machine uses
2002 for the index in the tablejump instruction. */
2003 #define CASE_VECTOR_MODE (TARGET_32BIT ? SImode : DImode)
2004
2005 /* Define as C expression which evaluates to nonzero if the tablejump
2006 instruction expects the table to contain offsets from the address of the
2007 table.
2008 Do not define this if the table should contain absolute addresses. */
2009 #define CASE_VECTOR_PC_RELATIVE 1
2010
2011 /* Specify the tree operation to be used to convert reals to integers. */
2012 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
2013
2014 /* This is the kind of divide that is easiest to do in the general case. */
2015 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
2016
2017 /* Define this as 1 if `char' should by default be signed; else as 0. */
2018 #define DEFAULT_SIGNED_CHAR 0
2019
2020 /* This flag, if defined, says the same insns that convert to a signed fixnum
2021 also convert validly to an unsigned one. */
2022
2023 /* #define FIXUNS_TRUNC_LIKE_FIX_TRUNC */
2024
2025 /* Max number of bytes we can move from memory to memory
2026 in one reasonably fast instruction. */
2027 #define MOVE_MAX (! TARGET_POWERPC64 ? 4 : 8)
2028 #define MAX_MOVE_MAX 8
2029
2030 /* Nonzero if access to memory by bytes is no faster than for words.
2031 Also non-zero if doing byte operations (specifically shifts) in registers
2032 is undesirable. */
2033 #define SLOW_BYTE_ACCESS 1
2034
2035 /* Define if operations between registers always perform the operation
2036 on the full register even if a narrower mode is specified. */
2037 #define WORD_REGISTER_OPERATIONS
2038
2039 /* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
2040 will either zero-extend or sign-extend. The value of this macro should
2041 be the code that says which one of the two operations is implicitly
2042 done, NIL if none. */
2043 #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
2044
2045 /* Define if loading short immediate values into registers sign extends. */
2046 #define SHORT_IMMEDIATES_SIGN_EXTEND
2047 \f
2048 /* The RS/6000 uses the XCOFF format. */
2049
2050 #define XCOFF_DEBUGGING_INFO
2051
2052 /* Define if the object format being used is COFF or a superset. */
2053 #define OBJECT_FORMAT_COFF
2054
2055 /* Define the magic numbers that we recognize as COFF.
2056 AIX 4.3 adds U803XTOCMAGIC (0757) for 64-bit executables, but collect2.c
2057 does not include these files in the right order to conditionally define
2058 the value in the macro. */
2059
2060 #define MY_ISCOFF(magic) \
2061 ((magic) == U802WRMAGIC || (magic) == U802ROMAGIC \
2062 || (magic) == U802TOCMAGIC || (magic) == 0757)
2063
2064 /* This is the only version of nm that collect2 can work with. */
2065 #define REAL_NM_FILE_NAME "/usr/ucb/nm"
2066
2067 /* We don't have GAS for the RS/6000 yet, so don't write out special
2068 .stabs in cc1plus. */
2069
2070 #define FASCIST_ASSEMBLER
2071
2072 #ifndef ASM_OUTPUT_CONSTRUCTOR
2073 #define ASM_OUTPUT_CONSTRUCTOR(file, name)
2074 #endif
2075 #ifndef ASM_OUTPUT_DESTRUCTOR
2076 #define ASM_OUTPUT_DESTRUCTOR(file, name)
2077 #endif
2078
2079 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
2080 is done just by pretending it is already truncated. */
2081 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
2082
2083 /* Specify the machine mode that pointers have.
2084 After generation of rtl, the compiler makes no further distinction
2085 between pointers and any other objects of this machine mode. */
2086 #define Pmode (TARGET_32BIT ? SImode : DImode)
2087
2088 /* Mode of a function address in a call instruction (for indexing purposes).
2089
2090 Doesn't matter on RS/6000. */
2091 #define FUNCTION_MODE (TARGET_32BIT ? SImode : DImode)
2092
2093 /* Define this if addresses of constant functions
2094 shouldn't be put through pseudo regs where they can be cse'd.
2095 Desirable on machines where ordinary constants are expensive
2096 but a CALL with constant address is cheap. */
2097 #define NO_FUNCTION_CSE
2098
2099 /* Define this to be nonzero if shift instructions ignore all but the low-order
2100 few bits.
2101
2102 The sle and sre instructions which allow SHIFT_COUNT_TRUNCATED
2103 have been dropped from the PowerPC architecture. */
2104
2105 #define SHIFT_COUNT_TRUNCATED (TARGET_POWER ? 1 : 0)
2106
2107 /* Use atexit for static constructors/destructors, instead of defining
2108 our own exit function. */
2109 #define HAVE_ATEXIT
2110
2111 /* Compute the cost of computing a constant rtl expression RTX
2112 whose rtx-code is CODE. The body of this macro is a portion
2113 of a switch statement. If the code is computed here,
2114 return it with a return statement. Otherwise, break from the switch.
2115
2116 On the RS/6000, if it is valid in the insn, it is free. So this
2117 always returns 0. */
2118
2119 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
2120 case CONST_INT: \
2121 case CONST: \
2122 case LABEL_REF: \
2123 case SYMBOL_REF: \
2124 case CONST_DOUBLE: \
2125 case HIGH: \
2126 return 0;
2127
2128 /* Provide the costs of a rtl expression. This is in the body of a
2129 switch on CODE. */
2130
2131 #define RTX_COSTS(X,CODE,OUTER_CODE) \
2132 case PLUS: \
2133 return ((GET_CODE (XEXP (X, 1)) == CONST_INT \
2134 && (unsigned HOST_WIDE_INT) ((INTVAL (XEXP (X, 1)) \
2135 + 0x8000) >= 0x10000)) \
2136 ? COSTS_N_INSNS (2) \
2137 : COSTS_N_INSNS (1)); \
2138 case AND: \
2139 return ((non_and_cint_operand (XEXP (X, 1), SImode)) \
2140 ? COSTS_N_INSNS (2) \
2141 : COSTS_N_INSNS (1)); \
2142 case IOR: \
2143 case XOR: \
2144 return ((non_logical_cint_operand (XEXP (X, 1), SImode)) \
2145 ? COSTS_N_INSNS (2) \
2146 : COSTS_N_INSNS (1)); \
2147 case MULT: \
2148 switch (rs6000_cpu) \
2149 { \
2150 case PROCESSOR_RIOS1: \
2151 return (GET_CODE (XEXP (X, 1)) != CONST_INT \
2152 ? COSTS_N_INSNS (5) \
2153 : INTVAL (XEXP (X, 1)) >= -256 && INTVAL (XEXP (X, 1)) <= 255 \
2154 ? COSTS_N_INSNS (3) : COSTS_N_INSNS (4)); \
2155 case PROCESSOR_RIOS2: \
2156 case PROCESSOR_MPCCORE: \
2157 return COSTS_N_INSNS (2); \
2158 case PROCESSOR_PPC601: \
2159 return COSTS_N_INSNS (5); \
2160 case PROCESSOR_PPC603: \
2161 return (GET_CODE (XEXP (X, 1)) != CONST_INT \
2162 ? COSTS_N_INSNS (5) \
2163 : INTVAL (XEXP (X, 1)) >= -256 && INTVAL (XEXP (X, 1)) <= 255 \
2164 ? COSTS_N_INSNS (2) : COSTS_N_INSNS (3)); \
2165 case PROCESSOR_PPC403: \
2166 case PROCESSOR_PPC604: \
2167 case PROCESSOR_PPC620: \
2168 return COSTS_N_INSNS (4); \
2169 } \
2170 case DIV: \
2171 case MOD: \
2172 if (GET_CODE (XEXP (X, 1)) == CONST_INT \
2173 && exact_log2 (INTVAL (XEXP (X, 1))) >= 0) \
2174 return COSTS_N_INSNS (2); \
2175 /* otherwise fall through to normal divide. */ \
2176 case UDIV: \
2177 case UMOD: \
2178 switch (rs6000_cpu) \
2179 { \
2180 case PROCESSOR_RIOS1: \
2181 return COSTS_N_INSNS (19); \
2182 case PROCESSOR_RIOS2: \
2183 return COSTS_N_INSNS (13); \
2184 case PROCESSOR_MPCCORE: \
2185 return COSTS_N_INSNS (6); \
2186 case PROCESSOR_PPC403: \
2187 return COSTS_N_INSNS (33); \
2188 case PROCESSOR_PPC601: \
2189 return COSTS_N_INSNS (36); \
2190 case PROCESSOR_PPC603: \
2191 return COSTS_N_INSNS (37); \
2192 case PROCESSOR_PPC604: \
2193 case PROCESSOR_PPC620: \
2194 return COSTS_N_INSNS (20); \
2195 } \
2196 case FFS: \
2197 return COSTS_N_INSNS (4); \
2198 case MEM: \
2199 /* MEM should be slightly more expensive than (plus (reg) (const)) */ \
2200 return 5;
2201
2202 /* Compute the cost of an address. This is meant to approximate the size
2203 and/or execution delay of an insn using that address. If the cost is
2204 approximated by the RTL complexity, including CONST_COSTS above, as
2205 is usually the case for CISC machines, this macro should not be defined.
2206 For aggressively RISCy machines, only one insn format is allowed, so
2207 this macro should be a constant. The value of this macro only matters
2208 for valid addresses.
2209
2210 For the RS/6000, everything is cost 0. */
2211
2212 #define ADDRESS_COST(RTX) 0
2213
2214 /* Adjust the length of an INSN. LENGTH is the currently-computed length and
2215 should be adjusted to reflect any required changes. This macro is used when
2216 there is some systematic length adjustment required that would be difficult
2217 to express in the length attribute. */
2218
2219 /* #define ADJUST_INSN_LENGTH(X,LENGTH) */
2220
2221 /* Add any extra modes needed to represent the condition code.
2222
2223 For the RS/6000, we need separate modes when unsigned (logical) comparisons
2224 are being done and we need a separate mode for floating-point. We also
2225 use a mode for the case when we are comparing the results of two
2226 comparisons. */
2227
2228 #define EXTRA_CC_MODES CCUNSmode, CCFPmode, CCEQmode
2229
2230 /* Define the names for the modes specified above. */
2231 #define EXTRA_CC_NAMES "CCUNS", "CCFP", "CCEQ"
2232
2233 /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
2234 return the mode to be used for the comparison. For floating-point, CCFPmode
2235 should be used. CCUNSmode should be used for unsigned comparisons.
2236 CCEQmode should be used when we are doing an inequality comparison on
2237 the result of a comparison. CCmode should be used in all other cases. */
2238
2239 #define SELECT_CC_MODE(OP,X,Y) \
2240 (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT ? CCFPmode \
2241 : (OP) == GTU || (OP) == LTU || (OP) == GEU || (OP) == LEU ? CCUNSmode \
2242 : (((OP) == EQ || (OP) == NE) && GET_RTX_CLASS (GET_CODE (X)) == '<' \
2243 ? CCEQmode : CCmode))
2244
2245 /* Define the information needed to generate branch and scc insns. This is
2246 stored from the compare operation. Note that we can't use "rtx" here
2247 since it hasn't been defined! */
2248
2249 extern struct rtx_def *rs6000_compare_op0, *rs6000_compare_op1;
2250 extern int rs6000_compare_fp_p;
2251
2252 /* Set to non-zero by "fix" operation to indicate that itrunc and
2253 uitrunc must be defined. */
2254
2255 extern int rs6000_trunc_used;
2256
2257 /* Function names to call to do floating point truncation. */
2258
2259 #define RS6000_ITRUNC "__itrunc"
2260 #define RS6000_UITRUNC "__uitrunc"
2261
2262 /* Prefix and suffix to use to saving floating point */
2263 #ifndef SAVE_FP_PREFIX
2264 #define SAVE_FP_PREFIX "._savef"
2265 #define SAVE_FP_SUFFIX ""
2266 #endif
2267
2268 /* Prefix and suffix to use to restoring floating point */
2269 #ifndef RESTORE_FP_PREFIX
2270 #define RESTORE_FP_PREFIX "._restf"
2271 #define RESTORE_FP_SUFFIX ""
2272 #endif
2273
2274 /* Function name to call to do profiling. */
2275 #define RS6000_MCOUNT ".__mcount"
2276
2277 \f
2278 /* Control the assembler format that we output. */
2279
2280 /* A C string constant describing how to begin a comment in the target
2281 assembler language. The compiler assumes that the comment will end at
2282 the end of the line. */
2283 #define ASM_COMMENT_START " #"
2284
2285 /* Output at beginning of assembler file.
2286
2287 Initialize the section names for the RS/6000 at this point.
2288
2289 Specify filename to assembler.
2290
2291 We want to go into the TOC section so at least one .toc will be emitted.
2292 Also, in order to output proper .bs/.es pairs, we need at least one static
2293 [RW] section emitted.
2294
2295 We then switch back to text to force the gcc2_compiled. label and the space
2296 allocated after it (when profiling) into the text section.
2297
2298 Finally, declare mcount when profiling to make the assembler happy. */
2299
2300 #define ASM_FILE_START(FILE) \
2301 { \
2302 rs6000_gen_section_name (&xcoff_bss_section_name, \
2303 main_input_filename, ".bss_"); \
2304 rs6000_gen_section_name (&xcoff_private_data_section_name, \
2305 main_input_filename, ".rw_"); \
2306 rs6000_gen_section_name (&xcoff_read_only_section_name, \
2307 main_input_filename, ".ro_"); \
2308 \
2309 output_file_directive (FILE, main_input_filename); \
2310 toc_section (); \
2311 if (write_symbols != NO_DEBUG) \
2312 private_data_section (); \
2313 text_section (); \
2314 if (profile_flag) \
2315 fprintf (FILE, "\t.extern %s\n", RS6000_MCOUNT); \
2316 rs6000_file_start (FILE, TARGET_CPU_DEFAULT); \
2317 }
2318
2319 /* Output at end of assembler file.
2320
2321 On the RS/6000, referencing data should automatically pull in text. */
2322
2323 #define ASM_FILE_END(FILE) \
2324 { \
2325 text_section (); \
2326 fputs ("_section_.text:\n", FILE); \
2327 data_section (); \
2328 fputs ("\t.long _section_.text\n", FILE); \
2329 }
2330
2331 /* We define this to prevent the name mangler from putting dollar signs into
2332 function names. */
2333
2334 #define NO_DOLLAR_IN_LABEL
2335
2336 /* We define this to 0 so that gcc will never accept a dollar sign in a
2337 variable name. This is needed because the AIX assembler will not accept
2338 dollar signs. */
2339
2340 #define DOLLARS_IN_IDENTIFIERS 0
2341
2342 /* Implicit library calls should use memcpy, not bcopy, etc. */
2343
2344 #define TARGET_MEM_FUNCTIONS
2345
2346 /* Define the extra sections we need. We define three: one is the read-only
2347 data section which is used for constants. This is a csect whose name is
2348 derived from the name of the input file. The second is for initialized
2349 global variables. This is a csect whose name is that of the variable.
2350 The third is the TOC. */
2351
2352 #define EXTRA_SECTIONS \
2353 read_only_data, private_data, read_only_private_data, toc, bss
2354
2355 /* Define the name of our readonly data section. */
2356
2357 #define READONLY_DATA_SECTION read_only_data_section
2358
2359
2360 /* Define the name of the section to use for the exception tables.
2361 TODO: test and see if we can use read_only_data_section, if so,
2362 remove this. */
2363
2364 #define EXCEPTION_SECTION data_section
2365
2366 /* If we are referencing a function that is static or is known to be
2367 in this file, make the SYMBOL_REF special. We can use this to indicate
2368 that we can branch to this function without emitting a no-op after the
2369 call. */
2370
2371 #define ENCODE_SECTION_INFO(DECL) \
2372 if (TREE_CODE (DECL) == FUNCTION_DECL \
2373 && (TREE_ASM_WRITTEN (DECL) || ! TREE_PUBLIC (DECL))) \
2374 SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1;
2375
2376 /* Indicate that jump tables go in the text section. */
2377
2378 #define JUMP_TABLES_IN_TEXT_SECTION
2379
2380 /* Define the routines to implement these extra sections. */
2381
2382 #define EXTRA_SECTION_FUNCTIONS \
2383 \
2384 void \
2385 read_only_data_section () \
2386 { \
2387 if (in_section != read_only_data) \
2388 { \
2389 fprintf (asm_out_file, ".csect %s[RO]\n", \
2390 xcoff_read_only_section_name); \
2391 in_section = read_only_data; \
2392 } \
2393 } \
2394 \
2395 void \
2396 private_data_section () \
2397 { \
2398 if (in_section != private_data) \
2399 { \
2400 fprintf (asm_out_file, ".csect %s[RW]\n", \
2401 xcoff_private_data_section_name); \
2402 \
2403 in_section = private_data; \
2404 } \
2405 } \
2406 \
2407 void \
2408 read_only_private_data_section () \
2409 { \
2410 if (in_section != read_only_private_data) \
2411 { \
2412 fprintf (asm_out_file, ".csect %s[RO]\n", \
2413 xcoff_private_data_section_name); \
2414 in_section = read_only_private_data; \
2415 } \
2416 } \
2417 \
2418 void \
2419 toc_section () \
2420 { \
2421 if (TARGET_MINIMAL_TOC) \
2422 { \
2423 /* toc_section is always called at least once from ASM_FILE_START, \
2424 so this is guaranteed to always be defined once and only once \
2425 in each file. */ \
2426 if (! toc_initialized) \
2427 { \
2428 fputs (".toc\nLCTOC..0:\n", asm_out_file); \
2429 fputs ("\t.tc toc_table[TC],toc_table[RW]\n", asm_out_file); \
2430 toc_initialized = 1; \
2431 } \
2432 \
2433 if (in_section != toc) \
2434 fputs (".csect toc_table[RW]\n", asm_out_file); \
2435 } \
2436 else \
2437 { \
2438 if (in_section != toc) \
2439 fputs (".toc\n", asm_out_file); \
2440 } \
2441 in_section = toc; \
2442 }
2443
2444 /* Flag to say the TOC is initialized */
2445 extern int toc_initialized;
2446
2447 /* This macro produces the initial definition of a function name.
2448 On the RS/6000, we need to place an extra '.' in the function name and
2449 output the function descriptor.
2450
2451 The csect for the function will have already been created by the
2452 `text_section' call previously done. We do have to go back to that
2453 csect, however. */
2454
2455 /* ??? What do the 16 and 044 in the .function line really mean? */
2456
2457 #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
2458 { if (TREE_PUBLIC (DECL)) \
2459 { \
2460 fputs ("\t.globl .", FILE); \
2461 RS6000_OUTPUT_BASENAME (FILE, NAME); \
2462 putc ('\n', FILE); \
2463 } \
2464 else \
2465 { \
2466 fputs ("\t.lglobl .", FILE); \
2467 RS6000_OUTPUT_BASENAME (FILE, NAME); \
2468 putc ('\n', FILE); \
2469 } \
2470 fputs (".csect ", FILE); \
2471 RS6000_OUTPUT_BASENAME (FILE, NAME); \
2472 fputs ("[DS]\n", FILE); \
2473 RS6000_OUTPUT_BASENAME (FILE, NAME); \
2474 fputs (":\n", FILE); \
2475 fputs ((TARGET_32BIT) ? "\t.long ." : "\t.llong .", FILE); \
2476 RS6000_OUTPUT_BASENAME (FILE, NAME); \
2477 fputs (", TOC[tc0], 0\n", FILE); \
2478 fputs (".csect .text[PR]\n.", FILE); \
2479 RS6000_OUTPUT_BASENAME (FILE, NAME); \
2480 fputs (":\n", FILE); \
2481 if (write_symbols == XCOFF_DEBUG) \
2482 xcoffout_declare_function (FILE, DECL, NAME); \
2483 }
2484
2485 /* Return non-zero if this entry is to be written into the constant pool
2486 in a special way. We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
2487 containing one of them. If -mfp-in-toc (the default), we also do
2488 this for floating-point constants. We actually can only do this
2489 if the FP formats of the target and host machines are the same, but
2490 we can't check that since not every file that uses
2491 GO_IF_LEGITIMATE_ADDRESS_P includes real.h. */
2492
2493 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X) \
2494 (TARGET_TOC \
2495 && (GET_CODE (X) == SYMBOL_REF \
2496 || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
2497 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
2498 || GET_CODE (X) == LABEL_REF \
2499 || (! (TARGET_NO_FP_IN_TOC && ! TARGET_MINIMAL_TOC) \
2500 && GET_CODE (X) == CONST_DOUBLE \
2501 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
2502 && BITS_PER_WORD == HOST_BITS_PER_INT)))
2503
2504 /* Select section for constant in constant pool.
2505
2506 On RS/6000, all constants are in the private read-only data area.
2507 However, if this is being placed in the TOC it must be output as a
2508 toc entry. */
2509
2510 #define SELECT_RTX_SECTION(MODE, X) \
2511 { if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (X)) \
2512 toc_section (); \
2513 else \
2514 read_only_private_data_section (); \
2515 }
2516
2517 /* Macro to output a special constant pool entry. Go to WIN if we output
2518 it. Otherwise, it is written the usual way.
2519
2520 On the RS/6000, toc entries are handled this way. */
2521
2522 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY(FILE, X, MODE, ALIGN, LABELNO, WIN) \
2523 { if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (X)) \
2524 { \
2525 output_toc (FILE, X, LABELNO); \
2526 goto WIN; \
2527 } \
2528 }
2529
2530 /* Select the section for an initialized data object.
2531
2532 On the RS/6000, we have a special section for all variables except those
2533 that are static. */
2534
2535 #define SELECT_SECTION(EXP,RELOC) \
2536 { \
2537 if ((TREE_CODE (EXP) == STRING_CST \
2538 && !flag_writable_strings) \
2539 || (TREE_CODE_CLASS (TREE_CODE (EXP)) == 'd' \
2540 && TREE_READONLY (EXP) && ! TREE_THIS_VOLATILE (EXP) \
2541 && DECL_INITIAL (EXP) \
2542 && (DECL_INITIAL (EXP) == error_mark_node \
2543 || TREE_CONSTANT (DECL_INITIAL (EXP))) \
2544 && ! (RELOC))) \
2545 { \
2546 if (TREE_PUBLIC (EXP)) \
2547 read_only_data_section (); \
2548 else \
2549 read_only_private_data_section (); \
2550 } \
2551 else \
2552 { \
2553 if (TREE_PUBLIC (EXP)) \
2554 data_section (); \
2555 else \
2556 private_data_section (); \
2557 } \
2558 }
2559
2560 /* This outputs NAME to FILE up to the first null or '['. */
2561
2562 #define RS6000_OUTPUT_BASENAME(FILE, NAME) \
2563 { \
2564 char *_p; \
2565 \
2566 STRIP_NAME_ENCODING (_p, (NAME)); \
2567 assemble_name ((FILE), _p); \
2568 }
2569
2570 /* Remove any trailing [DS] or the like from the symbol name. */
2571
2572 #define STRIP_NAME_ENCODING(VAR,NAME) \
2573 do \
2574 { \
2575 char *_name = (NAME); \
2576 int _len; \
2577 if (_name[0] == '*') \
2578 _name++; \
2579 _len = strlen (_name); \
2580 if (_name[_len - 1] != ']') \
2581 (VAR) = _name; \
2582 else \
2583 { \
2584 (VAR) = (char *) alloca (_len + 1); \
2585 strcpy ((VAR), _name); \
2586 (VAR)[_len - 4] = '\0'; \
2587 } \
2588 } \
2589 while (0)
2590
2591 /* Output something to declare an external symbol to the assembler. Most
2592 assemblers don't need this.
2593
2594 If we haven't already, add "[RW]" (or "[DS]" for a function) to the
2595 name. Normally we write this out along with the name. In the few cases
2596 where we can't, it gets stripped off. */
2597
2598 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
2599 { rtx _symref = XEXP (DECL_RTL (DECL), 0); \
2600 if ((TREE_CODE (DECL) == VAR_DECL \
2601 || TREE_CODE (DECL) == FUNCTION_DECL) \
2602 && (NAME)[strlen (NAME) - 1] != ']') \
2603 { \
2604 char *_name = (char *) permalloc (strlen (XSTR (_symref, 0)) + 5); \
2605 strcpy (_name, XSTR (_symref, 0)); \
2606 strcat (_name, TREE_CODE (DECL) == FUNCTION_DECL ? "[DS]" : "[RW]"); \
2607 XSTR (_symref, 0) = _name; \
2608 } \
2609 fputs ("\t.extern ", FILE); \
2610 assemble_name (FILE, XSTR (_symref, 0)); \
2611 if (TREE_CODE (DECL) == FUNCTION_DECL) \
2612 { \
2613 fputs ("\n\t.extern .", FILE); \
2614 RS6000_OUTPUT_BASENAME (FILE, XSTR (_symref, 0)); \
2615 } \
2616 putc ('\n', FILE); \
2617 }
2618
2619 /* Similar, but for libcall. We only have to worry about the function name,
2620 not that of the descriptor. */
2621
2622 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
2623 { fputs ("\t.extern .", FILE); \
2624 assemble_name (FILE, XSTR (FUN, 0)); \
2625 putc ('\n', FILE); \
2626 }
2627
2628 /* Output to assembler file text saying following lines
2629 may contain character constants, extra white space, comments, etc. */
2630
2631 #define ASM_APP_ON ""
2632
2633 /* Output to assembler file text saying following lines
2634 no longer contain unusual constructs. */
2635
2636 #define ASM_APP_OFF ""
2637
2638 /* Output before instructions. */
2639
2640 #define TEXT_SECTION_ASM_OP ".csect .text[PR]"
2641
2642 /* Output before writable data. */
2643
2644 #define DATA_SECTION_ASM_OP ".csect .data[RW]"
2645
2646 /* How to refer to registers in assembler output.
2647 This sequence is indexed by compiler's hard-register-number (see above). */
2648
2649 extern char rs6000_reg_names[][8]; /* register names (0 vs. %r0). */
2650
2651 #define REGISTER_NAMES \
2652 { \
2653 &rs6000_reg_names[ 0][0], /* r0 */ \
2654 &rs6000_reg_names[ 1][0], /* r1 */ \
2655 &rs6000_reg_names[ 2][0], /* r2 */ \
2656 &rs6000_reg_names[ 3][0], /* r3 */ \
2657 &rs6000_reg_names[ 4][0], /* r4 */ \
2658 &rs6000_reg_names[ 5][0], /* r5 */ \
2659 &rs6000_reg_names[ 6][0], /* r6 */ \
2660 &rs6000_reg_names[ 7][0], /* r7 */ \
2661 &rs6000_reg_names[ 8][0], /* r8 */ \
2662 &rs6000_reg_names[ 9][0], /* r9 */ \
2663 &rs6000_reg_names[10][0], /* r10 */ \
2664 &rs6000_reg_names[11][0], /* r11 */ \
2665 &rs6000_reg_names[12][0], /* r12 */ \
2666 &rs6000_reg_names[13][0], /* r13 */ \
2667 &rs6000_reg_names[14][0], /* r14 */ \
2668 &rs6000_reg_names[15][0], /* r15 */ \
2669 &rs6000_reg_names[16][0], /* r16 */ \
2670 &rs6000_reg_names[17][0], /* r17 */ \
2671 &rs6000_reg_names[18][0], /* r18 */ \
2672 &rs6000_reg_names[19][0], /* r19 */ \
2673 &rs6000_reg_names[20][0], /* r20 */ \
2674 &rs6000_reg_names[21][0], /* r21 */ \
2675 &rs6000_reg_names[22][0], /* r22 */ \
2676 &rs6000_reg_names[23][0], /* r23 */ \
2677 &rs6000_reg_names[24][0], /* r24 */ \
2678 &rs6000_reg_names[25][0], /* r25 */ \
2679 &rs6000_reg_names[26][0], /* r26 */ \
2680 &rs6000_reg_names[27][0], /* r27 */ \
2681 &rs6000_reg_names[28][0], /* r28 */ \
2682 &rs6000_reg_names[29][0], /* r29 */ \
2683 &rs6000_reg_names[30][0], /* r30 */ \
2684 &rs6000_reg_names[31][0], /* r31 */ \
2685 \
2686 &rs6000_reg_names[32][0], /* fr0 */ \
2687 &rs6000_reg_names[33][0], /* fr1 */ \
2688 &rs6000_reg_names[34][0], /* fr2 */ \
2689 &rs6000_reg_names[35][0], /* fr3 */ \
2690 &rs6000_reg_names[36][0], /* fr4 */ \
2691 &rs6000_reg_names[37][0], /* fr5 */ \
2692 &rs6000_reg_names[38][0], /* fr6 */ \
2693 &rs6000_reg_names[39][0], /* fr7 */ \
2694 &rs6000_reg_names[40][0], /* fr8 */ \
2695 &rs6000_reg_names[41][0], /* fr9 */ \
2696 &rs6000_reg_names[42][0], /* fr10 */ \
2697 &rs6000_reg_names[43][0], /* fr11 */ \
2698 &rs6000_reg_names[44][0], /* fr12 */ \
2699 &rs6000_reg_names[45][0], /* fr13 */ \
2700 &rs6000_reg_names[46][0], /* fr14 */ \
2701 &rs6000_reg_names[47][0], /* fr15 */ \
2702 &rs6000_reg_names[48][0], /* fr16 */ \
2703 &rs6000_reg_names[49][0], /* fr17 */ \
2704 &rs6000_reg_names[50][0], /* fr18 */ \
2705 &rs6000_reg_names[51][0], /* fr19 */ \
2706 &rs6000_reg_names[52][0], /* fr20 */ \
2707 &rs6000_reg_names[53][0], /* fr21 */ \
2708 &rs6000_reg_names[54][0], /* fr22 */ \
2709 &rs6000_reg_names[55][0], /* fr23 */ \
2710 &rs6000_reg_names[56][0], /* fr24 */ \
2711 &rs6000_reg_names[57][0], /* fr25 */ \
2712 &rs6000_reg_names[58][0], /* fr26 */ \
2713 &rs6000_reg_names[59][0], /* fr27 */ \
2714 &rs6000_reg_names[60][0], /* fr28 */ \
2715 &rs6000_reg_names[61][0], /* fr29 */ \
2716 &rs6000_reg_names[62][0], /* fr30 */ \
2717 &rs6000_reg_names[63][0], /* fr31 */ \
2718 \
2719 &rs6000_reg_names[64][0], /* mq */ \
2720 &rs6000_reg_names[65][0], /* lr */ \
2721 &rs6000_reg_names[66][0], /* ctr */ \
2722 &rs6000_reg_names[67][0], /* ap */ \
2723 \
2724 &rs6000_reg_names[68][0], /* cr0 */ \
2725 &rs6000_reg_names[69][0], /* cr1 */ \
2726 &rs6000_reg_names[70][0], /* cr2 */ \
2727 &rs6000_reg_names[71][0], /* cr3 */ \
2728 &rs6000_reg_names[72][0], /* cr4 */ \
2729 &rs6000_reg_names[73][0], /* cr5 */ \
2730 &rs6000_reg_names[74][0], /* cr6 */ \
2731 &rs6000_reg_names[75][0], /* cr7 */ \
2732 \
2733 &rs6000_reg_names[76][0], /* fpmem */ \
2734 }
2735
2736 /* print-rtl can't handle the above REGISTER_NAMES, so define the
2737 following for it. Switch to use the alternate names since
2738 they are more mnemonic. */
2739
2740 #define DEBUG_REGISTER_NAMES \
2741 { \
2742 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
2743 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
2744 "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \
2745 "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", \
2746 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
2747 "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
2748 "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \
2749 "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \
2750 "mq", "lr", "ctr", "ap", \
2751 "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
2752 "fpmem" \
2753 }
2754
2755 /* Table of additional register names to use in user input. */
2756
2757 #define ADDITIONAL_REGISTER_NAMES \
2758 {{"r0", 0}, {"r1", 1}, {"r2", 2}, {"r3", 3}, \
2759 {"r4", 4}, {"r5", 5}, {"r6", 6}, {"r7", 7}, \
2760 {"r8", 8}, {"r9", 9}, {"r10", 10}, {"r11", 11}, \
2761 {"r12", 12}, {"r13", 13}, {"r14", 14}, {"r15", 15}, \
2762 {"r16", 16}, {"r17", 17}, {"r18", 18}, {"r19", 19}, \
2763 {"r20", 20}, {"r21", 21}, {"r22", 22}, {"r23", 23}, \
2764 {"r24", 24}, {"r25", 25}, {"r26", 26}, {"r27", 27}, \
2765 {"r28", 28}, {"r29", 29}, {"r30", 30}, {"r31", 31}, \
2766 {"fr0", 32}, {"fr1", 33}, {"fr2", 34}, {"fr3", 35}, \
2767 {"fr4", 36}, {"fr5", 37}, {"fr6", 38}, {"fr7", 39}, \
2768 {"fr8", 40}, {"fr9", 41}, {"fr10", 42}, {"fr11", 43}, \
2769 {"fr12", 44}, {"fr13", 45}, {"fr14", 46}, {"fr15", 47}, \
2770 {"fr16", 48}, {"fr17", 49}, {"fr18", 50}, {"fr19", 51}, \
2771 {"fr20", 52}, {"fr21", 53}, {"fr22", 54}, {"fr23", 55}, \
2772 {"fr24", 56}, {"fr25", 57}, {"fr26", 58}, {"fr27", 59}, \
2773 {"fr28", 60}, {"fr29", 61}, {"fr30", 62}, {"fr31", 63}, \
2774 /* no additional names for: mq, lr, ctr, ap */ \
2775 {"cr0", 68}, {"cr1", 69}, {"cr2", 70}, {"cr3", 71}, \
2776 {"cr4", 72}, {"cr5", 73}, {"cr6", 74}, {"cr7", 75}, \
2777 {"cc", 68}, {"sp", 1}, {"toc", 2} }
2778
2779 /* How to renumber registers for dbx and gdb. */
2780
2781 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
2782
2783 /* Text to write out after a CALL that may be replaced by glue code by
2784 the loader. This depends on the AIX version. */
2785 #define RS6000_CALL_GLUE "cror 31,31,31"
2786
2787 /* This is how to output the definition of a user-level label named NAME,
2788 such as the label on a static function or variable NAME. */
2789
2790 #define ASM_OUTPUT_LABEL(FILE,NAME) \
2791 do { RS6000_OUTPUT_BASENAME (FILE, NAME); fputs (":\n", FILE); } while (0)
2792
2793 /* This is how to output a command to make the user-level label named NAME
2794 defined for reference from other files. */
2795
2796 #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
2797 do { fputs ("\t.globl ", FILE); \
2798 RS6000_OUTPUT_BASENAME (FILE, NAME); fputs ("\n", FILE);} while (0)
2799
2800 /* This is how to output a reference to a user-level label named NAME.
2801 `assemble_name' uses this. */
2802
2803 #define ASM_OUTPUT_LABELREF(FILE,NAME) \
2804 fputs (NAME, FILE)
2805
2806 /* This is how to output an internal numbered label where
2807 PREFIX is the class of label and NUM is the number within the class. */
2808
2809 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
2810 fprintf (FILE, "%s..%d:\n", PREFIX, NUM)
2811
2812 /* This is how to output an internal label prefix. rs6000.c uses this
2813 when generating traceback tables. */
2814
2815 #define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \
2816 fprintf (FILE, "%s..", PREFIX)
2817
2818 /* This is how to output a label for a jump table. Arguments are the same as
2819 for ASM_OUTPUT_INTERNAL_LABEL, except the insn for the jump table is
2820 passed. */
2821
2822 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
2823 { ASM_OUTPUT_ALIGN (FILE, 2); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); }
2824
2825 /* This is how to store into the string LABEL
2826 the symbol_ref name of an internal numbered label where
2827 PREFIX is the class of label and NUM is the number within the class.
2828 This is suitable for output with `assemble_name'. */
2829
2830 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
2831 sprintf (LABEL, "*%s..%d", PREFIX, NUM)
2832
2833 /* This is how to output an assembler line defining a `double' constant. */
2834
2835 #define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
2836 { \
2837 if (REAL_VALUE_ISINF (VALUE) \
2838 || REAL_VALUE_ISNAN (VALUE) \
2839 || REAL_VALUE_MINUS_ZERO (VALUE)) \
2840 { \
2841 long t[2]; \
2842 REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
2843 fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n", \
2844 t[0] & 0xffffffff, t[1] & 0xffffffff); \
2845 } \
2846 else \
2847 { \
2848 char str[30]; \
2849 REAL_VALUE_TO_DECIMAL (VALUE, "%.20e", str); \
2850 fprintf (FILE, "\t.double 0d%s\n", str); \
2851 } \
2852 }
2853
2854 /* This is how to output an assembler line defining a `float' constant. */
2855
2856 #define ASM_OUTPUT_FLOAT(FILE, VALUE) \
2857 { \
2858 if (REAL_VALUE_ISINF (VALUE) \
2859 || REAL_VALUE_ISNAN (VALUE) \
2860 || REAL_VALUE_MINUS_ZERO (VALUE)) \
2861 { \
2862 long t; \
2863 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
2864 fprintf (FILE, "\t.long 0x%lx\n", t & 0xffffffff); \
2865 } \
2866 else \
2867 { \
2868 char str[30]; \
2869 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
2870 fprintf (FILE, "\t.float 0d%s\n", str); \
2871 } \
2872 }
2873
2874 /* This is how to output an assembler line defining an `int' constant. */
2875
2876 #define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE) \
2877 do { \
2878 if (TARGET_32BIT) \
2879 { \
2880 assemble_integer (operand_subword ((VALUE), 0, 0, DImode), \
2881 UNITS_PER_WORD, 1); \
2882 assemble_integer (operand_subword ((VALUE), 1, 0, DImode), \
2883 UNITS_PER_WORD, 1); \
2884 } \
2885 else \
2886 { \
2887 fputs ("\t.llong ", FILE); \
2888 output_addr_const (FILE, (VALUE)); \
2889 putc ('\n', FILE); \
2890 } \
2891 } while (0)
2892
2893 #define ASM_OUTPUT_INT(FILE,VALUE) \
2894 ( fputs ("\t.long ", FILE), \
2895 output_addr_const (FILE, (VALUE)), \
2896 putc ('\n', FILE))
2897
2898 /* Likewise for `char' and `short' constants. */
2899
2900 #define ASM_OUTPUT_SHORT(FILE,VALUE) \
2901 ( fputs ("\t.short ", FILE), \
2902 output_addr_const (FILE, (VALUE)), \
2903 putc ('\n', FILE))
2904
2905 #define ASM_OUTPUT_CHAR(FILE,VALUE) \
2906 ( fputs ("\t.byte ", FILE), \
2907 output_addr_const (FILE, (VALUE)), \
2908 putc ('\n', FILE))
2909
2910 /* This is how to output an assembler line for a numeric constant byte. */
2911
2912 #define ASM_OUTPUT_BYTE(FILE,VALUE) \
2913 fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
2914
2915 /* This is how to output an assembler line to define N characters starting
2916 at P to FILE. */
2917
2918 #define ASM_OUTPUT_ASCII(FILE, P, N) output_ascii ((FILE), (P), (N))
2919
2920 /* This is how to output code to push a register on the stack.
2921 It need not be very fast code.
2922
2923 On the rs6000, we must keep the backchain up to date. In order
2924 to simplify things, always allocate 16 bytes for a push (System V
2925 wants to keep stack aligned to a 16 byte boundary). */
2926
2927 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
2928 do { \
2929 extern char *reg_names[]; \
2930 asm_fprintf (FILE, "\t{stu|stwu} %s,-16(%s)\n\t{st|stw} %s,8(%s)\n", \
2931 reg_names[1], reg_names[1], reg_names[REGNO], \
2932 reg_names[1]); \
2933 } while (0)
2934
2935 /* This is how to output an insn to pop a register from the stack.
2936 It need not be very fast code. */
2937
2938 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
2939 do { \
2940 extern char *reg_names[]; \
2941 asm_fprintf (FILE, "\t{l|lwz} %s,8(%s)\n\t{ai|addic} %s,%s,16\n", \
2942 reg_names[REGNO], reg_names[1], reg_names[1], \
2943 reg_names[1]); \
2944 } while (0)
2945
2946 /* This is how to output an element of a case-vector that is absolute.
2947 (RS/6000 does not use such vectors, but we must define this macro
2948 anyway.) */
2949
2950 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
2951 do { char buf[100]; \
2952 fputs ((TARGET_32BIT) ? "\t.long " : "\t.llong ", FILE); \
2953 ASM_GENERATE_INTERNAL_LABEL (buf, "L", VALUE); \
2954 assemble_name (FILE, buf); \
2955 putc ('\n', FILE); \
2956 } while (0)
2957
2958 /* This is how to output an element of a case-vector that is relative. */
2959
2960 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL)\
2961 do { char buf[100]; \
2962 fputs ((TARGET_32BIT) ? "\t.long " : "\t.llong ", FILE); \
2963 ASM_GENERATE_INTERNAL_LABEL (buf, "L", VALUE); \
2964 assemble_name (FILE, buf); \
2965 putc ('-', FILE); \
2966 ASM_GENERATE_INTERNAL_LABEL (buf, "L", REL); \
2967 assemble_name (FILE, buf); \
2968 putc ('\n', FILE); \
2969 } while (0)
2970
2971 /* This is how to output an assembler line
2972 that says to advance the location counter
2973 to a multiple of 2**LOG bytes. */
2974
2975 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
2976 if ((LOG) != 0) \
2977 fprintf (FILE, "\t.align %d\n", (LOG))
2978
2979 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
2980 fprintf (FILE, "\t.space %d\n", (SIZE))
2981
2982 /* This says how to output an assembler line
2983 to define a global common symbol. */
2984
2985 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGNMENT) \
2986 do { fputs (".comm ", (FILE)); \
2987 RS6000_OUTPUT_BASENAME ((FILE), (NAME)); \
2988 if ( (SIZE) > 4) \
2989 fprintf ((FILE), ",%d,3\n", (SIZE)); \
2990 else \
2991 fprintf( (FILE), ",%d\n", (SIZE)); \
2992 } while (0)
2993
2994 /* This says how to output an assembler line
2995 to define a local common symbol. */
2996
2997 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \
2998 do { fputs (".lcomm ", (FILE)); \
2999 RS6000_OUTPUT_BASENAME ((FILE), (NAME)); \
3000 fprintf ((FILE), ",%d,%s\n", (SIZE), xcoff_bss_section_name); \
3001 } while (0)
3002
3003 /* Store in OUTPUT a string (made with alloca) containing
3004 an assembler-name for a local static variable named NAME.
3005 LABELNO is an integer which is different for each call. */
3006
3007 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
3008 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
3009 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
3010
3011 /* Define the parentheses used to group arithmetic operations
3012 in assembler code. */
3013
3014 #define ASM_OPEN_PAREN "("
3015 #define ASM_CLOSE_PAREN ")"
3016
3017 /* Define results of standard character escape sequences. */
3018 #define TARGET_BELL 007
3019 #define TARGET_BS 010
3020 #define TARGET_TAB 011
3021 #define TARGET_NEWLINE 012
3022 #define TARGET_VT 013
3023 #define TARGET_FF 014
3024 #define TARGET_CR 015
3025
3026 /* Print operand X (an rtx) in assembler syntax to file FILE.
3027 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
3028 For `%' followed by punctuation, CODE is the punctuation and X is null. */
3029
3030 #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
3031
3032 /* Define which CODE values are valid. */
3033
3034 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
3035 ((CODE) == '.' || (CODE) == '*' || (CODE) == '$')
3036
3037 /* Print a memory address as an operand to reference that memory location. */
3038
3039 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
3040
3041 /* Define the codes that are matched by predicates in rs6000.c. */
3042
3043 #define PREDICATE_CODES \
3044 {"short_cint_operand", {CONST_INT}}, \
3045 {"u_short_cint_operand", {CONST_INT}}, \
3046 {"non_short_cint_operand", {CONST_INT}}, \
3047 {"gpc_reg_operand", {SUBREG, REG}}, \
3048 {"cc_reg_operand", {SUBREG, REG}}, \
3049 {"reg_or_short_operand", {SUBREG, REG, CONST_INT}}, \
3050 {"reg_or_neg_short_operand", {SUBREG, REG, CONST_INT}}, \
3051 {"reg_or_u_short_operand", {SUBREG, REG, CONST_INT}}, \
3052 {"reg_or_cint_operand", {SUBREG, REG, CONST_INT}}, \
3053 {"got_operand", {SYMBOL_REF, CONST, LABEL_REF}}, \
3054 {"got_no_const_operand", {SYMBOL_REF, LABEL_REF}}, \
3055 {"easy_fp_constant", {CONST_DOUBLE}}, \
3056 {"reg_or_mem_operand", {SUBREG, MEM, REG}}, \
3057 {"lwa_operand", {SUBREG, MEM, REG}}, \
3058 {"volatile_mem_operand", {MEM}}, \
3059 {"offsettable_addr_operand", {REG, SUBREG, PLUS}}, \
3060 {"mem_or_easy_const_operand", {SUBREG, MEM, CONST_DOUBLE}}, \
3061 {"add_operand", {SUBREG, REG, CONST_INT}}, \
3062 {"non_add_cint_operand", {CONST_INT}}, \
3063 {"and_operand", {SUBREG, REG, CONST_INT}}, \
3064 {"non_and_cint_operand", {CONST_INT}}, \
3065 {"logical_operand", {SUBREG, REG, CONST_INT}}, \
3066 {"non_logical_cint_operand", {CONST_INT}}, \
3067 {"mask_operand", {CONST_INT}}, \
3068 {"count_register_operand", {REG}}, \
3069 {"fpmem_operand", {REG}}, \
3070 {"call_operand", {SYMBOL_REF, REG}}, \
3071 {"current_file_function_operand", {SYMBOL_REF}}, \
3072 {"input_operand", {SUBREG, MEM, REG, CONST_INT, SYMBOL_REF}}, \
3073 {"load_multiple_operation", {PARALLEL}}, \
3074 {"store_multiple_operation", {PARALLEL}}, \
3075 {"branch_comparison_operator", {EQ, NE, LE, LT, GE, \
3076 GT, LEU, LTU, GEU, GTU}}, \
3077 {"scc_comparison_operator", {EQ, NE, LE, LT, GE, \
3078 GT, LEU, LTU, GEU, GTU}},
3079
3080
3081 /* uncomment for disabling the corresponding default options */
3082 /* #define MACHINE_no_sched_interblock */
3083 /* #define MACHINE_no_sched_speculative */
3084 /* #define MACHINE_no_sched_speculative_load */
3085
3086 /* indicate that issue rate is defined for this machine
3087 (no need to use the default) */
3088 #define ISSUE_RATE get_issue_rate ()
3089
3090 /* General flags. */
3091 extern int flag_pic;
3092 extern int optimize;
3093 extern int flag_expensive_optimizations;
3094 extern int frame_pointer_needed;
3095
3096 /* Declare functions in rs6000.c */
3097 extern void output_options ();
3098 extern void rs6000_override_options ();
3099 extern void rs6000_file_start ();
3100 extern struct rtx_def *rs6000_float_const ();
3101 extern struct rtx_def *rs6000_immed_double_const ();
3102 extern struct rtx_def *rs6000_got_register ();
3103 extern int direct_return ();
3104 extern int get_issue_rate ();
3105 extern int any_operand ();
3106 extern int short_cint_operand ();
3107 extern int u_short_cint_operand ();
3108 extern int non_short_cint_operand ();
3109 extern int gpc_reg_operand ();
3110 extern int cc_reg_operand ();
3111 extern int reg_or_short_operand ();
3112 extern int reg_or_neg_short_operand ();
3113 extern int reg_or_u_short_operand ();
3114 extern int reg_or_cint_operand ();
3115 extern int got_operand ();
3116 extern int got_no_const_operand ();
3117 extern int num_insns_constant ();
3118 extern int easy_fp_constant ();
3119 extern int volatile_mem_operand ();
3120 extern int offsettable_addr_operand ();
3121 extern int mem_or_easy_const_operand ();
3122 extern int add_operand ();
3123 extern int non_add_cint_operand ();
3124 extern int non_logical_cint_operand ();
3125 extern int logical_operand ();
3126 extern int non_logical_operand ();
3127 extern int mask_constant ();
3128 extern int mask_operand ();
3129 extern int and_operand ();
3130 extern int count_register_operand ();
3131 extern int fpmem_operand ();
3132 extern int non_and_cint_operand ();
3133 extern int reg_or_mem_operand ();
3134 extern int lwa_operand ();
3135 extern int call_operand ();
3136 extern int current_file_function_operand ();
3137 extern int input_operand ();
3138 extern int small_data_operand ();
3139 extern void init_cumulative_args ();
3140 extern void function_arg_advance ();
3141 extern int function_arg_boundary ();
3142 extern struct rtx_def *function_arg ();
3143 extern int function_arg_partial_nregs ();
3144 extern int function_arg_pass_by_reference ();
3145 extern void setup_incoming_varargs ();
3146 extern struct rtx_def *expand_builtin_saveregs ();
3147 extern struct rtx_def *rs6000_stack_temp ();
3148 extern int expand_block_move ();
3149 extern int load_multiple_operation ();
3150 extern int store_multiple_operation ();
3151 extern int branch_comparison_operator ();
3152 extern int scc_comparison_operator ();
3153 extern int includes_lshift_p ();
3154 extern int includes_rshift_p ();
3155 extern int registers_ok_for_quad_peep ();
3156 extern int addrs_ok_for_quad_peep ();
3157 extern enum reg_class secondary_reload_class ();
3158 extern int ccr_bit ();
3159 extern void rs6000_finalize_pic ();
3160 extern void rs6000_reorg ();
3161 extern void rs6000_save_machine_status ();
3162 extern void rs6000_restore_machine_status ();
3163 extern void rs6000_init_expanders ();
3164 extern void print_operand ();
3165 extern void print_operand_address ();
3166 extern int first_reg_to_save ();
3167 extern int first_fp_reg_to_save ();
3168 extern int rs6000_makes_calls ();
3169 extern rs6000_stack_t *rs6000_stack_info ();
3170 extern void output_prolog ();
3171 extern void output_epilog ();
3172 extern void output_toc ();
3173 extern void output_ascii ();
3174 extern void rs6000_gen_section_name ();
3175 extern void output_function_profiler ();
3176 extern int rs6000_adjust_cost ();
3177 extern void rs6000_trampoline_template ();
3178 extern int rs6000_trampoline_size ();
3179 extern void rs6000_initialize_trampoline ();
3180 extern void rs6000_output_load_toc_table ();
3181 extern int rs6000_comp_type_attributes ();
3182 extern int rs6000_valid_decl_attribute_p ();
3183 extern int rs6000_valid_type_attribute_p ();
3184 extern void rs6000_set_default_type_attributes ();
3185 extern struct rtx_def *rs6000_dll_import_ref ();
3186 extern struct rtx_def *rs6000_longcall_ref ();
3187 extern int function_arg_padding ();
3188
3189 /* See nonlocal_goto_receiver for when this must be set. */
3190
3191 #define DONT_ACCESS_GBLS_AFTER_EPILOGUE (TARGET_TOC && TARGET_MINIMAL_TOC)