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