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