|
|
1.1 root 1: /* Definitions of target machine for GNU compiler, for IBM RS/6000.
2: Copyright (C) 1992 Free Software Foundation, Inc.
3: Contributed by Richard Kenner ([email protected])
4:
5: This file is part of GNU CC.
6:
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)
10: any later version.
11:
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.
16:
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. */
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:
28: #define CPP_PREDEFINES "-D_IBMR2 -D_AIX"
29:
30: /* Print subsidiary information on the compiler version in use. */
31: #define TARGET_VERSION ;
32:
1.1.1.2 ! root 33: /* Tell the assembler to assume that all undefined names are external.
! 34:
! 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. */
1.1 root 39:
40: /* #define ASM_SPEC "-u" */
41:
42: /* Define the options for the binder: Start text at 512, align all segments
43: to 512 bytes, and warn if there is text relocation.
44:
45: The -bhalt:4 option supposedly changes the level at which ld will abort,
46: but it also suppresses warnings about multiply defined symbols and is
47: used by the AIX cc command. So we use it here.
48:
49: -bnodelcsect undoes a poor choice of default relating to multiply-defined
50: csects. See AIX documentation for more information about this. */
51:
52: #define LINK_SPEC "-T512 -H512 -btextro -bhalt:4 -bnodelcsect"
53:
54: /* Add -lfp_p when running with -p or -pg. */
55: #define LIB_SPEC "%{pg:-lfp_p}%{p:-lfp_p} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
56:
57: /* gcc must do the search itself to find libgcc.a, not use -l. */
58: #define LINK_LIBGCC_SPECIAL
59:
60: /* Don't turn -B into -L if the argument specifies a relative file name. */
61: #define RELATIVE_PREFIX_NOT_LINKDIR
62:
63: /* Run-time compilation parameters selecting different hardware subsets. */
64:
65: /* Flag to allow putting fp constants in the TOC; can be turned off when
66: the TOC overflows. */
67:
68: #define TARGET_FP_IN_TOC (target_flags & 1)
69:
70: extern int target_flags;
71:
72: /* Macro to define tables used to set the flags.
73: This is a list in braces of pairs in braces,
74: each pair being { "NAME", VALUE }
75: where VALUE is the bits to set or minus the bits to clear.
76: An empty string NAME is used to identify the default VALUE. */
77:
78: #define TARGET_SWITCHES \
79: {{"fp-in-toc", 1}, \
80: {"no-fp-in-toc", -1}, \
81: { "", TARGET_DEFAULT}}
82:
83: #define TARGET_DEFAULT 1
84:
85: /* On the RS/6000, we turn on various flags if optimization is selected. */
86:
87: #define OPTIMIZATION_OPTIONS(LEVEL) \
88: { \
89: if ((LEVEL) > 0) \
90: { \
91: flag_force_mem = 1; \
92: flag_omit_frame_pointer = 1; \
93: } \
94: }
95:
96: /* Define this to modify the options specified by the user.
97:
98: We turn off profiling because we don't know how to do it. */
99:
100: #define OVERRIDE_OPTIONS \
101: { \
102: profile_flag = profile_block_flag = 0; \
103: }
104:
105: /* target machine storage layout */
106:
107: /* Define this if most significant bit is lowest numbered
108: in instructions that operate on numbered bit-fields. */
109: /* That is true on RS/6000. */
110: #define BITS_BIG_ENDIAN 1
111:
112: /* Define this if most significant byte of a word is the lowest numbered. */
113: /* That is true on RS/6000. */
114: #define BYTES_BIG_ENDIAN 1
115:
116: /* Define this if most significant word of a multiword number is lowest
117: numbered.
118:
119: For RS/6000 we can decide arbitrarily since there are no machine
120: instructions for them. Might as well be consistent with bits and bytes. */
121: #define WORDS_BIG_ENDIAN 1
122:
1.1.1.2 ! root 123: /* number of bits in an addressable storage unit */
1.1 root 124: #define BITS_PER_UNIT 8
125:
126: /* Width in bits of a "word", which is the contents of a machine register.
127: Note that this is not necessarily the width of data type `int';
128: if using 16-bit ints on a 68000, this would still be 32.
129: But on a machine with 16-bit registers, this would be 16. */
130: #define BITS_PER_WORD 32
131:
132: /* Width of a word, in units (bytes). */
133: #define UNITS_PER_WORD 4
134:
135: /* Type used for wchar_t, as a string used in a declaration. */
136: #define WCHAR_TYPE "short unsigned int"
137:
138: /* Width of wchar_t in bits. */
139: #define WCHAR_TYPE_SIZE 16
140:
141: /* Width in bits of a pointer.
142: See also the macro `Pmode' defined below. */
143: #define POINTER_SIZE 32
144:
145: /* Allocation boundary (in *bits*) for storing arguments in argument list. */
146: #define PARM_BOUNDARY 32
147:
148: /* Boundary (in *bits*) on which stack pointer should be aligned. */
149: #define STACK_BOUNDARY 64
150:
151: /* Allocation boundary (in *bits*) for the code of a function. */
152: #define FUNCTION_BOUNDARY 32
153:
154: /* No data type wants to be aligned rounder than this. */
155: #define BIGGEST_ALIGNMENT 32
156:
157: /* Alignment of field after `int : 0' in a structure. */
158: #define EMPTY_FIELD_BOUNDARY 32
159:
160: /* Every structure's size must be a multiple of this. */
161: #define STRUCTURE_SIZE_BOUNDARY 8
162:
163: /* A bitfield declared as `int' forces `int' alignment for the struct. */
164: #define PCC_BITFIELD_TYPE_MATTERS 1
165:
166: /* Make strings word-aligned so strcpy from constants will be faster. */
167: #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
168: (TREE_CODE (EXP) == STRING_CST \
169: && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
170:
171: /* Make arrays of chars word-aligned for the same reasons. */
172: #define DATA_ALIGNMENT(TYPE, ALIGN) \
173: (TREE_CODE (TYPE) == ARRAY_TYPE \
174: && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
175: && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
176:
1.1.1.2 ! root 177: /* Non-zero if move instructions will actually fail to work
1.1 root 178: when given unaligned data. */
1.1.1.2 ! root 179: #define STRICT_ALIGNMENT 0
1.1 root 180:
181: /* Standard register usage. */
182:
183: /* Number of actual hardware registers.
184: The hardware registers are assigned numbers for the compiler
185: from 0 to just below FIRST_PSEUDO_REGISTER.
186: All registers that the compiler knows about must be given numbers,
187: even those that are not normally considered general registers.
188:
189: RS/6000 has 32 fixed-point registers, 32 floating-point registers,
190: an MQ register, a count register, a link register, and 8 condition
191: register fields, which we view here as separate registers.
192:
193: In addition, the difference between the frame and argument pointers is
194: a function of the number of registers saved, so we need to have a
195: register for AP that will later be eliminated in favor of SP or FP.
196: This is a normal register, but it is fixed. */
197:
198: #define FIRST_PSEUDO_REGISTER 76
199:
200: /* 1 for registers that have pervasive standard uses
201: and are not available for the register allocator.
202:
203: On RS/6000, r1 is used for the stack and r2 is used as the TOC pointer.
204:
205: cr5 is not supposed to be used. */
206:
207: #define FIXED_REGISTERS \
208: {0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
209: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
210: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
211: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
212: 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0}
213:
214: /* 1 for registers not available across function calls.
215: These must include the FIXED_REGISTERS and also any
216: registers that can be used without being saved.
217: The latter must include the registers where values are returned
218: and the register where structure-value addresses are passed.
219: Aside from that, you can include as many other registers as you like. */
220:
221: #define CALL_USED_REGISTERS \
222: {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, \
223: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
224: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, \
225: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
226: 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1}
227:
228: /* List the order in which to allocate registers. Each register must be
229: listed once, even those in FIXED_REGISTERS.
230:
231: We allocate in the following order:
232: fp0 (not saved or used for anything)
233: fp13 - fp2 (not saved; incoming fp arg registers)
234: fp1 (not saved; return value)
235: fp31 - fp14 (saved; order given to save least number)
236: cr1, cr6, cr7 (not saved or special)
237: cr0 (not saved, but used for arithmetic operations)
238: cr2, cr3, cr4 (saved)
239: r0 (not saved; cannot be base reg)
240: r9 (not saved; best for TImode)
241: r11, r10, r8-r4 (not saved; highest used first to make less conflict)
242: r3 (not saved; return value register)
243: r31 - r13 (saved; order given to save least number)
244: r12 (not saved; if used for DImode or DFmode would use r13)
245: mq (not saved; best to use it if we can)
246: ctr (not saved; when we have the choice ctr is better)
247: lr (saved)
248: cr5, r1, r2, ap (fixed) */
249:
250: #define REG_ALLOC_ORDER \
251: {32, \
252: 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, \
253: 33, \
254: 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, \
255: 50, 49, 48, 47, 46, \
256: 69, 74, 75, 68, 70, 71, 72, \
257: 0, \
258: 9, 11, 10, 8, 7, 6, 5, 4, \
259: 3, \
260: 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, \
261: 18, 17, 16, 15, 14, 13, 12, \
262: 64, 66, 65, \
263: 73, 1, 2, 67}
264:
265: /* True if register is floating-point. */
266: #define FP_REGNO_P(N) ((N) >= 32 && (N) <= 63)
267:
268: /* True if register is a condition register. */
269: #define CR_REGNO_P(N) ((N) >= 68 && (N) <= 75)
270:
271: /* True if register is an integer register. */
272: #define INT_REGNO_P(N) ((N) <= 31 || (N) == 67)
273:
274: /* Return number of consecutive hard regs needed starting at reg REGNO
275: to hold something of mode MODE.
276: This is ordinarily the length in words of a value of mode MODE
277: but can be less for certain modes in special long registers.
278:
279: On RS/6000, ordinary registers hold 32 bits worth;
280: a single floating point register holds 64 bits worth. */
281:
282: #define HARD_REGNO_NREGS(REGNO, MODE) \
283: (FP_REGNO_P (REGNO) \
284: ? ((GET_MODE_SIZE (MODE) + 2 * UNITS_PER_WORD - 1) / (2 * UNITS_PER_WORD)) \
285: : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
286:
287: /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
288: On RS/6000, the cpu registers can hold any mode but the float registers
289: can hold only floating modes and CR register can only hold CC modes. We
290: cannot put DImode or TImode anywhere except general register and they
291: must be able to fit within the register set. */
292:
293: #define HARD_REGNO_MODE_OK(REGNO, MODE) \
294: (FP_REGNO_P (REGNO) ? GET_MODE_CLASS (MODE) == MODE_FLOAT \
295: : CR_REGNO_P (REGNO) ? GET_MODE_CLASS (MODE) == MODE_CC \
296: : ! INT_REGNO_P (REGNO) ? GET_MODE_CLASS (MODE) == MODE_INT \
297: : 1)
298:
299: /* Value is 1 if it is a good idea to tie two pseudo registers
300: when one has mode MODE1 and one has mode MODE2.
301: If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
302: for any hard reg, then this must be 0 for correct output. */
303: #define MODES_TIEABLE_P(MODE1, MODE2) \
304: (GET_MODE_CLASS (MODE1) == MODE_FLOAT \
305: ? GET_MODE_CLASS (MODE2) == MODE_FLOAT \
306: : GET_MODE_CLASS (MODE2) == MODE_FLOAT \
307: ? GET_MODE_CLASS (MODE1) == MODE_FLOAT \
308: : GET_MODE_CLASS (MODE1) == MODE_CC \
309: ? GET_MODE_CLASS (MODE2) == MODE_CC \
310: : GET_MODE_CLASS (MODE2) == MODE_CC \
311: ? GET_MODE_CLASS (MODE1) == MODE_CC \
312: : 1)
313:
314: /* A C expression returning the cost of moving data from a register of class
315: CLASS1 to one of CLASS2.
316:
317: On the RS/6000, copying between floating-point and fixed-point
318: registers is expensive. */
319:
320: #define REGISTER_MOVE_COST(CLASS1, CLASS2) \
321: ((CLASS1) == FLOAT_REGS && (CLASS2) == FLOAT_REGS ? 2 \
322: : (CLASS1) == FLOAT_REGS && (CLASS2) != FLOAT_REGS ? 10 \
323: : (CLASS1) != FLOAT_REGS && (CLASS2) == FLOAT_REGS ? 10 \
324: : 2)
325:
326: /* A C expressions returning the cost of moving data of MODE from a register to
327: or from memory.
328:
329: On the RS/6000, bump this up a bit. */
330:
331: #define MEMORY_MOVE_COST(MODE) 4
332:
333: /* Specify the cost of a branch insn; roughly the number of extra insns that
334: should be added to avoid a branch.
335:
336: Set this to 2 on the RS/6000 since that is roughly the average cost of an
337: unscheduled conditional branch. */
338:
339: #define BRANCH_COST 2
340:
341: /* Specify the registers used for certain standard purposes.
342: The values of these macros are register numbers. */
343:
344: /* RS/6000 pc isn't overloaded on a register that the compiler knows about. */
345: /* #define PC_REGNUM */
346:
347: /* Register to use for pushing function arguments. */
348: #define STACK_POINTER_REGNUM 1
349:
350: /* Base register for access to local variables of the function. */
351: #define FRAME_POINTER_REGNUM 31
352:
353: /* Value should be nonzero if functions must have frame pointers.
354: Zero means the frame pointer need not be set up (and parms
355: may be accessed via the stack pointer) in functions that seem suitable.
356: This is computed in `reload', in reload1.c. */
357: #define FRAME_POINTER_REQUIRED 0
358:
359: /* Base register for access to arguments of the function. */
360: #define ARG_POINTER_REGNUM 67
361:
362: /* Place to put static chain when calling a function that requires it. */
363: #define STATIC_CHAIN_REGNUM 11
364:
365: /* Place that structure value return address is placed.
366:
367: On the RS/6000, it is passed as an extra parameter. */
368: #define STRUCT_VALUE 0
369:
370: /* Define the classes of registers for register constraints in the
371: machine description. Also define ranges of constants.
372:
373: One of the classes must always be named ALL_REGS and include all hard regs.
374: If there is more than one class, another class must be named NO_REGS
375: and contain no registers.
376:
377: The name GENERAL_REGS must be the name of a class (or an alias for
378: another name such as ALL_REGS). This is the class of registers
379: that is allowed by "g" or "r" in a register constraint.
380: Also, registers outside this class are allocated only when
381: instructions express preferences for them.
382:
383: The classes must be numbered in nondecreasing order; that is,
384: a larger-numbered class must never be contained completely
385: in a smaller-numbered class.
386:
387: For any two classes, it is very desirable that there be another
388: class that represents their union. */
389:
390: /* The RS/6000 has three types of registers, fixed-point, floating-point,
391: and condition registers, plus three special registers, MQ, CTR, and the
392: link register.
393:
394: However, r0 is special in that it cannot be used as a base register.
395: So make a class for registers valid as base registers.
396:
397: Also, cr0 is the only condition code register that can be used in
398: arithmetic insns, so make a separate class for it. */
399:
400: enum reg_class { NO_REGS, BASE_REGS, GENERAL_REGS, FLOAT_REGS,
401: NON_SPECIAL_REGS, MQ_REGS, LINK_REGS, CTR_REGS, LINK_OR_CTR_REGS,
402: SPECIAL_REGS, CR0_REGS, CR_REGS, ALL_REGS, LIM_REG_CLASSES };
403:
404: #define N_REG_CLASSES (int) LIM_REG_CLASSES
405:
406: /* Give names of register classes as strings for dump file. */
407:
408: #define REG_CLASS_NAMES \
409: { "NO_REGS", "BASE_REGS", "GENERAL_REGS", "FLOAT_REGS", \
410: "NON_SPECIAL_REGS", "MQ_REGS", "LINK_REGS", "CTR_REGS", \
411: "LINK_OR_CTR_REGS", "SPECIAL_REGS", "CR0_REGS", "CR_REGS", "ALL_REGS" }
412:
413: /* Define which registers fit in which classes.
414: This is an initializer for a vector of HARD_REG_SET
415: of length N_REG_CLASSES. */
416:
417: #define REG_CLASS_CONTENTS \
418: { {0, 0, 0}, {0xfffffffe, 0, 8}, {~0, 0, 8}, \
419: {0, ~0, 0}, {~0, ~0, 0}, {0, 0, 1}, {0, 0, 2}, \
420: {0, 0, 4}, {0, 0, 6}, {0, 0, 7}, {0, 0, 16}, \
421: {0, 0, 0xff0}, {~0, ~0, 0xfff5} }
422:
423: /* The same information, inverted:
424: Return the class number of the smallest class containing
425: reg number REGNO. This could be a conditional expression
426: or could index an array. */
427:
428: #define REGNO_REG_CLASS(REGNO) \
429: ((REGNO) == 0 ? GENERAL_REGS \
430: : (REGNO) < 32 ? BASE_REGS \
431: : FP_REGNO_P (REGNO) ? FLOAT_REGS \
432: : (REGNO) == 68 ? CR0_REGS \
433: : CR_REGNO_P (REGNO) ? CR_REGS \
434: : (REGNO) == 64 ? MQ_REGS \
435: : (REGNO) == 65 ? LINK_REGS \
436: : (REGNO) == 66 ? CTR_REGS \
437: : (REGNO) == 67 ? BASE_REGS \
438: : NO_REGS)
439:
440: /* The class value for index registers, and the one for base regs. */
441: #define INDEX_REG_CLASS GENERAL_REGS
442: #define BASE_REG_CLASS BASE_REGS
443:
444: /* Get reg_class from a letter such as appears in the machine description. */
445:
446: #define REG_CLASS_FROM_LETTER(C) \
447: ((C) == 'f' ? FLOAT_REGS \
448: : (C) == 'b' ? BASE_REGS \
449: : (C) == 'h' ? SPECIAL_REGS \
450: : (C) == 'q' ? MQ_REGS \
451: : (C) == 'c' ? CTR_REGS \
452: : (C) == 'l' ? LINK_REGS \
453: : (C) == 'x' ? CR0_REGS \
454: : (C) == 'y' ? CR_REGS \
455: : NO_REGS)
456:
457: /* The letters I, J, K, L, M, N, and P in a register constraint string
458: can be used to stand for particular ranges of immediate operands.
459: This macro defines what the ranges are.
460: C is the letter, and VALUE is a constant value.
461: Return 1 if VALUE is in the range specified by C.
462:
463: `I' is signed 16-bit constants
464: `J' is a constant with only the high-order 16 bits non-zero
465: `K' is a constant with only the low-order 16 bits non-zero
466: `L' is a constant that can be placed into a mask operand
467: `M' is a constant that is greater than 31
468: `N' is a constant that is an exact power of two
469: `O' is the constant zero
470: `P' is a constant whose negation is a signed 16-bit constant */
471:
472: #define CONST_OK_FOR_LETTER_P(VALUE, C) \
473: ( (C) == 'I' ? (unsigned) ((VALUE) + 0x8000) < 0x10000 \
474: : (C) == 'J' ? ((VALUE) & 0xffff) == 0 \
475: : (C) == 'K' ? ((VALUE) & 0xffff0000) == 0 \
476: : (C) == 'L' ? mask_constant (VALUE) \
477: : (C) == 'M' ? (VALUE) > 31 \
478: : (C) == 'N' ? exact_log2 (VALUE) >= 0 \
479: : (C) == 'O' ? (VALUE) == 0 \
480: : (C) == 'P' ? (unsigned) ((- (VALUE)) + 0x8000) < 0x1000 \
481: : 0)
482:
483: /* Similar, but for floating constants, and defining letters G and H.
484: Here VALUE is the CONST_DOUBLE rtx itself.
485:
486: We flag for special constants when we can copy the constant into
487: a general register in two insns for DF and one insn for SF. */
488:
489: #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
490: ((C) == 'G' ? easy_fp_constant (VALUE, GET_MODE (VALUE)) : 0)
491:
492: /* Optional extra constraints for this machine.
493:
494: For the RS/6000, `Q' means that this is a memory operand that is just
495: an offset from a register. */
496:
497: #define EXTRA_CONSTRAINT(OP, C) \
498: ((C) == 'Q' ? indirect_operand (OP, VOIDmode) : 0)
499:
500: /* Given an rtx X being reloaded into a reg required to be
501: in class CLASS, return the class of reg to actually use.
502: In general this is just CLASS; but on some machines
503: in some cases it is preferable to use a more restrictive class.
504:
505: On the RS/6000, we have to return NO_REGS when we want to reload a
506: floating-point CONST_DOUBLE to force it to be copied to memory. */
507:
508: #define PREFERRED_RELOAD_CLASS(X,CLASS) \
509: ((GET_CODE (X) == CONST_DOUBLE \
510: && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) \
511: ? NO_REGS : (CLASS))
512:
513: /* Return the register class of a scratch register needed to copy IN into
514: or out of a register in CLASS in MODE. If it can be done directly,
515: NO_REGS is returned. */
516:
517: #define SECONDARY_RELOAD_CLASS(CLASS,MODE,IN) \
518: secondary_reload_class (CLASS, MODE, IN)
519:
520: /* Return the maximum number of consecutive registers
521: needed to represent mode MODE in a register of class CLASS.
522:
523: On RS/6000, this is the size of MODE in words,
524: except in the FP regs, where a single reg is enough for two words. */
525: #define CLASS_MAX_NREGS(CLASS, MODE) \
526: ((CLASS) == FLOAT_REGS \
527: ? ((GET_MODE_SIZE (MODE) + 2 * UNITS_PER_WORD - 1) / (2 * UNITS_PER_WORD)) \
528: : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
529:
530: /* Stack layout; function entry, exit and calling. */
531:
532: /* Define this if pushing a word on the stack
533: makes the stack pointer a smaller address. */
534: #define STACK_GROWS_DOWNWARD
535:
536: /* Define this if the nominal address of the stack frame
537: is at the high-address end of the local variables;
538: that is, each additional local variable allocated
539: goes at a more negative offset in the frame.
540:
541: On the RS/6000, we grow upwards, from the area after the outgoing
542: arguments. */
543: /* #define FRAME_GROWS_DOWNWARD */
544:
545: /* Offset within stack frame to start allocating local variables at.
546: If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
547: first local allocated. Otherwise, it is the offset to the BEGINNING
548: of the first local allocated.
549:
550: On the RS/6000, the frame pointer is the same as the stack pointer,
551: except for dynamic allocations. So we start after the fixed area and
552: outgoing parameter area. */
553:
554: #define STARTING_FRAME_OFFSET (current_function_outgoing_args_size + 24)
555:
556: /* If we generate an insn to push BYTES bytes,
557: this says how many the stack pointer really advances by.
558: On RS/6000, don't define this because there are no push insns. */
559: /* #define PUSH_ROUNDING(BYTES) */
560:
561: /* Offset of first parameter from the argument pointer register value.
562: On the RS/6000, we define the argument pointer to the start of the fixed
563: area. */
564: #define FIRST_PARM_OFFSET(FNDECL) 24
565:
566: /* Define this if stack space is still allocated for a parameter passed
567: in a register. The value is the number of bytes allocated to this
568: area. */
569: #define REG_PARM_STACK_SPACE(FNDECL) 32
570:
571: /* Define this if the above stack space is to be considered part of the
572: space allocated by the caller. */
573: #define OUTGOING_REG_PARM_STACK_SPACE
574:
575: /* This is the difference between the logical top of stack and the actual sp.
576:
577: For the RS/6000, sp points past the fixed area. */
578: #define STACK_POINTER_OFFSET 24
579:
580: /* Define this if the maximum size of all the outgoing args is to be
581: accumulated and pushed during the prologue. The amount can be
582: found in the variable current_function_outgoing_args_size. */
583: #define ACCUMULATE_OUTGOING_ARGS
584:
585: /* Value is the number of bytes of arguments automatically
586: popped when returning from a subroutine call.
587: FUNTYPE is the data type of the function (as a tree),
588: or for a library call it is an identifier node for the subroutine name.
589: SIZE is the number of bytes of arguments passed on the stack. */
590:
591: #define RETURN_POPS_ARGS(FUNTYPE,SIZE) 0
592:
593: /* Define how to find the value returned by a function.
594: VALTYPE is the data type of the value (as a tree).
595: If the precise function being called is known, FUNC is its FUNCTION_DECL;
596: otherwise, FUNC is 0.
597:
598: On RS/6000 an integer value is in r3 and a floating-point value is in
599: fp1. */
600:
601: #define FUNCTION_VALUE(VALTYPE, FUNC) \
602: gen_rtx (REG, TYPE_MODE (VALTYPE), \
603: TREE_CODE (VALTYPE) == REAL_TYPE ? 33 : 3)
604:
605: /* Define how to find the value returned by a library function
606: assuming the value has mode MODE. */
607:
608: #define LIBCALL_VALUE(MODE) \
609: gen_rtx (REG, MODE, GET_MODE_CLASS (MODE) == MODE_FLOAT ? 33 : 3)
610:
611: /* The definition of this macro implies that there are cases where
612: a scalar value cannot be returned in registers.
613:
614: For the RS/6000, any structure or union type is returned in memory. */
615:
616: #define RETURN_IN_MEMORY(TYPE) \
617: (TREE_CODE (TYPE) == RECORD_TYPE || TREE_CODE (TYPE) == UNION_TYPE)
618:
619: /* 1 if N is a possible register number for a function value
620: as seen by the caller.
621:
622: On RS/6000, this is r3 and fp1. */
623:
624: #define FUNCTION_VALUE_REGNO_P(N) ((N) == 3 || ((N) == 33))
625:
626: /* 1 if N is a possible register number for function argument passing.
627: On RS/6000, these are r3-r10 and fp1-fp13. */
628:
629: #define FUNCTION_ARG_REGNO_P(N) \
630: (((N) <= 10 && (N) >= 3) || ((N) >= 33 && (N) <= 45))
631:
632: /* Define a data type for recording info about an argument list
633: during the scan of that argument list. This data type should
634: hold all necessary information about the function itself
635: and about the args processed so far, enough to enable macros
636: such as FUNCTION_ARG to determine where the next arg should go.
637:
638: On the RS/6000, this is a structure. The first element is the number of
639: total argument words, the second is used to store the next
640: floating-point register number, and the third says how many more args we
641: have prototype types for. */
642:
643: struct rs6000_args {int words, fregno, nargs_prototype; };
644: #define CUMULATIVE_ARGS struct rs6000_args
645:
646: /* Define intermediate macro to compute the size (in registers) of an argument
647: for the RS/6000. */
648:
649: #define RS6000_ARG_SIZE(MODE, TYPE, NAMED) \
650: (! (NAMED) ? 0 \
651: : (MODE) != BLKmode \
652: ? (GET_MODE_SIZE (MODE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD \
653: : (int_size_in_bytes (TYPE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
654:
655: /* Initialize a variable CUM of type CUMULATIVE_ARGS
656: for a call to a function whose data type is FNTYPE.
657: For a library call, FNTYPE is 0. */
658:
659: #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME) \
660: (CUM).words = 0, \
661: (CUM).fregno = 33, \
662: (CUM).nargs_prototype = (FNTYPE && TYPE_ARG_TYPES (FNTYPE) \
663: ? (list_length (TYPE_ARG_TYPES (FNTYPE)) - 1 \
664: + (TYPE_MODE (TREE_TYPE (FNTYPE)) == BLKmode \
665: || RETURN_IN_MEMORY (TREE_TYPE (FNTYPE)))) \
666: : 0)
667:
668: /* Similar, but when scanning the definition of a procedure. We always
669: set NARGS_PROTOTYPE large so we never return an EXPR_LIST. */
670:
671: #define INIT_CUMULATIVE_INCOMING_ARGS(CUM,FNTYPE,IGNORE) \
672: (CUM).words = 0, \
673: (CUM).fregno = 33, \
674: (CUM).nargs_prototype = 1000
675:
676: /* Update the data in CUM to advance over an argument
677: of mode MODE and data type TYPE.
678: (TYPE is null for libcalls where that information may not be available.) */
679:
680: #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
681: { (CUM).nargs_prototype--; \
682: if (NAMED) \
683: { \
684: (CUM).words += RS6000_ARG_SIZE (MODE, TYPE, NAMED); \
685: if (GET_MODE_CLASS (MODE) == MODE_FLOAT) \
686: (CUM).fregno++; \
687: } \
688: }
689:
690: /* Non-zero if we can use a floating-point register to pass this arg. */
691: #define USE_FP_FOR_ARG_P(CUM,MODE,TYPE) \
692: (GET_MODE_CLASS (MODE) == MODE_FLOAT && (CUM).fregno < 46)
693:
694: /* Determine where to put an argument to a function.
695: Value is zero to push the argument on the stack,
696: or a hard register in which to store the argument.
697:
698: MODE is the argument's machine mode.
699: TYPE is the data type of the argument (as a tree).
700: This is null for libcalls where that information may
701: not be available.
702: CUM is a variable of type CUMULATIVE_ARGS which gives info about
703: the preceding args and about the function being called.
704: NAMED is nonzero if this argument is a named parameter
705: (otherwise it is an extra parameter matching an ellipsis).
706:
707: On RS/6000 the first eight words of non-FP are normally in registers
708: and the rest are pushed. The first 13 FP args are in registers.
709:
710: If this is floating-point and no prototype is specified, we use
711: both an FP and integer register (or possibly FP reg and stack). */
712:
713: #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
714: (! (NAMED) ? 0 \
715: : USE_FP_FOR_ARG_P (CUM, MODE, TYPE) \
716: ? ((CUM).nargs_prototype > 0 \
717: ? gen_rtx (REG, MODE, (CUM).fregno) \
718: : ((CUM).words < 8 \
719: ? gen_rtx (EXPR_LIST, VOIDmode, \
720: gen_rtx (REG, (MODE), 3 + (CUM).words), \
721: gen_rtx (REG, (MODE), (CUM).fregno)) \
722: : gen_rtx (EXPR_LIST, VOIDmode, 0, \
723: gen_rtx (REG, (MODE), (CUM).fregno)))) \
724: : (CUM).words < 8 ? gen_rtx(REG, (MODE), 3 + (CUM).words) : 0)
725:
726: /* For an arg passed partly in registers and partly in memory,
727: this is the number of registers used.
728: For args passed entirely in registers or entirely in memory, zero. */
729:
730: #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
731: (! (NAMED) ? 0 \
732: : USE_FP_FOR_ARG_P (CUM, MODE, TYPE) && (CUM).nargs_prototype >= 0 ? 0 \
733: : (((CUM).words < 8 \
734: && 8 < ((CUM).words + RS6000_ARG_SIZE (MODE, TYPE, NAMED))) \
735: ? 8 - (CUM).words : 0))
736:
737: /* Perform any needed actions needed for a function that is receiving a
738: variable number of arguments.
739:
740: CUM is as above.
741:
742: MODE and TYPE are the mode and type of the current parameter.
743:
744: PRETEND_SIZE is a variable that should be set to the amount of stack
745: that must be pushed by the prolog to pretend that our caller pushed
746: it.
747:
748: Normally, this macro will push all remaining incoming registers on the
749: stack and set PRETEND_SIZE to the length of the registers pushed. */
750:
751: #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
752: { if ((CUM).words < 8) \
753: { \
754: int first_reg_offset = (CUM).words; \
755: \
756: if (MUST_PASS_IN_STACK (MODE, TYPE)) \
757: first_reg_offset += RS6000_ARG_SIZE (TYPE_MODE (TYPE), TYPE, 1); \
758: \
759: if (first_reg_offset > 8) \
760: first_reg_offset = 8; \
761: \
762: if (! (NO_RTL) && first_reg_offset != 8) \
763: move_block_from_reg \
764: (3 + first_reg_offset, \
765: gen_rtx (MEM, BLKmode, \
766: plus_constant (virtual_incoming_args_rtx, \
767: first_reg_offset * 4)), \
768: 8 - first_reg_offset); \
769: PRETEND_SIZE = (8 - first_reg_offset) * UNITS_PER_WORD; \
770: } \
771: }
772:
773: /* This macro generates the assembly code for function entry.
774: FILE is a stdio stream to output the code to.
775: SIZE is an int: how many units of temporary storage to allocate.
776: Refer to the array `regs_ever_live' to determine which registers
777: to save; `regs_ever_live[I]' is nonzero if register number I
778: is ever used in the function. This macro is responsible for
779: knowing which registers should not be saved even if used. */
780:
781: #define FUNCTION_PROLOGUE(FILE, SIZE) output_prolog (FILE, SIZE)
782:
783: /* Output assembler code to FILE to increment profiler label # LABELNO
784: for profiling a function entry.
785:
786: I have no real idea what r3 should point to here. */
787:
788: #define FUNCTION_PROFILER(FILE, LABELNO) \
789: fprintf(FILE, "\tbl mcount\n");
790:
791: /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
792: the stack pointer does not matter. No definition is equivalent to
793: always zero.
794:
795: On the RS/6000, this is non-zero because we can restore the stack from
796: its backpointer, which we maintain. */
797: #define EXIT_IGNORE_STACK 1
798:
799: /* This macro generates the assembly code for function exit,
800: on machines that need it. If FUNCTION_EPILOGUE is not defined
801: then individual return instructions are generated for each
802: return statement. Args are same as for FUNCTION_PROLOGUE.
803:
804: The function epilogue should not depend on the current stack pointer!
805: It should use the frame pointer only. This is mandatory because
806: of alloca; we also take advantage of it to omit stack adjustments
807: before returning. */
808:
809: #define FUNCTION_EPILOGUE(FILE, SIZE) output_epilog (FILE, SIZE)
810:
811: /* Output assembler code for a block containing the constant parts
812: of a trampoline, leaving space for the variable parts.
813:
814: The trampoline should set the static chain pointer to value placed
815: into the trampoline and should branch to the specified routine.
816:
817: On the RS/6000, this is not code at all, but merely a data area,
818: since that is the way all functions are called. The first word is
819: the address of the function, the second word is the TOC pointer (r2),
820: and the third word is the static chain value. */
821:
822: #define TRAMPOLINE_TEMPLATE(FILE) { fprintf (FILE, "\t.long 0, 0, 0\n"); }
823:
824: /* Length in units of the trampoline for entering a nested function. */
825:
826: #define TRAMPOLINE_SIZE 12
827:
828: /* Emit RTL insns to initialize the variable parts of a trampoline.
829: FNADDR is an RTX for the address of the function's pure code.
830: CXT is an RTX for the static chain value for the function. */
831:
832: #define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, CXT) \
833: { \
834: emit_move_insn (gen_rtx (MEM, SImode, memory_address (SImode, ADDR)), \
835: force_reg (SImode, FNADDR)); \
836: emit_move_insn (gen_rtx (MEM, SImode, \
837: memory_address (SImode, plus_constant (ADDR, 4))), \
838: gen_rtx (REG, SImode, 2)); \
839: emit_move_insn (gen_rtx (MEM, SImode, \
840: memory_address (SImode, plus_constant (ADDR, 8))), \
841: force_reg (SImode, CXT)); \
842: }
843:
844: /* Definitions for register eliminations.
845:
846: We have two registers that can be eliminated on the RS/6000. First, the
847: frame pointer register can often be eliminated in favor of the stack
848: pointer register. Secondly, the argument pointer register can always be
849: eliminated; it is replaced with either the stack or frame pointer. */
850:
851: /* This is an array of structures. Each structure initializes one pair
852: of eliminable registers. The "from" register number is given first,
853: followed by "to". Eliminations of the same "from" register are listed
854: in order of preference. */
855: #define ELIMINABLE_REGS \
856: {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
857: { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
858: { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM} }
859:
860: /* Given FROM and TO register numbers, say whether this elimination is allowed.
861: Frame pointer elimination is automatically handled.
862:
863: For the RS/6000, if frame pointer elimination is being done, we would like
864: to convert ap into fp, not sp. */
865:
866: #define CAN_ELIMINATE(FROM, TO) \
867: ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \
868: ? ! frame_pointer_needed \
869: : 1)
870:
871: /* Define the offset between two registers, one to be eliminated, and the other
872: its replacement, at the start of a routine. */
873: #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
874: { \
875: int total_stack_size = (rs6000_sa_size () + get_frame_size () \
876: + current_function_outgoing_args_size); \
877: \
878: total_stack_size = (total_stack_size + 7) & ~7; \
879: \
880: if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
881: { \
882: if (rs6000_pushes_stack ()) \
883: (OFFSET) = 0; \
884: else \
885: (OFFSET) = - total_stack_size; \
886: } \
887: else if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \
888: (OFFSET) = total_stack_size; \
889: else if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
890: { \
891: if (rs6000_pushes_stack ()) \
892: (OFFSET) = total_stack_size; \
893: else \
894: (OFFSET) = 0; \
895: } \
896: else \
897: abort (); \
898: }
899:
900: /* Addressing modes, and classification of registers for them. */
901:
902: /* #define HAVE_POST_INCREMENT */
903: /* #define HAVE_POST_DECREMENT */
904:
905: #define HAVE_PRE_DECREMENT
906: #define HAVE_PRE_INCREMENT
907:
908: /* Macros to check register numbers against specific register classes. */
909:
910: /* These assume that REGNO is a hard or pseudo reg number.
911: They give nonzero only if REGNO is a hard reg of the suitable class
912: or a pseudo reg currently allocated to a suitable hard reg.
913: Since they use reg_renumber, they are safe only once reg_renumber
914: has been allocated, which happens in local-alloc.c. */
915:
916: #define REGNO_OK_FOR_INDEX_P(REGNO) \
917: ((REGNO) < FIRST_PSEUDO_REGISTER \
918: ? (REGNO) <= 31 || (REGNO) == 67 \
919: : (reg_renumber[REGNO] >= 0 \
920: && (reg_renumber[REGNO] <= 31 || reg_renumber[REGNO] == 67)))
921:
922: #define REGNO_OK_FOR_BASE_P(REGNO) \
923: ((REGNO) < FIRST_PSEUDO_REGISTER \
924: ? ((REGNO) > 0 && (REGNO) <= 31) || (REGNO) == 67 \
925: : (reg_renumber[REGNO] > 0 \
926: && (reg_renumber[REGNO] <= 31 || reg_renumber[REGNO] == 67)))
927:
928: /* Maximum number of registers that can appear in a valid memory address. */
929:
930: #define MAX_REGS_PER_ADDRESS 2
931:
932: /* Recognize any constant value that is a valid address. */
933:
934: #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)
935:
936: /* Nonzero if the constant value X is a legitimate general operand.
937: It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.
938:
939: On the RS/6000, all integer constants are acceptable, most won't be valid
940: for particular insns, though. Only easy FP constants are
941: acceptable. */
942:
943: #define LEGITIMATE_CONSTANT_P(X) \
944: (GET_CODE (X) != CONST_DOUBLE || GET_MODE (X) == VOIDmode \
945: || easy_fp_constant (X, GET_MODE (X)))
946:
947: /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
948: and check its validity for a certain class.
949: We have two alternate definitions for each of them.
950: The usual definition accepts all pseudo regs; the other rejects
951: them unless they have been allocated suitable hard regs.
952: The symbol REG_OK_STRICT causes the latter definition to be used.
953:
954: Most source files want to accept pseudo regs in the hope that
955: they will get allocated to the class that the insn wants them to be in.
956: Source files for reload pass need to be strict.
957: After reload, it makes no difference, since pseudo regs have
958: been eliminated by then. */
959:
960: #ifndef REG_OK_STRICT
961:
962: /* Nonzero if X is a hard reg that can be used as an index
963: or if it is a pseudo reg. */
964: #define REG_OK_FOR_INDEX_P(X) \
965: (REGNO (X) <= 31 || REGNO (X) == 67 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
966:
967: /* Nonzero if X is a hard reg that can be used as a base reg
968: or if it is a pseudo reg. */
969: #define REG_OK_FOR_BASE_P(X) \
970: (REGNO (X) > 0 && REG_OK_FOR_INDEX_P (X))
971:
972: #else
973:
974: /* Nonzero if X is a hard reg that can be used as an index. */
975: #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
976: /* Nonzero if X is a hard reg that can be used as a base reg. */
977: #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
978:
979: #endif
980:
981: /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
982: that is a valid memory address for an instruction.
983: The MODE argument is the machine mode for the MEM expression
984: that wants to use this address.
985:
986: On the RS/6000, there are four valid address: a SYMBOL_REF that
987: refers to a constant pool entry of an address (or the sum of it
988: plus a constant), a short (16-bit signed) constant plus a register,
989: the sum of two registers, or a register indirect, possibly with an
990: auto-increment. For DFmode and DImode with an constant plus register,
991: we must ensure that both words are addressable. */
992:
993: #define LEGITIMATE_CONSTANT_POOL_BASE_P(X) \
994: (GET_CODE (X) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (X) \
995: && ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (get_pool_constant (X)))
996:
997: #define LEGITIMATE_CONSTANT_POOL_ADDRESS_P(X) \
998: (LEGITIMATE_CONSTANT_POOL_BASE_P (X) \
999: || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
1000: && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT \
1001: && LEGITIMATE_CONSTANT_POOL_BASE_P (XEXP (XEXP (X, 0), 0))))
1002:
1003: #define LEGITIMATE_ADDRESS_INTEGER_P(X,OFFSET) \
1004: (GET_CODE (X) == CONST_INT \
1005: && (unsigned) (INTVAL (X) + (OFFSET) + 0x8000) < 0x10000)
1006:
1007: #define LEGITIMATE_OFFSET_ADDRESS_P(MODE,X) \
1008: (GET_CODE (X) == PLUS \
1009: && GET_CODE (XEXP (X, 0)) == REG \
1010: && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
1011: && LEGITIMATE_ADDRESS_INTEGER_P (XEXP (X, 1), 0) \
1012: && (((MODE) != DFmode && (MODE) != DImode) \
1013: || LEGITIMATE_ADDRESS_INTEGER_P (XEXP (X, 1), 4)))
1014:
1015: #define LEGITIMATE_INDEXED_ADDRESS_P(X) \
1016: (GET_CODE (X) == PLUS \
1017: && GET_CODE (XEXP (X, 0)) == REG \
1018: && GET_CODE (XEXP (X, 1)) == REG \
1019: && ((REG_OK_FOR_BASE_P (XEXP (X, 0)) \
1020: && REG_OK_FOR_INDEX_P (XEXP (X, 1))) \
1021: || (REG_OK_FOR_BASE_P (XEXP (X, 1)) \
1022: && REG_OK_FOR_INDEX_P (XEXP (X, 0)))))
1023:
1024: #define LEGITIMATE_INDIRECT_ADDRESS_P(X) \
1025: (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))
1026:
1027: #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1028: { if (LEGITIMATE_INDIRECT_ADDRESS_P (X)) \
1029: goto ADDR; \
1030: if (GET_CODE (X) == PRE_INC \
1031: && LEGITIMATE_INDIRECT_ADDRESS_P (XEXP (X, 0))) \
1032: goto ADDR; \
1033: if (GET_CODE (X) == PRE_DEC \
1034: && LEGITIMATE_INDIRECT_ADDRESS_P (XEXP (X, 0))) \
1035: goto ADDR; \
1036: if (LEGITIMATE_CONSTANT_POOL_ADDRESS_P (X)) \
1037: goto ADDR; \
1038: if (LEGITIMATE_OFFSET_ADDRESS_P (MODE, X)) \
1039: goto ADDR; \
1040: if ((MODE) != DImode && (MODE) != TImode \
1041: && LEGITIMATE_INDEXED_ADDRESS_P (X)) \
1042: goto ADDR; \
1043: }
1044:
1045: /* Try machine-dependent ways of modifying an illegitimate address
1046: to be legitimate. If we find one, return the new, valid address.
1047: This macro is used in only one place: `memory_address' in explow.c.
1048:
1049: OLDX is the address as it was before break_out_memory_refs was called.
1050: In some cases it is useful to look at this to decide what needs to be done.
1051:
1052: MODE and WIN are passed so that this macro can use
1053: GO_IF_LEGITIMATE_ADDRESS.
1054:
1055: It is always safe for this macro to do nothing. It exists to recognize
1056: opportunities to optimize the output.
1057:
1058: On RS/6000, first check for the sum of a register with a constant
1059: integer that is out of range. If so, generate code to add the
1060: constant with the low-order 16 bits masked to the register and force
1061: this result into another register (this can be done with `cau').
1062: Then generate an address of REG+(CONST&0xffff), allowing for the
1063: possibility of bit 16 being a one.
1064:
1065: Then check for the sum of a register and something not constant, try to
1066: load the other things into a register and return the sum. */
1067:
1068: #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
1069: { if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == REG \
1070: && GET_CODE (XEXP (X, 1)) == CONST_INT \
1071: && (unsigned) (INTVAL (XEXP (X, 1)) + 0x8000) >= 0x10000) \
1072: { int high_int, low_int; \
1073: high_int = INTVAL (XEXP (X, 1)) >> 16; \
1074: low_int = INTVAL (XEXP (X, 1)) & 0xffff; \
1075: if (low_int & 0x8000) \
1076: high_int += 1, low_int |= 0xffff0000; \
1077: (X) = gen_rtx (PLUS, SImode, \
1078: force_operand \
1079: (gen_rtx (PLUS, SImode, XEXP (X, 0), \
1080: gen_rtx (CONST_INT, VOIDmode, \
1081: high_int << 16)), 0),\
1082: gen_rtx (CONST_INT, VOIDmode, low_int)); \
1083: } \
1084: else if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == REG \
1085: && GET_CODE (XEXP (X, 1)) != CONST_INT) \
1086: (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
1087: force_operand (XEXP (X, 1), 0)); \
1088: }
1089:
1090: /* Go to LABEL if ADDR (a legitimate address expression)
1091: has an effect that depends on the machine mode it is used for.
1092:
1093: On the RS/6000 this is true if the address is valid with a zero offset
1094: but not with an offset of four (this means it cannot be used as an
1095: address for DImode or DFmode) or is a pre-increment or decrement. Since
1096: we know it is valid, we just check for an address that is not valid with
1097: an offset of four. */
1098:
1099: #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1100: { if (GET_CODE (ADDR) == PLUS \
1101: && LEGITIMATE_ADDRESS_INTEGER_P (XEXP (ADDR, 1), 0) \
1102: && ! LEGITIMATE_ADDRESS_INTEGER_P (XEXP (ADDR, 1), 4)) \
1103: goto LABEL; \
1104: if (GET_CODE (ADDR) == PRE_INC) \
1105: goto LABEL; \
1106: if (GET_CODE (ADDR) == PRE_DEC) \
1107: goto LABEL; \
1108: }
1109:
1110: /* Define this if some processing needs to be done immediately before
1111: emitting code for an insn. */
1112:
1113: /* #define FINAL_PRESCAN_INSN(INSN,OPERANDS,NOPERANDS) */
1114:
1115: /* Specify the machine mode that this machine uses
1116: for the index in the tablejump instruction. */
1117: #define CASE_VECTOR_MODE SImode
1118:
1119: /* Define this if the tablejump instruction expects the table
1120: to contain offsets from the address of the table.
1121: Do not define this if the table should contain absolute addresses. */
1122: #define CASE_VECTOR_PC_RELATIVE
1123:
1124: /* Specify the tree operation to be used to convert reals to integers. */
1125: #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1126:
1127: /* This is the kind of divide that is easiest to do in the general case. */
1128: #define EASY_DIV_EXPR TRUNC_DIV_EXPR
1129:
1130: /* Define this as 1 if `char' should by default be signed; else as 0. */
1131: #define DEFAULT_SIGNED_CHAR 0
1132:
1133: /* This flag, if defined, says the same insns that convert to a signed fixnum
1134: also convert validly to an unsigned one. */
1135:
1136: /* #define FIXUNS_TRUNC_LIKE_FIX_TRUNC */
1137:
1138: /* Max number of bytes we can move from memory to memory
1139: in one reasonably fast instruction. */
1140: #define MOVE_MAX 16
1141:
1142: /* Nonzero if access to memory by bytes is no faster than for words.
1143: Also non-zero if doing byte operations (specifically shifts) in registers
1144: is undesirable. */
1145: #define SLOW_BYTE_ACCESS 1
1146:
1147: /* Define if normal loads of shorter-than-word items from memory clears
1148: the rest of the bigs in the register. */
1149: #define BYTE_LOADS_ZERO_EXTEND
1.1.1.2 ! root 1150:
! 1151: /* The RS/6000 uses the XCOFF format. */
1.1 root 1152:
1.1.1.2 ! root 1153: #define XCOFF_DEBUGGING_INFO
1.1 root 1154:
1155: /* We don't have GAS for the RS/6000 yet, so don't write out special
1156: .stabs in cc1plus. */
1157:
1158: #define FASCIST_ASSEMBLER
1159:
1160: /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1161: is done just by pretending it is already truncated. */
1162: #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1163:
1164: /* Specify the machine mode that pointers have.
1165: After generation of rtl, the compiler makes no further distinction
1166: between pointers and any other objects of this machine mode. */
1167: #define Pmode SImode
1168:
1169: /* Mode of a function address in a call instruction (for indexing purposes).
1170:
1171: Doesn't matter on RS/6000. */
1172: #define FUNCTION_MODE SImode
1173:
1174: /* Define this if addresses of constant functions
1175: shouldn't be put through pseudo regs where they can be cse'd.
1176: Desirable on machines where ordinary constants are expensive
1177: but a CALL with constant address is cheap. */
1178: #define NO_FUNCTION_CSE
1179:
1180: /* Define this if shift instructions ignore all but the low-order
1181: few bits. */
1182: #define SHIFT_COUNT_TRUNCATED
1183:
1184: /* Use atexit for static constructors/destructors, instead of defining
1185: our own exit function. */
1186: #define HAVE_ATEXIT
1187:
1188: /* Compute the cost of computing a constant rtl expression RTX
1189: whose rtx-code is CODE. The body of this macro is a portion
1190: of a switch statement. If the code is computed here,
1191: return it with a return statement. Otherwise, break from the switch.
1192:
1193: On the RS/6000, if it is legal in the insn, it is free. So this
1194: always returns 0. */
1195:
1196: #define CONST_COSTS(RTX,CODE) \
1197: case CONST_INT: \
1198: case CONST: \
1199: case LABEL_REF: \
1200: case SYMBOL_REF: \
1201: case CONST_DOUBLE: \
1202: return 0;
1203:
1204: /* Provide the costs of a rtl expression. This is in the body of a
1205: switch on CODE. */
1206:
1207: #define RTX_COSTS(X,CODE) \
1208: case MULT: \
1209: return (GET_CODE (XEXP (X, 1)) != CONST_INT \
1210: ? COSTS_N_INSNS (5) \
1211: : INTVAL (XEXP (X, 1)) >= -256 && INTVAL (XEXP (X, 1)) <= 255 \
1212: ? COSTS_N_INSNS (3) : COSTS_N_INSNS (4)); \
1213: case DIV: \
1214: case MOD: \
1215: if (GET_CODE (XEXP (X, 1)) == CONST_INT \
1216: && exact_log2 (INTVAL (XEXP (X, 1))) >= 0) \
1217: return COSTS_N_INSNS (2); \
1218: /* otherwise fall through to normal divide. */ \
1219: case UDIV: \
1220: case UMOD: \
1221: return COSTS_N_INSNS (19); \
1222: case MEM: \
1223: /* MEM should be slightly more expensive than (plus (reg) (const)) */ \
1224: return 5;
1225:
1226: /* Compute the cost of an address. This is meant to approximate the size
1227: and/or execution delay of an insn using that address. If the cost is
1228: approximated by the RTL complexity, including CONST_COSTS above, as
1229: is usually the case for CISC machines, this macro should not be defined.
1230: For aggressively RISCy machines, only one insn format is allowed, so
1231: this macro should be a constant. The value of this macro only matters
1232: for valid addresses.
1233:
1234: For the RS/6000, everything is cost 0. */
1235:
1236: #define ADDRESS_COST(RTX) 0
1237:
1238: /* Adjust the length of an INSN. LENGTH is the currently-computed length and
1239: should be adjusted to reflect any required changes. This macro is used when
1240: there is some systematic length adjustment required that would be difficult
1241: to express in the length attribute. */
1242:
1243: /* #define ADJUST_INSN_LENGTH(X,LENGTH) */
1244:
1245: /* Add any extra modes needed to represent the condition code.
1246:
1247: For the RS/6000, we need separate modes when unsigned (logical) comparisons
1248: are being done and we need a separate mode for floating-point. */
1249:
1250: #define EXTRA_CC_MODES CCUNSmode, CCFPmode
1251:
1252: /* Define the names for the modes specified above. */
1253: #define EXTRA_CC_NAMES "CCUNS", "CCFP"
1254:
1255: /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
1256: return the mode to be used for the comparison. For floating-point, CCFPmode
1257: should be used. CC_NOOVmode should be used when the first operand is a
1258: PLUS, MINUS, or NEG. CCmode should be used when no special processing is
1259: needed. */
1260: #define SELECT_CC_MODE(OP,X) \
1261: (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT ? CCFPmode \
1262: : ((OP) == GTU || (OP) == LTU || (OP) == GEU || (OP) == LEU \
1263: ? CCUNSmode : CCmode))
1264:
1265: /* Define the information needed to generate branch and scc insns. This is
1266: stored from the compare operation. Note that we can't use "rtx" here
1267: since it hasn't been defined! */
1268:
1269: extern struct rtx_def *rs6000_compare_op0, *rs6000_compare_op1;
1270: extern int rs6000_compare_fp_p;
1271:
1272: /* Set to non-zero by "fix" operation to indicate that itrunc and
1273: uitrunc must be defined. */
1274:
1275: extern int rs6000_trunc_used;
1276:
1277: /* Control the assembler format that we output. */
1278:
1279: /* Output at beginning of assembler file.
1280:
1281: On the RS/6000, we want to go into the TOC section so at least one
1282: .toc will be emitted.
1283:
1.1.1.2 ! root 1284: Also initialize the section names for the RS/6000 at this point.
! 1285:
! 1286: Also, in order to output proper .bs/.es pairs, we need at least one static
! 1287: [RW] section emitted. */
1.1 root 1288:
1289: #define ASM_FILE_START(FILE) \
1290: { \
1.1.1.2 ! root 1291: rs6000_gen_section_name (&xcoff_bss_section_name, \
1.1 root 1292: main_input_filename, ".bss_"); \
1.1.1.2 ! root 1293: rs6000_gen_section_name (&xcoff_private_data_section_name, \
1.1 root 1294: main_input_filename, ".rw_"); \
1.1.1.2 ! root 1295: rs6000_gen_section_name (&xcoff_read_only_section_name, \
1.1 root 1296: main_input_filename, ".ro_"); \
1297: \
1298: toc_section (); \
1299: bss_section (); \
1.1.1.2 ! root 1300: if (write_symbols != NO_DEBUG) \
! 1301: private_data_section (); \
1.1 root 1302: }
1303:
1304: /* Output at end of assembler file.
1305:
1306: On the RS/6000, referencing data should automatically pull in text. */
1307:
1308: #define ASM_FILE_END(FILE) \
1309: { \
1310: text_section (); \
1311: fprintf (FILE, "_section_.text:\n"); \
1312: data_section (); \
1313: fprintf (FILE, "\t.long _section_.text\n"); \
1314: }
1315:
1316: /* We define this to prevent the name mangler from putting dollar signs into
1317: function names. */
1318:
1319: #define NO_DOLLAR_IN_LABEL
1320:
1321: /* We define this to 0 so that gcc will never accept a dollar sign in a
1322: variable name. This is needed because the AIX assembler will not accept
1323: dollar signs. */
1324:
1325: #define DOLLARS_IN_IDENTIFIERS 0
1326:
1.1.1.2 ! root 1327: /* Implicit library calls should use memcpy, not bcopy, etc. */
! 1328:
! 1329: #define TARGET_MEM_FUNCTIONS
! 1330:
1.1 root 1331: /* Define the extra sections we need. We define three: one is the read-only
1332: data section which is used for constants. This is a csect whose name is
1333: derived from the name of the input file. The second is for initialized
1334: global variables. This is a csect whose name is that of the variable.
1335: The third is the TOC. */
1336:
1337: #define EXTRA_SECTIONS \
1338: read_only_data, private_data, read_only_private_data, toc, bss
1339:
1340: /* Define the name of our readonly data section. */
1341:
1342: #define READONLY_DATA_SECTION read_only_data_section
1343:
1344: /* Indicate that jump tables go in the text section. */
1345:
1346: #define JUMP_TABLES_IN_TEXT_SECTION
1347:
1348: /* Define the routines to implement these extra sections. */
1349:
1350: #define EXTRA_SECTION_FUNCTIONS \
1351: \
1352: void \
1353: read_only_data_section () \
1354: { \
1355: if (in_section != read_only_data) \
1356: { \
1.1.1.2 ! root 1357: fprintf (asm_out_file, "\t.csect %s[RO]\n", \
! 1358: xcoff_read_only_section_name); \
1.1 root 1359: in_section = read_only_data; \
1360: } \
1361: } \
1362: \
1363: void \
1364: private_data_section () \
1365: { \
1366: if (in_section != private_data) \
1367: { \
1368: fprintf (asm_out_file, "\t.csect %s[RW]\n", \
1.1.1.2 ! root 1369: xcoff_private_data_section_name); \
1.1 root 1370: \
1371: in_section = private_data; \
1372: } \
1373: } \
1374: \
1375: void \
1376: read_only_private_data_section () \
1377: { \
1378: if (in_section != read_only_private_data) \
1379: { \
1.1.1.2 ! root 1380: fprintf (asm_out_file, "\t.csect %s[RO]\n", \
! 1381: xcoff_private_data_section_name); \
1.1 root 1382: in_section = read_only_private_data; \
1383: } \
1384: } \
1385: \
1386: void \
1387: toc_section () \
1388: { \
1389: if (in_section != toc) \
1390: fprintf (asm_out_file, "\t.toc\n"); \
1391: \
1392: in_section = toc; \
1393: } \
1394: \
1395: void \
1396: bss_section () \
1397: { \
1398: if (in_section != bss) \
1399: { \
1.1.1.2 ! root 1400: fprintf (asm_out_file, "\t.csect %s[BS]\n", \
! 1401: xcoff_bss_section_name); \
1.1 root 1402: in_section = bss; \
1403: } \
1404: } \
1405:
1406: /* This macro produces the initial definition of a function name.
1407: On the RS/6000, we need to place an extra '.' in the function name and
1408: output the function descriptor.
1409:
1410: The csect for the function will have already been created by the
1411: `text_section' call previously done. We do have to go back to that
1412: csect, however. */
1413:
1.1.1.2 ! root 1414: /* ??? What do the 16 and 044 in the .function line really mean? */
! 1415:
1.1 root 1416: #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
1417: { if (TREE_PUBLIC (DECL)) \
1418: { \
1419: fprintf (FILE, "\t.globl ."); \
1420: RS6000_OUTPUT_BASENAME (FILE, NAME); \
1.1.1.2 ! root 1421: fprintf (FILE, "\n"); \
! 1422: } \
! 1423: else if (write_symbols == XCOFF_DEBUG) \
! 1424: { \
! 1425: fprintf (FILE, "\t.lglobl ."); \
! 1426: RS6000_OUTPUT_BASENAME (FILE, NAME); \
! 1427: fprintf (FILE, "\n"); \
1.1 root 1428: } \
1429: fprintf (FILE, "\t.csect "); \
1430: RS6000_OUTPUT_BASENAME (FILE, NAME); \
1431: fprintf (FILE, "[DS]\n"); \
1432: RS6000_OUTPUT_BASENAME (FILE, NAME); \
1433: fprintf (FILE, ":\n"); \
1434: fprintf (FILE, "\t.long ."); \
1435: RS6000_OUTPUT_BASENAME (FILE, NAME); \
1.1.1.2 ! root 1436: fprintf (FILE, ", TOC[tc0], 0\n"); \
1.1 root 1437: fprintf (FILE, "\t.csect [PR]\n."); \
1438: RS6000_OUTPUT_BASENAME (FILE, NAME); \
1439: fprintf (FILE, ":\n"); \
1.1.1.2 ! root 1440: if (write_symbols == XCOFF_DEBUG) \
! 1441: { \
! 1442: dbxout_symbol (DECL, 0); \
! 1443: fprintf (FILE, "\t.function ."); \
! 1444: RS6000_OUTPUT_BASENAME (FILE, NAME); \
! 1445: fprintf (FILE, ",."); \
! 1446: RS6000_OUTPUT_BASENAME (FILE, NAME); \
! 1447: fprintf (FILE, ",16,044,L..end_"); \
! 1448: RS6000_OUTPUT_BASENAME (FILE, NAME); \
! 1449: fprintf (FILE, "-."); \
! 1450: RS6000_OUTPUT_BASENAME (FILE, NAME); \
! 1451: fprintf (FILE, "\n"); \
! 1452: } \
1.1 root 1453: }
1454:
1455: /* Return non-zero if this entry is to be written into the constant pool
1456: in a special way. We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
1457: containing one of them. If -mfp-in-toc (the default), we also do
1458: this for floating-point constants. We actually can only do this
1459: if the FP formats of the target and host machines are the same, but
1460: we can't check that since not every file that uses
1461: GO_IF_LEGITIMATE_ADDRESS_P includes real.h. */
1462:
1463: #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X) \
1464: (GET_CODE (X) == SYMBOL_REF \
1465: || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
1466: && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
1467: || GET_CODE (X) == LABEL_REF \
1468: || (TARGET_FP_IN_TOC && GET_CODE (X) == CONST_DOUBLE \
1469: && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
1470: && BITS_PER_WORD == HOST_BITS_PER_INT))
1471:
1472: /* Select section for constant in constant pool.
1473:
1474: On RS/6000, all constants are in the private read-only data area.
1475: However, if this is being placed in the TOC it must be output as a
1476: toc entry. */
1477:
1478: #define SELECT_RTX_SECTION(MODE, X) \
1479: { if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (X)) \
1480: toc_section (); \
1481: else \
1482: read_only_private_data_section (); \
1483: }
1484:
1485: /* Macro to output a special constant pool entry. Go to WIN if we output
1486: it. Otherwise, it is written the usual way.
1487:
1488: On the RS/6000, toc entries are handled this way. */
1489:
1490: #define ASM_OUTPUT_SPECIAL_POOL_ENTRY(FILE, X, MODE, ALIGN, LABELNO, WIN) \
1491: { if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (X)) \
1492: { \
1493: output_toc (FILE, X, LABELNO); \
1494: goto WIN; \
1495: } \
1496: }
1497:
1498: /* Select the section for an initialized data object.
1499:
1500: On the RS/6000, we have a special section for all variables except those
1501: that are static. */
1502:
1503: #define SELECT_SECTION(EXP,RELOC) \
1504: { \
1505: if ((TREE_READONLY (EXP) \
1506: || (TREE_CODE (EXP) == STRING_CST \
1507: && !flag_writable_strings)) \
1508: && ! TREE_THIS_VOLATILE (EXP) \
1509: && ! (RELOC)) \
1510: { \
1511: if (TREE_PUBLIC (EXP)) \
1512: read_only_data_section (); \
1513: else \
1514: read_only_private_data_section (); \
1515: } \
1516: else \
1517: { \
1518: if (TREE_PUBLIC (EXP)) \
1519: data_section (); \
1520: else \
1521: private_data_section (); \
1522: } \
1523: }
1524:
1525: /* This outputs NAME to FILE up to the first null or '['. */
1526:
1527: #define RS6000_OUTPUT_BASENAME(FILE, NAME) \
1528: if ((NAME)[0] == '*') \
1529: assemble_name (FILE, NAME); \
1530: else \
1531: { \
1532: char *_p; \
1533: for (_p = (NAME); *_p && *_p != '['; _p++) \
1534: fputc (*_p, FILE); \
1535: }
1536:
1537: /* Output something to declare an external symbol to the assembler. Most
1538: assemblers don't need this.
1539:
1540: If we haven't already, add "[RW]" (or "[DS]" for a function) to the
1541: name. Normally we write this out along with the name. In the few cases
1542: where we can't, it gets stripped off. */
1543:
1544: #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
1545: { rtx _symref = XEXP (DECL_RTL (DECL), 0); \
1546: if ((TREE_CODE (DECL) == VAR_DECL \
1547: || TREE_CODE (DECL) == FUNCTION_DECL) \
1548: && (NAME)[0] != '*' \
1549: && (NAME)[strlen (NAME) - 1] != ']') \
1550: { \
1551: char *_name = (char *) permalloc (strlen (XSTR (_symref, 0)) + 5); \
1552: strcpy (_name, XSTR (_symref, 0)); \
1553: strcat (_name, TREE_CODE (DECL) == FUNCTION_DECL ? "[DS]" : "[RW]"); \
1554: XSTR (_symref, 0) = _name; \
1555: } \
1556: fprintf (FILE, "\t.extern "); \
1557: assemble_name (FILE, XSTR (_symref, 0)); \
1558: if (TREE_CODE (DECL) == FUNCTION_DECL) \
1559: { \
1560: fprintf (FILE, "\n\t.extern ."); \
1561: RS6000_OUTPUT_BASENAME (FILE, XSTR (_symref, 0)); \
1562: } \
1563: fprintf (FILE, "\n"); \
1564: }
1565:
1566: /* Similar, but for libcall. We only have to worry about the function name,
1567: not that of the descriptor. */
1568:
1569: #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
1570: { fprintf (FILE, "\t.extern ."); \
1571: assemble_name (FILE, XSTR (FUN, 0)); \
1572: fprintf (FILE, "\n"); \
1573: }
1574:
1575: /* Output to assembler file text saying following lines
1576: may contain character constants, extra white space, comments, etc. */
1577:
1578: #define ASM_APP_ON ""
1579:
1580: /* Output to assembler file text saying following lines
1581: no longer contain unusual constructs. */
1582:
1583: #define ASM_APP_OFF ""
1584:
1585: /* Output before instructions. */
1586:
1.1.1.2 ! root 1587: #define TEXT_SECTION_ASM_OP ".csect [PR]"
1.1 root 1588:
1589: /* Output before writable data. */
1590:
1.1.1.2 ! root 1591: #define DATA_SECTION_ASM_OP ".csect .data[RW]"
1.1 root 1592:
1593: /* How to refer to registers in assembler output.
1594: This sequence is indexed by compiler's hard-register-number (see above). */
1595:
1596: #define REGISTER_NAMES \
1597: {"0", "1", "2", "3", "4", "5", "6", "7", \
1598: "8", "9", "10", "11", "12", "13", "14", "15", \
1599: "16", "17", "18", "19", "20", "21", "22", "23", \
1600: "24", "25", "26", "27", "28", "29", "30", "31", \
1601: "0", "1", "2", "3", "4", "5", "6", "7", \
1602: "8", "9", "10", "11", "12", "13", "14", "15", \
1603: "16", "17", "18", "19", "20", "21", "22", "23", \
1604: "24", "25", "26", "27", "28", "29", "30", "31", \
1605: "mq", "lr", "ctr", "ap", \
1606: "0", "1", "2", "3", "4", "5", "6", "7" }
1607:
1608: /* Table of additional register names to use in user input. */
1609:
1610: #define ADDITIONAL_REGISTER_NAMES \
1611: {"r0", 0, "r1", 1, "r2", 2, "r3", 3, \
1612: "r4", 4, "r5", 5, "r6", 6, "r7", 7, \
1613: "r8", 8, "r9", 9, "r10", 10, "r11", 11, \
1614: "r12", 12, "r13", 13, "r14", 14, "r15", 15, \
1615: "r16", 16, "r17", 17, "r18", 18, "r19", 19, \
1616: "r20", 20, "r21", 21, "r22", 22, "r23", 23, \
1617: "r24", 24, "r25", 25, "r26", 26, "r27", 27, \
1618: "r28", 28, "r29", 29, "r30", 30, "r31", 31, \
1619: "fr0", 32, "fr1", 33, "fr2", 34, "fr3", 35, \
1620: "fr4", 36, "fr5", 37, "fr6", 38, "fr7", 39, \
1621: "fr8", 40, "fr9", 41, "fr10", 42, "fr11", 43, \
1622: "fr12", 44, "fr13", 45, "fr14", 46, "fr15", 47, \
1623: "fr16", 48, "fr17", 49, "fr18", 50, "fr19", 51, \
1624: "fr20", 52, "fr21", 53, "fr22", 54, "fr23", 55, \
1625: "fr24", 56, "fr25", 57, "fr26", 58, "fr27", 59, \
1626: "fr28", 60, "fr29", 61, "fr30", 62, "fr31", 63, \
1627: /* no additional names for: mq, lr, ctr, ap */ \
1628: "cr0", 68, "cr1", 69, "cr2", 70, "cr3", 71, \
1629: "cr4", 72, "cr5", 73, "cr6", 74, "cr7", 75 }
1630:
1631: /* How to renumber registers for dbx and gdb. */
1632:
1633: #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
1634:
1635: /* This is how to output the definition of a user-level label named NAME,
1636: such as the label on a static function or variable NAME. */
1637:
1638: #define ASM_OUTPUT_LABEL(FILE,NAME) \
1639: do { RS6000_OUTPUT_BASENAME (FILE, NAME); fputs (":\n", FILE); } while (0)
1640:
1641: /* This is how to output a command to make the user-level label named NAME
1642: defined for reference from other files. */
1643:
1644: #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
1645: do { fputs ("\t.globl ", FILE); \
1646: RS6000_OUTPUT_BASENAME (FILE, NAME); fputs ("\n", FILE);} while (0)
1647:
1648: /* This is how to output a reference to a user-level label named NAME.
1649: `assemble_name' uses this. */
1650:
1651: #define ASM_OUTPUT_LABELREF(FILE,NAME) \
1652: fprintf (FILE, NAME)
1653:
1654: /* This is how to output an internal numbered label where
1655: PREFIX is the class of label and NUM is the number within the class. */
1656:
1657: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
1658: fprintf (FILE, "%s..%d:\n", PREFIX, NUM)
1659:
1660: /* This is how to output a label for a jump table. Arguments are the same as
1661: for ASM_OUTPUT_INTERNAL_LABEL, except the insn for the jump table is
1662: passed. */
1663:
1664: #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
1665: { ASM_OUTPUT_ALIGN (FILE, 2); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); }
1666:
1667: /* This is how to store into the string LABEL
1668: the symbol_ref name of an internal numbered label where
1669: PREFIX is the class of label and NUM is the number within the class.
1670: This is suitable for output with `assemble_name'. */
1671:
1672: #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
1673: sprintf (LABEL, "%s..%d", PREFIX, NUM)
1674:
1675: /* This is how to output an assembler line defining a `double' constant. */
1676:
1677: #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
1678: fprintf (FILE, "\t.double 0d%.20e\n", (VALUE))
1679:
1680: /* This is how to output an assembler line defining a `float' constant. */
1681:
1682: #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
1683: fprintf (FILE, "\t.float 0d%.20e\n", (VALUE))
1684:
1685: /* This is how to output an assembler line defining an `int' constant. */
1686:
1687: #define ASM_OUTPUT_INT(FILE,VALUE) \
1688: ( fprintf (FILE, "\t.long "), \
1689: output_addr_const (FILE, (VALUE)), \
1690: fprintf (FILE, "\n"))
1691:
1692: /* Likewise for `char' and `short' constants. */
1693:
1694: #define ASM_OUTPUT_SHORT(FILE,VALUE) \
1695: ( fprintf (FILE, "\t.short "), \
1696: output_addr_const (FILE, (VALUE)), \
1697: fprintf (FILE, "\n"))
1698:
1699: #define ASM_OUTPUT_CHAR(FILE,VALUE) \
1700: ( fprintf (FILE, "\t.byte "), \
1701: output_addr_const (FILE, (VALUE)), \
1702: fprintf (FILE, "\n"))
1703:
1704: /* This is how to output an assembler line for a numeric constant byte. */
1705:
1706: #define ASM_OUTPUT_BYTE(FILE,VALUE) \
1707: fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
1708:
1709: /* This is how to output an assembler line to define N characters starting
1710: at P to FILE. */
1711:
1712: #define ASM_OUTPUT_ASCII(FILE, P, N) output_ascii ((FILE), (P), (N))
1713:
1714: /* This is how to output code to push a register on the stack.
1715: It need not be very fast code. */
1716:
1717: #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
1718: fprintf (FILE, "\tstu %s,-4(r1)\n", reg_names[REGNO]);
1719:
1720: /* This is how to output an insn to pop a register from the stack.
1721: It need not be very fast code. */
1722:
1723: #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
1724: fprintf (FILE, "\tl %s,0(r1)\n\tai r1,r1,4\n", reg_names[REGNO])
1725:
1726: /* This is how to output an element of a case-vector that is absolute.
1727: (RS/6000 does not use such vectors, but we must define this macro
1728: anyway.) */
1729:
1730: #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1731: fprintf (FILE, "\t.long L..%d\n", VALUE)
1732:
1733: /* This is how to output an element of a case-vector that is relative. */
1734:
1735: #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
1736: fprintf (FILE, "\t.long L..%d-L..%d\n", VALUE, REL)
1737:
1738: /* This is how to output an assembler line
1739: that says to advance the location counter
1740: to a multiple of 2**LOG bytes. */
1741:
1742: #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1743: if ((LOG) != 0) \
1744: fprintf (FILE, "\t.align %d\n", (LOG))
1745:
1746: #define ASM_OUTPUT_SKIP(FILE,SIZE) \
1747: fprintf (FILE, "\t.space %d\n", (SIZE))
1748:
1749: /* This says how to output an assembler line
1750: to define a global common symbol. */
1751:
1752: #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
1.1.1.2 ! root 1753: do { bss_section (); \
! 1754: fputs (".comm ", (FILE)); \
1.1 root 1755: RS6000_OUTPUT_BASENAME ((FILE), (NAME)); \
1756: fprintf ((FILE), ",%d\n", (SIZE)); } while (0)
1757:
1758: /* This says how to output an assembler line
1759: to define a local common symbol. */
1760:
1761: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \
1.1.1.2 ! root 1762: do { bss_section (); \
! 1763: fputs (".lcomm ", (FILE)); \
1.1 root 1764: RS6000_OUTPUT_BASENAME ((FILE), (NAME)); \
1.1.1.2 ! root 1765: fprintf ((FILE), ",%d,%s\n", (SIZE), xcoff_bss_section_name); \
1.1 root 1766: } while (0)
1767:
1768: /* Store in OUTPUT a string (made with alloca) containing
1769: an assembler-name for a local static variable named NAME.
1770: LABELNO is an integer which is different for each call. */
1771:
1772: #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1773: ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
1774: sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1775:
1776: /* Define the parentheses used to group arithmetic operations
1777: in assembler code. */
1778:
1779: #define ASM_OPEN_PAREN "("
1780: #define ASM_CLOSE_PAREN ")"
1781:
1782: /* Define results of standard character escape sequences. */
1783: #define TARGET_BELL 007
1784: #define TARGET_BS 010
1785: #define TARGET_TAB 011
1786: #define TARGET_NEWLINE 012
1787: #define TARGET_VT 013
1788: #define TARGET_FF 014
1789: #define TARGET_CR 015
1790:
1791: /* Print operand X (an rtx) in assembler syntax to file FILE.
1792: CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1793: For `%' followed by punctuation, CODE is the punctuation and X is null. */
1794:
1795: #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
1796:
1797: /* Define which CODE values are valid. */
1798:
1799: #define PRINT_OPERAND_PUNCT_VALID_P(CODE) 0
1800:
1801: /* Print a memory address as an operand to reference that memory location. */
1802:
1803: #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
1804:
1805: /* Define the codes that are matched by predicates in rs6000.c. */
1806:
1807: #define PREDICATE_CODES \
1808: {"short_cint_operand", {CONST_INT}}, \
1809: {"u_short_cint_operand", {CONST_INT}}, \
1810: {"gen_reg_operand", {SUBREG, REG}}, \
1811: {"cc_reg_operand", {SUBREG, REG}}, \
1812: {"reg_or_short_operand", {SUBREG, REG, CONST_INT}}, \
1813: {"reg_or_neg_short_operand", {SUBREG, REG, CONST_INT}}, \
1814: {"reg_or_u_short_operand", {SUBREG, REG, CONST_INT}}, \
1815: {"reg_or_cint_operand", {SUBREG, REG, CONST_INT}}, \
1816: {"easy_fp_constant", {CONST_DOUBLE}}, \
1817: {"reg_or_mem_operand", {SUBREG, MEM, REG}}, \
1818: {"fp_reg_or_mem_operand", {SUBREG, MEM, REG}}, \
1819: {"mem_or_easy_const_operand", {SUBREG, MEM, CONST_DOUBLE}}, \
1820: {"add_operand", {SUBREG, REG, CONST_INT}}, \
1821: {"and_operand", {SUBREG, REG, CONST_INT}}, \
1822: {"logical_operand", {SUBREG, REG, CONST_INT}}, \
1823: {"mask_operand", {CONST_INT}}, \
1824: {"call_operand", {SYMBOL_REF, REG}}, \
1825: {"input_operand", {SUBREG, MEM, REG, CONST_INT}}, \
1826: {"branch_comparison_operation", {EQ, NE, LE, LT, GE, \
1827: LT, LEU, LTU, GEU, GTU}}, \
1828: {"scc_comparison_operation", {EQ, NE, LE, LT, GE, \
1829: LT, LEU, LTU, GEU, GTU}},
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.