1 /* Definitions of target machine for GNU compiler, for IBM RS/6000.
2 Copyright (C) 1992, 1993 Free Software Foundation, Inc.
3 Contributed by Richard Kenner (kenner@nyu.edu)
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
22 /* Note that some other tm.h files include this one and then override
23 many of the definitions that relate to assembler syntax. */
26 /* Names to predefine in the preprocessor for this target machine. */
28 #define CPP_PREDEFINES "-D_IBMR2 -D_AIX -D_AIX32"
30 /* Print subsidiary information on the compiler version in use. */
31 #define TARGET_VERSION ;
33 /* Tell the assembler to assume that all undefined names are external.
35 Don't do this until the fixed IBM assembler is more generally available.
36 When this becomes permanently defined, the ASM_OUTPUT_EXTERNAL,
37 ASM_OUTPUT_EXTERNAL_LIBCALL, and RS6000_OUTPUT_BASENAME macros will no
38 longer be needed. Also, the extern declaration of mcount in ASM_FILE_START
39 will no longer be needed. */
41 /* #define ASM_SPEC "-u" */
43 /* Define the options for the binder: Start text at 512, align all segments
44 to 512 bytes, and warn if there is text relocation.
46 The -bhalt:4 option supposedly changes the level at which ld will abort,
47 but it also suppresses warnings about multiply defined symbols and is
48 used by the AIX cc command. So we use it here.
50 -bnodelcsect undoes a poor choice of default relating to multiply-defined
51 csects. See AIX documentation for more information about this. */
53 #define LINK_SPEC "-T512 -H512 -btextro -bhalt:4 -bnodelcsect\
54 %{static:-bnso -bI:/lib/syscalls.exp} %{g*:-bexport:/usr/lib/libg.exp}"
56 /* Profiled library versions are used by linking with special directories. */
57 #define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\
58 %{p:-L/lib/profiled -L/usr/lib/profiled} %{g*:-lg} -lc"
60 /* gcc must do the search itself to find libgcc.a, not use -l. */
61 #define LINK_LIBGCC_SPECIAL_1
63 /* Don't turn -B into -L if the argument specifies a relative file name. */
64 #define RELATIVE_PREFIX_NOT_LINKDIR
66 /* Architecture type. */
68 extern int target_flags
;
70 /* Use POWER architecture instructions and MQ register. */
71 #define MASK_POWER 0x01
73 /* Use PowerPC architecture instructions. */
74 #define MASK_POWERPC 0x02
76 /* Use PowerPC-64 architecture instructions. */
77 #define MASK_POWERPC64 0x04
79 /* Use revised mnemonic names defined for PowerPC architecture. */
80 #define MASK_NEW_MNEMONICS 0x08
82 /* Disable placing fp constants in the TOC; can be turned on when the
84 #define MASK_NO_FP_IN_TOC 0x10
86 /* Output only one TOC entry per module. Normally linking fails if
87 there are more than 16K unique variables/constants in an executable. With
88 this option, linking fails only if there are more than 16K modules, or
89 if there are more than 16K unique variables/constant in a single module.
91 This is at the cost of having 2 extra loads and one extra store per
92 function, and one less allocatable register. */
93 #define MASK_MINIMAL_TOC 0x20
95 #define TARGET_POWER (target_flags & MASK_POWER)
96 #define TARGET_POWERPC (target_flags & MASK_POWERPC)
97 #define TARGET_POWERPC64 (target_flags & MASK_POWERPC64)
98 #define TARGET_NEW_MNEMONICS (target_flags & MASK_NEW_MNEMONICS)
99 #define TARGET_NO_FP_IN_TOC (target_flags & MASK_NO_FP_IN_TOC)
100 #define TARGET_MINIMAL_TOC (target_flags & MASK_MINIMAL_TOC)
102 /* Run-time compilation parameters selecting different hardware subsets.
104 Macro to define tables used to set the flags.
105 This is a list in braces of pairs in braces,
106 each pair being { "NAME", VALUE }
107 where VALUE is the bits to set or minus the bits to clear.
108 An empty string NAME is used to identify the default VALUE. */
110 #define TARGET_SWITCHES \
111 {{"power", MASK_POWER}, \
112 {"no-power", - MASK_POWER}, \
113 {"powerpc", MASK_POWERPC}, \
114 {"no-powerpc", - (MASK_POWERPC | MASK_POWERPC64)}, \
115 {"powerpc64", MASK_POWERPC | MASK_POWERPC64}, \
116 {"no-powerpc64", -MASK_POWERPC64}, \
117 {"new-mnemonics", MASK_NEW_MNEMONICS}, \
118 {"old-mnemonics", -MASK_NEW_MNEMONICS}, \
119 {"normal-toc", - (MASK_NO_FP_IN_TOC | MASK_MINIMAL_TOC)}, \
120 {"fp-in-toc", - MASK_NO_FP_IN_TOC}, \
121 {"no-fp-in-toc", MASK_NO_FP_IN_TOC}, \
122 {"minimal-toc", MASK_MINIMAL_TOC}, \
123 {"no-minimal-toc", - MASK_MINIMAL_TOC}, \
124 {"", TARGET_DEFAULT}}
126 #define TARGET_DEFAULT MASK_POWER
128 /* Processor type. */
137 extern enum processor_type rs6000_cpu
;
139 /* Recast the processor type to the cpu attribute. */
140 #define rs6000_cpu_attr ((enum attr_cpu)rs6000_cpu)
142 /* Define the default processor. This is overridden by other tm.h files. */
143 #define PROCESSOR_DEFAULT PROCESSOR_RIOS
145 /* This macro is similar to `TARGET_SWITCHES' but defines names of
146 command options that have values. Its definition is an
147 initializer with a subgrouping for each command option.
149 Each subgrouping contains a string constant, that defines the
150 fixed part of the option name, and the address of a variable.
151 The variable, type `char *', is set to the variable part of the
152 given option if the fixed part matches. The actual option name
153 is made by appending `-m' to the specified name.
155 Here is an example which defines `-mshort-data-NUMBER'. If the
156 given option is `-mshort-data-512', the variable `m88k_short_data'
157 will be set to the string `"512"'.
159 extern char *m88k_short_data;
160 #define TARGET_OPTIONS { { "short-data-", &m88k_short_data } } */
162 #define TARGET_OPTIONS \
163 { {"cpu=", &rs6000_cpu_string}}
165 extern char *rs6000_cpu_string
;
167 /* Sometimes certain combinations of command options do not make sense
168 on a particular target machine. You can define a macro
169 `OVERRIDE_OPTIONS' to take account of this. This macro, if
170 defined, is executed once just after all the command options have
173 On the RS/6000 this is used to define the target cpu type. */
175 #define OVERRIDE_OPTIONS rs6000_override_options ()
177 #define OPTIMIZATION_OPTIONS(LEVEL) \
181 flag_force_mem = 1; \
182 flag_omit_frame_pointer = 1; \
186 /* target machine storage layout */
188 /* Define this macro if it is advisable to hold scalars in registers
189 in a wider mode than that declared by the program. In such cases,
190 the value is constrained to be within the bounds of the declared
191 type, but kept valid in the wider mode. The signedness of the
192 extension may differ from that of the type. */
194 #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
195 if (GET_MODE_CLASS (MODE) == MODE_INT \
196 && GET_MODE_SIZE (MODE) < 4) \
199 /* Define this if most significant bit is lowest numbered
200 in instructions that operate on numbered bit-fields. */
201 /* That is true on RS/6000. */
202 #define BITS_BIG_ENDIAN 1
204 /* Define this if most significant byte of a word is the lowest numbered. */
205 /* That is true on RS/6000. */
206 #define BYTES_BIG_ENDIAN 1
208 /* Define this if most significant word of a multiword number is lowest
211 For RS/6000 we can decide arbitrarily since there are no machine
212 instructions for them. Might as well be consistent with bits and bytes. */
213 #define WORDS_BIG_ENDIAN 1
215 /* number of bits in an addressable storage unit */
216 #define BITS_PER_UNIT 8
218 /* Width in bits of a "word", which is the contents of a machine register.
219 Note that this is not necessarily the width of data type `int';
220 if using 16-bit ints on a 68000, this would still be 32.
221 But on a machine with 16-bit registers, this would be 16. */
222 #define BITS_PER_WORD 32
224 /* Width of a word, in units (bytes). */
225 #define UNITS_PER_WORD 4
227 /* Type used for ptrdiff_t, as a string used in a declaration. */
228 #define PTRDIFF_TYPE "int"
230 /* Type used for wchar_t, as a string used in a declaration. */
231 #define WCHAR_TYPE "short unsigned int"
233 /* Width of wchar_t in bits. */
234 #define WCHAR_TYPE_SIZE 16
236 /* Width in bits of a pointer.
237 See also the macro `Pmode' defined below. */
238 #define POINTER_SIZE 32
240 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
241 #define PARM_BOUNDARY 32
243 /* Boundary (in *bits*) on which stack pointer should be aligned. */
244 #define STACK_BOUNDARY 64
246 /* Allocation boundary (in *bits*) for the code of a function. */
247 #define FUNCTION_BOUNDARY 32
249 /* No data type wants to be aligned rounder than this. */
250 #define BIGGEST_ALIGNMENT 32
252 /* Alignment of field after `int : 0' in a structure. */
253 #define EMPTY_FIELD_BOUNDARY 32
255 /* Every structure's size must be a multiple of this. */
256 #define STRUCTURE_SIZE_BOUNDARY 8
258 /* A bitfield declared as `int' forces `int' alignment for the struct. */
259 #define PCC_BITFIELD_TYPE_MATTERS 1
261 /* Make strings word-aligned so strcpy from constants will be faster. */
262 #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
263 (TREE_CODE (EXP) == STRING_CST \
264 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
266 /* Make arrays of chars word-aligned for the same reasons. */
267 #define DATA_ALIGNMENT(TYPE, ALIGN) \
268 (TREE_CODE (TYPE) == ARRAY_TYPE \
269 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
270 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
272 /* Non-zero if move instructions will actually fail to work
273 when given unaligned data. */
274 #define STRICT_ALIGNMENT 0
276 /* Standard register usage. */
278 /* Number of actual hardware registers.
279 The hardware registers are assigned numbers for the compiler
280 from 0 to just below FIRST_PSEUDO_REGISTER.
281 All registers that the compiler knows about must be given numbers,
282 even those that are not normally considered general registers.
284 RS/6000 has 32 fixed-point registers, 32 floating-point registers,
285 an MQ register, a count register, a link register, and 8 condition
286 register fields, which we view here as separate registers.
288 In addition, the difference between the frame and argument pointers is
289 a function of the number of registers saved, so we need to have a
290 register for AP that will later be eliminated in favor of SP or FP.
291 This is a normal register, but it is fixed. */
293 #define FIRST_PSEUDO_REGISTER 76
295 /* 1 for registers that have pervasive standard uses
296 and are not available for the register allocator.
298 On RS/6000, r1 is used for the stack and r2 is used as the TOC pointer.
300 cr5 is not supposed to be used. */
302 #define FIXED_REGISTERS \
303 {0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
304 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
305 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
306 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
307 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0}
309 /* 1 for registers not available across function calls.
310 These must include the FIXED_REGISTERS and also any
311 registers that can be used without being saved.
312 The latter must include the registers where values are returned
313 and the register where structure-value addresses are passed.
314 Aside from that, you can include as many other registers as you like. */
316 #define CALL_USED_REGISTERS \
317 {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, \
318 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
319 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, \
320 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
321 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1}
323 /* List the order in which to allocate registers. Each register must be
324 listed once, even those in FIXED_REGISTERS.
326 We allocate in the following order:
327 fp0 (not saved or used for anything)
328 fp13 - fp2 (not saved; incoming fp arg registers)
329 fp1 (not saved; return value)
330 fp31 - fp14 (saved; order given to save least number)
331 cr1, cr6, cr7 (not saved or special)
332 cr0 (not saved, but used for arithmetic operations)
333 cr2, cr3, cr4 (saved)
334 r0 (not saved; cannot be base reg)
335 r9 (not saved; best for TImode)
336 r11, r10, r8-r4 (not saved; highest used first to make less conflict)
337 r3 (not saved; return value register)
338 r31 - r13 (saved; order given to save least number)
339 r12 (not saved; if used for DImode or DFmode would use r13)
340 mq (not saved; best to use it if we can)
341 ctr (not saved; when we have the choice ctr is better)
343 cr5, r1, r2, ap (fixed) */
345 #define REG_ALLOC_ORDER \
347 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, \
349 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, \
350 50, 49, 48, 47, 46, \
351 69, 74, 75, 68, 70, 71, 72, \
353 9, 11, 10, 8, 7, 6, 5, 4, \
355 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, \
356 18, 17, 16, 15, 14, 13, 12, \
360 /* True if register is floating-point. */
361 #define FP_REGNO_P(N) ((N) >= 32 && (N) <= 63)
363 /* True if register is a condition register. */
364 #define CR_REGNO_P(N) ((N) >= 68 && (N) <= 75)
366 /* True if register is an integer register. */
367 #define INT_REGNO_P(N) ((N) <= 31 || (N) == 67)
369 /* Return number of consecutive hard regs needed starting at reg REGNO
370 to hold something of mode MODE.
371 This is ordinarily the length in words of a value of mode MODE
372 but can be less for certain modes in special long registers.
374 On RS/6000, ordinary registers hold 32 bits worth;
375 a single floating point register holds 64 bits worth. */
377 #define HARD_REGNO_NREGS(REGNO, MODE) \
378 (FP_REGNO_P (REGNO) \
379 ? ((GET_MODE_SIZE (MODE) + 2 * UNITS_PER_WORD - 1) / (2 * UNITS_PER_WORD)) \
380 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
382 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
383 On RS/6000, the cpu registers can hold any mode but the float registers
384 can hold only floating modes and CR register can only hold CC modes. We
385 cannot put DImode or TImode anywhere except general register and they
386 must be able to fit within the register set. */
388 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
389 (FP_REGNO_P (REGNO) ? GET_MODE_CLASS (MODE) == MODE_FLOAT \
390 : CR_REGNO_P (REGNO) ? GET_MODE_CLASS (MODE) == MODE_CC \
391 : ! INT_REGNO_P (REGNO) ? GET_MODE_CLASS (MODE) == MODE_INT \
394 /* Value is 1 if it is a good idea to tie two pseudo registers
395 when one has mode MODE1 and one has mode MODE2.
396 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
397 for any hard reg, then this must be 0 for correct output. */
398 #define MODES_TIEABLE_P(MODE1, MODE2) \
399 (GET_MODE_CLASS (MODE1) == MODE_FLOAT \
400 ? GET_MODE_CLASS (MODE2) == MODE_FLOAT \
401 : GET_MODE_CLASS (MODE2) == MODE_FLOAT \
402 ? GET_MODE_CLASS (MODE1) == MODE_FLOAT \
403 : GET_MODE_CLASS (MODE1) == MODE_CC \
404 ? GET_MODE_CLASS (MODE2) == MODE_CC \
405 : GET_MODE_CLASS (MODE2) == MODE_CC \
406 ? GET_MODE_CLASS (MODE1) == MODE_CC \
409 /* A C expression returning the cost of moving data from a register of class
410 CLASS1 to one of CLASS2.
412 On the RS/6000, copying between floating-point and fixed-point
413 registers is expensive. */
415 #define REGISTER_MOVE_COST(CLASS1, CLASS2) \
416 ((CLASS1) == FLOAT_REGS && (CLASS2) == FLOAT_REGS ? 2 \
417 : (CLASS1) == FLOAT_REGS && (CLASS2) != FLOAT_REGS ? 10 \
418 : (CLASS1) != FLOAT_REGS && (CLASS2) == FLOAT_REGS ? 10 \
421 /* A C expressions returning the cost of moving data of MODE from a register to
424 On the RS/6000, bump this up a bit. */
426 #define MEMORY_MOVE_COST(MODE) 6
428 /* Specify the cost of a branch insn; roughly the number of extra insns that
429 should be added to avoid a branch.
431 Set this to 3 on the RS/6000 since that is roughly the average cost of an
432 unscheduled conditional branch. */
434 #define BRANCH_COST 3
436 /* A C statement (sans semicolon) to update the integer variable COST
437 based on the relationship between INSN that is dependent on
438 DEP_INSN through the dependence LINK. The default is to make no
439 adjustment to COST. On the RS/6000, ignore the cost of anti- and
440 output-dependencies. In fact, output dependencies on the CR do have
441 a cost, but it is probably not worthwhile to track it. */
443 #define ADJUST_COST(INSN,LINK,DEP_INSN,COST) \
444 if (REG_NOTE_KIND (LINK) != 0) \
445 (COST) = 0; /* Anti or output dependence. */
447 /* Specify the registers used for certain standard purposes.
448 The values of these macros are register numbers. */
450 /* RS/6000 pc isn't overloaded on a register that the compiler knows about. */
451 /* #define PC_REGNUM */
453 /* Register to use for pushing function arguments. */
454 #define STACK_POINTER_REGNUM 1
456 /* Base register for access to local variables of the function. */
457 #define FRAME_POINTER_REGNUM 31
459 /* Value should be nonzero if functions must have frame pointers.
460 Zero means the frame pointer need not be set up (and parms
461 may be accessed via the stack pointer) in functions that seem suitable.
462 This is computed in `reload', in reload1.c. */
463 #define FRAME_POINTER_REQUIRED 0
465 /* Base register for access to arguments of the function. */
466 #define ARG_POINTER_REGNUM 67
468 /* Place to put static chain when calling a function that requires it. */
469 #define STATIC_CHAIN_REGNUM 11
471 /* Place that structure value return address is placed.
473 On the RS/6000, it is passed as an extra parameter. */
474 #define STRUCT_VALUE 0
476 /* Define the classes of registers for register constraints in the
477 machine description. Also define ranges of constants.
479 One of the classes must always be named ALL_REGS and include all hard regs.
480 If there is more than one class, another class must be named NO_REGS
481 and contain no registers.
483 The name GENERAL_REGS must be the name of a class (or an alias for
484 another name such as ALL_REGS). This is the class of registers
485 that is allowed by "g" or "r" in a register constraint.
486 Also, registers outside this class are allocated only when
487 instructions express preferences for them.
489 The classes must be numbered in nondecreasing order; that is,
490 a larger-numbered class must never be contained completely
491 in a smaller-numbered class.
493 For any two classes, it is very desirable that there be another
494 class that represents their union. */
496 /* The RS/6000 has three types of registers, fixed-point, floating-point,
497 and condition registers, plus three special registers, MQ, CTR, and the
500 However, r0 is special in that it cannot be used as a base register.
501 So make a class for registers valid as base registers.
503 Also, cr0 is the only condition code register that can be used in
504 arithmetic insns, so make a separate class for it. */
506 enum reg_class
{ NO_REGS
, BASE_REGS
, GENERAL_REGS
, FLOAT_REGS
,
507 NON_SPECIAL_REGS
, MQ_REGS
, LINK_REGS
, CTR_REGS
, LINK_OR_CTR_REGS
,
508 SPECIAL_REGS
, SPEC_OR_GEN_REGS
, CR0_REGS
, CR_REGS
, NON_FLOAT_REGS
,
509 ALL_REGS
, LIM_REG_CLASSES
};
511 #define N_REG_CLASSES (int) LIM_REG_CLASSES
513 /* Give names of register classes as strings for dump file. */
515 #define REG_CLASS_NAMES \
516 { "NO_REGS", "BASE_REGS", "GENERAL_REGS", "FLOAT_REGS", \
517 "NON_SPECIAL_REGS", "MQ_REGS", "LINK_REGS", "CTR_REGS", \
518 "LINK_OR_CTR_REGS", "SPECIAL_REGS", "SPEC_OR_GEN_REGS", \
519 "CR0_REGS", "CR_REGS", "NON_FLOAT_REGS", "ALL_REGS" }
521 /* Define which registers fit in which classes.
522 This is an initializer for a vector of HARD_REG_SET
523 of length N_REG_CLASSES. */
525 #define REG_CLASS_CONTENTS \
526 { {0, 0, 0}, {0xfffffffe, 0, 8}, {~0, 0, 8}, \
527 {0, ~0, 0}, {~0, ~0, 8}, {0, 0, 1}, {0, 0, 2}, \
528 {0, 0, 4}, {0, 0, 6}, {0, 0, 7}, {~0, 0, 15}, \
529 {0, 0, 16}, {0, 0, 0xff0}, {~0, 0, 0xffff}, \
532 /* The same information, inverted:
533 Return the class number of the smallest class containing
534 reg number REGNO. This could be a conditional expression
535 or could index an array. */
537 #define REGNO_REG_CLASS(REGNO) \
538 ((REGNO) == 0 ? GENERAL_REGS \
539 : (REGNO) < 32 ? BASE_REGS \
540 : FP_REGNO_P (REGNO) ? FLOAT_REGS \
541 : (REGNO) == 68 ? CR0_REGS \
542 : CR_REGNO_P (REGNO) ? CR_REGS \
543 : (REGNO) == 64 ? MQ_REGS \
544 : (REGNO) == 65 ? LINK_REGS \
545 : (REGNO) == 66 ? CTR_REGS \
546 : (REGNO) == 67 ? BASE_REGS \
549 /* The class value for index registers, and the one for base regs. */
550 #define INDEX_REG_CLASS GENERAL_REGS
551 #define BASE_REG_CLASS BASE_REGS
553 /* Get reg_class from a letter such as appears in the machine description. */
555 #define REG_CLASS_FROM_LETTER(C) \
556 ((C) == 'f' ? FLOAT_REGS \
557 : (C) == 'b' ? BASE_REGS \
558 : (C) == 'h' ? SPECIAL_REGS \
559 : (C) == 'q' ? MQ_REGS \
560 : (C) == 'c' ? CTR_REGS \
561 : (C) == 'l' ? LINK_REGS \
562 : (C) == 'x' ? CR0_REGS \
563 : (C) == 'y' ? CR_REGS \
566 /* The letters I, J, K, L, M, N, and P in a register constraint string
567 can be used to stand for particular ranges of immediate operands.
568 This macro defines what the ranges are.
569 C is the letter, and VALUE is a constant value.
570 Return 1 if VALUE is in the range specified by C.
572 `I' is signed 16-bit constants
573 `J' is a constant with only the high-order 16 bits non-zero
574 `K' is a constant with only the low-order 16 bits non-zero
575 `L' is a constant that can be placed into a mask operand
576 `M' is a constant that is greater than 31
577 `N' is a constant that is an exact power of two
578 `O' is the constant zero
579 `P' is a constant whose negation is a signed 16-bit constant */
581 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
582 ( (C) == 'I' ? (unsigned) ((VALUE) + 0x8000) < 0x10000 \
583 : (C) == 'J' ? ((VALUE) & 0xffff) == 0 \
584 : (C) == 'K' ? ((VALUE) & 0xffff0000) == 0 \
585 : (C) == 'L' ? mask_constant (VALUE) \
586 : (C) == 'M' ? (VALUE) > 31 \
587 : (C) == 'N' ? exact_log2 (VALUE) >= 0 \
588 : (C) == 'O' ? (VALUE) == 0 \
589 : (C) == 'P' ? (unsigned) ((- (VALUE)) + 0x8000) < 0x1000 \
592 /* Similar, but for floating constants, and defining letters G and H.
593 Here VALUE is the CONST_DOUBLE rtx itself.
595 We flag for special constants when we can copy the constant into
596 a general register in two insns for DF and one insn for SF. */
598 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
599 ((C) == 'G' ? easy_fp_constant (VALUE, GET_MODE (VALUE)) : 0)
601 /* Optional extra constraints for this machine.
603 For the RS/6000, `Q' means that this is a memory operand that is just
604 an offset from a register. */
606 #define EXTRA_CONSTRAINT(OP, C) \
607 ((C) == 'Q' ? GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == REG \
610 /* Given an rtx X being reloaded into a reg required to be
611 in class CLASS, return the class of reg to actually use.
612 In general this is just CLASS; but on some machines
613 in some cases it is preferable to use a more restrictive class.
615 On the RS/6000, we have to return NO_REGS when we want to reload a
616 floating-point CONST_DOUBLE to force it to be copied to memory. */
618 #define PREFERRED_RELOAD_CLASS(X,CLASS) \
619 ((GET_CODE (X) == CONST_DOUBLE \
620 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) \
623 /* Return the register class of a scratch register needed to copy IN into
624 or out of a register in CLASS in MODE. If it can be done directly,
625 NO_REGS is returned. */
627 #define SECONDARY_RELOAD_CLASS(CLASS,MODE,IN) \
628 secondary_reload_class (CLASS, MODE, IN)
630 /* If we are copying between FP registers and anything else, we need a memory
633 #define SECONDARY_MEMORY_NEEDED(CLASS1,CLASS2,MODE) \
634 ((CLASS1) != (CLASS2) && ((CLASS1) == FLOAT_REGS || (CLASS2) == FLOAT_REGS))
636 /* Return the maximum number of consecutive registers
637 needed to represent mode MODE in a register of class CLASS.
639 On RS/6000, this is the size of MODE in words,
640 except in the FP regs, where a single reg is enough for two words. */
641 #define CLASS_MAX_NREGS(CLASS, MODE) \
642 ((CLASS) == FLOAT_REGS \
643 ? ((GET_MODE_SIZE (MODE) + 2 * UNITS_PER_WORD - 1) / (2 * UNITS_PER_WORD)) \
644 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
646 /* Stack layout; function entry, exit and calling. */
648 /* Define this if pushing a word on the stack
649 makes the stack pointer a smaller address. */
650 #define STACK_GROWS_DOWNWARD
652 /* Define this if the nominal address of the stack frame
653 is at the high-address end of the local variables;
654 that is, each additional local variable allocated
655 goes at a more negative offset in the frame.
657 On the RS/6000, we grow upwards, from the area after the outgoing
659 /* #define FRAME_GROWS_DOWNWARD */
661 /* Offset within stack frame to start allocating local variables at.
662 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
663 first local allocated. Otherwise, it is the offset to the BEGINNING
664 of the first local allocated.
666 On the RS/6000, the frame pointer is the same as the stack pointer,
667 except for dynamic allocations. So we start after the fixed area and
668 outgoing parameter area. */
670 #define STARTING_FRAME_OFFSET (current_function_outgoing_args_size + 24)
672 /* If we generate an insn to push BYTES bytes,
673 this says how many the stack pointer really advances by.
674 On RS/6000, don't define this because there are no push insns. */
675 /* #define PUSH_ROUNDING(BYTES) */
677 /* Offset of first parameter from the argument pointer register value.
678 On the RS/6000, we define the argument pointer to the start of the fixed
680 #define FIRST_PARM_OFFSET(FNDECL) 24
682 /* Define this if stack space is still allocated for a parameter passed
683 in a register. The value is the number of bytes allocated to this
685 #define REG_PARM_STACK_SPACE(FNDECL) 32
687 /* Define this if the above stack space is to be considered part of the
688 space allocated by the caller. */
689 #define OUTGOING_REG_PARM_STACK_SPACE
691 /* This is the difference between the logical top of stack and the actual sp.
693 For the RS/6000, sp points past the fixed area. */
694 #define STACK_POINTER_OFFSET 24
696 /* Define this if the maximum size of all the outgoing args is to be
697 accumulated and pushed during the prologue. The amount can be
698 found in the variable current_function_outgoing_args_size. */
699 #define ACCUMULATE_OUTGOING_ARGS
701 /* Value is the number of bytes of arguments automatically
702 popped when returning from a subroutine call.
703 FUNTYPE is the data type of the function (as a tree),
704 or for a library call it is an identifier node for the subroutine name.
705 SIZE is the number of bytes of arguments passed on the stack. */
707 #define RETURN_POPS_ARGS(FUNTYPE,SIZE) 0
709 /* Define how to find the value returned by a function.
710 VALTYPE is the data type of the value (as a tree).
711 If the precise function being called is known, FUNC is its FUNCTION_DECL;
712 otherwise, FUNC is 0.
714 On RS/6000 an integer value is in r3 and a floating-point value is in
717 #define FUNCTION_VALUE(VALTYPE, FUNC) \
718 gen_rtx (REG, TYPE_MODE (VALTYPE), \
719 TREE_CODE (VALTYPE) == REAL_TYPE ? 33 : 3)
721 /* Define how to find the value returned by a library function
722 assuming the value has mode MODE. */
724 #define LIBCALL_VALUE(MODE) \
725 gen_rtx (REG, MODE, GET_MODE_CLASS (MODE) == MODE_FLOAT ? 33 : 3)
727 /* The definition of this macro implies that there are cases where
728 a scalar value cannot be returned in registers.
730 For the RS/6000, any structure or union type is returned in memory. */
732 #define RETURN_IN_MEMORY(TYPE) \
733 (TYPE_MODE (TYPE) == BLKmode)
735 /* 1 if N is a possible register number for a function value
736 as seen by the caller.
738 On RS/6000, this is r3 and fp1. */
740 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 3 || ((N) == 33))
742 /* 1 if N is a possible register number for function argument passing.
743 On RS/6000, these are r3-r10 and fp1-fp13. */
745 #define FUNCTION_ARG_REGNO_P(N) \
746 (((N) <= 10 && (N) >= 3) || ((N) >= 33 && (N) <= 45))
748 /* Define a data type for recording info about an argument list
749 during the scan of that argument list. This data type should
750 hold all necessary information about the function itself
751 and about the args processed so far, enough to enable macros
752 such as FUNCTION_ARG to determine where the next arg should go.
754 On the RS/6000, this is a structure. The first element is the number of
755 total argument words, the second is used to store the next
756 floating-point register number, and the third says how many more args we
757 have prototype types for. */
759 struct rs6000_args
{int words
, fregno
, nargs_prototype
; };
760 #define CUMULATIVE_ARGS struct rs6000_args
762 /* Define intermediate macro to compute the size (in registers) of an argument
765 #define RS6000_ARG_SIZE(MODE, TYPE, NAMED) \
767 : (MODE) != BLKmode \
768 ? (GET_MODE_SIZE (MODE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD \
769 : (int_size_in_bytes (TYPE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
771 /* Initialize a variable CUM of type CUMULATIVE_ARGS
772 for a call to a function whose data type is FNTYPE.
773 For a library call, FNTYPE is 0. */
775 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME) \
778 (CUM).nargs_prototype = (FNTYPE && TYPE_ARG_TYPES (FNTYPE) \
779 ? (list_length (TYPE_ARG_TYPES (FNTYPE)) - 1 \
780 + (TYPE_MODE (TREE_TYPE (FNTYPE)) == BLKmode \
781 || RETURN_IN_MEMORY (TREE_TYPE (FNTYPE)))) \
784 /* Similar, but when scanning the definition of a procedure. We always
785 set NARGS_PROTOTYPE large so we never return an EXPR_LIST. */
787 #define INIT_CUMULATIVE_INCOMING_ARGS(CUM,FNTYPE,IGNORE) \
790 (CUM).nargs_prototype = 1000
792 /* Update the data in CUM to advance over an argument
793 of mode MODE and data type TYPE.
794 (TYPE is null for libcalls where that information may not be available.) */
796 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
797 { (CUM).nargs_prototype--; \
800 (CUM).words += RS6000_ARG_SIZE (MODE, TYPE, NAMED); \
801 if (GET_MODE_CLASS (MODE) == MODE_FLOAT) \
806 /* Non-zero if we can use a floating-point register to pass this arg. */
807 #define USE_FP_FOR_ARG_P(CUM,MODE,TYPE) \
808 (GET_MODE_CLASS (MODE) == MODE_FLOAT && (CUM).fregno < 46)
810 /* Determine where to put an argument to a function.
811 Value is zero to push the argument on the stack,
812 or a hard register in which to store the argument.
814 MODE is the argument's machine mode.
815 TYPE is the data type of the argument (as a tree).
816 This is null for libcalls where that information may
818 CUM is a variable of type CUMULATIVE_ARGS which gives info about
819 the preceding args and about the function being called.
820 NAMED is nonzero if this argument is a named parameter
821 (otherwise it is an extra parameter matching an ellipsis).
823 On RS/6000 the first eight words of non-FP are normally in registers
824 and the rest are pushed. The first 13 FP args are in registers.
826 If this is floating-point and no prototype is specified, we use
827 both an FP and integer register (or possibly FP reg and stack). Library
828 functions (when TYPE is zero) always have the proper types for args,
829 so we can pass the FP value just in one register. emit_library_function
830 doesn't support EXPR_LIST anyway. */
832 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
834 : ((TYPE) != 0 && TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST) ? 0 \
835 : USE_FP_FOR_ARG_P (CUM, MODE, TYPE) \
836 ? ((CUM).nargs_prototype > 0 || (TYPE) == 0 \
837 ? gen_rtx (REG, MODE, (CUM).fregno) \
839 ? gen_rtx (EXPR_LIST, VOIDmode, \
840 gen_rtx (REG, (MODE), 3 + (CUM).words), \
841 gen_rtx (REG, (MODE), (CUM).fregno)) \
842 : gen_rtx (EXPR_LIST, VOIDmode, 0, \
843 gen_rtx (REG, (MODE), (CUM).fregno)))) \
844 : (CUM).words < 8 ? gen_rtx(REG, (MODE), 3 + (CUM).words) : 0)
846 /* For an arg passed partly in registers and partly in memory,
847 this is the number of registers used.
848 For args passed entirely in registers or entirely in memory, zero. */
850 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
852 : USE_FP_FOR_ARG_P (CUM, MODE, TYPE) && (CUM).nargs_prototype >= 0 ? 0 \
853 : (((CUM).words < 8 \
854 && 8 < ((CUM).words + RS6000_ARG_SIZE (MODE, TYPE, NAMED))) \
855 ? 8 - (CUM).words : 0))
857 /* Perform any needed actions needed for a function that is receiving a
858 variable number of arguments.
862 MODE and TYPE are the mode and type of the current parameter.
864 PRETEND_SIZE is a variable that should be set to the amount of stack
865 that must be pushed by the prolog to pretend that our caller pushed
868 Normally, this macro will push all remaining incoming registers on the
869 stack and set PRETEND_SIZE to the length of the registers pushed. */
871 #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
872 { if ((CUM).words < 8) \
874 int first_reg_offset = (CUM).words; \
876 if (MUST_PASS_IN_STACK (MODE, TYPE)) \
877 first_reg_offset += RS6000_ARG_SIZE (TYPE_MODE (TYPE), TYPE, 1); \
879 if (first_reg_offset > 8) \
880 first_reg_offset = 8; \
882 if (! (NO_RTL) && first_reg_offset != 8) \
883 move_block_from_reg \
884 (3 + first_reg_offset, \
885 gen_rtx (MEM, BLKmode, \
886 plus_constant (virtual_incoming_args_rtx, \
887 first_reg_offset * 4)), \
888 8 - first_reg_offset, (8 - first_reg_offset) * UNITS_PER_WORD); \
889 PRETEND_SIZE = (8 - first_reg_offset) * UNITS_PER_WORD; \
893 /* This macro generates the assembly code for function entry.
894 FILE is a stdio stream to output the code to.
895 SIZE is an int: how many units of temporary storage to allocate.
896 Refer to the array `regs_ever_live' to determine which registers
897 to save; `regs_ever_live[I]' is nonzero if register number I
898 is ever used in the function. This macro is responsible for
899 knowing which registers should not be saved even if used. */
901 #define FUNCTION_PROLOGUE(FILE, SIZE) output_prolog (FILE, SIZE)
903 /* Output assembler code to FILE to increment profiler label # LABELNO
904 for profiling a function entry. */
906 #define FUNCTION_PROFILER(FILE, LABELNO) \
907 output_function_profiler ((FILE), (LABELNO));
909 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
910 the stack pointer does not matter. No definition is equivalent to
913 On the RS/6000, this is non-zero because we can restore the stack from
914 its backpointer, which we maintain. */
915 #define EXIT_IGNORE_STACK 1
917 /* This macro generates the assembly code for function exit,
918 on machines that need it. If FUNCTION_EPILOGUE is not defined
919 then individual return instructions are generated for each
920 return statement. Args are same as for FUNCTION_PROLOGUE.
922 The function epilogue should not depend on the current stack pointer!
923 It should use the frame pointer only. This is mandatory because
924 of alloca; we also take advantage of it to omit stack adjustments
927 #define FUNCTION_EPILOGUE(FILE, SIZE) output_epilog (FILE, SIZE)
929 /* Output assembler code for a block containing the constant parts
930 of a trampoline, leaving space for the variable parts.
932 The trampoline should set the static chain pointer to value placed
933 into the trampoline and should branch to the specified routine.
935 On the RS/6000, this is not code at all, but merely a data area,
936 since that is the way all functions are called. The first word is
937 the address of the function, the second word is the TOC pointer (r2),
938 and the third word is the static chain value. */
940 #define TRAMPOLINE_TEMPLATE(FILE) { fprintf (FILE, "\t.long 0, 0, 0\n"); }
942 /* Length in units of the trampoline for entering a nested function. */
944 #define TRAMPOLINE_SIZE 12
946 /* Emit RTL insns to initialize the variable parts of a trampoline.
947 FNADDR is an RTX for the address of the function's pure code.
948 CXT is an RTX for the static chain value for the function. */
950 #define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, CXT) \
952 emit_move_insn (gen_rtx (MEM, SImode, \
953 memory_address (SImode, (ADDR))), \
954 gen_rtx (MEM, SImode, \
955 memory_address (SImode, (FNADDR)))); \
956 emit_move_insn (gen_rtx (MEM, SImode, \
957 memory_address (SImode, \
958 plus_constant ((ADDR), 4))), \
959 gen_rtx (MEM, SImode, \
960 memory_address (SImode, \
961 plus_constant ((FNADDR), 4)))); \
962 emit_move_insn (gen_rtx (MEM, SImode, \
963 memory_address (SImode, \
964 plus_constant ((ADDR), 8))), \
965 force_reg (SImode, (CXT))); \
968 /* Definitions for register eliminations.
970 We have two registers that can be eliminated on the RS/6000. First, the
971 frame pointer register can often be eliminated in favor of the stack
972 pointer register. Secondly, the argument pointer register can always be
973 eliminated; it is replaced with either the stack or frame pointer.
975 In addition, we use the elimination mechanism to see if r30 is needed
976 Initially we assume that it isn't. If it is, we spill it. This is done
977 by making it an eliminable register. We replace it with itself so that
978 if it isn't needed, then existing uses won't be modified. */
980 /* This is an array of structures. Each structure initializes one pair
981 of eliminable registers. The "from" register number is given first,
982 followed by "to". Eliminations of the same "from" register are listed
983 in order of preference. */
984 #define ELIMINABLE_REGS \
985 {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
986 { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
987 { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
990 /* Given FROM and TO register numbers, say whether this elimination is allowed.
991 Frame pointer elimination is automatically handled.
993 For the RS/6000, if frame pointer elimination is being done, we would like
994 to convert ap into fp, not sp.
996 We need r30 if -mmininal-toc was specified, and there are constant pool
999 #define CAN_ELIMINATE(FROM, TO) \
1000 ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \
1001 ? ! frame_pointer_needed \
1002 : (FROM) == 30 ? ! TARGET_MINIMAL_TOC || get_pool_size () == 0 \
1005 /* Define the offset between two registers, one to be eliminated, and the other
1006 its replacement, at the start of a routine. */
1007 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
1009 int total_stack_size = (rs6000_sa_size () + get_frame_size () \
1010 + current_function_outgoing_args_size); \
1012 total_stack_size = (total_stack_size + 7) & ~7; \
1014 if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
1016 if (rs6000_pushes_stack ()) \
1019 (OFFSET) = - total_stack_size; \
1021 else if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \
1022 (OFFSET) = total_stack_size; \
1023 else if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
1025 if (rs6000_pushes_stack ()) \
1026 (OFFSET) = total_stack_size; \
1030 else if ((FROM) == 30) \
1036 /* Addressing modes, and classification of registers for them. */
1038 /* #define HAVE_POST_INCREMENT */
1039 /* #define HAVE_POST_DECREMENT */
1041 #define HAVE_PRE_DECREMENT
1042 #define HAVE_PRE_INCREMENT
1044 /* Macros to check register numbers against specific register classes. */
1046 /* These assume that REGNO is a hard or pseudo reg number.
1047 They give nonzero only if REGNO is a hard reg of the suitable class
1048 or a pseudo reg currently allocated to a suitable hard reg.
1049 Since they use reg_renumber, they are safe only once reg_renumber
1050 has been allocated, which happens in local-alloc.c. */
1052 #define REGNO_OK_FOR_INDEX_P(REGNO) \
1053 ((REGNO) < FIRST_PSEUDO_REGISTER \
1054 ? (REGNO) <= 31 || (REGNO) == 67 \
1055 : (reg_renumber[REGNO] >= 0 \
1056 && (reg_renumber[REGNO] <= 31 || reg_renumber[REGNO] == 67)))
1058 #define REGNO_OK_FOR_BASE_P(REGNO) \
1059 ((REGNO) < FIRST_PSEUDO_REGISTER \
1060 ? ((REGNO) > 0 && (REGNO) <= 31) || (REGNO) == 67 \
1061 : (reg_renumber[REGNO] > 0 \
1062 && (reg_renumber[REGNO] <= 31 || reg_renumber[REGNO] == 67)))
1064 /* Maximum number of registers that can appear in a valid memory address. */
1066 #define MAX_REGS_PER_ADDRESS 2
1068 /* Recognize any constant value that is a valid address. */
1070 #define CONSTANT_ADDRESS_P(X) \
1071 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
1072 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
1073 || GET_CODE (X) == HIGH)
1075 /* Nonzero if the constant value X is a legitimate general operand.
1076 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.
1078 On the RS/6000, all integer constants are acceptable, most won't be valid
1079 for particular insns, though. Only easy FP constants are
1082 #define LEGITIMATE_CONSTANT_P(X) \
1083 (GET_CODE (X) != CONST_DOUBLE || GET_MODE (X) == VOIDmode \
1084 || easy_fp_constant (X, GET_MODE (X)))
1086 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1087 and check its validity for a certain class.
1088 We have two alternate definitions for each of them.
1089 The usual definition accepts all pseudo regs; the other rejects
1090 them unless they have been allocated suitable hard regs.
1091 The symbol REG_OK_STRICT causes the latter definition to be used.
1093 Most source files want to accept pseudo regs in the hope that
1094 they will get allocated to the class that the insn wants them to be in.
1095 Source files for reload pass need to be strict.
1096 After reload, it makes no difference, since pseudo regs have
1097 been eliminated by then. */
1099 #ifndef REG_OK_STRICT
1101 /* Nonzero if X is a hard reg that can be used as an index
1102 or if it is a pseudo reg. */
1103 #define REG_OK_FOR_INDEX_P(X) \
1104 (REGNO (X) <= 31 || REGNO (X) == 67 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
1106 /* Nonzero if X is a hard reg that can be used as a base reg
1107 or if it is a pseudo reg. */
1108 #define REG_OK_FOR_BASE_P(X) \
1109 (REGNO (X) > 0 && REG_OK_FOR_INDEX_P (X))
1113 /* Nonzero if X is a hard reg that can be used as an index. */
1114 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
1115 /* Nonzero if X is a hard reg that can be used as a base reg. */
1116 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1120 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1121 that is a valid memory address for an instruction.
1122 The MODE argument is the machine mode for the MEM expression
1123 that wants to use this address.
1125 On the RS/6000, there are four valid address: a SYMBOL_REF that
1126 refers to a constant pool entry of an address (or the sum of it
1127 plus a constant), a short (16-bit signed) constant plus a register,
1128 the sum of two registers, or a register indirect, possibly with an
1129 auto-increment. For DFmode and DImode with an constant plus register,
1130 we must ensure that both words are addressable. */
1132 #define LEGITIMATE_CONSTANT_POOL_BASE_P(X) \
1133 (GET_CODE (X) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (X) \
1134 && ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (get_pool_constant (X)))
1136 #define LEGITIMATE_CONSTANT_POOL_ADDRESS_P(X) \
1137 (LEGITIMATE_CONSTANT_POOL_BASE_P (X) \
1138 || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
1139 && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT \
1140 && LEGITIMATE_CONSTANT_POOL_BASE_P (XEXP (XEXP (X, 0), 0))))
1142 #define LEGITIMATE_ADDRESS_INTEGER_P(X,OFFSET) \
1143 (GET_CODE (X) == CONST_INT \
1144 && (unsigned) (INTVAL (X) + (OFFSET) + 0x8000) < 0x10000)
1146 #define LEGITIMATE_OFFSET_ADDRESS_P(MODE,X) \
1147 (GET_CODE (X) == PLUS \
1148 && GET_CODE (XEXP (X, 0)) == REG \
1149 && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
1150 && LEGITIMATE_ADDRESS_INTEGER_P (XEXP (X, 1), 0) \
1151 && (((MODE) != DFmode && (MODE) != DImode) \
1152 || LEGITIMATE_ADDRESS_INTEGER_P (XEXP (X, 1), 4)))
1154 #define LEGITIMATE_INDEXED_ADDRESS_P(X) \
1155 (GET_CODE (X) == PLUS \
1156 && GET_CODE (XEXP (X, 0)) == REG \
1157 && GET_CODE (XEXP (X, 1)) == REG \
1158 && ((REG_OK_FOR_BASE_P (XEXP (X, 0)) \
1159 && REG_OK_FOR_INDEX_P (XEXP (X, 1))) \
1160 || (REG_OK_FOR_BASE_P (XEXP (X, 1)) \
1161 && REG_OK_FOR_INDEX_P (XEXP (X, 0)))))
1163 #define LEGITIMATE_INDIRECT_ADDRESS_P(X) \
1164 (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))
1166 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1167 { if (LEGITIMATE_INDIRECT_ADDRESS_P (X)) \
1169 if (GET_CODE (X) == PRE_INC \
1170 && LEGITIMATE_INDIRECT_ADDRESS_P (XEXP (X, 0))) \
1172 if (GET_CODE (X) == PRE_DEC \
1173 && LEGITIMATE_INDIRECT_ADDRESS_P (XEXP (X, 0))) \
1175 if (LEGITIMATE_CONSTANT_POOL_ADDRESS_P (X)) \
1177 if (LEGITIMATE_OFFSET_ADDRESS_P (MODE, X)) \
1179 if ((MODE) != DImode && (MODE) != TImode \
1180 && LEGITIMATE_INDEXED_ADDRESS_P (X)) \
1184 /* Try machine-dependent ways of modifying an illegitimate address
1185 to be legitimate. If we find one, return the new, valid address.
1186 This macro is used in only one place: `memory_address' in explow.c.
1188 OLDX is the address as it was before break_out_memory_refs was called.
1189 In some cases it is useful to look at this to decide what needs to be done.
1191 MODE and WIN are passed so that this macro can use
1192 GO_IF_LEGITIMATE_ADDRESS.
1194 It is always safe for this macro to do nothing. It exists to recognize
1195 opportunities to optimize the output.
1197 On RS/6000, first check for the sum of a register with a constant
1198 integer that is out of range. If so, generate code to add the
1199 constant with the low-order 16 bits masked to the register and force
1200 this result into another register (this can be done with `cau').
1201 Then generate an address of REG+(CONST&0xffff), allowing for the
1202 possibility of bit 16 being a one.
1204 Then check for the sum of a register and something not constant, try to
1205 load the other things into a register and return the sum. */
1207 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
1208 { if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == REG \
1209 && GET_CODE (XEXP (X, 1)) == CONST_INT \
1210 && (unsigned) (INTVAL (XEXP (X, 1)) + 0x8000) >= 0x10000) \
1211 { int high_int, low_int; \
1212 high_int = INTVAL (XEXP (X, 1)) >> 16; \
1213 low_int = INTVAL (XEXP (X, 1)) & 0xffff; \
1214 if (low_int & 0x8000) \
1215 high_int += 1, low_int |= 0xffff0000; \
1216 (X) = gen_rtx (PLUS, SImode, \
1218 (gen_rtx (PLUS, SImode, XEXP (X, 0), \
1219 gen_rtx (CONST_INT, VOIDmode, \
1220 high_int << 16)), 0),\
1221 gen_rtx (CONST_INT, VOIDmode, low_int)); \
1224 else if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == REG \
1225 && GET_CODE (XEXP (X, 1)) != CONST_INT \
1226 && (MODE) != DImode && (MODE) != TImode) \
1228 (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
1229 force_reg (SImode, force_operand (XEXP (X, 1), 0))); \
1234 /* Go to LABEL if ADDR (a legitimate address expression)
1235 has an effect that depends on the machine mode it is used for.
1237 On the RS/6000 this is true if the address is valid with a zero offset
1238 but not with an offset of four (this means it cannot be used as an
1239 address for DImode or DFmode) or is a pre-increment or decrement. Since
1240 we know it is valid, we just check for an address that is not valid with
1241 an offset of four. */
1243 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1244 { if (GET_CODE (ADDR) == PLUS \
1245 && LEGITIMATE_ADDRESS_INTEGER_P (XEXP (ADDR, 1), 0) \
1246 && ! LEGITIMATE_ADDRESS_INTEGER_P (XEXP (ADDR, 1), 4)) \
1248 if (GET_CODE (ADDR) == PRE_INC) \
1250 if (GET_CODE (ADDR) == PRE_DEC) \
1254 /* Define this if some processing needs to be done immediately before
1255 emitting code for an insn. */
1257 /* #define FINAL_PRESCAN_INSN(INSN,OPERANDS,NOPERANDS) */
1259 /* Specify the machine mode that this machine uses
1260 for the index in the tablejump instruction. */
1261 #define CASE_VECTOR_MODE SImode
1263 /* Define this if the tablejump instruction expects the table
1264 to contain offsets from the address of the table.
1265 Do not define this if the table should contain absolute addresses. */
1266 #define CASE_VECTOR_PC_RELATIVE
1268 /* Specify the tree operation to be used to convert reals to integers. */
1269 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1271 /* This is the kind of divide that is easiest to do in the general case. */
1272 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
1274 /* Define this as 1 if `char' should by default be signed; else as 0. */
1275 #define DEFAULT_SIGNED_CHAR 0
1277 /* This flag, if defined, says the same insns that convert to a signed fixnum
1278 also convert validly to an unsigned one. */
1280 /* #define FIXUNS_TRUNC_LIKE_FIX_TRUNC */
1282 /* Max number of bytes we can move from memory to memory
1283 in one reasonably fast instruction. */
1286 /* Nonzero if access to memory by bytes is no faster than for words.
1287 Also non-zero if doing byte operations (specifically shifts) in registers
1289 #define SLOW_BYTE_ACCESS 1
1291 /* Define if normal loads of shorter-than-word items from memory clears
1292 the rest of the bigs in the register. */
1293 #define BYTE_LOADS_ZERO_EXTEND
1295 /* Define if loading short immediate values into registers sign extends. */
1296 #define SHORT_IMMEDIATES_SIGN_EXTEND
1298 /* The RS/6000 uses the XCOFF format. */
1300 #define XCOFF_DEBUGGING_INFO
1302 /* Define if the object format being used is COFF or a superset. */
1303 #define OBJECT_FORMAT_COFF
1305 /* Define the magic numbers that we recognize as COFF. */
1307 #define MY_ISCOFF(magic) \
1308 ((magic) == U802WRMAGIC || (magic) == U802ROMAGIC || (magic) == U802TOCMAGIC)
1310 /* This is the only version of nm that collect2 can work with. */
1311 #define REAL_NM_FILE_NAME "/usr/ucb/nm"
1313 /* We don't have GAS for the RS/6000 yet, so don't write out special
1314 .stabs in cc1plus. */
1316 #define FASCIST_ASSEMBLER
1318 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1319 is done just by pretending it is already truncated. */
1320 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1322 /* Specify the machine mode that pointers have.
1323 After generation of rtl, the compiler makes no further distinction
1324 between pointers and any other objects of this machine mode. */
1325 #define Pmode SImode
1327 /* Mode of a function address in a call instruction (for indexing purposes).
1329 Doesn't matter on RS/6000. */
1330 #define FUNCTION_MODE SImode
1332 /* Define this if addresses of constant functions
1333 shouldn't be put through pseudo regs where they can be cse'd.
1334 Desirable on machines where ordinary constants are expensive
1335 but a CALL with constant address is cheap. */
1336 #define NO_FUNCTION_CSE
1338 /* Define this if shift instructions ignore all but the low-order
1340 #define SHIFT_COUNT_TRUNCATED
1342 /* Use atexit for static constructors/destructors, instead of defining
1343 our own exit function. */
1346 /* Compute the cost of computing a constant rtl expression RTX
1347 whose rtx-code is CODE. The body of this macro is a portion
1348 of a switch statement. If the code is computed here,
1349 return it with a return statement. Otherwise, break from the switch.
1351 On the RS/6000, if it is legal in the insn, it is free. So this
1352 always returns 0. */
1354 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
1359 case CONST_DOUBLE: \
1362 /* Provide the costs of a rtl expression. This is in the body of a
1365 #define RTX_COSTS(X,CODE,OUTER_CODE) \
1367 return (GET_CODE (XEXP (X, 1)) != CONST_INT \
1368 ? COSTS_N_INSNS (5) \
1369 : INTVAL (XEXP (X, 1)) >= -256 && INTVAL (XEXP (X, 1)) <= 255 \
1370 ? COSTS_N_INSNS (3) : COSTS_N_INSNS (4)); \
1373 if (GET_CODE (XEXP (X, 1)) == CONST_INT \
1374 && exact_log2 (INTVAL (XEXP (X, 1))) >= 0) \
1375 return COSTS_N_INSNS (2); \
1376 /* otherwise fall through to normal divide. */ \
1379 return COSTS_N_INSNS (19); \
1381 /* MEM should be slightly more expensive than (plus (reg) (const)) */ \
1384 /* Compute the cost of an address. This is meant to approximate the size
1385 and/or execution delay of an insn using that address. If the cost is
1386 approximated by the RTL complexity, including CONST_COSTS above, as
1387 is usually the case for CISC machines, this macro should not be defined.
1388 For aggressively RISCy machines, only one insn format is allowed, so
1389 this macro should be a constant. The value of this macro only matters
1390 for valid addresses.
1392 For the RS/6000, everything is cost 0. */
1394 #define ADDRESS_COST(RTX) 0
1396 /* Adjust the length of an INSN. LENGTH is the currently-computed length and
1397 should be adjusted to reflect any required changes. This macro is used when
1398 there is some systematic length adjustment required that would be difficult
1399 to express in the length attribute. */
1401 /* #define ADJUST_INSN_LENGTH(X,LENGTH) */
1403 /* Add any extra modes needed to represent the condition code.
1405 For the RS/6000, we need separate modes when unsigned (logical) comparisons
1406 are being done and we need a separate mode for floating-point. We also
1407 use a mode for the case when we are comparing the results of two
1410 #define EXTRA_CC_MODES CCUNSmode, CCFPmode, CCEQmode
1412 /* Define the names for the modes specified above. */
1413 #define EXTRA_CC_NAMES "CCUNS", "CCFP", "CCEQ"
1415 /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
1416 return the mode to be used for the comparison. For floating-point, CCFPmode
1417 should be used. CCUNSmode should be used for unsigned comparisons.
1418 CCEQmode should be used when we are doing an inequality comparison on
1419 the result of a comparison. CCmode should be used in all other cases. */
1421 #define SELECT_CC_MODE(OP,X,Y) \
1422 (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT ? CCFPmode \
1423 : (OP) == GTU || (OP) == LTU || (OP) == GEU || (OP) == LEU ? CCUNSmode \
1424 : (((OP) == EQ || (OP) == NE) && GET_RTX_CLASS (GET_CODE (X)) == '<' \
1425 ? CCEQmode : CCmode))
1427 /* Define the information needed to generate branch and scc insns. This is
1428 stored from the compare operation. Note that we can't use "rtx" here
1429 since it hasn't been defined! */
1431 extern struct rtx_def
*rs6000_compare_op0
, *rs6000_compare_op1
;
1432 extern int rs6000_compare_fp_p
;
1434 /* Set to non-zero by "fix" operation to indicate that itrunc and
1435 uitrunc must be defined. */
1437 extern int rs6000_trunc_used
;
1439 /* Control the assembler format that we output. */
1441 /* Output at beginning of assembler file.
1443 Initialize the section names for the RS/6000 at this point.
1445 We want to go into the TOC section so at least one .toc will be emitted.
1446 Also, in order to output proper .bs/.es pairs, we need at least one static
1447 [RW] section emitted.
1449 We then switch back to text to force the gcc2_compiled. label and the space
1450 allocated after it (when profiling) into the text section.
1452 Finally, declare mcount when profiling to make the assembler happy. */
1454 #define ASM_FILE_START(FILE) \
1456 rs6000_gen_section_name (&xcoff_bss_section_name, \
1457 main_input_filename, ".bss_"); \
1458 rs6000_gen_section_name (&xcoff_private_data_section_name, \
1459 main_input_filename, ".rw_"); \
1460 rs6000_gen_section_name (&xcoff_read_only_section_name, \
1461 main_input_filename, ".ro_"); \
1464 if (write_symbols != NO_DEBUG) \
1465 private_data_section (); \
1468 fprintf (FILE, "\t.extern .mcount\n"); \
1471 /* Output at end of assembler file.
1473 On the RS/6000, referencing data should automatically pull in text. */
1475 #define ASM_FILE_END(FILE) \
1478 fprintf (FILE, "_section_.text:\n"); \
1480 fprintf (FILE, "\t.long _section_.text\n"); \
1483 /* We define this to prevent the name mangler from putting dollar signs into
1486 #define NO_DOLLAR_IN_LABEL
1488 /* We define this to 0 so that gcc will never accept a dollar sign in a
1489 variable name. This is needed because the AIX assembler will not accept
1492 #define DOLLARS_IN_IDENTIFIERS 0
1494 /* Implicit library calls should use memcpy, not bcopy, etc. */
1496 #define TARGET_MEM_FUNCTIONS
1498 /* Define the extra sections we need. We define three: one is the read-only
1499 data section which is used for constants. This is a csect whose name is
1500 derived from the name of the input file. The second is for initialized
1501 global variables. This is a csect whose name is that of the variable.
1502 The third is the TOC. */
1504 #define EXTRA_SECTIONS \
1505 read_only_data, private_data, read_only_private_data, toc, bss
1507 /* Define the name of our readonly data section. */
1509 #define READONLY_DATA_SECTION read_only_data_section
1511 /* If we are referencing a function that is static or is known to be
1512 in this file, make the SYMBOL_REF special. We can use this to indicate
1513 that we can branch to this function without emitting a no-op after the
1516 #define ENCODE_SECTION_INFO(DECL) \
1517 if (TREE_CODE (DECL) == FUNCTION_DECL \
1518 && (TREE_ASM_WRITTEN (DECL) || ! TREE_PUBLIC (DECL))) \
1519 SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1;
1521 /* Indicate that jump tables go in the text section. */
1523 #define JUMP_TABLES_IN_TEXT_SECTION
1525 /* Define the routines to implement these extra sections. */
1527 #define EXTRA_SECTION_FUNCTIONS \
1530 read_only_data_section () \
1532 if (in_section != read_only_data) \
1534 fprintf (asm_out_file, ".csect %s[RO]\n", \
1535 xcoff_read_only_section_name); \
1536 in_section = read_only_data; \
1541 private_data_section () \
1543 if (in_section != private_data) \
1545 fprintf (asm_out_file, ".csect %s[RW]\n", \
1546 xcoff_private_data_section_name); \
1548 in_section = private_data; \
1553 read_only_private_data_section () \
1555 if (in_section != read_only_private_data) \
1557 fprintf (asm_out_file, ".csect %s[RO]\n", \
1558 xcoff_private_data_section_name); \
1559 in_section = read_only_private_data; \
1566 if (TARGET_MINIMAL_TOC) \
1568 static int toc_initialized = 0; \
1570 /* toc_section is always called at least once from ASM_FILE_START, \
1571 so this is guaranteed to always be defined once and only once \
1573 if (! toc_initialized) \
1575 fprintf (asm_out_file, ".toc\nLCTOC..0:\n"); \
1576 fprintf (asm_out_file, "\t.tc toc_table[TC],toc_table[RW]\n"); \
1577 toc_initialized = 1; \
1580 if (in_section != toc) \
1581 fprintf (asm_out_file, ".csect toc_table[RW]\n"); \
1585 if (in_section != toc) \
1586 fprintf (asm_out_file, ".toc\n"); \
1591 /* This macro produces the initial definition of a function name.
1592 On the RS/6000, we need to place an extra '.' in the function name and
1593 output the function descriptor.
1595 The csect for the function will have already been created by the
1596 `text_section' call previously done. We do have to go back to that
1599 /* ??? What do the 16 and 044 in the .function line really mean? */
1601 #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
1602 { if (TREE_PUBLIC (DECL)) \
1604 fprintf (FILE, "\t.globl ."); \
1605 RS6000_OUTPUT_BASENAME (FILE, NAME); \
1606 fprintf (FILE, "\n"); \
1608 else if (write_symbols == XCOFF_DEBUG) \
1610 fprintf (FILE, "\t.lglobl ."); \
1611 RS6000_OUTPUT_BASENAME (FILE, NAME); \
1612 fprintf (FILE, "\n"); \
1614 fprintf (FILE, ".csect "); \
1615 RS6000_OUTPUT_BASENAME (FILE, NAME); \
1616 fprintf (FILE, "[DS]\n"); \
1617 RS6000_OUTPUT_BASENAME (FILE, NAME); \
1618 fprintf (FILE, ":\n"); \
1619 fprintf (FILE, "\t.long ."); \
1620 RS6000_OUTPUT_BASENAME (FILE, NAME); \
1621 fprintf (FILE, ", TOC[tc0], 0\n"); \
1622 fprintf (FILE, ".csect .text[PR]\n."); \
1623 RS6000_OUTPUT_BASENAME (FILE, NAME); \
1624 fprintf (FILE, ":\n"); \
1625 if (write_symbols == XCOFF_DEBUG) \
1626 xcoffout_declare_function (FILE, DECL, NAME); \
1629 /* Return non-zero if this entry is to be written into the constant pool
1630 in a special way. We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
1631 containing one of them. If -mfp-in-toc (the default), we also do
1632 this for floating-point constants. We actually can only do this
1633 if the FP formats of the target and host machines are the same, but
1634 we can't check that since not every file that uses
1635 GO_IF_LEGITIMATE_ADDRESS_P includes real.h. */
1637 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X) \
1638 (GET_CODE (X) == SYMBOL_REF \
1639 || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
1640 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
1641 || GET_CODE (X) == LABEL_REF \
1642 || (! (TARGET_NO_FP_IN_TOC && ! TARGET_MINIMAL_TOC) \
1643 && GET_CODE (X) == CONST_DOUBLE \
1644 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
1645 && BITS_PER_WORD == HOST_BITS_PER_INT))
1647 /* Select section for constant in constant pool.
1649 On RS/6000, all constants are in the private read-only data area.
1650 However, if this is being placed in the TOC it must be output as a
1653 #define SELECT_RTX_SECTION(MODE, X) \
1654 { if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (X)) \
1657 read_only_private_data_section (); \
1660 /* Macro to output a special constant pool entry. Go to WIN if we output
1661 it. Otherwise, it is written the usual way.
1663 On the RS/6000, toc entries are handled this way. */
1665 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY(FILE, X, MODE, ALIGN, LABELNO, WIN) \
1666 { if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (X)) \
1668 output_toc (FILE, X, LABELNO); \
1673 /* Select the section for an initialized data object.
1675 On the RS/6000, we have a special section for all variables except those
1678 #define SELECT_SECTION(EXP,RELOC) \
1680 if ((TREE_READONLY (EXP) \
1681 || (TREE_CODE (EXP) == STRING_CST \
1682 && !flag_writable_strings)) \
1683 && ! TREE_THIS_VOLATILE (EXP) \
1686 if (TREE_PUBLIC (EXP)) \
1687 read_only_data_section (); \
1689 read_only_private_data_section (); \
1693 if (TREE_PUBLIC (EXP)) \
1696 private_data_section (); \
1700 /* This outputs NAME to FILE up to the first null or '['. */
1702 #define RS6000_OUTPUT_BASENAME(FILE, NAME) \
1703 if ((NAME)[0] == '*') \
1704 assemble_name (FILE, NAME); \
1708 for (_p = (NAME); *_p && *_p != '['; _p++) \
1709 fputc (*_p, FILE); \
1712 /* Output something to declare an external symbol to the assembler. Most
1713 assemblers don't need this.
1715 If we haven't already, add "[RW]" (or "[DS]" for a function) to the
1716 name. Normally we write this out along with the name. In the few cases
1717 where we can't, it gets stripped off. */
1719 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
1720 { rtx _symref = XEXP (DECL_RTL (DECL), 0); \
1721 if ((TREE_CODE (DECL) == VAR_DECL \
1722 || TREE_CODE (DECL) == FUNCTION_DECL) \
1723 && (NAME)[0] != '*' \
1724 && (NAME)[strlen (NAME) - 1] != ']') \
1726 char *_name = (char *) permalloc (strlen (XSTR (_symref, 0)) + 5); \
1727 strcpy (_name, XSTR (_symref, 0)); \
1728 strcat (_name, TREE_CODE (DECL) == FUNCTION_DECL ? "[DS]" : "[RW]"); \
1729 XSTR (_symref, 0) = _name; \
1731 fprintf (FILE, "\t.extern "); \
1732 assemble_name (FILE, XSTR (_symref, 0)); \
1733 if (TREE_CODE (DECL) == FUNCTION_DECL) \
1735 fprintf (FILE, "\n\t.extern ."); \
1736 RS6000_OUTPUT_BASENAME (FILE, XSTR (_symref, 0)); \
1738 fprintf (FILE, "\n"); \
1741 /* Similar, but for libcall. We only have to worry about the function name,
1742 not that of the descriptor. */
1744 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
1745 { fprintf (FILE, "\t.extern ."); \
1746 assemble_name (FILE, XSTR (FUN, 0)); \
1747 fprintf (FILE, "\n"); \
1750 /* Output to assembler file text saying following lines
1751 may contain character constants, extra white space, comments, etc. */
1753 #define ASM_APP_ON ""
1755 /* Output to assembler file text saying following lines
1756 no longer contain unusual constructs. */
1758 #define ASM_APP_OFF ""
1760 /* Output before instructions. */
1762 #define TEXT_SECTION_ASM_OP ".csect .text[PR]"
1764 /* Output before writable data. */
1766 #define DATA_SECTION_ASM_OP ".csect .data[RW]"
1768 /* How to refer to registers in assembler output.
1769 This sequence is indexed by compiler's hard-register-number (see above). */
1771 #define REGISTER_NAMES \
1772 {"0", "1", "2", "3", "4", "5", "6", "7", \
1773 "8", "9", "10", "11", "12", "13", "14", "15", \
1774 "16", "17", "18", "19", "20", "21", "22", "23", \
1775 "24", "25", "26", "27", "28", "29", "30", "31", \
1776 "0", "1", "2", "3", "4", "5", "6", "7", \
1777 "8", "9", "10", "11", "12", "13", "14", "15", \
1778 "16", "17", "18", "19", "20", "21", "22", "23", \
1779 "24", "25", "26", "27", "28", "29", "30", "31", \
1780 "mq", "lr", "ctr", "ap", \
1781 "0", "1", "2", "3", "4", "5", "6", "7" }
1783 /* Table of additional register names to use in user input. */
1785 #define ADDITIONAL_REGISTER_NAMES \
1786 {"r0", 0, "r1", 1, "r2", 2, "r3", 3, \
1787 "r4", 4, "r5", 5, "r6", 6, "r7", 7, \
1788 "r8", 8, "r9", 9, "r10", 10, "r11", 11, \
1789 "r12", 12, "r13", 13, "r14", 14, "r15", 15, \
1790 "r16", 16, "r17", 17, "r18", 18, "r19", 19, \
1791 "r20", 20, "r21", 21, "r22", 22, "r23", 23, \
1792 "r24", 24, "r25", 25, "r26", 26, "r27", 27, \
1793 "r28", 28, "r29", 29, "r30", 30, "r31", 31, \
1794 "fr0", 32, "fr1", 33, "fr2", 34, "fr3", 35, \
1795 "fr4", 36, "fr5", 37, "fr6", 38, "fr7", 39, \
1796 "fr8", 40, "fr9", 41, "fr10", 42, "fr11", 43, \
1797 "fr12", 44, "fr13", 45, "fr14", 46, "fr15", 47, \
1798 "fr16", 48, "fr17", 49, "fr18", 50, "fr19", 51, \
1799 "fr20", 52, "fr21", 53, "fr22", 54, "fr23", 55, \
1800 "fr24", 56, "fr25", 57, "fr26", 58, "fr27", 59, \
1801 "fr28", 60, "fr29", 61, "fr30", 62, "fr31", 63, \
1802 /* no additional names for: mq, lr, ctr, ap */ \
1803 "cr0", 68, "cr1", 69, "cr2", 70, "cr3", 71, \
1804 "cr4", 72, "cr5", 73, "cr6", 74, "cr7", 75, \
1807 /* How to renumber registers for dbx and gdb. */
1809 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
1811 /* Bit number to use in cror after branch. Different between AIX 3.2 and
1813 #define RS6000_CROR_BIT_NUMBER 31
1815 /* This is how to output the definition of a user-level label named NAME,
1816 such as the label on a static function or variable NAME. */
1818 #define ASM_OUTPUT_LABEL(FILE,NAME) \
1819 do { RS6000_OUTPUT_BASENAME (FILE, NAME); fputs (":\n", FILE); } while (0)
1821 /* This is how to output a command to make the user-level label named NAME
1822 defined for reference from other files. */
1824 #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
1825 do { fputs ("\t.globl ", FILE); \
1826 RS6000_OUTPUT_BASENAME (FILE, NAME); fputs ("\n", FILE);} while (0)
1828 /* This is how to output a reference to a user-level label named NAME.
1829 `assemble_name' uses this. */
1831 #define ASM_OUTPUT_LABELREF(FILE,NAME) \
1832 fprintf (FILE, NAME)
1834 /* This is how to output an internal numbered label where
1835 PREFIX is the class of label and NUM is the number within the class. */
1837 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
1838 fprintf (FILE, "%s..%d:\n", PREFIX, NUM)
1840 /* This is how to output a label for a jump table. Arguments are the same as
1841 for ASM_OUTPUT_INTERNAL_LABEL, except the insn for the jump table is
1844 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
1845 { ASM_OUTPUT_ALIGN (FILE, 2); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); }
1847 /* This is how to store into the string LABEL
1848 the symbol_ref name of an internal numbered label where
1849 PREFIX is the class of label and NUM is the number within the class.
1850 This is suitable for output with `assemble_name'. */
1852 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
1853 sprintf (LABEL, "%s..%d", PREFIX, NUM)
1855 /* This is how to output an assembler line defining a `double' constant. */
1857 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
1858 fprintf (FILE, "\t.double 0d%.20e\n", (VALUE))
1860 /* This is how to output an assembler line defining a `float' constant. */
1862 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
1863 fprintf (FILE, "\t.float 0d%.20e\n", (VALUE))
1865 /* This is how to output an assembler line defining an `int' constant. */
1867 #define ASM_OUTPUT_INT(FILE,VALUE) \
1868 ( fprintf (FILE, "\t.long "), \
1869 output_addr_const (FILE, (VALUE)), \
1870 fprintf (FILE, "\n"))
1872 /* Likewise for `char' and `short' constants. */
1874 #define ASM_OUTPUT_SHORT(FILE,VALUE) \
1875 ( fprintf (FILE, "\t.short "), \
1876 output_addr_const (FILE, (VALUE)), \
1877 fprintf (FILE, "\n"))
1879 #define ASM_OUTPUT_CHAR(FILE,VALUE) \
1880 ( fprintf (FILE, "\t.byte "), \
1881 output_addr_const (FILE, (VALUE)), \
1882 fprintf (FILE, "\n"))
1884 /* This is how to output an assembler line for a numeric constant byte. */
1886 #define ASM_OUTPUT_BYTE(FILE,VALUE) \
1887 fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
1889 /* This is how to output an assembler line to define N characters starting
1892 #define ASM_OUTPUT_ASCII(FILE, P, N) output_ascii ((FILE), (P), (N))
1894 /* This is how to output code to push a register on the stack.
1895 It need not be very fast code. */
1897 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
1898 fprintf (FILE, "\tstu %s,-4(r1)\n", reg_names[REGNO]);
1900 /* This is how to output an insn to pop a register from the stack.
1901 It need not be very fast code. */
1903 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
1904 fprintf (FILE, "\tl %s,0(r1)\n\tai r1,r1,4\n", reg_names[REGNO])
1906 /* This is how to output an element of a case-vector that is absolute.
1907 (RS/6000 does not use such vectors, but we must define this macro
1910 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1911 fprintf (FILE, "\t.long L..%d\n", VALUE)
1913 /* This is how to output an element of a case-vector that is relative. */
1915 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
1916 fprintf (FILE, "\t.long L..%d-L..%d\n", VALUE, REL)
1918 /* This is how to output an assembler line
1919 that says to advance the location counter
1920 to a multiple of 2**LOG bytes. */
1922 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1924 fprintf (FILE, "\t.align %d\n", (LOG))
1926 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
1927 fprintf (FILE, "\t.space %d\n", (SIZE))
1929 /* This says how to output an assembler line
1930 to define a global common symbol. */
1932 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
1933 do { fputs (".comm ", (FILE)); \
1934 RS6000_OUTPUT_BASENAME ((FILE), (NAME)); \
1935 fprintf ((FILE), ",%d\n", (SIZE)); } while (0)
1937 /* This says how to output an assembler line
1938 to define a local common symbol. */
1940 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \
1941 do { fputs (".lcomm ", (FILE)); \
1942 RS6000_OUTPUT_BASENAME ((FILE), (NAME)); \
1943 fprintf ((FILE), ",%d,%s\n", (SIZE), xcoff_bss_section_name); \
1946 /* Store in OUTPUT a string (made with alloca) containing
1947 an assembler-name for a local static variable named NAME.
1948 LABELNO is an integer which is different for each call. */
1950 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1951 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
1952 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1954 /* Define the parentheses used to group arithmetic operations
1955 in assembler code. */
1957 #define ASM_OPEN_PAREN "("
1958 #define ASM_CLOSE_PAREN ")"
1960 /* Define results of standard character escape sequences. */
1961 #define TARGET_BELL 007
1962 #define TARGET_BS 010
1963 #define TARGET_TAB 011
1964 #define TARGET_NEWLINE 012
1965 #define TARGET_VT 013
1966 #define TARGET_FF 014
1967 #define TARGET_CR 015
1969 /* Print operand X (an rtx) in assembler syntax to file FILE.
1970 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1971 For `%' followed by punctuation, CODE is the punctuation and X is null. */
1973 #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
1975 /* Define which CODE values are valid. */
1977 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '.')
1979 /* Print a memory address as an operand to reference that memory location. */
1981 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
1983 /* Define the codes that are matched by predicates in rs6000.c. */
1985 #define PREDICATE_CODES \
1986 {"short_cint_operand", {CONST_INT}}, \
1987 {"u_short_cint_operand", {CONST_INT}}, \
1988 {"non_short_cint_operand", {CONST_INT}}, \
1989 {"gpc_reg_operand", {SUBREG, REG}}, \
1990 {"cc_reg_operand", {SUBREG, REG}}, \
1991 {"reg_or_short_operand", {SUBREG, REG, CONST_INT}}, \
1992 {"reg_or_neg_short_operand", {SUBREG, REG, CONST_INT}}, \
1993 {"reg_or_u_short_operand", {SUBREG, REG, CONST_INT}}, \
1994 {"reg_or_cint_operand", {SUBREG, REG, CONST_INT}}, \
1995 {"easy_fp_constant", {CONST_DOUBLE}}, \
1996 {"reg_or_mem_operand", {SUBREG, MEM, REG}}, \
1997 {"fp_reg_or_mem_operand", {SUBREG, MEM, REG}}, \
1998 {"mem_or_easy_const_operand", {SUBREG, MEM, CONST_DOUBLE}}, \
1999 {"add_operand", {SUBREG, REG, CONST_INT}}, \
2000 {"non_add_cint_operand", {CONST_INT}}, \
2001 {"and_operand", {SUBREG, REG, CONST_INT}}, \
2002 {"non_and_cint_operand", {CONST_INT}}, \
2003 {"logical_operand", {SUBREG, REG, CONST_INT}}, \
2004 {"non_logical_cint_operand", {CONST_INT}}, \
2005 {"mask_operand", {CONST_INT}}, \
2006 {"call_operand", {SYMBOL_REF, REG}}, \
2007 {"current_file_function_operand", {SYMBOL_REF}}, \
2008 {"input_operand", {SUBREG, MEM, REG, CONST_INT}}, \
2009 {"load_multiple_operation", {PARALLEL}}, \
2010 {"store_multiple_operation", {PARALLEL}}, \
2011 {"branch_comparison_operator", {EQ, NE, LE, LT, GE, \
2012 LT, LEU, LTU, GEU, GTU}}, \
2013 {"scc_comparison_operator", {EQ, NE, LE, LT, GE, \
2014 LT, LEU, LTU, GEU, GTU}},