]> gcc.gnu.org Git - gcc.git/blame - gcc/config/rs6000/rs6000.h
Added arg to RETURN_POPS_ARGS.
[gcc.git] / gcc / config / rs6000 / rs6000.h
CommitLineData
f045b2c9 1/* Definitions of target machine for GNU compiler, for IBM RS/6000.
5119dc13 2 Copyright (C) 1992, 1993, 1994, 1995 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
19the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
20
21
22/* Note that some other tm.h files include this one and then override
23 many of the definitions that relate to assembler syntax. */
24
25
26/* Names to predefine in the preprocessor for this target machine. */
27
84b49fa7
RK
28#define CPP_PREDEFINES "-D_IBMR2 -D_POWER -D_AIX -D_AIX32 \
29-Asystem(unix) -Asystem(aix) -Acpu(rs6000) -Amachine(rs6000)"
f045b2c9
RS
30
31/* Print subsidiary information on the compiler version in use. */
32#define TARGET_VERSION ;
33
fdaff8ba
RS
34/* Tell the assembler to assume that all undefined names are external.
35
36 Don't do this until the fixed IBM assembler is more generally available.
37 When this becomes permanently defined, the ASM_OUTPUT_EXTERNAL,
38 ASM_OUTPUT_EXTERNAL_LIBCALL, and RS6000_OUTPUT_BASENAME macros will no
b4d6689b
RK
39 longer be needed. Also, the extern declaration of mcount in ASM_FILE_START
40 will no longer be needed. */
f045b2c9
RS
41
42/* #define ASM_SPEC "-u" */
43
84b49fa7
RK
44/* Define appropriate architecture macros for preprocessor depending on
45 target switches. */
46
47#define CPP_SPEC "\
50124474 48%{posix: -D_POSIX_SOURCE} \
84b49fa7
RK
49%{!mcpu*: \
50 %{mpower: %{!mpower2: -D_ARCH_PWR}} \
51 %{mpower2: -D_ARCH_PWR2} \
52 %{mpowerpc*: -D_ARCH_PPC} \
53 %{mno-power: %{!mpowerpc*: -D_ARCH_COM}} \
54 %{!mno-power: %{!mpower2: -D_ARCH_PWR}}} \
55%{mcpu=common: -D_ARCH_COM} \
56%{mcpu=power: -D_ARCH_PWR} \
57%{mcpu=powerpc: -D_ARCH_PPC} \
58%{mcpu=rios: -D_ARCH_PWR} \
59%{mcpu=rios1: -D_ARCH_PWR} \
60%{mcpu=rios2: -D_ARCH_PWR2} \
61%{mcpu=rsc: -D_ARCH_PWR} \
62%{mcpu=rsc1: -D_ARCH_PWR} \
63%{mcpu=601: -D_ARCH_PPC -D_ARCH_PWR} \
64%{mcpu=mpc601: -D_ARCH_PPC -D_ARCH_PWR} \
65%{mcpu=ppc601: -D_ARCH_PPC -D_ARCH_PWR} \
66%{mcpu=603: -D_ARCH_PPC} \
67%{mcpu=mpc603: -D_ARCH_PPC} \
68%{mcpu=ppc603: -D_ARCH_PPC} \
69%{mcpu=604: -D_ARCH_PPC} \
70%{mcpu=mpc604: -D_ARCH_PPC} \
71%{mcpu=ppc604: -D_ARCH_PPC}"
72
f045b2c9
RS
73/* Define the options for the binder: Start text at 512, align all segments
74 to 512 bytes, and warn if there is text relocation.
75
76 The -bhalt:4 option supposedly changes the level at which ld will abort,
77 but it also suppresses warnings about multiply defined symbols and is
78 used by the AIX cc command. So we use it here.
79
80 -bnodelcsect undoes a poor choice of default relating to multiply-defined
52c0eaf8
JM
81 csects. See AIX documentation for more information about this.
82
83 -bM:SRE tells the linker that the output file is Shared REusable. Note
84 that to actually build a shared library you will also need to specify an
85 export list with the -Wl,-bE option. */
f045b2c9 86
c1950f1c 87#define LINK_SPEC "-T512 -H512 %{!r:-btextro} -bhalt:4 -bnodelcsect\
52c0eaf8
JM
88 %{static:-bnso -bI:/lib/syscalls.exp} %{g*:-bexport:/usr/lib/libg.exp}\
89 %{shared:-bM:SRE}"
f045b2c9 90
58a39e45
RS
91/* Profiled library versions are used by linking with special directories. */
92#define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\
93 %{p:-L/lib/profiled -L/usr/lib/profiled} %{g*:-lg} -lc"
f045b2c9
RS
94
95/* gcc must do the search itself to find libgcc.a, not use -l. */
52c0eaf8 96#define LIBGCC_SPEC "%{!shared:libgcc.a%s}"
f045b2c9
RS
97
98/* Don't turn -B into -L if the argument specifies a relative file name. */
99#define RELATIVE_PREFIX_NOT_LINKDIR
100
9f21696b
JM
101/* The AIX linker will discard static constructors in object files before
102 collect has a chance to see them, so scan the object files directly. */
103#define COLLECT_SCAN_OBJECTS
104
fb623df5 105/* Architecture type. */
f045b2c9 106
fb623df5
RK
107extern int target_flags;
108
109/* Use POWER architecture instructions and MQ register. */
110#define MASK_POWER 0x01
111
6febd581
RK
112/* Use POWER2 extensions to POWER architecture. */
113#define MASK_POWER2 0x02
114
fb623df5 115/* Use PowerPC architecture instructions. */
6febd581
RK
116#define MASK_POWERPC 0x04
117
583cf4db
RK
118/* Use PowerPC General Purpose group optional instructions, e.g. fsqrt. */
119#define MASK_PPC_GPOPT 0x08
120
121/* Use PowerPC Graphics group optional instructions, e.g. fsel. */
122#define MASK_PPC_GFXOPT 0x10
f045b2c9 123
fb623df5 124/* Use PowerPC-64 architecture instructions. */
583cf4db 125#define MASK_POWERPC64 0x20
f045b2c9 126
fb623df5 127/* Use revised mnemonic names defined for PowerPC architecture. */
583cf4db 128#define MASK_NEW_MNEMONICS 0x40
fb623df5
RK
129
130/* Disable placing fp constants in the TOC; can be turned on when the
131 TOC overflows. */
583cf4db 132#define MASK_NO_FP_IN_TOC 0x80
fb623df5 133
0b9ccabc
RK
134/* Disable placing symbol+offset constants in the TOC; can be turned on when
135 the TOC overflows. */
583cf4db 136#define MASK_NO_SUM_IN_TOC 0x100
0b9ccabc 137
fb623df5 138/* Output only one TOC entry per module. Normally linking fails if
642a35f1
JW
139 there are more than 16K unique variables/constants in an executable. With
140 this option, linking fails only if there are more than 16K modules, or
141 if there are more than 16K unique variables/constant in a single module.
142
143 This is at the cost of having 2 extra loads and one extra store per
144 function, and one less allocatable register. */
583cf4db 145#define MASK_MINIMAL_TOC 0x200
642a35f1 146
9e654916
RK
147/* Nonzero for the 64bit model: ints, longs, and pointers are 64 bits. */
148#define MASK_64BIT 0x400
149
f85f4585
RK
150/* Disable use of FPRs. */
151#define MASK_NO_FPR 0x800
152
4d30c363
MM
153/* Enable load/store multiple, even on powerpc */
154#define MASK_MULTIPLE 0x1000
155
fb623df5 156#define TARGET_POWER (target_flags & MASK_POWER)
6febd581 157#define TARGET_POWER2 (target_flags & MASK_POWER2)
fb623df5 158#define TARGET_POWERPC (target_flags & MASK_POWERPC)
583cf4db
RK
159#define TARGET_PPC_GPOPT (target_flags & MASK_PPC_GPOPT)
160#define TARGET_PPC_GFXOPT (target_flags & MASK_PPC_GFXOPT)
fb623df5
RK
161#define TARGET_POWERPC64 (target_flags & MASK_POWERPC64)
162#define TARGET_NEW_MNEMONICS (target_flags & MASK_NEW_MNEMONICS)
163#define TARGET_NO_FP_IN_TOC (target_flags & MASK_NO_FP_IN_TOC)
0b9ccabc 164#define TARGET_NO_SUM_IN_TOC (target_flags & MASK_NO_SUM_IN_TOC)
fb623df5 165#define TARGET_MINIMAL_TOC (target_flags & MASK_MINIMAL_TOC)
9e654916 166#define TARGET_64BIT (target_flags & MASK_64BIT)
f85f4585 167#define TARGET_NO_FPR (target_flags & MASK_NO_FPR)
4d30c363 168#define TARGET_MULTIPLE (target_flags & MASK_MULTIPLE)
642a35f1 169
fb623df5 170/* Run-time compilation parameters selecting different hardware subsets.
f045b2c9 171
fb623df5 172 Macro to define tables used to set the flags.
f045b2c9
RS
173 This is a list in braces of pairs in braces,
174 each pair being { "NAME", VALUE }
175 where VALUE is the bits to set or minus the bits to clear.
176 An empty string NAME is used to identify the default VALUE. */
177
4d30c363
MM
178/* This is meant to be redefined in the host dependent files */
179#ifndef SUBTARGET_SWITCHES
180#define SUBTARGET_SWITCHES
181#endif
182
fb623df5
RK
183#define TARGET_SWITCHES \
184 {{"power", MASK_POWER}, \
6febd581
RK
185 {"power2", MASK_POWER | MASK_POWER2}, \
186 {"no-power2", - MASK_POWER2}, \
187 {"no-power", - (MASK_POWER | MASK_POWER2)}, \
fb623df5 188 {"powerpc", MASK_POWERPC}, \
583cf4db
RK
189 {"no-powerpc", - (MASK_POWERPC | MASK_PPC_GPOPT \
190 | MASK_PPC_GFXOPT | MASK_POWERPC64)}, \
191 {"powerpc-gpopt", MASK_POWERPC | MASK_PPC_GPOPT}, \
192 {"no-powerpc-gpopt", - MASK_PPC_GPOPT}, \
193 {"powerpc-gfxopt", MASK_POWERPC | MASK_PPC_GFXOPT}, \
194 {"no-powerpc-gfxopt", - MASK_PPC_GFXOPT}, \
fb623df5
RK
195 {"new-mnemonics", MASK_NEW_MNEMONICS}, \
196 {"old-mnemonics", -MASK_NEW_MNEMONICS}, \
0b9ccabc
RK
197 {"full-toc", - (MASK_NO_FP_IN_TOC | MASK_NO_SUM_IN_TOC \
198 | MASK_MINIMAL_TOC)}, \
fb623df5
RK
199 {"fp-in-toc", - MASK_NO_FP_IN_TOC}, \
200 {"no-fp-in-toc", MASK_NO_FP_IN_TOC}, \
0b9ccabc
RK
201 {"sum-in-toc", - MASK_NO_SUM_IN_TOC}, \
202 {"no-sum-in-toc", MASK_NO_SUM_IN_TOC}, \
fb623df5 203 {"minimal-toc", MASK_MINIMAL_TOC}, \
0b9ccabc 204 {"minimal-toc", - (MASK_NO_FP_IN_TOC | MASK_NO_SUM_IN_TOC)}, \
fb623df5 205 {"no-minimal-toc", - MASK_MINIMAL_TOC}, \
f85f4585
RK
206 {"fp-regs", - MASK_NO_FPR}, \
207 {"no-fp-regs", MASK_NO_FPR}, \
4d30c363
MM
208 {"multiple", MASK_MULTIPLE}, \
209 {"no-multiple", - MASK_MULTIPLE}, \
210 SUBTARGET_SWITCHES \
fb623df5
RK
211 {"", TARGET_DEFAULT}}
212
4d30c363 213#define TARGET_DEFAULT (MASK_POWER | MASK_MULTIPLE)
fb623df5
RK
214
215/* Processor type. */
216enum processor_type
f86fe1fb 217 {PROCESSOR_RIOS1,
fb623df5
RK
218 PROCESSOR_RIOS2,
219 PROCESSOR_PPC601,
220 PROCESSOR_PPC603,
221 PROCESSOR_PPC604,
222 PROCESSOR_PPC620};
223
224extern enum processor_type rs6000_cpu;
225
226/* Recast the processor type to the cpu attribute. */
227#define rs6000_cpu_attr ((enum attr_cpu)rs6000_cpu)
228
8482e358
RK
229/* Define generic processor types based upon current deployment. */
230#define PROCESSOR_COMMON PROCESSOR_PPC601
231#define PROCESSOR_POWER PROCESSOR_RIOS1
232#define PROCESSOR_POWERPC PROCESSOR_PPC601
6e151478 233
fb623df5 234/* Define the default processor. This is overridden by other tm.h files. */
f86fe1fb 235#define PROCESSOR_DEFAULT PROCESSOR_RIOS1
fb623df5 236
6febd581
RK
237/* Specify the dialect of assembler to use. New mnemonics is dialect one
238 and the old mnemonics are dialect zero. */
239#define ASSEMBLER_DIALECT TARGET_NEW_MNEMONICS ? 1 : 0
240
fb623df5
RK
241/* This macro is similar to `TARGET_SWITCHES' but defines names of
242 command options that have values. Its definition is an
243 initializer with a subgrouping for each command option.
244
245 Each subgrouping contains a string constant, that defines the
246 fixed part of the option name, and the address of a variable.
247 The variable, type `char *', is set to the variable part of the
248 given option if the fixed part matches. The actual option name
249 is made by appending `-m' to the specified name.
250
251 Here is an example which defines `-mshort-data-NUMBER'. If the
252 given option is `-mshort-data-512', the variable `m88k_short_data'
253 will be set to the string `"512"'.
254
255 extern char *m88k_short_data;
256 #define TARGET_OPTIONS { { "short-data-", &m88k_short_data } } */
257
258#define TARGET_OPTIONS \
259{ {"cpu=", &rs6000_cpu_string}}
260
261extern char *rs6000_cpu_string;
262
263/* Sometimes certain combinations of command options do not make sense
264 on a particular target machine. You can define a macro
265 `OVERRIDE_OPTIONS' to take account of this. This macro, if
266 defined, is executed once just after all the command options have
267 been parsed.
268
269 On the RS/6000 this is used to define the target cpu type. */
270
b6a2d236
DE
271#define OVERRIDE_OPTIONS \
272do { \
273 rs6000_override_options (); \
274 SUBTARGET_OVERRIDE_OPTIONS; \
275} while (0)
276
277/* For OS-dependent options */
278#ifndef SUBTARGET_OVERRIDE_OPTIONS
279#define SUBTARGET_OVERRIDE_OPTIONS
280#endif
f045b2c9 281
4f074454
RK
282/* Show we can debug even without a frame pointer. */
283#define CAN_DEBUG_WITHOUT_FP
f045b2c9
RS
284\f
285/* target machine storage layout */
286
df44fa77
RK
287/* Define to support cross compilation to an RS6000 target. */
288#define REAL_ARITHMETIC
289
13d39dbc 290/* Define this macro if it is advisable to hold scalars in registers
ef457bda
RK
291 in a wider mode than that declared by the program. In such cases,
292 the value is constrained to be within the bounds of the declared
293 type, but kept valid in the wider mode. The signedness of the
294 extension may differ from that of the type. */
295
296#define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
297 if (GET_MODE_CLASS (MODE) == MODE_INT \
298 && GET_MODE_SIZE (MODE) < 4) \
dac29d65 299 (MODE) = SImode;
ef457bda 300
f045b2c9
RS
301/* Define this if most significant bit is lowest numbered
302 in instructions that operate on numbered bit-fields. */
303/* That is true on RS/6000. */
304#define BITS_BIG_ENDIAN 1
305
306/* Define this if most significant byte of a word is the lowest numbered. */
307/* That is true on RS/6000. */
308#define BYTES_BIG_ENDIAN 1
309
310/* Define this if most significant word of a multiword number is lowest
311 numbered.
312
313 For RS/6000 we can decide arbitrarily since there are no machine
314 instructions for them. Might as well be consistent with bits and bytes. */
315#define WORDS_BIG_ENDIAN 1
316
fdaff8ba 317/* number of bits in an addressable storage unit */
f045b2c9
RS
318#define BITS_PER_UNIT 8
319
320/* Width in bits of a "word", which is the contents of a machine register.
321 Note that this is not necessarily the width of data type `int';
322 if using 16-bit ints on a 68000, this would still be 32.
323 But on a machine with 16-bit registers, this would be 16. */
2e360ab3
RK
324#define BITS_PER_WORD (TARGET_POWERPC64 ? 64 : 32)
325#define MAX_BITS_PER_WORD 64
f045b2c9
RS
326
327/* Width of a word, in units (bytes). */
2e360ab3 328#define UNITS_PER_WORD (TARGET_POWERPC64 ? 8 : 4)
ef0e53ce 329#define MIN_UNITS_PER_WORD 4
2e360ab3 330#define UNITS_PER_FP_WORD 8
f045b2c9 331
915f619f
JW
332/* Type used for ptrdiff_t, as a string used in a declaration. */
333#define PTRDIFF_TYPE "int"
334
f045b2c9
RS
335/* Type used for wchar_t, as a string used in a declaration. */
336#define WCHAR_TYPE "short unsigned int"
337
338/* Width of wchar_t in bits. */
339#define WCHAR_TYPE_SIZE 16
340
9e654916
RK
341/* A C expression for the size in bits of the type `short' on the
342 target machine. If you don't define this, the default is half a
343 word. (If this would be less than one storage unit, it is
344 rounded up to one unit.) */
345#define SHORT_TYPE_SIZE 16
346
347/* A C expression for the size in bits of the type `int' on the
348 target machine. If you don't define this, the default is one
349 word. */
350#define INT_TYPE_SIZE (TARGET_64BIT ? 64 : 32)
351#define MAX_INT_TYPE_SIZE 64
352
353/* A C expression for the size in bits of the type `long' on the
354 target machine. If you don't define this, the default is one
355 word. */
356#define LONG_TYPE_SIZE (TARGET_64BIT ? 64 : 32)
357#define MAX_LONG_TYPE_SIZE 64
358
359/* A C expression for the size in bits of the type `long long' on the
360 target machine. If you don't define this, the default is two
361 words. */
362#define LONG_LONG_TYPE_SIZE 64
363
364/* A C expression for the size in bits of the type `char' on the
365 target machine. If you don't define this, the default is one
366 quarter of a word. (If this would be less than one storage unit,
367 it is rounded up to one unit.) */
368#define CHAR_TYPE_SIZE BITS_PER_UNIT
369
370/* A C expression for the size in bits of the type `float' on the
371 target machine. If you don't define this, the default is one
372 word. */
373#define FLOAT_TYPE_SIZE 32
374
375/* A C expression for the size in bits of the type `double' on the
376 target machine. If you don't define this, the default is two
377 words. */
378#define DOUBLE_TYPE_SIZE 64
379
380/* A C expression for the size in bits of the type `long double' on
381 the target machine. If you don't define this, the default is two
382 words. */
383#define LONG_DOUBLE_TYPE_SIZE 64
384
f045b2c9
RS
385/* Width in bits of a pointer.
386 See also the macro `Pmode' defined below. */
9e654916 387#define POINTER_SIZE (TARGET_64BIT ? 64 : 32)
f045b2c9
RS
388
389/* Allocation boundary (in *bits*) for storing arguments in argument list. */
9e654916 390#define PARM_BOUNDARY (TARGET_64BIT ? 64 : 32)
f045b2c9
RS
391
392/* Boundary (in *bits*) on which stack pointer should be aligned. */
393#define STACK_BOUNDARY 64
394
395/* Allocation boundary (in *bits*) for the code of a function. */
396#define FUNCTION_BOUNDARY 32
397
398/* No data type wants to be aligned rounder than this. */
9e654916 399#define BIGGEST_ALIGNMENT (TARGET_64BIT ? 64 : 32)
f045b2c9
RS
400
401/* Alignment of field after `int : 0' in a structure. */
402#define EMPTY_FIELD_BOUNDARY 32
403
404/* Every structure's size must be a multiple of this. */
405#define STRUCTURE_SIZE_BOUNDARY 8
406
407/* A bitfield declared as `int' forces `int' alignment for the struct. */
408#define PCC_BITFIELD_TYPE_MATTERS 1
409
410/* Make strings word-aligned so strcpy from constants will be faster. */
411#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
412 (TREE_CODE (EXP) == STRING_CST \
413 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
414
415/* Make arrays of chars word-aligned for the same reasons. */
416#define DATA_ALIGNMENT(TYPE, ALIGN) \
417 (TREE_CODE (TYPE) == ARRAY_TYPE \
418 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
419 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
420
fdaff8ba 421/* Non-zero if move instructions will actually fail to work
f045b2c9 422 when given unaligned data. */
fdaff8ba 423#define STRICT_ALIGNMENT 0
f045b2c9
RS
424\f
425/* Standard register usage. */
426
427/* Number of actual hardware registers.
428 The hardware registers are assigned numbers for the compiler
429 from 0 to just below FIRST_PSEUDO_REGISTER.
430 All registers that the compiler knows about must be given numbers,
431 even those that are not normally considered general registers.
432
433 RS/6000 has 32 fixed-point registers, 32 floating-point registers,
434 an MQ register, a count register, a link register, and 8 condition
435 register fields, which we view here as separate registers.
436
437 In addition, the difference between the frame and argument pointers is
438 a function of the number of registers saved, so we need to have a
439 register for AP that will later be eliminated in favor of SP or FP.
440 This is a normal register, but it is fixed. */
441
442#define FIRST_PSEUDO_REGISTER 76
443
444/* 1 for registers that have pervasive standard uses
445 and are not available for the register allocator.
446
447 On RS/6000, r1 is used for the stack and r2 is used as the TOC pointer.
448
449 cr5 is not supposed to be used. */
450
451#define FIXED_REGISTERS \
452 {0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
453 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
454 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
455 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
456 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0}
457
458/* 1 for registers not available across function calls.
459 These must include the FIXED_REGISTERS and also any
460 registers that can be used without being saved.
461 The latter must include the registers where values are returned
462 and the register where structure-value addresses are passed.
463 Aside from that, you can include as many other registers as you like. */
464
465#define CALL_USED_REGISTERS \
466 {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, \
467 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
468 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, \
469 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
470 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1}
471
472/* List the order in which to allocate registers. Each register must be
473 listed once, even those in FIXED_REGISTERS.
474
475 We allocate in the following order:
476 fp0 (not saved or used for anything)
477 fp13 - fp2 (not saved; incoming fp arg registers)
478 fp1 (not saved; return value)
479 fp31 - fp14 (saved; order given to save least number)
480 cr1, cr6, cr7 (not saved or special)
481 cr0 (not saved, but used for arithmetic operations)
482 cr2, cr3, cr4 (saved)
483 r0 (not saved; cannot be base reg)
484 r9 (not saved; best for TImode)
485 r11, r10, r8-r4 (not saved; highest used first to make less conflict)
486 r3 (not saved; return value register)
487 r31 - r13 (saved; order given to save least number)
488 r12 (not saved; if used for DImode or DFmode would use r13)
489 mq (not saved; best to use it if we can)
490 ctr (not saved; when we have the choice ctr is better)
491 lr (saved)
492 cr5, r1, r2, ap (fixed) */
493
494#define REG_ALLOC_ORDER \
495 {32, \
496 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, \
497 33, \
498 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, \
499 50, 49, 48, 47, 46, \
500 69, 74, 75, 68, 70, 71, 72, \
501 0, \
502 9, 11, 10, 8, 7, 6, 5, 4, \
503 3, \
504 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, \
505 18, 17, 16, 15, 14, 13, 12, \
506 64, 66, 65, \
507 73, 1, 2, 67}
508
509/* True if register is floating-point. */
510#define FP_REGNO_P(N) ((N) >= 32 && (N) <= 63)
511
512/* True if register is a condition register. */
513#define CR_REGNO_P(N) ((N) >= 68 && (N) <= 75)
514
515/* True if register is an integer register. */
516#define INT_REGNO_P(N) ((N) <= 31 || (N) == 67)
517
518/* Return number of consecutive hard regs needed starting at reg REGNO
519 to hold something of mode MODE.
520 This is ordinarily the length in words of a value of mode MODE
521 but can be less for certain modes in special long registers.
522
523 On RS/6000, ordinary registers hold 32 bits worth;
524 a single floating point register holds 64 bits worth. */
525
526#define HARD_REGNO_NREGS(REGNO, MODE) \
527 (FP_REGNO_P (REGNO) \
2e360ab3 528 ? ((GET_MODE_SIZE (MODE) + UNITS_PER_FP_WORD - 1) / UNITS_PER_FP_WORD) \
f045b2c9
RS
529 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
530
531/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
bdfd4e31
RK
532 For POWER and PowerPC, the GPRs can hold any mode, but the float
533 registers only can hold floating modes and DImode, and CR register only
534 can hold CC modes. We cannot put TImode anywhere except general
535 register and it must be able to fit within the register set. */
f045b2c9
RS
536
537#define HARD_REGNO_MODE_OK(REGNO, MODE) \
bdfd4e31
RK
538 (FP_REGNO_P (REGNO) ? \
539 (GET_MODE_CLASS (MODE) == MODE_FLOAT \
540 || (GET_MODE_CLASS (MODE) == MODE_INT \
2e360ab3 541 && GET_MODE_SIZE (MODE) == UNITS_PER_FP_WORD)) \
f045b2c9 542 : CR_REGNO_P (REGNO) ? GET_MODE_CLASS (MODE) == MODE_CC \
bdfd4e31
RK
543 : ! INT_REGNO_P (REGNO) ? (GET_MODE_CLASS (MODE) == MODE_INT \
544 && GET_MODE_SIZE (MODE) <= UNITS_PER_WORD) \
f045b2c9
RS
545 : 1)
546
547/* Value is 1 if it is a good idea to tie two pseudo registers
548 when one has mode MODE1 and one has mode MODE2.
549 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
550 for any hard reg, then this must be 0 for correct output. */
551#define MODES_TIEABLE_P(MODE1, MODE2) \
552 (GET_MODE_CLASS (MODE1) == MODE_FLOAT \
553 ? GET_MODE_CLASS (MODE2) == MODE_FLOAT \
554 : GET_MODE_CLASS (MODE2) == MODE_FLOAT \
555 ? GET_MODE_CLASS (MODE1) == MODE_FLOAT \
556 : GET_MODE_CLASS (MODE1) == MODE_CC \
557 ? GET_MODE_CLASS (MODE2) == MODE_CC \
558 : GET_MODE_CLASS (MODE2) == MODE_CC \
559 ? GET_MODE_CLASS (MODE1) == MODE_CC \
560 : 1)
561
562/* A C expression returning the cost of moving data from a register of class
563 CLASS1 to one of CLASS2.
564
565 On the RS/6000, copying between floating-point and fixed-point
566 registers is expensive. */
567
568#define REGISTER_MOVE_COST(CLASS1, CLASS2) \
569 ((CLASS1) == FLOAT_REGS && (CLASS2) == FLOAT_REGS ? 2 \
570 : (CLASS1) == FLOAT_REGS && (CLASS2) != FLOAT_REGS ? 10 \
571 : (CLASS1) != FLOAT_REGS && (CLASS2) == FLOAT_REGS ? 10 \
a4b970a0 572 : (((CLASS1) == SPECIAL_REGS || (CLASS1) == MQ_REGS \
5119dc13
RK
573 || (CLASS1) == LINK_REGS || (CLASS1) == CTR_REGS \
574 || (CLASS1) == LINK_OR_CTR_REGS) \
a4b970a0 575 && ((CLASS2) == SPECIAL_REGS || (CLASS2) == MQ_REGS \
5119dc13
RK
576 || (CLASS2) == LINK_REGS || (CLASS2) == CTR_REGS \
577 || (CLASS2) == LINK_OR_CTR_REGS)) ? 10 \
f045b2c9
RS
578 : 2)
579
580/* A C expressions returning the cost of moving data of MODE from a register to
581 or from memory.
582
583 On the RS/6000, bump this up a bit. */
584
ab4a5fc9
RK
585#define MEMORY_MOVE_COST(MODE) \
586 ((GET_MODE_CLASS (MODE) == MODE_FLOAT \
587 && (rs6000_cpu == PROCESSOR_RIOS1 || rs6000_cpu == PROCESSOR_PPC601) \
588 ? 3 : 2) \
589 + 4)
f045b2c9
RS
590
591/* Specify the cost of a branch insn; roughly the number of extra insns that
592 should be added to avoid a branch.
593
ef457bda 594 Set this to 3 on the RS/6000 since that is roughly the average cost of an
f045b2c9
RS
595 unscheduled conditional branch. */
596
ef457bda 597#define BRANCH_COST 3
f045b2c9 598
5a5e4c2c
RK
599/* A C statement (sans semicolon) to update the integer variable COST
600 based on the relationship between INSN that is dependent on
601 DEP_INSN through the dependence LINK. The default is to make no
602 adjustment to COST. On the RS/6000, ignore the cost of anti- and
603 output-dependencies. In fact, output dependencies on the CR do have
604 a cost, but it is probably not worthwhile to track it. */
605
606#define ADJUST_COST(INSN,LINK,DEP_INSN,COST) \
b0634e74 607 (COST) = rs6000_adjust_cost (INSN,LINK,DEP_INSN,COST)
5a5e4c2c 608
6febd581
RK
609/* Define this macro to change register usage conditional on target flags.
610 Set MQ register fixed (already call_used) if not POWER architecture
f85f4585
RK
611 (RIOS1, RIOS2, RSC, and PPC601) so that it will not be allocated.
612 Conditionally disable FPRs. */
613
614#define CONDITIONAL_REGISTER_USAGE \
615{ \
616 if (! TARGET_POWER) \
617 fixed_regs[64] = 1; \
618 if (TARGET_NO_FPR) \
619 for (i = 32; i < 64; i++) \
620 fixed_regs[i] = call_used_regs[i] = 1; \
621}
6febd581 622
f045b2c9
RS
623/* Specify the registers used for certain standard purposes.
624 The values of these macros are register numbers. */
625
626/* RS/6000 pc isn't overloaded on a register that the compiler knows about. */
627/* #define PC_REGNUM */
628
629/* Register to use for pushing function arguments. */
630#define STACK_POINTER_REGNUM 1
631
632/* Base register for access to local variables of the function. */
633#define FRAME_POINTER_REGNUM 31
634
635/* Value should be nonzero if functions must have frame pointers.
636 Zero means the frame pointer need not be set up (and parms
637 may be accessed via the stack pointer) in functions that seem suitable.
638 This is computed in `reload', in reload1.c. */
639#define FRAME_POINTER_REQUIRED 0
640
641/* Base register for access to arguments of the function. */
642#define ARG_POINTER_REGNUM 67
643
644/* Place to put static chain when calling a function that requires it. */
645#define STATIC_CHAIN_REGNUM 11
646
647/* Place that structure value return address is placed.
648
649 On the RS/6000, it is passed as an extra parameter. */
650#define STRUCT_VALUE 0
651\f
652/* Define the classes of registers for register constraints in the
653 machine description. Also define ranges of constants.
654
655 One of the classes must always be named ALL_REGS and include all hard regs.
656 If there is more than one class, another class must be named NO_REGS
657 and contain no registers.
658
659 The name GENERAL_REGS must be the name of a class (or an alias for
660 another name such as ALL_REGS). This is the class of registers
661 that is allowed by "g" or "r" in a register constraint.
662 Also, registers outside this class are allocated only when
663 instructions express preferences for them.
664
665 The classes must be numbered in nondecreasing order; that is,
666 a larger-numbered class must never be contained completely
667 in a smaller-numbered class.
668
669 For any two classes, it is very desirable that there be another
670 class that represents their union. */
671
672/* The RS/6000 has three types of registers, fixed-point, floating-point,
673 and condition registers, plus three special registers, MQ, CTR, and the
674 link register.
675
676 However, r0 is special in that it cannot be used as a base register.
677 So make a class for registers valid as base registers.
678
679 Also, cr0 is the only condition code register that can be used in
680 arithmetic insns, so make a separate class for it. */
681
682enum reg_class { NO_REGS, BASE_REGS, GENERAL_REGS, FLOAT_REGS,
683 NON_SPECIAL_REGS, MQ_REGS, LINK_REGS, CTR_REGS, LINK_OR_CTR_REGS,
e8a8bc24
RK
684 SPECIAL_REGS, SPEC_OR_GEN_REGS, CR0_REGS, CR_REGS, NON_FLOAT_REGS,
685 ALL_REGS, LIM_REG_CLASSES };
f045b2c9
RS
686
687#define N_REG_CLASSES (int) LIM_REG_CLASSES
688
689/* Give names of register classes as strings for dump file. */
690
691#define REG_CLASS_NAMES \
692 { "NO_REGS", "BASE_REGS", "GENERAL_REGS", "FLOAT_REGS", \
693 "NON_SPECIAL_REGS", "MQ_REGS", "LINK_REGS", "CTR_REGS", \
e8a8bc24
RK
694 "LINK_OR_CTR_REGS", "SPECIAL_REGS", "SPEC_OR_GEN_REGS", \
695 "CR0_REGS", "CR_REGS", "NON_FLOAT_REGS", "ALL_REGS" }
f045b2c9
RS
696
697/* Define which registers fit in which classes.
698 This is an initializer for a vector of HARD_REG_SET
699 of length N_REG_CLASSES. */
700
701#define REG_CLASS_CONTENTS \
702 { {0, 0, 0}, {0xfffffffe, 0, 8}, {~0, 0, 8}, \
e8a8bc24
RK
703 {0, ~0, 0}, {~0, ~0, 8}, {0, 0, 1}, {0, 0, 2}, \
704 {0, 0, 4}, {0, 0, 6}, {0, 0, 7}, {~0, 0, 15}, \
705 {0, 0, 16}, {0, 0, 0xff0}, {~0, 0, 0xffff}, \
706 {~0, ~0, 0xffff} }
f045b2c9
RS
707
708/* The same information, inverted:
709 Return the class number of the smallest class containing
710 reg number REGNO. This could be a conditional expression
711 or could index an array. */
712
713#define REGNO_REG_CLASS(REGNO) \
714 ((REGNO) == 0 ? GENERAL_REGS \
715 : (REGNO) < 32 ? BASE_REGS \
716 : FP_REGNO_P (REGNO) ? FLOAT_REGS \
717 : (REGNO) == 68 ? CR0_REGS \
718 : CR_REGNO_P (REGNO) ? CR_REGS \
719 : (REGNO) == 64 ? MQ_REGS \
720 : (REGNO) == 65 ? LINK_REGS \
721 : (REGNO) == 66 ? CTR_REGS \
722 : (REGNO) == 67 ? BASE_REGS \
723 : NO_REGS)
724
725/* The class value for index registers, and the one for base regs. */
726#define INDEX_REG_CLASS GENERAL_REGS
727#define BASE_REG_CLASS BASE_REGS
728
729/* Get reg_class from a letter such as appears in the machine description. */
730
731#define REG_CLASS_FROM_LETTER(C) \
732 ((C) == 'f' ? FLOAT_REGS \
733 : (C) == 'b' ? BASE_REGS \
734 : (C) == 'h' ? SPECIAL_REGS \
735 : (C) == 'q' ? MQ_REGS \
736 : (C) == 'c' ? CTR_REGS \
737 : (C) == 'l' ? LINK_REGS \
738 : (C) == 'x' ? CR0_REGS \
739 : (C) == 'y' ? CR_REGS \
740 : NO_REGS)
741
742/* The letters I, J, K, L, M, N, and P in a register constraint string
743 can be used to stand for particular ranges of immediate operands.
744 This macro defines what the ranges are.
745 C is the letter, and VALUE is a constant value.
746 Return 1 if VALUE is in the range specified by C.
747
748 `I' is signed 16-bit constants
749 `J' is a constant with only the high-order 16 bits non-zero
750 `K' is a constant with only the low-order 16 bits non-zero
751 `L' is a constant that can be placed into a mask operand
752 `M' is a constant that is greater than 31
753 `N' is a constant that is an exact power of two
754 `O' is the constant zero
755 `P' is a constant whose negation is a signed 16-bit constant */
756
757#define CONST_OK_FOR_LETTER_P(VALUE, C) \
758 ( (C) == 'I' ? (unsigned) ((VALUE) + 0x8000) < 0x10000 \
759 : (C) == 'J' ? ((VALUE) & 0xffff) == 0 \
760 : (C) == 'K' ? ((VALUE) & 0xffff0000) == 0 \
761 : (C) == 'L' ? mask_constant (VALUE) \
762 : (C) == 'M' ? (VALUE) > 31 \
763 : (C) == 'N' ? exact_log2 (VALUE) >= 0 \
764 : (C) == 'O' ? (VALUE) == 0 \
765 : (C) == 'P' ? (unsigned) ((- (VALUE)) + 0x8000) < 0x1000 \
766 : 0)
767
768/* Similar, but for floating constants, and defining letters G and H.
769 Here VALUE is the CONST_DOUBLE rtx itself.
770
771 We flag for special constants when we can copy the constant into
772 a general register in two insns for DF and one insn for SF. */
773
774#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
775 ((C) == 'G' ? easy_fp_constant (VALUE, GET_MODE (VALUE)) : 0)
776
777/* Optional extra constraints for this machine.
778
779 For the RS/6000, `Q' means that this is a memory operand that is just
780 an offset from a register. */
781
e8a8bc24
RK
782#define EXTRA_CONSTRAINT(OP, C) \
783 ((C) == 'Q' ? GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == REG \
d537c24d 784 : (C) == 'R' ? LEGITIMATE_CONSTANT_POOL_ADDRESS_P (OP) \
e8a8bc24 785 : 0)
f045b2c9
RS
786
787/* Given an rtx X being reloaded into a reg required to be
788 in class CLASS, return the class of reg to actually use.
789 In general this is just CLASS; but on some machines
790 in some cases it is preferable to use a more restrictive class.
791
792 On the RS/6000, we have to return NO_REGS when we want to reload a
793 floating-point CONST_DOUBLE to force it to be copied to memory. */
794
795#define PREFERRED_RELOAD_CLASS(X,CLASS) \
796 ((GET_CODE (X) == CONST_DOUBLE \
797 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) \
798 ? NO_REGS : (CLASS))
799
800/* Return the register class of a scratch register needed to copy IN into
801 or out of a register in CLASS in MODE. If it can be done directly,
802 NO_REGS is returned. */
803
804#define SECONDARY_RELOAD_CLASS(CLASS,MODE,IN) \
805 secondary_reload_class (CLASS, MODE, IN)
806
7ea555a4
RK
807/* If we are copying between FP registers and anything else, we need a memory
808 location. */
809
810#define SECONDARY_MEMORY_NEEDED(CLASS1,CLASS2,MODE) \
811 ((CLASS1) != (CLASS2) && ((CLASS1) == FLOAT_REGS || (CLASS2) == FLOAT_REGS))
812
f045b2c9
RS
813/* Return the maximum number of consecutive registers
814 needed to represent mode MODE in a register of class CLASS.
815
816 On RS/6000, this is the size of MODE in words,
817 except in the FP regs, where a single reg is enough for two words. */
818#define CLASS_MAX_NREGS(CLASS, MODE) \
819 ((CLASS) == FLOAT_REGS \
2e360ab3 820 ? ((GET_MODE_SIZE (MODE) + UNITS_PER_FP_WORD - 1) / UNITS_PER_FP_WORD) \
f045b2c9 821 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
580d3230
RK
822
823/* If defined, gives a class of registers that cannot be used as the
824 operand of a SUBREG that changes the size of the object. */
825
826#define CLASS_CANNOT_CHANGE_SIZE FLOAT_REGS
f045b2c9
RS
827\f
828/* Stack layout; function entry, exit and calling. */
829
830/* Define this if pushing a word on the stack
831 makes the stack pointer a smaller address. */
832#define STACK_GROWS_DOWNWARD
833
834/* Define this if the nominal address of the stack frame
835 is at the high-address end of the local variables;
836 that is, each additional local variable allocated
837 goes at a more negative offset in the frame.
838
839 On the RS/6000, we grow upwards, from the area after the outgoing
840 arguments. */
841/* #define FRAME_GROWS_DOWNWARD */
842
843/* Offset within stack frame to start allocating local variables at.
844 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
845 first local allocated. Otherwise, it is the offset to the BEGINNING
846 of the first local allocated.
847
848 On the RS/6000, the frame pointer is the same as the stack pointer,
849 except for dynamic allocations. So we start after the fixed area and
850 outgoing parameter area. */
851
9e654916
RK
852#define STARTING_FRAME_OFFSET (current_function_outgoing_args_size \
853 + (TARGET_64BIT ? 48 : 24))
f045b2c9
RS
854
855/* If we generate an insn to push BYTES bytes,
856 this says how many the stack pointer really advances by.
857 On RS/6000, don't define this because there are no push insns. */
858/* #define PUSH_ROUNDING(BYTES) */
859
860/* Offset of first parameter from the argument pointer register value.
861 On the RS/6000, we define the argument pointer to the start of the fixed
862 area. */
9e654916 863#define FIRST_PARM_OFFSET(FNDECL) (TARGET_64BIT ? 48 : 24)
f045b2c9
RS
864
865/* Define this if stack space is still allocated for a parameter passed
866 in a register. The value is the number of bytes allocated to this
867 area. */
9e654916 868#define REG_PARM_STACK_SPACE(FNDECL) (TARGET_64BIT ? 64 : 32)
f045b2c9
RS
869
870/* Define this if the above stack space is to be considered part of the
871 space allocated by the caller. */
872#define OUTGOING_REG_PARM_STACK_SPACE
873
874/* This is the difference between the logical top of stack and the actual sp.
875
876 For the RS/6000, sp points past the fixed area. */
9e654916 877#define STACK_POINTER_OFFSET (TARGET_64BIT ? 48 : 24)
f045b2c9
RS
878
879/* Define this if the maximum size of all the outgoing args is to be
880 accumulated and pushed during the prologue. The amount can be
881 found in the variable current_function_outgoing_args_size. */
882#define ACCUMULATE_OUTGOING_ARGS
883
884/* Value is the number of bytes of arguments automatically
885 popped when returning from a subroutine call.
8b109b37 886 FUNDECL is the declaration node of the function (as a tree),
f045b2c9
RS
887 FUNTYPE is the data type of the function (as a tree),
888 or for a library call it is an identifier node for the subroutine name.
889 SIZE is the number of bytes of arguments passed on the stack. */
890
8b109b37 891#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
f045b2c9
RS
892
893/* Define how to find the value returned by a function.
894 VALTYPE is the data type of the value (as a tree).
895 If the precise function being called is known, FUNC is its FUNCTION_DECL;
896 otherwise, FUNC is 0.
897
898 On RS/6000 an integer value is in r3 and a floating-point value is in
899 fp1. */
900
901#define FUNCTION_VALUE(VALTYPE, FUNC) \
902 gen_rtx (REG, TYPE_MODE (VALTYPE), \
903 TREE_CODE (VALTYPE) == REAL_TYPE ? 33 : 3)
904
905/* Define how to find the value returned by a library function
906 assuming the value has mode MODE. */
907
908#define LIBCALL_VALUE(MODE) \
909 gen_rtx (REG, MODE, GET_MODE_CLASS (MODE) == MODE_FLOAT ? 33 : 3)
910
911/* The definition of this macro implies that there are cases where
912 a scalar value cannot be returned in registers.
913
914 For the RS/6000, any structure or union type is returned in memory. */
915
916#define RETURN_IN_MEMORY(TYPE) \
e419152d 917 (TYPE_MODE (TYPE) == BLKmode)
f045b2c9
RS
918
919/* 1 if N is a possible register number for a function value
920 as seen by the caller.
921
922 On RS/6000, this is r3 and fp1. */
923
924#define FUNCTION_VALUE_REGNO_P(N) ((N) == 3 || ((N) == 33))
925
926/* 1 if N is a possible register number for function argument passing.
927 On RS/6000, these are r3-r10 and fp1-fp13. */
928
929#define FUNCTION_ARG_REGNO_P(N) \
930 (((N) <= 10 && (N) >= 3) || ((N) >= 33 && (N) <= 45))
931\f
932/* Define a data type for recording info about an argument list
933 during the scan of that argument list. This data type should
934 hold all necessary information about the function itself
935 and about the args processed so far, enough to enable macros
936 such as FUNCTION_ARG to determine where the next arg should go.
937
938 On the RS/6000, this is a structure. The first element is the number of
939 total argument words, the second is used to store the next
940 floating-point register number, and the third says how many more args we
941 have prototype types for. */
942
943struct rs6000_args {int words, fregno, nargs_prototype; };
944#define CUMULATIVE_ARGS struct rs6000_args
945
946/* Define intermediate macro to compute the size (in registers) of an argument
947 for the RS/6000. */
948
949#define RS6000_ARG_SIZE(MODE, TYPE, NAMED) \
950(! (NAMED) ? 0 \
951 : (MODE) != BLKmode \
952 ? (GET_MODE_SIZE (MODE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD \
953 : (int_size_in_bytes (TYPE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
954
955/* Initialize a variable CUM of type CUMULATIVE_ARGS
956 for a call to a function whose data type is FNTYPE.
957 For a library call, FNTYPE is 0. */
958
959#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME) \
960 (CUM).words = 0, \
961 (CUM).fregno = 33, \
962 (CUM).nargs_prototype = (FNTYPE && TYPE_ARG_TYPES (FNTYPE) \
963 ? (list_length (TYPE_ARG_TYPES (FNTYPE)) - 1 \
964 + (TYPE_MODE (TREE_TYPE (FNTYPE)) == BLKmode \
965 || RETURN_IN_MEMORY (TREE_TYPE (FNTYPE)))) \
966 : 0)
967
968/* Similar, but when scanning the definition of a procedure. We always
969 set NARGS_PROTOTYPE large so we never return an EXPR_LIST. */
970
971#define INIT_CUMULATIVE_INCOMING_ARGS(CUM,FNTYPE,IGNORE) \
972 (CUM).words = 0, \
973 (CUM).fregno = 33, \
974 (CUM).nargs_prototype = 1000
975
976/* Update the data in CUM to advance over an argument
977 of mode MODE and data type TYPE.
978 (TYPE is null for libcalls where that information may not be available.) */
979
980#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
981{ (CUM).nargs_prototype--; \
982 if (NAMED) \
983 { \
984 (CUM).words += RS6000_ARG_SIZE (MODE, TYPE, NAMED); \
985 if (GET_MODE_CLASS (MODE) == MODE_FLOAT) \
986 (CUM).fregno++; \
987 } \
988}
989
990/* Non-zero if we can use a floating-point register to pass this arg. */
991#define USE_FP_FOR_ARG_P(CUM,MODE,TYPE) \
992 (GET_MODE_CLASS (MODE) == MODE_FLOAT && (CUM).fregno < 46)
993
994/* Determine where to put an argument to a function.
995 Value is zero to push the argument on the stack,
996 or a hard register in which to store the argument.
997
998 MODE is the argument's machine mode.
999 TYPE is the data type of the argument (as a tree).
1000 This is null for libcalls where that information may
1001 not be available.
1002 CUM is a variable of type CUMULATIVE_ARGS which gives info about
1003 the preceding args and about the function being called.
1004 NAMED is nonzero if this argument is a named parameter
1005 (otherwise it is an extra parameter matching an ellipsis).
1006
1007 On RS/6000 the first eight words of non-FP are normally in registers
1008 and the rest are pushed. The first 13 FP args are in registers.
1009
1010 If this is floating-point and no prototype is specified, we use
4d6697ca
RK
1011 both an FP and integer register (or possibly FP reg and stack). Library
1012 functions (when TYPE is zero) always have the proper types for args,
1013 so we can pass the FP value just in one register. emit_library_function
1014 doesn't support EXPR_LIST anyway. */
f045b2c9
RS
1015
1016#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
1017 (! (NAMED) ? 0 \
38bd31fc 1018 : ((TYPE) != 0 && TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST) ? 0 \
d072107f 1019 : USE_FP_FOR_ARG_P (CUM, MODE, TYPE) \
4d6697ca 1020 ? ((CUM).nargs_prototype > 0 || (TYPE) == 0 \
f045b2c9
RS
1021 ? gen_rtx (REG, MODE, (CUM).fregno) \
1022 : ((CUM).words < 8 \
1023 ? gen_rtx (EXPR_LIST, VOIDmode, \
1024 gen_rtx (REG, (MODE), 3 + (CUM).words), \
1025 gen_rtx (REG, (MODE), (CUM).fregno)) \
1026 : gen_rtx (EXPR_LIST, VOIDmode, 0, \
1027 gen_rtx (REG, (MODE), (CUM).fregno)))) \
1028 : (CUM).words < 8 ? gen_rtx(REG, (MODE), 3 + (CUM).words) : 0)
1029
1030/* For an arg passed partly in registers and partly in memory,
1031 this is the number of registers used.
1032 For args passed entirely in registers or entirely in memory, zero. */
1033
1034#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
1035 (! (NAMED) ? 0 \
1036 : USE_FP_FOR_ARG_P (CUM, MODE, TYPE) && (CUM).nargs_prototype >= 0 ? 0 \
1037 : (((CUM).words < 8 \
1038 && 8 < ((CUM).words + RS6000_ARG_SIZE (MODE, TYPE, NAMED))) \
1039 ? 8 - (CUM).words : 0))
1040
1041/* Perform any needed actions needed for a function that is receiving a
1042 variable number of arguments.
1043
1044 CUM is as above.
1045
1046 MODE and TYPE are the mode and type of the current parameter.
1047
1048 PRETEND_SIZE is a variable that should be set to the amount of stack
1049 that must be pushed by the prolog to pretend that our caller pushed
1050 it.
1051
1052 Normally, this macro will push all remaining incoming registers on the
1053 stack and set PRETEND_SIZE to the length of the registers pushed. */
1054
1055#define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
1056{ if ((CUM).words < 8) \
1057 { \
1058 int first_reg_offset = (CUM).words; \
1059 \
1060 if (MUST_PASS_IN_STACK (MODE, TYPE)) \
1061 first_reg_offset += RS6000_ARG_SIZE (TYPE_MODE (TYPE), TYPE, 1); \
1062 \
1063 if (first_reg_offset > 8) \
1064 first_reg_offset = 8; \
1065 \
1066 if (! (NO_RTL) && first_reg_offset != 8) \
1067 move_block_from_reg \
1068 (3 + first_reg_offset, \
1069 gen_rtx (MEM, BLKmode, \
1070 plus_constant (virtual_incoming_args_rtx, \
1071 first_reg_offset * 4)), \
02892e06 1072 8 - first_reg_offset, (8 - first_reg_offset) * UNITS_PER_WORD); \
f045b2c9
RS
1073 PRETEND_SIZE = (8 - first_reg_offset) * UNITS_PER_WORD; \
1074 } \
1075}
1076
1077/* This macro generates the assembly code for function entry.
1078 FILE is a stdio stream to output the code to.
1079 SIZE is an int: how many units of temporary storage to allocate.
1080 Refer to the array `regs_ever_live' to determine which registers
1081 to save; `regs_ever_live[I]' is nonzero if register number I
1082 is ever used in the function. This macro is responsible for
1083 knowing which registers should not be saved even if used. */
1084
1085#define FUNCTION_PROLOGUE(FILE, SIZE) output_prolog (FILE, SIZE)
1086
1087/* Output assembler code to FILE to increment profiler label # LABELNO
58a39e45 1088 for profiling a function entry. */
f045b2c9
RS
1089
1090#define FUNCTION_PROFILER(FILE, LABELNO) \
58a39e45 1091 output_function_profiler ((FILE), (LABELNO));
f045b2c9
RS
1092
1093/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
1094 the stack pointer does not matter. No definition is equivalent to
1095 always zero.
1096
1097 On the RS/6000, this is non-zero because we can restore the stack from
1098 its backpointer, which we maintain. */
1099#define EXIT_IGNORE_STACK 1
1100
1101/* This macro generates the assembly code for function exit,
1102 on machines that need it. If FUNCTION_EPILOGUE is not defined
1103 then individual return instructions are generated for each
1104 return statement. Args are same as for FUNCTION_PROLOGUE.
1105
1106 The function epilogue should not depend on the current stack pointer!
1107 It should use the frame pointer only. This is mandatory because
1108 of alloca; we also take advantage of it to omit stack adjustments
1109 before returning. */
1110
1111#define FUNCTION_EPILOGUE(FILE, SIZE) output_epilog (FILE, SIZE)
1112\f
1113/* Output assembler code for a block containing the constant parts
1114 of a trampoline, leaving space for the variable parts.
1115
1116 The trampoline should set the static chain pointer to value placed
1117 into the trampoline and should branch to the specified routine.
1118
1119 On the RS/6000, this is not code at all, but merely a data area,
1120 since that is the way all functions are called. The first word is
1121 the address of the function, the second word is the TOC pointer (r2),
1122 and the third word is the static chain value. */
1123
1124#define TRAMPOLINE_TEMPLATE(FILE) { fprintf (FILE, "\t.long 0, 0, 0\n"); }
1125
1126/* Length in units of the trampoline for entering a nested function. */
1127
1128#define TRAMPOLINE_SIZE 12
1129
1130/* Emit RTL insns to initialize the variable parts of a trampoline.
1131 FNADDR is an RTX for the address of the function's pure code.
1132 CXT is an RTX for the static chain value for the function. */
1133
1134#define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, CXT) \
1135{ \
f045b2c9 1136 emit_move_insn (gen_rtx (MEM, SImode, \
858b728c
RK
1137 memory_address (SImode, (ADDR))), \
1138 gen_rtx (MEM, SImode, \
1139 memory_address (SImode, (FNADDR)))); \
f045b2c9 1140 emit_move_insn (gen_rtx (MEM, SImode, \
858b728c
RK
1141 memory_address (SImode, \
1142 plus_constant ((ADDR), 4))), \
1143 gen_rtx (MEM, SImode, \
1144 memory_address (SImode, \
1145 plus_constant ((FNADDR), 4)))); \
1146 emit_move_insn (gen_rtx (MEM, SImode, \
1147 memory_address (SImode, \
1148 plus_constant ((ADDR), 8))), \
1149 force_reg (SImode, (CXT))); \
f045b2c9
RS
1150}
1151\f
1152/* Definitions for register eliminations.
1153
1154 We have two registers that can be eliminated on the RS/6000. First, the
1155 frame pointer register can often be eliminated in favor of the stack
1156 pointer register. Secondly, the argument pointer register can always be
642a35f1
JW
1157 eliminated; it is replaced with either the stack or frame pointer.
1158
1159 In addition, we use the elimination mechanism to see if r30 is needed
1160 Initially we assume that it isn't. If it is, we spill it. This is done
1161 by making it an eliminable register. We replace it with itself so that
1162 if it isn't needed, then existing uses won't be modified. */
f045b2c9
RS
1163
1164/* This is an array of structures. Each structure initializes one pair
1165 of eliminable registers. The "from" register number is given first,
1166 followed by "to". Eliminations of the same "from" register are listed
1167 in order of preference. */
1168#define ELIMINABLE_REGS \
1169{{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
1170 { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
642a35f1
JW
1171 { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
1172 { 30, 30} }
f045b2c9
RS
1173
1174/* Given FROM and TO register numbers, say whether this elimination is allowed.
1175 Frame pointer elimination is automatically handled.
1176
1177 For the RS/6000, if frame pointer elimination is being done, we would like
642a35f1
JW
1178 to convert ap into fp, not sp.
1179
1180 We need r30 if -mmininal-toc was specified, and there are constant pool
1181 references. */
f045b2c9
RS
1182
1183#define CAN_ELIMINATE(FROM, TO) \
1184 ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \
1185 ? ! frame_pointer_needed \
642a35f1 1186 : (FROM) == 30 ? ! TARGET_MINIMAL_TOC || get_pool_size () == 0 \
f045b2c9
RS
1187 : 1)
1188
1189/* Define the offset between two registers, one to be eliminated, and the other
1190 its replacement, at the start of a routine. */
1191#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
1192{ \
1193 int total_stack_size = (rs6000_sa_size () + get_frame_size () \
1194 + current_function_outgoing_args_size); \
1195 \
1196 total_stack_size = (total_stack_size + 7) & ~7; \
1197 \
1198 if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
1199 { \
1200 if (rs6000_pushes_stack ()) \
1201 (OFFSET) = 0; \
1202 else \
1203 (OFFSET) = - total_stack_size; \
1204 } \
1205 else if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \
1206 (OFFSET) = total_stack_size; \
1207 else if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
1208 { \
1209 if (rs6000_pushes_stack ()) \
1210 (OFFSET) = total_stack_size; \
1211 else \
1212 (OFFSET) = 0; \
1213 } \
642a35f1
JW
1214 else if ((FROM) == 30) \
1215 (OFFSET) = 0; \
f045b2c9
RS
1216 else \
1217 abort (); \
1218}
1219\f
1220/* Addressing modes, and classification of registers for them. */
1221
1222/* #define HAVE_POST_INCREMENT */
1223/* #define HAVE_POST_DECREMENT */
1224
1225#define HAVE_PRE_DECREMENT
1226#define HAVE_PRE_INCREMENT
1227
1228/* Macros to check register numbers against specific register classes. */
1229
1230/* These assume that REGNO is a hard or pseudo reg number.
1231 They give nonzero only if REGNO is a hard reg of the suitable class
1232 or a pseudo reg currently allocated to a suitable hard reg.
1233 Since they use reg_renumber, they are safe only once reg_renumber
1234 has been allocated, which happens in local-alloc.c. */
1235
1236#define REGNO_OK_FOR_INDEX_P(REGNO) \
1237((REGNO) < FIRST_PSEUDO_REGISTER \
1238 ? (REGNO) <= 31 || (REGNO) == 67 \
1239 : (reg_renumber[REGNO] >= 0 \
1240 && (reg_renumber[REGNO] <= 31 || reg_renumber[REGNO] == 67)))
1241
1242#define REGNO_OK_FOR_BASE_P(REGNO) \
1243((REGNO) < FIRST_PSEUDO_REGISTER \
1244 ? ((REGNO) > 0 && (REGNO) <= 31) || (REGNO) == 67 \
1245 : (reg_renumber[REGNO] > 0 \
1246 && (reg_renumber[REGNO] <= 31 || reg_renumber[REGNO] == 67)))
1247\f
1248/* Maximum number of registers that can appear in a valid memory address. */
1249
1250#define MAX_REGS_PER_ADDRESS 2
1251
1252/* Recognize any constant value that is a valid address. */
1253
6eff269e
BK
1254#define CONSTANT_ADDRESS_P(X) \
1255 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
1256 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
1257 || GET_CODE (X) == HIGH)
f045b2c9
RS
1258
1259/* Nonzero if the constant value X is a legitimate general operand.
1260 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.
1261
1262 On the RS/6000, all integer constants are acceptable, most won't be valid
1263 for particular insns, though. Only easy FP constants are
1264 acceptable. */
1265
1266#define LEGITIMATE_CONSTANT_P(X) \
1267 (GET_CODE (X) != CONST_DOUBLE || GET_MODE (X) == VOIDmode \
1268 || easy_fp_constant (X, GET_MODE (X)))
1269
1270/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1271 and check its validity for a certain class.
1272 We have two alternate definitions for each of them.
1273 The usual definition accepts all pseudo regs; the other rejects
1274 them unless they have been allocated suitable hard regs.
1275 The symbol REG_OK_STRICT causes the latter definition to be used.
1276
1277 Most source files want to accept pseudo regs in the hope that
1278 they will get allocated to the class that the insn wants them to be in.
1279 Source files for reload pass need to be strict.
1280 After reload, it makes no difference, since pseudo regs have
1281 been eliminated by then. */
1282
1283#ifndef REG_OK_STRICT
1284
1285/* Nonzero if X is a hard reg that can be used as an index
1286 or if it is a pseudo reg. */
1287#define REG_OK_FOR_INDEX_P(X) \
1288 (REGNO (X) <= 31 || REGNO (X) == 67 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
1289
1290/* Nonzero if X is a hard reg that can be used as a base reg
1291 or if it is a pseudo reg. */
1292#define REG_OK_FOR_BASE_P(X) \
1293 (REGNO (X) > 0 && REG_OK_FOR_INDEX_P (X))
1294
1295#else
1296
1297/* Nonzero if X is a hard reg that can be used as an index. */
1298#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
1299/* Nonzero if X is a hard reg that can be used as a base reg. */
1300#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1301
1302#endif
1303\f
1304/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1305 that is a valid memory address for an instruction.
1306 The MODE argument is the machine mode for the MEM expression
1307 that wants to use this address.
1308
1309 On the RS/6000, there are four valid address: a SYMBOL_REF that
1310 refers to a constant pool entry of an address (or the sum of it
1311 plus a constant), a short (16-bit signed) constant plus a register,
1312 the sum of two registers, or a register indirect, possibly with an
1313 auto-increment. For DFmode and DImode with an constant plus register,
1314 we must ensure that both words are addressable. */
1315
1316#define LEGITIMATE_CONSTANT_POOL_BASE_P(X) \
1317 (GET_CODE (X) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (X) \
1318 && ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (get_pool_constant (X)))
1319
1320#define LEGITIMATE_CONSTANT_POOL_ADDRESS_P(X) \
1321 (LEGITIMATE_CONSTANT_POOL_BASE_P (X) \
1322 || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
1323 && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT \
1324 && LEGITIMATE_CONSTANT_POOL_BASE_P (XEXP (XEXP (X, 0), 0))))
1325
1326#define LEGITIMATE_ADDRESS_INTEGER_P(X,OFFSET) \
1327 (GET_CODE (X) == CONST_INT \
1328 && (unsigned) (INTVAL (X) + (OFFSET) + 0x8000) < 0x10000)
1329
1330#define LEGITIMATE_OFFSET_ADDRESS_P(MODE,X) \
1331 (GET_CODE (X) == PLUS \
1332 && GET_CODE (XEXP (X, 0)) == REG \
1333 && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
1334 && LEGITIMATE_ADDRESS_INTEGER_P (XEXP (X, 1), 0) \
1335 && (((MODE) != DFmode && (MODE) != DImode) \
1336 || LEGITIMATE_ADDRESS_INTEGER_P (XEXP (X, 1), 4)))
1337
1338#define LEGITIMATE_INDEXED_ADDRESS_P(X) \
1339 (GET_CODE (X) == PLUS \
1340 && GET_CODE (XEXP (X, 0)) == REG \
1341 && GET_CODE (XEXP (X, 1)) == REG \
1342 && ((REG_OK_FOR_BASE_P (XEXP (X, 0)) \
1343 && REG_OK_FOR_INDEX_P (XEXP (X, 1))) \
1344 || (REG_OK_FOR_BASE_P (XEXP (X, 1)) \
1345 && REG_OK_FOR_INDEX_P (XEXP (X, 0)))))
1346
1347#define LEGITIMATE_INDIRECT_ADDRESS_P(X) \
1348 (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))
1349
1350#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1351{ if (LEGITIMATE_INDIRECT_ADDRESS_P (X)) \
1352 goto ADDR; \
1353 if (GET_CODE (X) == PRE_INC \
1354 && LEGITIMATE_INDIRECT_ADDRESS_P (XEXP (X, 0))) \
1355 goto ADDR; \
1356 if (GET_CODE (X) == PRE_DEC \
1357 && LEGITIMATE_INDIRECT_ADDRESS_P (XEXP (X, 0))) \
1358 goto ADDR; \
1359 if (LEGITIMATE_CONSTANT_POOL_ADDRESS_P (X)) \
1360 goto ADDR; \
1361 if (LEGITIMATE_OFFSET_ADDRESS_P (MODE, X)) \
1362 goto ADDR; \
1363 if ((MODE) != DImode && (MODE) != TImode \
1364 && LEGITIMATE_INDEXED_ADDRESS_P (X)) \
1365 goto ADDR; \
1366}
1367\f
1368/* Try machine-dependent ways of modifying an illegitimate address
1369 to be legitimate. If we find one, return the new, valid address.
1370 This macro is used in only one place: `memory_address' in explow.c.
1371
1372 OLDX is the address as it was before break_out_memory_refs was called.
1373 In some cases it is useful to look at this to decide what needs to be done.
1374
1375 MODE and WIN are passed so that this macro can use
1376 GO_IF_LEGITIMATE_ADDRESS.
1377
1378 It is always safe for this macro to do nothing. It exists to recognize
1379 opportunities to optimize the output.
1380
1381 On RS/6000, first check for the sum of a register with a constant
1382 integer that is out of range. If so, generate code to add the
1383 constant with the low-order 16 bits masked to the register and force
1384 this result into another register (this can be done with `cau').
1385 Then generate an address of REG+(CONST&0xffff), allowing for the
1386 possibility of bit 16 being a one.
1387
1388 Then check for the sum of a register and something not constant, try to
1389 load the other things into a register and return the sum. */
1390
1391#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
1392{ if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == REG \
1393 && GET_CODE (XEXP (X, 1)) == CONST_INT \
1394 && (unsigned) (INTVAL (XEXP (X, 1)) + 0x8000) >= 0x10000) \
1395 { int high_int, low_int; \
1396 high_int = INTVAL (XEXP (X, 1)) >> 16; \
1397 low_int = INTVAL (XEXP (X, 1)) & 0xffff; \
1398 if (low_int & 0x8000) \
1399 high_int += 1, low_int |= 0xffff0000; \
1400 (X) = gen_rtx (PLUS, SImode, \
1401 force_operand \
1402 (gen_rtx (PLUS, SImode, XEXP (X, 0), \
1403 gen_rtx (CONST_INT, VOIDmode, \
1404 high_int << 16)), 0),\
1405 gen_rtx (CONST_INT, VOIDmode, low_int)); \
f357808b 1406 goto WIN; \
f045b2c9
RS
1407 } \
1408 else if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == REG \
27a2a2f1
RK
1409 && GET_CODE (XEXP (X, 1)) != CONST_INT \
1410 && (MODE) != DImode && (MODE) != TImode) \
f357808b
RK
1411 { \
1412 (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
1413 force_reg (SImode, force_operand (XEXP (X, 1), 0))); \
1414 goto WIN; \
1415 } \
f045b2c9
RS
1416}
1417
1418/* Go to LABEL if ADDR (a legitimate address expression)
1419 has an effect that depends on the machine mode it is used for.
1420
1421 On the RS/6000 this is true if the address is valid with a zero offset
1422 but not with an offset of four (this means it cannot be used as an
1423 address for DImode or DFmode) or is a pre-increment or decrement. Since
1424 we know it is valid, we just check for an address that is not valid with
1425 an offset of four. */
1426
1427#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1428{ if (GET_CODE (ADDR) == PLUS \
1429 && LEGITIMATE_ADDRESS_INTEGER_P (XEXP (ADDR, 1), 0) \
1430 && ! LEGITIMATE_ADDRESS_INTEGER_P (XEXP (ADDR, 1), 4)) \
1431 goto LABEL; \
1432 if (GET_CODE (ADDR) == PRE_INC) \
1433 goto LABEL; \
1434 if (GET_CODE (ADDR) == PRE_DEC) \
1435 goto LABEL; \
1436}
1437\f
1438/* Define this if some processing needs to be done immediately before
4255474b 1439 emitting code for an insn. */
f045b2c9 1440
4255474b 1441/* #define FINAL_PRESCAN_INSN(INSN,OPERANDS,NOPERANDS) */
f045b2c9
RS
1442
1443/* Specify the machine mode that this machine uses
1444 for the index in the tablejump instruction. */
1445#define CASE_VECTOR_MODE SImode
1446
1447/* Define this if the tablejump instruction expects the table
1448 to contain offsets from the address of the table.
1449 Do not define this if the table should contain absolute addresses. */
1450#define CASE_VECTOR_PC_RELATIVE
1451
1452/* Specify the tree operation to be used to convert reals to integers. */
1453#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1454
1455/* This is the kind of divide that is easiest to do in the general case. */
1456#define EASY_DIV_EXPR TRUNC_DIV_EXPR
1457
1458/* Define this as 1 if `char' should by default be signed; else as 0. */
1459#define DEFAULT_SIGNED_CHAR 0
1460
1461/* This flag, if defined, says the same insns that convert to a signed fixnum
1462 also convert validly to an unsigned one. */
1463
1464/* #define FIXUNS_TRUNC_LIKE_FIX_TRUNC */
1465
1466/* Max number of bytes we can move from memory to memory
1467 in one reasonably fast instruction. */
2e360ab3
RK
1468#define MOVE_MAX (TARGET_POWER ? 16 : (TARGET_POWERPC64 ? 8 : 4))
1469#define MAX_MOVE_MAX 16
f045b2c9
RS
1470
1471/* Nonzero if access to memory by bytes is no faster than for words.
1472 Also non-zero if doing byte operations (specifically shifts) in registers
1473 is undesirable. */
1474#define SLOW_BYTE_ACCESS 1
1475
9a63901f
RK
1476/* Define if operations between registers always perform the operation
1477 on the full register even if a narrower mode is specified. */
1478#define WORD_REGISTER_OPERATIONS
1479
1480/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
1481 will either zero-extend or sign-extend. The value of this macro should
1482 be the code that says which one of the two operations is implicitly
1483 done, NIL if none. */
1484#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
225211e2
RK
1485
1486/* Define if loading short immediate values into registers sign extends. */
1487#define SHORT_IMMEDIATES_SIGN_EXTEND
fdaff8ba
RS
1488\f
1489/* The RS/6000 uses the XCOFF format. */
f045b2c9 1490
fdaff8ba 1491#define XCOFF_DEBUGGING_INFO
f045b2c9 1492
c5abcf1d
CH
1493/* Define if the object format being used is COFF or a superset. */
1494#define OBJECT_FORMAT_COFF
1495
2c440f06
RK
1496/* Define the magic numbers that we recognize as COFF. */
1497
1498#define MY_ISCOFF(magic) \
1499 ((magic) == U802WRMAGIC || (magic) == U802ROMAGIC || (magic) == U802TOCMAGIC)
1500
115e69a9
RK
1501/* This is the only version of nm that collect2 can work with. */
1502#define REAL_NM_FILE_NAME "/usr/ucb/nm"
1503
f045b2c9
RS
1504/* We don't have GAS for the RS/6000 yet, so don't write out special
1505 .stabs in cc1plus. */
1506
1507#define FASCIST_ASSEMBLER
1508
f045b2c9
RS
1509/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1510 is done just by pretending it is already truncated. */
1511#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1512
1513/* Specify the machine mode that pointers have.
1514 After generation of rtl, the compiler makes no further distinction
1515 between pointers and any other objects of this machine mode. */
9e654916 1516#define Pmode (TARGET_64BIT ? DImode : SImode)
f045b2c9
RS
1517
1518/* Mode of a function address in a call instruction (for indexing purposes).
1519
1520 Doesn't matter on RS/6000. */
9e654916 1521#define FUNCTION_MODE (TARGET_64BIT ? DImode : SImode)
f045b2c9
RS
1522
1523/* Define this if addresses of constant functions
1524 shouldn't be put through pseudo regs where they can be cse'd.
1525 Desirable on machines where ordinary constants are expensive
1526 but a CALL with constant address is cheap. */
1527#define NO_FUNCTION_CSE
1528
d969caf8 1529/* Define this to be nonzero if shift instructions ignore all but the low-order
6febd581
RK
1530 few bits.
1531
1532 The sle and sre instructions which allow SHIFT_COUNT_TRUNCATED
1533 have been dropped from the PowerPC architecture. */
1534
1535#define SHIFT_COUNT_TRUNCATED TARGET_POWER ? 1 : 0
f045b2c9
RS
1536
1537/* Use atexit for static constructors/destructors, instead of defining
1538 our own exit function. */
1539#define HAVE_ATEXIT
1540
1541/* Compute the cost of computing a constant rtl expression RTX
1542 whose rtx-code is CODE. The body of this macro is a portion
1543 of a switch statement. If the code is computed here,
1544 return it with a return statement. Otherwise, break from the switch.
1545
01554f00 1546 On the RS/6000, if it is valid in the insn, it is free. So this
f045b2c9
RS
1547 always returns 0. */
1548
3bb22aee 1549#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
f045b2c9
RS
1550 case CONST_INT: \
1551 case CONST: \
1552 case LABEL_REF: \
1553 case SYMBOL_REF: \
1554 case CONST_DOUBLE: \
1555 return 0;
1556
1557/* Provide the costs of a rtl expression. This is in the body of a
1558 switch on CODE. */
1559
3bb22aee 1560#define RTX_COSTS(X,CODE,OUTER_CODE) \
f045b2c9 1561 case MULT: \
bdfd4e31
RK
1562 switch (rs6000_cpu) \
1563 { \
1564 case PROCESSOR_RIOS1: \
1565 return (GET_CODE (XEXP (X, 1)) != CONST_INT \
1566 ? COSTS_N_INSNS (5) \
1567 : INTVAL (XEXP (X, 1)) >= -256 && INTVAL (XEXP (X, 1)) <= 255 \
1568 ? COSTS_N_INSNS (3) : COSTS_N_INSNS (4)); \
1569 case PROCESSOR_RIOS2: \
1570 return COSTS_N_INSNS (2); \
1571 case PROCESSOR_PPC601: \
1572 case PROCESSOR_PPC603: \
869c489d 1573 return COSTS_N_INSNS (5); \
bdfd4e31
RK
1574 case PROCESSOR_PPC604: \
1575 case PROCESSOR_PPC620: \
869c489d 1576 return COSTS_N_INSNS (4); \
bdfd4e31 1577 } \
f045b2c9
RS
1578 case DIV: \
1579 case MOD: \
1580 if (GET_CODE (XEXP (X, 1)) == CONST_INT \
1581 && exact_log2 (INTVAL (XEXP (X, 1))) >= 0) \
1582 return COSTS_N_INSNS (2); \
1583 /* otherwise fall through to normal divide. */ \
1584 case UDIV: \
1585 case UMOD: \
bdfd4e31
RK
1586 switch (rs6000_cpu) \
1587 { \
1588 case PROCESSOR_RIOS1: \
1589 return COSTS_N_INSNS (19); \
1590 case PROCESSOR_RIOS2: \
1591 return COSTS_N_INSNS (13); \
1592 case PROCESSOR_PPC601: \
869c489d 1593 return COSTS_N_INSNS (36); \
bdfd4e31 1594 case PROCESSOR_PPC603: \
869c489d 1595 return COSTS_N_INSNS (37); \
bdfd4e31
RK
1596 case PROCESSOR_PPC604: \
1597 case PROCESSOR_PPC620: \
869c489d 1598 return COSTS_N_INSNS (20); \
bdfd4e31 1599 } \
f045b2c9
RS
1600 case MEM: \
1601 /* MEM should be slightly more expensive than (plus (reg) (const)) */ \
1602 return 5;
1603
1604/* Compute the cost of an address. This is meant to approximate the size
1605 and/or execution delay of an insn using that address. If the cost is
1606 approximated by the RTL complexity, including CONST_COSTS above, as
1607 is usually the case for CISC machines, this macro should not be defined.
1608 For aggressively RISCy machines, only one insn format is allowed, so
1609 this macro should be a constant. The value of this macro only matters
1610 for valid addresses.
1611
1612 For the RS/6000, everything is cost 0. */
1613
1614#define ADDRESS_COST(RTX) 0
1615
1616/* Adjust the length of an INSN. LENGTH is the currently-computed length and
1617 should be adjusted to reflect any required changes. This macro is used when
1618 there is some systematic length adjustment required that would be difficult
1619 to express in the length attribute. */
1620
1621/* #define ADJUST_INSN_LENGTH(X,LENGTH) */
1622
1623/* Add any extra modes needed to represent the condition code.
1624
1625 For the RS/6000, we need separate modes when unsigned (logical) comparisons
c5defebb
RK
1626 are being done and we need a separate mode for floating-point. We also
1627 use a mode for the case when we are comparing the results of two
1628 comparisons. */
f045b2c9 1629
c5defebb 1630#define EXTRA_CC_MODES CCUNSmode, CCFPmode, CCEQmode
f045b2c9
RS
1631
1632/* Define the names for the modes specified above. */
c5defebb 1633#define EXTRA_CC_NAMES "CCUNS", "CCFP", "CCEQ"
f045b2c9
RS
1634
1635/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
1636 return the mode to be used for the comparison. For floating-point, CCFPmode
c5defebb
RK
1637 should be used. CCUNSmode should be used for unsigned comparisons.
1638 CCEQmode should be used when we are doing an inequality comparison on
1639 the result of a comparison. CCmode should be used in all other cases. */
1640
b565a316 1641#define SELECT_CC_MODE(OP,X,Y) \
f045b2c9 1642 (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT ? CCFPmode \
c5defebb
RK
1643 : (OP) == GTU || (OP) == LTU || (OP) == GEU || (OP) == LEU ? CCUNSmode \
1644 : (((OP) == EQ || (OP) == NE) && GET_RTX_CLASS (GET_CODE (X)) == '<' \
1645 ? CCEQmode : CCmode))
f045b2c9
RS
1646
1647/* Define the information needed to generate branch and scc insns. This is
1648 stored from the compare operation. Note that we can't use "rtx" here
1649 since it hasn't been defined! */
1650
1651extern struct rtx_def *rs6000_compare_op0, *rs6000_compare_op1;
1652extern int rs6000_compare_fp_p;
1653
1654/* Set to non-zero by "fix" operation to indicate that itrunc and
1655 uitrunc must be defined. */
1656
1657extern int rs6000_trunc_used;
9929b575
ILT
1658
1659/* Function names to call to do floating point truncation. */
1660
1661#define RS6000_ITRUNC "itrunc"
1662#define RS6000_UITRUNC "uitrunc"
4d30c363
MM
1663
1664/* Prefix and suffix to use to saving floating point */
1665#ifndef SAVE_FP_PREFIX
1666#define SAVE_FP_PREFIX "._savef"
1667#define SAVE_FP_SUFFIX ""
1668#endif
1669
1670/* Prefix and suffix to use to restoring floating point */
1671#ifndef RESTORE_FP_PREFIX
1672#define RESTORE_FP_PREFIX "._restf"
1673#define RESTORE_FP_SUFFIX ""
1674#endif
1675
f045b2c9
RS
1676\f
1677/* Control the assembler format that we output. */
1678
1679/* Output at beginning of assembler file.
1680
b4d6689b 1681 Initialize the section names for the RS/6000 at this point.
fdaff8ba 1682
6355b140 1683 Specify filename to assembler.
3fc2151d 1684
b4d6689b 1685 We want to go into the TOC section so at least one .toc will be emitted.
fdaff8ba 1686 Also, in order to output proper .bs/.es pairs, we need at least one static
b4d6689b
RK
1687 [RW] section emitted.
1688
1689 We then switch back to text to force the gcc2_compiled. label and the space
1690 allocated after it (when profiling) into the text section.
1691
1692 Finally, declare mcount when profiling to make the assembler happy. */
f045b2c9
RS
1693
1694#define ASM_FILE_START(FILE) \
1695{ \
fdaff8ba 1696 rs6000_gen_section_name (&xcoff_bss_section_name, \
f045b2c9 1697 main_input_filename, ".bss_"); \
fdaff8ba 1698 rs6000_gen_section_name (&xcoff_private_data_section_name, \
f045b2c9 1699 main_input_filename, ".rw_"); \
fdaff8ba 1700 rs6000_gen_section_name (&xcoff_read_only_section_name, \
f045b2c9
RS
1701 main_input_filename, ".ro_"); \
1702 \
6355b140 1703 output_file_directive (FILE, main_input_filename); \
f045b2c9 1704 toc_section (); \
fdaff8ba
RS
1705 if (write_symbols != NO_DEBUG) \
1706 private_data_section (); \
b4d6689b
RK
1707 text_section (); \
1708 if (profile_flag) \
1709 fprintf (FILE, "\t.extern .mcount\n"); \
f045b2c9
RS
1710}
1711
1712/* Output at end of assembler file.
1713
1714 On the RS/6000, referencing data should automatically pull in text. */
1715
1716#define ASM_FILE_END(FILE) \
1717{ \
1718 text_section (); \
1719 fprintf (FILE, "_section_.text:\n"); \
1720 data_section (); \
1721 fprintf (FILE, "\t.long _section_.text\n"); \
1722}
1723
f045b2c9
RS
1724/* We define this to prevent the name mangler from putting dollar signs into
1725 function names. */
1726
1727#define NO_DOLLAR_IN_LABEL
1728
1729/* We define this to 0 so that gcc will never accept a dollar sign in a
1730 variable name. This is needed because the AIX assembler will not accept
1731 dollar signs. */
1732
1733#define DOLLARS_IN_IDENTIFIERS 0
1734
fdaff8ba
RS
1735/* Implicit library calls should use memcpy, not bcopy, etc. */
1736
1737#define TARGET_MEM_FUNCTIONS
1738
f045b2c9
RS
1739/* Define the extra sections we need. We define three: one is the read-only
1740 data section which is used for constants. This is a csect whose name is
1741 derived from the name of the input file. The second is for initialized
1742 global variables. This is a csect whose name is that of the variable.
1743 The third is the TOC. */
1744
1745#define EXTRA_SECTIONS \
1746 read_only_data, private_data, read_only_private_data, toc, bss
1747
1748/* Define the name of our readonly data section. */
1749
1750#define READONLY_DATA_SECTION read_only_data_section
1751
b4f892eb
RK
1752/* If we are referencing a function that is static or is known to be
1753 in this file, make the SYMBOL_REF special. We can use this to indicate
1754 that we can branch to this function without emitting a no-op after the
1755 call. */
1756
1757#define ENCODE_SECTION_INFO(DECL) \
1758 if (TREE_CODE (DECL) == FUNCTION_DECL \
1759 && (TREE_ASM_WRITTEN (DECL) || ! TREE_PUBLIC (DECL))) \
1760 SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1;
1761
f045b2c9
RS
1762/* Indicate that jump tables go in the text section. */
1763
1764#define JUMP_TABLES_IN_TEXT_SECTION
1765
1766/* Define the routines to implement these extra sections. */
1767
1768#define EXTRA_SECTION_FUNCTIONS \
1769 \
1770void \
1771read_only_data_section () \
1772{ \
1773 if (in_section != read_only_data) \
1774 { \
469adec3 1775 fprintf (asm_out_file, ".csect %s[RO]\n", \
fdaff8ba 1776 xcoff_read_only_section_name); \
f045b2c9
RS
1777 in_section = read_only_data; \
1778 } \
1779} \
1780 \
1781void \
1782private_data_section () \
1783{ \
1784 if (in_section != private_data) \
1785 { \
469adec3 1786 fprintf (asm_out_file, ".csect %s[RW]\n", \
fdaff8ba 1787 xcoff_private_data_section_name); \
f045b2c9
RS
1788 \
1789 in_section = private_data; \
1790 } \
1791} \
1792 \
1793void \
1794read_only_private_data_section () \
1795{ \
1796 if (in_section != read_only_private_data) \
1797 { \
f25359b5 1798 fprintf (asm_out_file, ".csect %s[RO]\n", \
fdaff8ba 1799 xcoff_private_data_section_name); \
f045b2c9
RS
1800 in_section = read_only_private_data; \
1801 } \
1802} \
1803 \
1804void \
1805toc_section () \
1806{ \
642a35f1
JW
1807 if (TARGET_MINIMAL_TOC) \
1808 { \
1809 static int toc_initialized = 0; \
1810 \
1811 /* toc_section is always called at least once from ASM_FILE_START, \
1812 so this is guaranteed to always be defined once and only once \
1813 in each file. */ \
1814 if (! toc_initialized) \
1815 { \
1816 fprintf (asm_out_file, ".toc\nLCTOC..0:\n"); \
1817 fprintf (asm_out_file, "\t.tc toc_table[TC],toc_table[RW]\n"); \
1818 toc_initialized = 1; \
1819 } \
f045b2c9 1820 \
642a35f1
JW
1821 if (in_section != toc) \
1822 fprintf (asm_out_file, ".csect toc_table[RW]\n"); \
1823 } \
1824 else \
1825 { \
1826 if (in_section != toc) \
1827 fprintf (asm_out_file, ".toc\n"); \
1828 } \
f045b2c9 1829 in_section = toc; \
fc3ffe83 1830}
f045b2c9
RS
1831
1832/* This macro produces the initial definition of a function name.
1833 On the RS/6000, we need to place an extra '.' in the function name and
1834 output the function descriptor.
1835
1836 The csect for the function will have already been created by the
1837 `text_section' call previously done. We do have to go back to that
1838 csect, however. */
1839
fdaff8ba
RS
1840/* ??? What do the 16 and 044 in the .function line really mean? */
1841
f045b2c9
RS
1842#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
1843{ if (TREE_PUBLIC (DECL)) \
1844 { \
1845 fprintf (FILE, "\t.globl ."); \
1846 RS6000_OUTPUT_BASENAME (FILE, NAME); \
fdaff8ba
RS
1847 fprintf (FILE, "\n"); \
1848 } \
3ce428da 1849 else \
fdaff8ba
RS
1850 { \
1851 fprintf (FILE, "\t.lglobl ."); \
1852 RS6000_OUTPUT_BASENAME (FILE, NAME); \
1853 fprintf (FILE, "\n"); \
f045b2c9 1854 } \
f25359b5 1855 fprintf (FILE, ".csect "); \
f045b2c9
RS
1856 RS6000_OUTPUT_BASENAME (FILE, NAME); \
1857 fprintf (FILE, "[DS]\n"); \
1858 RS6000_OUTPUT_BASENAME (FILE, NAME); \
1859 fprintf (FILE, ":\n"); \
1860 fprintf (FILE, "\t.long ."); \
1861 RS6000_OUTPUT_BASENAME (FILE, NAME); \
fdaff8ba 1862 fprintf (FILE, ", TOC[tc0], 0\n"); \
11117bb9 1863 fprintf (FILE, ".csect .text[PR]\n."); \
f045b2c9
RS
1864 RS6000_OUTPUT_BASENAME (FILE, NAME); \
1865 fprintf (FILE, ":\n"); \
fdaff8ba 1866 if (write_symbols == XCOFF_DEBUG) \
c2a47e48 1867 xcoffout_declare_function (FILE, DECL, NAME); \
f045b2c9
RS
1868}
1869
1870/* Return non-zero if this entry is to be written into the constant pool
1871 in a special way. We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
1872 containing one of them. If -mfp-in-toc (the default), we also do
1873 this for floating-point constants. We actually can only do this
1874 if the FP formats of the target and host machines are the same, but
1875 we can't check that since not every file that uses
1876 GO_IF_LEGITIMATE_ADDRESS_P includes real.h. */
1877
1878#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X) \
1879 (GET_CODE (X) == SYMBOL_REF \
1880 || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
1881 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
1882 || GET_CODE (X) == LABEL_REF \
72847b95
RK
1883 || (! (TARGET_NO_FP_IN_TOC && ! TARGET_MINIMAL_TOC) \
1884 && GET_CODE (X) == CONST_DOUBLE \
f045b2c9
RS
1885 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
1886 && BITS_PER_WORD == HOST_BITS_PER_INT))
1887
1888/* Select section for constant in constant pool.
1889
1890 On RS/6000, all constants are in the private read-only data area.
1891 However, if this is being placed in the TOC it must be output as a
1892 toc entry. */
1893
1894#define SELECT_RTX_SECTION(MODE, X) \
1895{ if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (X)) \
1896 toc_section (); \
1897 else \
1898 read_only_private_data_section (); \
1899}
1900
1901/* Macro to output a special constant pool entry. Go to WIN if we output
1902 it. Otherwise, it is written the usual way.
1903
1904 On the RS/6000, toc entries are handled this way. */
1905
1906#define ASM_OUTPUT_SPECIAL_POOL_ENTRY(FILE, X, MODE, ALIGN, LABELNO, WIN) \
1907{ if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (X)) \
1908 { \
1909 output_toc (FILE, X, LABELNO); \
1910 goto WIN; \
1911 } \
1912}
1913
1914/* Select the section for an initialized data object.
1915
1916 On the RS/6000, we have a special section for all variables except those
1917 that are static. */
1918
1919#define SELECT_SECTION(EXP,RELOC) \
1920{ \
ed8969fa
JW
1921 if ((TREE_CODE (EXP) == STRING_CST \
1922 && !flag_writable_strings) \
1923 || (TREE_READONLY (EXP) && ! TREE_THIS_VOLATILE (EXP) \
1924 && DECL_INITIAL (EXP) \
1925 && (DECL_INITIAL (EXP) == error_mark_node \
1926 || TREE_CONSTANT (DECL_INITIAL (EXP))) \
1927 && ! (RELOC))) \
f045b2c9
RS
1928 { \
1929 if (TREE_PUBLIC (EXP)) \
1930 read_only_data_section (); \
1931 else \
1932 read_only_private_data_section (); \
1933 } \
1934 else \
1935 { \
1936 if (TREE_PUBLIC (EXP)) \
1937 data_section (); \
1938 else \
1939 private_data_section (); \
1940 } \
1941}
1942
1943/* This outputs NAME to FILE up to the first null or '['. */
1944
1945#define RS6000_OUTPUT_BASENAME(FILE, NAME) \
99d3d26e 1946 if ((NAME)[0] == '*' || (NAME)[strlen (NAME) - 1] != ']') \
f045b2c9
RS
1947 assemble_name (FILE, NAME); \
1948 else \
1949 { \
99d3d26e
RK
1950 int _len = strlen (NAME); \
1951 char *_p = alloca (_len + 1); \
1952 \
1953 strcpy (_p, NAME); \
1954 _p[_len - 4] = '\0'; \
1955 assemble_name (FILE, _p); \
f045b2c9
RS
1956 }
1957
1958/* Output something to declare an external symbol to the assembler. Most
1959 assemblers don't need this.
1960
1961 If we haven't already, add "[RW]" (or "[DS]" for a function) to the
1962 name. Normally we write this out along with the name. In the few cases
1963 where we can't, it gets stripped off. */
1964
1965#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
1966{ rtx _symref = XEXP (DECL_RTL (DECL), 0); \
1967 if ((TREE_CODE (DECL) == VAR_DECL \
1968 || TREE_CODE (DECL) == FUNCTION_DECL) \
1969 && (NAME)[0] != '*' \
1970 && (NAME)[strlen (NAME) - 1] != ']') \
1971 { \
1972 char *_name = (char *) permalloc (strlen (XSTR (_symref, 0)) + 5); \
1973 strcpy (_name, XSTR (_symref, 0)); \
1974 strcat (_name, TREE_CODE (DECL) == FUNCTION_DECL ? "[DS]" : "[RW]"); \
1975 XSTR (_symref, 0) = _name; \
1976 } \
1977 fprintf (FILE, "\t.extern "); \
1978 assemble_name (FILE, XSTR (_symref, 0)); \
1979 if (TREE_CODE (DECL) == FUNCTION_DECL) \
1980 { \
1981 fprintf (FILE, "\n\t.extern ."); \
1982 RS6000_OUTPUT_BASENAME (FILE, XSTR (_symref, 0)); \
1983 } \
1984 fprintf (FILE, "\n"); \
1985}
1986
1987/* Similar, but for libcall. We only have to worry about the function name,
1988 not that of the descriptor. */
1989
1990#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
1991{ fprintf (FILE, "\t.extern ."); \
1992 assemble_name (FILE, XSTR (FUN, 0)); \
1993 fprintf (FILE, "\n"); \
1994}
1995
1996/* Output to assembler file text saying following lines
1997 may contain character constants, extra white space, comments, etc. */
1998
1999#define ASM_APP_ON ""
2000
2001/* Output to assembler file text saying following lines
2002 no longer contain unusual constructs. */
2003
2004#define ASM_APP_OFF ""
2005
2006/* Output before instructions. */
2007
11117bb9 2008#define TEXT_SECTION_ASM_OP ".csect .text[PR]"
f045b2c9
RS
2009
2010/* Output before writable data. */
2011
fdaff8ba 2012#define DATA_SECTION_ASM_OP ".csect .data[RW]"
f045b2c9
RS
2013
2014/* How to refer to registers in assembler output.
2015 This sequence is indexed by compiler's hard-register-number (see above). */
2016
2017#define REGISTER_NAMES \
2018 {"0", "1", "2", "3", "4", "5", "6", "7", \
2019 "8", "9", "10", "11", "12", "13", "14", "15", \
2020 "16", "17", "18", "19", "20", "21", "22", "23", \
2021 "24", "25", "26", "27", "28", "29", "30", "31", \
2022 "0", "1", "2", "3", "4", "5", "6", "7", \
2023 "8", "9", "10", "11", "12", "13", "14", "15", \
2024 "16", "17", "18", "19", "20", "21", "22", "23", \
2025 "24", "25", "26", "27", "28", "29", "30", "31", \
2026 "mq", "lr", "ctr", "ap", \
2027 "0", "1", "2", "3", "4", "5", "6", "7" }
2028
2029/* Table of additional register names to use in user input. */
2030
2031#define ADDITIONAL_REGISTER_NAMES \
2032 {"r0", 0, "r1", 1, "r2", 2, "r3", 3, \
2033 "r4", 4, "r5", 5, "r6", 6, "r7", 7, \
2034 "r8", 8, "r9", 9, "r10", 10, "r11", 11, \
2035 "r12", 12, "r13", 13, "r14", 14, "r15", 15, \
2036 "r16", 16, "r17", 17, "r18", 18, "r19", 19, \
2037 "r20", 20, "r21", 21, "r22", 22, "r23", 23, \
2038 "r24", 24, "r25", 25, "r26", 26, "r27", 27, \
2039 "r28", 28, "r29", 29, "r30", 30, "r31", 31, \
2040 "fr0", 32, "fr1", 33, "fr2", 34, "fr3", 35, \
2041 "fr4", 36, "fr5", 37, "fr6", 38, "fr7", 39, \
2042 "fr8", 40, "fr9", 41, "fr10", 42, "fr11", 43, \
2043 "fr12", 44, "fr13", 45, "fr14", 46, "fr15", 47, \
2044 "fr16", 48, "fr17", 49, "fr18", 50, "fr19", 51, \
2045 "fr20", 52, "fr21", 53, "fr22", 54, "fr23", 55, \
2046 "fr24", 56, "fr25", 57, "fr26", 58, "fr27", 59, \
2047 "fr28", 60, "fr29", 61, "fr30", 62, "fr31", 63, \
2048 /* no additional names for: mq, lr, ctr, ap */ \
2049 "cr0", 68, "cr1", 69, "cr2", 70, "cr3", 71, \
fc3ffe83
RK
2050 "cr4", 72, "cr5", 73, "cr6", 74, "cr7", 75, \
2051 "cc", 68 }
f045b2c9
RS
2052
2053/* How to renumber registers for dbx and gdb. */
2054
2055#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
2056
0da40b09
RK
2057/* Text to write out after a CALL that may be replaced by glue code by
2058 the loader. This depends on the AIX version. */
2059#define RS6000_CALL_GLUE "cror 31,31,31"
11117bb9 2060
f045b2c9
RS
2061/* This is how to output the definition of a user-level label named NAME,
2062 such as the label on a static function or variable NAME. */
2063
2064#define ASM_OUTPUT_LABEL(FILE,NAME) \
2065 do { RS6000_OUTPUT_BASENAME (FILE, NAME); fputs (":\n", FILE); } while (0)
2066
2067/* This is how to output a command to make the user-level label named NAME
2068 defined for reference from other files. */
2069
2070#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
2071 do { fputs ("\t.globl ", FILE); \
2072 RS6000_OUTPUT_BASENAME (FILE, NAME); fputs ("\n", FILE);} while (0)
2073
2074/* This is how to output a reference to a user-level label named NAME.
2075 `assemble_name' uses this. */
2076
2077#define ASM_OUTPUT_LABELREF(FILE,NAME) \
2078 fprintf (FILE, NAME)
2079
2080/* This is how to output an internal numbered label where
2081 PREFIX is the class of label and NUM is the number within the class. */
2082
2083#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
2084 fprintf (FILE, "%s..%d:\n", PREFIX, NUM)
2085
3daf36a4
ILT
2086/* This is how to output an internal label prefix. rs6000.c uses this
2087 when generating traceback tables. */
2088
2089#define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \
2090 fprintf (FILE, "%s..", PREFIX)
2091
f045b2c9
RS
2092/* This is how to output a label for a jump table. Arguments are the same as
2093 for ASM_OUTPUT_INTERNAL_LABEL, except the insn for the jump table is
2094 passed. */
2095
2096#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
2097{ ASM_OUTPUT_ALIGN (FILE, 2); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); }
2098
2099/* This is how to store into the string LABEL
2100 the symbol_ref name of an internal numbered label where
2101 PREFIX is the class of label and NUM is the number within the class.
2102 This is suitable for output with `assemble_name'. */
2103
2104#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
2105 sprintf (LABEL, "%s..%d", PREFIX, NUM)
2106
2107/* This is how to output an assembler line defining a `double' constant. */
2108
a5b1eb34
RS
2109#define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
2110 { \
2111 if (REAL_VALUE_ISINF (VALUE) \
2112 || REAL_VALUE_ISNAN (VALUE) \
2113 || REAL_VALUE_MINUS_ZERO (VALUE)) \
2114 { \
2115 long t[2]; \
2116 REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
2117 fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n", \
2118 t[0] & 0xffffffff, t[1] & 0xffffffff); \
2119 } \
2120 else \
2121 { \
2122 char str[30]; \
2123 REAL_VALUE_TO_DECIMAL (VALUE, "%.20e", str); \
2124 fprintf (FILE, "\t.double 0d%s\n", str); \
2125 } \
2126 }
f045b2c9
RS
2127
2128/* This is how to output an assembler line defining a `float' constant. */
2129
a5b1eb34
RS
2130#define ASM_OUTPUT_FLOAT(FILE, VALUE) \
2131 { \
2132 if (REAL_VALUE_ISINF (VALUE) \
2133 || REAL_VALUE_ISNAN (VALUE) \
2134 || REAL_VALUE_MINUS_ZERO (VALUE)) \
2135 { \
2136 long t; \
2137 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
2138 fprintf (FILE, "\t.long 0x%lx\n", t & 0xffffffff); \
2139 } \
2140 else \
2141 { \
2142 char str[30]; \
2143 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
2144 fprintf (FILE, "\t.float 0d%s\n", str); \
2145 } \
2146 }
f045b2c9
RS
2147
2148/* This is how to output an assembler line defining an `int' constant. */
2149
2150#define ASM_OUTPUT_INT(FILE,VALUE) \
2151( fprintf (FILE, "\t.long "), \
2152 output_addr_const (FILE, (VALUE)), \
2153 fprintf (FILE, "\n"))
2154
2155/* Likewise for `char' and `short' constants. */
2156
2157#define ASM_OUTPUT_SHORT(FILE,VALUE) \
2158( fprintf (FILE, "\t.short "), \
2159 output_addr_const (FILE, (VALUE)), \
2160 fprintf (FILE, "\n"))
2161
2162#define ASM_OUTPUT_CHAR(FILE,VALUE) \
2163( fprintf (FILE, "\t.byte "), \
2164 output_addr_const (FILE, (VALUE)), \
2165 fprintf (FILE, "\n"))
2166
2167/* This is how to output an assembler line for a numeric constant byte. */
2168
2169#define ASM_OUTPUT_BYTE(FILE,VALUE) \
2170 fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
2171
2172/* This is how to output an assembler line to define N characters starting
2173 at P to FILE. */
2174
2175#define ASM_OUTPUT_ASCII(FILE, P, N) output_ascii ((FILE), (P), (N))
2176
2177/* This is how to output code to push a register on the stack.
2178 It need not be very fast code. */
2179
2180#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
6febd581 2181 asm_fprintf (FILE, "\{tstu|stwu} %s,-4(r1)\n", reg_names[REGNO]);
f045b2c9
RS
2182
2183/* This is how to output an insn to pop a register from the stack.
2184 It need not be very fast code. */
2185
2186#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
6febd581
RK
2187 asm_fprintf (FILE, "\t{l|lwz} %s,0(r1)\n\t{ai|addic} r1,r1,4\n", \
2188 reg_names[REGNO])
f045b2c9
RS
2189
2190/* This is how to output an element of a case-vector that is absolute.
2191 (RS/6000 does not use such vectors, but we must define this macro
2192 anyway.) */
2193
3daf36a4
ILT
2194#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
2195 do { char buf[100]; \
2196 fprintf (FILE, "\t.long "); \
2197 ASM_GENERATE_INTERNAL_LABEL (buf, "L", VALUE); \
2198 assemble_name (FILE, buf); \
2199 fprintf (FILE, "\n"); \
2200 } while (0)
f045b2c9
RS
2201
2202/* This is how to output an element of a case-vector that is relative. */
2203
2204#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
3daf36a4
ILT
2205 do { char buf[100]; \
2206 fprintf (FILE, "\t.long "); \
2207 ASM_GENERATE_INTERNAL_LABEL (buf, "L", VALUE); \
2208 assemble_name (FILE, buf); \
2209 fprintf (FILE, "-"); \
2210 ASM_GENERATE_INTERNAL_LABEL (buf, "L", REL); \
2211 assemble_name (FILE, buf); \
2212 fprintf (FILE, "\n"); \
2213 } while (0)
f045b2c9
RS
2214
2215/* This is how to output an assembler line
2216 that says to advance the location counter
2217 to a multiple of 2**LOG bytes. */
2218
2219#define ASM_OUTPUT_ALIGN(FILE,LOG) \
2220 if ((LOG) != 0) \
2221 fprintf (FILE, "\t.align %d\n", (LOG))
2222
2223#define ASM_OUTPUT_SKIP(FILE,SIZE) \
2224 fprintf (FILE, "\t.space %d\n", (SIZE))
2225
2226/* This says how to output an assembler line
2227 to define a global common symbol. */
2228
2229#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
fc3ffe83 2230 do { fputs (".comm ", (FILE)); \
f045b2c9
RS
2231 RS6000_OUTPUT_BASENAME ((FILE), (NAME)); \
2232 fprintf ((FILE), ",%d\n", (SIZE)); } while (0)
2233
2234/* This says how to output an assembler line
2235 to define a local common symbol. */
2236
2237#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \
fc3ffe83 2238 do { fputs (".lcomm ", (FILE)); \
f045b2c9 2239 RS6000_OUTPUT_BASENAME ((FILE), (NAME)); \
fdaff8ba 2240 fprintf ((FILE), ",%d,%s\n", (SIZE), xcoff_bss_section_name); \
f045b2c9
RS
2241 } while (0)
2242
2243/* Store in OUTPUT a string (made with alloca) containing
2244 an assembler-name for a local static variable named NAME.
2245 LABELNO is an integer which is different for each call. */
2246
2247#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
2248( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
2249 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
2250
2251/* Define the parentheses used to group arithmetic operations
2252 in assembler code. */
2253
2254#define ASM_OPEN_PAREN "("
2255#define ASM_CLOSE_PAREN ")"
2256
2257/* Define results of standard character escape sequences. */
2258#define TARGET_BELL 007
2259#define TARGET_BS 010
2260#define TARGET_TAB 011
2261#define TARGET_NEWLINE 012
2262#define TARGET_VT 013
2263#define TARGET_FF 014
2264#define TARGET_CR 015
2265
2266/* Print operand X (an rtx) in assembler syntax to file FILE.
2267 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
2268 For `%' followed by punctuation, CODE is the punctuation and X is null. */
2269
2270#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
2271
2272/* Define which CODE values are valid. */
2273
38250554 2274#define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '.' || (CODE) == '*')
f045b2c9
RS
2275
2276/* Print a memory address as an operand to reference that memory location. */
2277
2278#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
2279
2280/* Define the codes that are matched by predicates in rs6000.c. */
2281
2282#define PREDICATE_CODES \
2283 {"short_cint_operand", {CONST_INT}}, \
2284 {"u_short_cint_operand", {CONST_INT}}, \
f357808b 2285 {"non_short_cint_operand", {CONST_INT}}, \
cd2b37d9 2286 {"gpc_reg_operand", {SUBREG, REG}}, \
f045b2c9
RS
2287 {"cc_reg_operand", {SUBREG, REG}}, \
2288 {"reg_or_short_operand", {SUBREG, REG, CONST_INT}}, \
2289 {"reg_or_neg_short_operand", {SUBREG, REG, CONST_INT}}, \
2290 {"reg_or_u_short_operand", {SUBREG, REG, CONST_INT}}, \
2291 {"reg_or_cint_operand", {SUBREG, REG, CONST_INT}}, \
2292 {"easy_fp_constant", {CONST_DOUBLE}}, \
2293 {"reg_or_mem_operand", {SUBREG, MEM, REG}}, \
414d3ee4 2294 {"lwa_operand", {SUBREG, MEM, REG}}, \
f045b2c9
RS
2295 {"fp_reg_or_mem_operand", {SUBREG, MEM, REG}}, \
2296 {"mem_or_easy_const_operand", {SUBREG, MEM, CONST_DOUBLE}}, \
2297 {"add_operand", {SUBREG, REG, CONST_INT}}, \
f357808b 2298 {"non_add_cint_operand", {CONST_INT}}, \
f045b2c9 2299 {"and_operand", {SUBREG, REG, CONST_INT}}, \
f357808b 2300 {"non_and_cint_operand", {CONST_INT}}, \
f045b2c9 2301 {"logical_operand", {SUBREG, REG, CONST_INT}}, \
f357808b 2302 {"non_logical_cint_operand", {CONST_INT}}, \
f045b2c9
RS
2303 {"mask_operand", {CONST_INT}}, \
2304 {"call_operand", {SYMBOL_REF, REG}}, \
f8634644 2305 {"current_file_function_operand", {SYMBOL_REF}}, \
38250554 2306 {"input_operand", {SUBREG, MEM, REG, CONST_INT, SYMBOL_REF}}, \
f8634644
RK
2307 {"load_multiple_operation", {PARALLEL}}, \
2308 {"store_multiple_operation", {PARALLEL}}, \
2309 {"branch_comparison_operator", {EQ, NE, LE, LT, GE, \
e477bbc7 2310 GT, LEU, LTU, GEU, GTU}}, \
f8634644 2311 {"scc_comparison_operator", {EQ, NE, LE, LT, GE, \
e477bbc7 2312 GT, LEU, LTU, GEU, GTU}},
This page took 0.440355 seconds and 5 git commands to generate.