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