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