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