]>
Commit | Line | Data |
---|---|---|
014cfee8 RS |
1 | /* Definitions of target machine parameters for GNU compiler, |
2 | for Pyramid 90x, 9000, and MIServer Series. | |
8b109b37 | 3 | Copyright (C) 1989, 1995 Free Software Foundation, Inc. |
014cfee8 RS |
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. */ | |
8b109b37 | 20 | |
014cfee8 RS |
21 | /* |
22 | * If you're going to change this, and you haven't already, | |
23 | * you should get and read | |
24 | * ``OSx Operating System Porting Guide'', | |
25 | * publication number 4100-0066-A | |
26 | * Revision A | |
27 | * Pyramid Technology Corporation. | |
28 | * | |
29 | * or whatever the most recent version is. In any case, page and | |
30 | * section number references given herein refer to this document. | |
31 | * | |
32 | * The instruction table for gdb lists the available insns and | |
33 | * the valid addressing modes. | |
34 | * | |
35 | * Any other information on the Pyramid architecture is proprietary | |
36 | * and hard to get. (Pyramid cc -S and adb are also useful.) | |
37 | * | |
38 | */ | |
39 | ||
40 | /*** Run-time compilation parameters selecting different hardware subsets. ***/ | |
41 | ||
42 | /* Names to predefine in the preprocessor for this target machine. */ | |
43 | ||
65c42379 | 44 | #define CPP_PREDEFINES "-Dpyr -Dunix -Asystem(unix) -Acpu(pyr) -Amachine(pyr)" |
014cfee8 RS |
45 | |
46 | /* Print subsidiary information on the compiler version in use. */ | |
47 | ||
48 | #define TARGET_VERSION fprintf (stderr, " (pyr)"); | |
49 | ||
50 | extern int target_flags; | |
51 | ||
52 | /* Nonzero if compiling code that Unix assembler can assemble. */ | |
53 | #define TARGET_UNIX_ASM (target_flags & 1) | |
54 | ||
014cfee8 | 55 | /* Implement stdarg in the same fashion used on all other machines. */ |
13a07c71 | 56 | #define TARGET_GNU_STDARG (target_flags & 2) |
014cfee8 RS |
57 | |
58 | /* Compile using RETD to pop off the args. | |
59 | This will not work unless you use prototypes at least | |
60 | for all functions that can take varying numbers of args. | |
61 | This contravenes the Pyramid calling convention, so we don't | |
62 | do it yet. */ | |
63 | ||
13a07c71 | 64 | #define TARGET_RETD (target_flags & 4) |
014cfee8 RS |
65 | |
66 | /* Macros used in the machine description to test the flags. */ | |
67 | ||
68 | /* Macro to define tables used to set the flags. | |
69 | This is a list in braces of pairs in braces, | |
70 | each pair being { "NAME", VALUE } | |
71 | where VALUE is the bits to set or minus the bits to clear. | |
72 | An empty string NAME is used to identify the default VALUE. | |
73 | ||
13a07c71 | 74 | -mgnu will be useful if we ever have GAS on a pyramid. */ |
014cfee8 RS |
75 | |
76 | #define TARGET_SWITCHES \ | |
77 | { {"unix", 1}, \ | |
78 | {"gnu", -1}, \ | |
13a07c71 TG |
79 | {"gnu-stdarg", 2}, \ |
80 | {"nognu-stdarg", -2}, \ | |
81 | {"retd", 4}, \ | |
82 | {"no-retd", -4}, \ | |
014cfee8 RS |
83 | { "", TARGET_DEFAULT}} |
84 | ||
85 | /* Default target_flags if no switches specified. | |
86 | ||
87 | (equivalent to "-munix -mindex -mgnu-stdarg") */ | |
88 | ||
89 | #ifndef TARGET_DEFAULT | |
13a07c71 | 90 | #define TARGET_DEFAULT (1 + 2) |
014cfee8 RS |
91 | #endif |
92 | ||
936b69b3 TG |
93 | /* Make GCC agree with types.h. */ |
94 | #ifdef SIZE_TYPE | |
95 | #undef SIZE_TYPE | |
96 | #endif | |
97 | #define SIZE_TYPE "unsigned int" | |
98 | ||
99 | /* Assembler does not permit $ in labels */ | |
100 | ||
101 | #define NO_DOLLAR_IN_LABEL | |
102 | ||
2e2863d4 RS |
103 | /* Maybe it doesn't permit dot either. */ |
104 | #define NO_DOT_IN_LABEL | |
105 | ||
014cfee8 RS |
106 | /* Never allow $ in identifiers */ |
107 | ||
108 | #define DOLLARS_IN_IDENTIFIERS 0 | |
109 | \f | |
110 | /*** Target machine storage layout ***/ | |
111 | ||
13a07c71 TG |
112 | /* Define this to non-zero if most significant bit is lowest |
113 | numbered in instructions that operate on numbered bit-fields. | |
014cfee8 RS |
114 | This is not true on the pyramid. */ |
115 | #define BITS_BIG_ENDIAN 0 | |
116 | ||
13a07c71 TG |
117 | /* Define this to non-zero if most significant byte of a word is |
118 | the lowest numbered. */ | |
014cfee8 RS |
119 | #define BYTES_BIG_ENDIAN 1 |
120 | ||
13a07c71 TG |
121 | /* Define this to non-zero if most significant word of a multiword |
122 | number is the lowest numbered. */ | |
014cfee8 RS |
123 | #define WORDS_BIG_ENDIAN 1 |
124 | ||
125 | /* Number of bits in an addressable storage unit */ | |
126 | #define BITS_PER_UNIT 8 | |
127 | ||
128 | /* Width in bits of a "word", which is the contents of a machine register. | |
129 | Note that this is not necessarily the width of data type `int'; | |
130 | if using 16-bit ints on a 68000, this would still be 32. | |
131 | But on a machine with 16-bit registers, this would be 16. */ | |
132 | #define BITS_PER_WORD 32 | |
133 | ||
134 | /* Width of a word, in units (bytes). */ | |
135 | #define UNITS_PER_WORD 4 | |
136 | ||
137 | /* Width in bits of a pointer. | |
138 | See also the macro `Pmode' defined below. */ | |
139 | #define POINTER_SIZE 32 | |
140 | ||
141 | /* Allocation boundary (in *bits*) for storing arguments in argument list. */ | |
142 | #define PARM_BOUNDARY 32 | |
143 | ||
144 | /* Boundary (in *bits*) on which stack pointer should be aligned. */ | |
145 | #define STACK_BOUNDARY 32 | |
146 | ||
147 | /* Allocation boundary (in *bits*) for the code of a function. */ | |
148 | #define FUNCTION_BOUNDARY 32 | |
149 | ||
150 | /* Alignment of field after `int : 0' in a structure. */ | |
151 | #define EMPTY_FIELD_BOUNDARY 32 | |
152 | ||
e97f2dc6 | 153 | /* Every structure's size must be a multiple of this. */ |
e97f2dc6 RS |
154 | #define STRUCTURE_SIZE_BOUNDARY 32 |
155 | ||
014cfee8 RS |
156 | /* No data type wants to be aligned rounder than this. */ |
157 | #define BIGGEST_ALIGNMENT 32 | |
158 | ||
159 | /* Specified types of bitfields affect alignment of those fields | |
160 | and of the structure as a whole. */ | |
e97f2dc6 | 161 | #define PCC_BITFIELD_TYPE_MATTERS 1 |
014cfee8 RS |
162 | |
163 | /* Make strings word-aligned so strcpy from constants will be faster. | |
164 | Pyramid documentation says the best alignment is to align | |
165 | on the size of a cache line, which is 32 bytes. | |
166 | Newer pyrs have single insns that do strcmp() and strcpy(), so this | |
167 | may not actually win anything. */ | |
014cfee8 RS |
168 | #define CONSTANT_ALIGNMENT(EXP, ALIGN) \ |
169 | (TREE_CODE (EXP) == STRING_CST \ | |
170 | && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN)) | |
171 | ||
172 | /* Make arrays of chars word-aligned for the same reasons. */ | |
173 | #define DATA_ALIGNMENT(TYPE, ALIGN) \ | |
174 | (TREE_CODE (TYPE) == ARRAY_TYPE \ | |
175 | && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \ | |
176 | && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN)) | |
177 | ||
e97f2dc6 | 178 | /* Set this nonzero if move instructions will actually fail to work |
014cfee8 | 179 | when given unaligned data. */ |
e97f2dc6 | 180 | #define STRICT_ALIGNMENT 1 |
014cfee8 RS |
181 | \f |
182 | /*** Standard register usage. ***/ | |
183 | ||
184 | /* Number of actual hardware registers. | |
185 | The hardware registers are assigned numbers for the compiler | |
186 | from 0 to just below FIRST_PSEUDO_REGISTER. | |
187 | All registers that the compiler knows about must be given numbers, | |
188 | even those that are not normally considered general registers. */ | |
189 | ||
190 | /* Nota Bene: | |
191 | Pyramids have 64 addressable 32-bit registers, arranged as four | |
192 | groups of sixteen registers each. Pyramid names the groups | |
193 | global, parameter, local, and temporary. | |
194 | ||
195 | The sixteen global registers are fairly conventional; the last | |
196 | four are overloaded with a PSW, frame pointer, stack pointer, and pc. | |
197 | The non-dedicated global registers used to be reserved for Pyramid | |
198 | operating systems, and still have cryptic and undocumented uses for | |
199 | certain library calls. We do not use global registers gr0 through | |
200 | gr11. | |
201 | ||
202 | The parameter, local, and temporary registers provide register | |
203 | windowing. Each procedure call has its own set of these 48 | |
204 | registers, which constitute its call frame. (These frames are | |
205 | not allocated on the conventional stack, but contiguously | |
206 | on a separate stack called the control stack.) | |
207 | Register windowing is a facility whereby the temporary registers | |
208 | of frame n become the parameter registers of frame n+1, viz.: | |
209 | ||
210 | 0 15 0 15 0 15 | |
211 | +------------+------------+------------+ | |
212 | frame n+1 | | | | | |
213 | +------------+------------+------------+ | |
214 | Parameter Local Temporary | |
215 | ||
216 | ^ | |
217 | | These 16 regs are the same. | |
218 | v | |
219 | ||
220 | 0 15 0 15 0 15 | |
221 | +------------+------------+------------+ | |
222 | frame n | | | | | |
223 | +------------+------------+------------+ | |
224 | Parameter Local Temporary | |
225 | ||
226 | New frames are automatically allocated on the control stack by the | |
227 | call instruction and de-allocated by the return insns "ret" and | |
228 | "retd". The control-stack grows contiguously upward from a | |
229 | well-known address in memory; programs are free to allocate | |
230 | a variable sized, conventional frame on the data stack, which | |
231 | grows downwards in memory from just below the control stack. | |
232 | ||
233 | Temporary registers are used for parameter passing, and are not | |
234 | preserved across calls. TR0 through TR11 correspond to | |
235 | gcc's ``input'' registers; PR0 through TR11 the ``output'' | |
236 | registers. The call insn stores the PC and PSW in PR14 and PR15 of | |
237 | the frame it creates; the return insns restore these into the PC | |
238 | and PSW. The same is true for interrupts; TR14 and TR15 of the | |
239 | current frame are reserved and should never be used, since an | |
240 | interrupt may occur at any time and clobber them. | |
241 | ||
242 | An interesting quirk is the ability to take the address of a | |
243 | variable in a windowed register. This done by adding the memory | |
244 | address of the base of the current window frame, to the offset | |
245 | within the frame of the desired register. The resulting address | |
246 | can be treated just like any other pointer; if a quantity is stored | |
247 | into that address, the appropriate register also changes. | |
248 | GCC does not, and according to RMS will not, support this feature, | |
249 | even though some programs rely on this (mis)feature. | |
250 | */ | |
251 | ||
252 | #define PYR_GREG(n) (n) | |
253 | #define PYR_PREG(n) (16+(n)) | |
254 | #define PYR_LREG(n) (32+(n)) | |
255 | #define PYR_TREG(n) (48+(n)) | |
256 | ||
8abded10 TW |
257 | /* Define this macro if the target machine has "register windows". This |
258 | C expression returns the register number as seen by the called function | |
259 | corresponding to register number OUT as seen by the calling function. | |
260 | Return OUT if register number OUT is not an outbound register. */ | |
261 | ||
262 | #define INCOMING_REGNO(OUT) \ | |
263 | (((OUT) < 48 || (OUT) > 63) ? (OUT) : (OUT) - 32) | |
264 | ||
265 | /* Define this macro if the target machine has "register windows". This | |
266 | C expression returns the register number as seen by the calling function | |
267 | corresponding to register number IN as seen by the called function. | |
268 | Return IN if register number IN is not an inbound register. */ | |
269 | ||
270 | #define OUTGOING_REGNO(IN) \ | |
271 | (((IN) < 15 || (IN) > 31) ? (IN) : (IN) + 32) | |
272 | ||
014cfee8 RS |
273 | #define FIRST_PSEUDO_REGISTER 64 |
274 | ||
275 | /* 1 for registers that have pervasive standard uses | |
276 | and are not available for the register allocator. | |
277 | ||
13a07c71 | 278 | On the pyramid, these are LOGPSW, SP, and PC. */ |
014cfee8 RS |
279 | |
280 | #define FIXED_REGISTERS \ | |
281 | {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
282 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, \ | |
283 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ | |
284 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1} | |
285 | ||
286 | /* 1 for registers not available across function calls. | |
287 | These must include the FIXED_REGISTERS and also any | |
288 | registers that can be used without being saved. | |
289 | The latter must include the registers where values are returned | |
290 | and the register where structure-value addresses are passed. | |
291 | Aside from that, you can include as many other registers as you like. */ | |
292 | #define CALL_USED_REGISTERS \ | |
293 | {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
294 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, \ | |
295 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ | |
296 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} | |
297 | ||
298 | /* #define DEFAULT_CALLER_SAVES */ | |
299 | ||
300 | /* Return number of consecutive hard regs needed starting at reg REGNO | |
301 | to hold something of mode MODE. | |
302 | This is ordinarily the length in words of a value of mode MODE | |
303 | but can be less for certain modes in special long registers. | |
304 | On the pyramid, all registers are one word long. */ | |
305 | #define HARD_REGNO_NREGS(REGNO, MODE) \ | |
306 | ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) | |
307 | ||
308 | /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. | |
309 | On the pyramid, all registers can hold all modes. */ | |
310 | ||
311 | /* -->FIXME: this is not the case for 64-bit quantities in tr11/12 through | |
312 | --> TR14/15. This should be fixed, but to do it correctly, we also | |
313 | --> need to fix MODES_TIEABLE_P. Yuk. We ignore this, since GCC should | |
314 | --> do the "right" thing due to FIXED_REGISTERS. */ | |
315 | #define HARD_REGNO_MODE_OK(REGNO, MODE) 1 | |
316 | ||
317 | /* Value is 1 if it is a good idea to tie two pseudo registers | |
318 | when one has mode MODE1 and one has mode MODE2. | |
319 | If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2, | |
320 | for any hard reg, then this must be 0 for correct output. */ | |
321 | #define MODES_TIEABLE_P(MODE1, MODE2) 1 | |
322 | ||
323 | /* Specify the registers used for certain standard purposes. | |
324 | The values of these macros are register numbers. */ | |
325 | ||
326 | /* Pyramid pc is overloaded on global register 15. */ | |
327 | #define PC_REGNUM PYR_GREG(15) | |
328 | ||
329 | /* Register to use for pushing function arguments. | |
330 | --> on Pyramids, the data stack pointer. */ | |
331 | #define STACK_POINTER_REGNUM PYR_GREG(14) | |
332 | ||
333 | /* Base register for access to local variables of the function. | |
334 | Pyramid uses CFP (GR13) as both frame pointer and argument pointer. */ | |
d218c758 | 335 | #define FRAME_POINTER_REGNUM 13 /* pyr cpp fails on PYR_GREG(13) */ |
014cfee8 RS |
336 | |
337 | /* Value should be nonzero if functions must have frame pointers. | |
338 | Zero means the frame pointer need not be set up (and parms | |
339 | may be accessed via the stack pointer) in functions that seem suitable. | |
340 | This is computed in `reload', in reload1.c. | |
341 | ||
342 | Setting this to 1 can't break anything. Since the Pyramid has | |
343 | register windows, I don't know if defining this to be zero can | |
344 | win anything. It could changed later, if it wins. */ | |
345 | #define FRAME_POINTER_REQUIRED 1 | |
346 | ||
347 | /* Base register for access to arguments of the function. */ | |
348 | #define ARG_POINTER_REGNUM 13 /* PYR_GREG(13) */ | |
349 | ||
350 | /* Register in which static-chain is passed to a function. */ | |
351 | /* If needed, Pyramid says to use temporary register 12. */ | |
352 | #define STATIC_CHAIN_REGNUM PYR_TREG(12) | |
353 | ||
e97f2dc6 RS |
354 | /* If register windows are used, STATIC_CHAIN_INCOMING_REGNUM |
355 | is the register number as seen by the called function, while | |
356 | STATIC_CHAIN_REGNUM is the register number as seen by the calling | |
357 | function. */ | |
358 | #define STATIC_CHAIN_INCOMING_REGNUM PYR_PREG(12) | |
359 | ||
014cfee8 RS |
360 | /* Register in which address to store a structure value |
361 | is passed to a function. | |
362 | On a Pyramid, this is temporary register 0 (TR0). */ | |
363 | ||
364 | #define STRUCT_VALUE_REGNUM PYR_TREG(0) | |
365 | #define STRUCT_VALUE_INCOMING_REGNUM PYR_PREG(0) | |
366 | \f | |
367 | /* Define the classes of registers for register constraints in the | |
368 | machine description. Also define ranges of constants. | |
369 | ||
370 | One of the classes must always be named ALL_REGS and include all hard regs. | |
371 | If there is more than one class, another class must be named NO_REGS | |
372 | and contain no registers. | |
373 | ||
374 | The name GENERAL_REGS must be the name of a class (or an alias for | |
375 | another name such as ALL_REGS). This is the class of registers | |
376 | that is allowed by "g" or "r" in a register constraint. | |
377 | Also, registers outside this class are allocated only when | |
378 | instructions express preferences for them. | |
379 | ||
380 | The classes must be numbered in nondecreasing order; that is, | |
381 | a larger-numbered class must never be contained completely | |
382 | in a smaller-numbered class. | |
383 | ||
384 | For any two classes, it is very desirable that there be another | |
385 | class that represents their union. */ | |
386 | ||
387 | /* The pyramid has only one kind of registers, so NO_REGS and ALL_REGS | |
388 | are the only classes. */ | |
389 | ||
390 | enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSES }; | |
391 | ||
392 | #define N_REG_CLASSES (int) LIM_REG_CLASSES | |
393 | ||
394 | /* Since GENERAL_REGS is the same class as ALL_REGS, | |
395 | don't give it a different class number; just make it an alias. */ | |
396 | ||
397 | #define GENERAL_REGS ALL_REGS | |
398 | ||
399 | /* Give names of register classes as strings for dump file. */ | |
400 | ||
401 | #define REG_CLASS_NAMES \ | |
402 | {"NO_REGS", "ALL_REGS" } | |
403 | ||
404 | /* Define which registers fit in which classes. | |
405 | This is an initializer for a vector of HARD_REG_SET | |
406 | of length N_REG_CLASSES. */ | |
407 | ||
408 | #define REG_CLASS_CONTENTS {{0,0}, {0xffffffff,0xffffffff}} | |
409 | ||
410 | /* The same information, inverted: | |
411 | Return the class number of the smallest class containing | |
412 | reg number REGNO. This could be a conditional expression | |
413 | or could index an array. */ | |
414 | ||
415 | #define REGNO_REG_CLASS(REGNO) ALL_REGS | |
416 | ||
417 | /* The class value for index registers, and the one for base regs. */ | |
418 | ||
419 | #define BASE_REG_CLASS ALL_REGS | |
420 | #define INDEX_REG_CLASS ALL_REGS | |
421 | ||
422 | /* Get reg_class from a letter such as appears in the machine description. */ | |
423 | ||
424 | #define REG_CLASS_FROM_LETTER(C) NO_REGS | |
425 | ||
426 | /* Given an rtx X being reloaded into a reg required to be | |
427 | in class CLASS, return the class of reg to actually use. | |
428 | In general this is just CLASS; but on some machines | |
429 | in some cases it is preferable to use a more restrictive class. */ | |
430 | ||
431 | #define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS) | |
432 | ||
433 | /* Return the maximum number of consecutive registers | |
434 | needed to represent mode MODE in a register of class CLASS. */ | |
435 | /* On the pyramid, this is always the size of MODE in words, | |
436 | since all registers are the same size. */ | |
437 | #define CLASS_MAX_NREGS(CLASS, MODE) \ | |
438 | ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) | |
439 | ||
440 | /* The letters I, J, K, L and M in a register constraint string | |
441 | can be used to stand for particular ranges of immediate operands. | |
442 | This macro defines what the ranges are. | |
443 | C is the letter, and VALUE is a constant value. | |
444 | Return 1 if VALUE is in the range specified by C. | |
445 | ||
446 | --> For the Pyramid, 'I' can be used for the 6-bit signed integers | |
447 | --> (-32 to 31) allowed as immediate short operands in many | |
448 | --> instructions. 'J' cane be used for any value that doesn't fit | |
449 | --> in 6 bits. */ | |
450 | ||
451 | #define CONST_OK_FOR_LETTER_P(VALUE, C) \ | |
452 | ((C) == 'I' ? (VALUE) >= -32 && (VALUE) < 32 : \ | |
453 | (C) == 'J' ? (VALUE) < -32 || (VALUE) >= 32 : \ | |
454 | (C) == 'K' ? (VALUE) == 0xff || (VALUE) == 0xffff : 0) | |
455 | ||
456 | /* Similar, but for floating constants, and defining letters G and H. | |
457 | Here VALUE is the CONST_DOUBLE rtx itself. */ | |
458 | ||
459 | #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0 | |
460 | ||
461 | \f | |
462 | /*** Stack layout; function entry, exit and calling. ***/ | |
463 | ||
464 | /* Define this if pushing a word on the stack | |
465 | makes the stack pointer a smaller address. */ | |
466 | #define STACK_GROWS_DOWNWARD | |
467 | ||
468 | /* Define this if the nominal address of the stack frame | |
469 | is at the high-address end of the local variables; | |
470 | that is, each additional local variable allocated | |
471 | goes at a more negative offset in the frame. */ | |
472 | #define FRAME_GROWS_DOWNWARD | |
473 | ||
474 | /* Offset within stack frame to start allocating local variables at. | |
475 | If FRAME_GROWS_DOWNWARD, this is the offset to the END of the | |
476 | first local allocated. Otherwise, it is the offset to the BEGINNING | |
477 | of the first local allocated. */ | |
478 | /* FIXME: this used to work when defined as 0. But that makes gnu | |
479 | stdargs clobber the first arg. What gives?? */ | |
480 | #define STARTING_FRAME_OFFSET 0 | |
481 | ||
482 | /* Offset of first parameter from the argument pointer register value. */ | |
483 | #define FIRST_PARM_OFFSET(FNDECL) 0 | |
484 | ||
485 | /* Value is the number of bytes of arguments automatically | |
486 | popped when returning from a subroutine call. | |
8b109b37 | 487 | FUNDECL is the declaration node of the function (as a tree), |
014cfee8 RS |
488 | FUNTYPE is the data type of the function (as a tree), |
489 | or for a library call it is an identifier node for the subroutine name. | |
490 | SIZE is the number of bytes of arguments passed on the stack. | |
491 | ||
492 | The Pyramid OSx Porting Guide says we are never to do this; | |
493 | using RETD in this way violates the Pyramid calling convention. | |
494 | We may nevertheless provide this as an option. */ | |
495 | ||
8b109b37 | 496 | #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \ |
014cfee8 RS |
497 | ((TARGET_RETD && TREE_CODE (FUNTYPE) != IDENTIFIER_NODE \ |
498 | && (TYPE_ARG_TYPES (FUNTYPE) == 0 \ | |
499 | || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \ | |
500 | == void_type_node))) \ | |
501 | ? (SIZE) : 0) | |
502 | ||
503 | /* Define how to find the value returned by a function. | |
504 | VALTYPE is the data type of the value (as a tree). | |
505 | If the precise function being called is known, FUNC is its FUNCTION_DECL; | |
506 | otherwise, FUNC is 0. */ | |
507 | ||
508 | /* --> Pyramid has register windows. | |
509 | --> The caller sees the return value is in TR0(/TR1) regardless of | |
510 | --> its type. */ | |
511 | ||
512 | #define FUNCTION_VALUE(VALTYPE, FUNC) \ | |
513 | gen_rtx (REG, TYPE_MODE (VALTYPE), PYR_TREG(0)) | |
514 | ||
515 | /* --> but the callee has to leave it in PR0(/PR1) */ | |
516 | ||
517 | #define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \ | |
518 | gen_rtx (REG, TYPE_MODE (VALTYPE), PYR_PREG(0)) | |
519 | ||
520 | /* Define how to find the value returned by a library function | |
521 | assuming the value has mode MODE. */ | |
522 | ||
523 | /* --> On Pyramid the return value is in TR0/TR1 regardless. */ | |
524 | ||
525 | #define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, PYR_TREG(0)) | |
526 | ||
527 | /* Define this if PCC uses the nonreentrant convention for returning | |
528 | structure and union values. */ | |
529 | ||
530 | #define PCC_STATIC_STRUCT_RETURN | |
531 | ||
532 | /* 1 if N is a possible register number for a function value | |
533 | as seen by the caller. | |
534 | ||
535 | On the Pyramid, TR0 is the only register thus used. */ | |
536 | ||
537 | #define FUNCTION_VALUE_REGNO_P(N) ((N) == PYR_TREG(0)) | |
538 | ||
539 | /* 1 if N is a possible register number for function argument passing. | |
540 | On the Pyramid, the first twelve temporary registers are available. */ | |
541 | ||
542 | /* FIXME FIXME FIXME | |
543 | it's not clear whether this macro should be defined from the point | |
544 | of view of the caller or the callee. Since it's never actually used | |
545 | in GNU CC, the point is somewhat moot :-). | |
546 | ||
547 | This definition is consistent with register usage in the md's for | |
548 | other register-window architectures (sparc and spur). | |
549 | */ | |
550 | #define FUNCTION_ARG_REGNO_P(N) ((PYR_TREG(0) <= (N)) && ((N) <= PYR_TREG(11))) | |
551 | \f | |
552 | /*** Parameter passing: FUNCTION_ARG and FUNCTION_INCOMING_ARG ***/ | |
553 | ||
554 | /* Define a data type for recording info about an argument list | |
555 | during the scan of that argument list. This data type should | |
556 | hold all necessary information about the function itself | |
557 | and about the args processed so far, enough to enable macros | |
558 | such as FUNCTION_ARG to determine where the next arg should go. | |
559 | ||
560 | On Pyramids, each parameter is passed either completely on the stack | |
561 | or completely in registers. No parameter larger than a double may | |
562 | be passed in a register. Also, no struct or union may be passed in | |
563 | a register, even if it would fit. | |
564 | ||
565 | So parameters are not necessarily passed "consecutively". | |
566 | Thus we need a vector data type: one element to record how many | |
567 | parameters have been passed in registers and on the stack, | |
568 | respectively. | |
569 | ||
570 | ((These constraints seem like a gross waste of registers. But if we | |
571 | ignore the constraint about structs & unions, we won`t be able to | |
572 | freely mix gcc-compiled code and pyr cc-compiled code. It looks | |
573 | like better argument passing conventions, and a machine-dependent | |
574 | flag to enable them, might be a win.)) */ | |
575 | ||
576 | ||
577 | #define CUMULATIVE_ARGS int | |
578 | ||
e97f2dc6 | 579 | /* Define the number of registers that can hold parameters. |
014cfee8 RS |
580 | This macro is used only in other macro definitions below. */ |
581 | #define NPARM_REGS 12 | |
582 | ||
583 | /* Decide whether or not a parameter can be put in a register. | |
584 | (We may still have problems with libcalls. GCC doesn't seem | |
585 | to know about anything more than the machine mode. I trust | |
586 | structures are never passed to a libcall... | |
587 | ||
588 | If compiling with -mgnu-stdarg, this definition should make | |
589 | functions using the gcc-supplied stdarg, and calls to such | |
590 | functions (declared with an arglist ending in"..."), work. | |
591 | But such fns won't be able to call pyr cc-compiled | |
592 | varargs fns (eg, printf(), _doprnt.) | |
593 | ||
594 | If compiling with -mnognu-stdarg, this definition should make | |
595 | calls to pyr cc-compiled functions work. Functions using | |
596 | the gcc-supplied stdarg will be utterly broken. | |
597 | There will be no better solution until RMS can be persuaded that | |
598 | one is needed. | |
599 | ||
600 | This macro is used only in other macro definitions below. | |
601 | (well, it may be used in pyr.c, because the damn pyramid cc | |
602 | can't handle the macro definition of PARAM_SAFE_FOR_REG_P ! */ | |
603 | ||
604 | ||
605 | #define INNER_PARAM_SAFE_HELPER(TYPE) \ | |
606 | ((TARGET_GNU_STDARG ? (! TREE_ADDRESSABLE ((tree)TYPE)): 1) \ | |
607 | && (TREE_CODE ((tree)TYPE) != RECORD_TYPE) \ | |
608 | && (TREE_CODE ((tree)TYPE) != UNION_TYPE)) | |
609 | ||
610 | #ifdef __GNUC__ | |
611 | #define PARAM_SAFE_HELPER(TYPE) \ | |
612 | INNER_PARAM_SAFE_HELPER((TYPE)) | |
613 | #else | |
614 | extern int inner_param_safe_helper(); | |
615 | #define PARAM_SAFE_HELPER(TYPE) \ | |
616 | inner_param_safe_helper((tree)(TYPE)) | |
617 | #endif | |
618 | ||
619 | /* Be careful with the expression (long) (TYPE) == 0. | |
620 | Writing it in more obvious/correct forms makes the Pyr cc | |
621 | dump core! */ | |
622 | #define PARAM_SAFE_FOR_REG_P(MODE, TYPE, NAMED) \ | |
623 | (((MODE) != BLKmode) \ | |
624 | && ((TARGET_GNU_STDARG) ? (NAMED) : 1) \ | |
625 | && ((((long)(TYPE))==0) || PARAM_SAFE_HELPER((TYPE)))) | |
626 | ||
627 | /* Initialize a variable CUM of type CUMULATIVE_ARGS | |
628 | for a call to a function whose data type is FNTYPE. | |
629 | For a library call, FNTYPE is 0. */ | |
630 | ||
76c30596 RS |
631 | #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME) \ |
632 | ((CUM) = (FNTYPE && !flag_pcc_struct_return \ | |
633 | && aggregate_value_p (TREE_TYPE (FNTYPE)))) | |
014cfee8 RS |
634 | |
635 | /* Determine where to put an argument to a function. | |
636 | Value is zero to push the argument on the stack, | |
637 | or a hard register in which to store the argument. | |
638 | ||
639 | MODE is the argument's machine mode. | |
640 | TYPE is the data type of the argument (as a tree). | |
641 | This is null for libcalls where that information may | |
642 | not be available. | |
643 | CUM is a variable of type CUMULATIVE_ARGS which gives info about | |
644 | the preceding args and about the function being called. | |
645 | NAMED is nonzero if this argument is a named parameter | |
646 | (otherwise it is an extra parameter matching an ellipsis). */ | |
647 | ||
648 | #define FUNCTION_ARG_HELPER(CUM, MODE, TYPE, NAMED) \ | |
649 | (PARAM_SAFE_FOR_REG_P(MODE,TYPE,NAMED) \ | |
650 | ? (NPARM_REGS >= ((CUM) \ | |
651 | + ((MODE) == BLKmode \ | |
652 | ? (int_size_in_bytes (TYPE) + 3) / 4 \ | |
653 | : (GET_MODE_SIZE (MODE) + 3) / 4)) \ | |
654 | ? gen_rtx (REG, (MODE), PYR_TREG(CUM)) \ | |
655 | : 0) \ | |
656 | : 0) | |
657 | #ifdef __GNUC__ | |
658 | #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ | |
659 | FUNCTION_ARG_HELPER(CUM, MODE, TYPE, NAMED) | |
660 | #else | |
661 | /***************** Avoid bug in Pyramid OSx compiler... ******************/ | |
662 | #define FUNCTION_ARG (rtx) pyr_function_arg | |
663 | extern void* pyr_function_arg (); | |
664 | #endif | |
665 | ||
666 | /* Define where a function finds its arguments. | |
667 | This is different from FUNCTION_ARG because of register windows. */ | |
668 | ||
669 | #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \ | |
670 | (PARAM_SAFE_FOR_REG_P(MODE,TYPE,NAMED) \ | |
671 | ? (NPARM_REGS >= ((CUM) \ | |
672 | + ((MODE) == BLKmode \ | |
673 | ? (int_size_in_bytes (TYPE) + 3) / 4 \ | |
674 | : (GET_MODE_SIZE (MODE) + 3) / 4)) \ | |
675 | ? gen_rtx (REG, (MODE), PYR_PREG(CUM)) \ | |
676 | : 0) \ | |
677 | : 0) | |
678 | ||
679 | /* Update the data in CUM to advance over an argument | |
680 | of mode MODE and data type TYPE. | |
681 | (TYPE is null for libcalls where that information may not be available.) */ | |
682 | ||
683 | #define FUNCTION_ARG_ADVANCE(CUM,MODE,TYPE,NAMED) \ | |
684 | ((CUM) += (PARAM_SAFE_FOR_REG_P(MODE,TYPE,NAMED) \ | |
685 | ? ((MODE) != BLKmode \ | |
686 | ? (GET_MODE_SIZE (MODE) + 3) / 4 \ | |
687 | : (int_size_in_bytes (TYPE) + 3) / 4) \ | |
688 | : 0)) | |
689 | ||
690 | /* This macro generates the assembly code for function entry. | |
691 | FILE is a stdio stream to output the code to. | |
692 | SIZE is an int: how many units of temporary storage to allocate. | |
693 | Refer to the array `regs_ever_live' to determine which registers | |
694 | to save; `regs_ever_live[I]' is nonzero if register number I | |
695 | is ever used in the function. This macro is responsible for | |
696 | knowing which registers should not be saved even if used. */ | |
697 | ||
698 | #if FRAME_POINTER_REQUIRED | |
699 | ||
700 | /* We always have frame pointers */ | |
701 | ||
702 | /* Don't set up a frame pointer if it's not referenced. */ | |
703 | ||
704 | #define FUNCTION_PROLOGUE(FILE, SIZE) \ | |
705 | { \ | |
706 | int _size = (SIZE) + current_function_pretend_args_size; \ | |
707 | if (_size + current_function_args_size != 0 \ | |
708 | || current_function_calls_alloca) \ | |
709 | { \ | |
710 | fprintf (FILE, "\tadsf $%d\n", _size); \ | |
711 | if (current_function_pretend_args_size > 0) \ | |
712 | fprintf (FILE, "\tsubw $%d,cfp\n", \ | |
713 | current_function_pretend_args_size); \ | |
714 | } \ | |
715 | } | |
716 | ||
717 | #else /* !FRAME_POINTER_REQUIRED */ | |
718 | ||
719 | /* Don't set up a frame pointer if `frame_pointer_needed' tells us | |
720 | there is no need. Also, don't set up a frame pointer if it's not | |
721 | referenced. */ | |
722 | ||
723 | /* The definition used to be broken. Write a new one. */ | |
724 | ||
725 | #endif /* !FRAME_POINTER_REQUIRED */ | |
726 | ||
e97f2dc6 RS |
727 | /* the trampoline stuff was taken from convex.h - S.P. */ |
728 | ||
729 | /* A C statement to output, on the stream FILE, assembler code for a | |
730 | block of data that contains the constant parts of a trampoline. This | |
731 | code should not include a label - the label is taken care of | |
732 | automatically. | |
733 | We use TR12/PR12 for the static chain. | |
734 | movew $<STATIC>,pr12 # I2R | |
735 | jump $<func> # S2R | |
736 | */ | |
737 | #define TRAMPOLINE_TEMPLATE(FILE) \ | |
738 | { ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x2100001C)); \ | |
739 | ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x00000000)); \ | |
740 | ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x40000000)); \ | |
741 | ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x00000000)); } | |
742 | ||
743 | #define TRAMPOLINE_SIZE 16 | |
744 | #define TRAMPOLINE_ALIGNMENT 32 | |
745 | ||
746 | /* Emit RTL insns to initialize the variable parts of a trampoline. | |
747 | FNADDR is an RTX for the address of the function's pure code. | |
748 | CXT is an RTX for the static chain value for the function. */ | |
749 | ||
750 | #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ | |
751 | { emit_move_insn (gen_rtx (MEM, Pmode, plus_constant (TRAMP, 4)), CXT); \ | |
752 | emit_move_insn (gen_rtx (MEM, Pmode, plus_constant (TRAMP, 12)), FNADDR); \ | |
753 | emit_call_insn (gen_call (gen_rtx (MEM, QImode, \ | |
754 | gen_rtx (SYMBOL_REF, Pmode, \ | |
755 | "__enable_execute_stack")), \ | |
756 | const0_rtx)); \ | |
757 | } | |
758 | ||
014cfee8 RS |
759 | /* Output assembler code to FILE to increment profiler label # LABELNO |
760 | for profiling a function entry. */ | |
761 | #define FUNCTION_PROFILER(FILE, LABELNO) \ | |
762 | fprintf (FILE, "\tmova LP%d,tr0\n\tcall mcount\n", (LABELNO)); | |
763 | ||
764 | /* Output assembler code to FILE to initialize this source file's | |
765 | basic block profiling info, if that has not already been done. | |
766 | Don't know if this works on Pyrs. */ | |
767 | ||
768 | #if 0 /* don't do basic_block profiling yet */ | |
769 | #define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \ | |
770 | fprintf (FILE, \ | |
771 | "\tmtstw LPBX0,tr0\n\tbne LPI%d\n\tmova LP%d,TR0\n\tcall __bb_init_func\nLPI%d:\n", \ | |
772 | LABELNO, LABELNO); | |
773 | ||
774 | /* Output assembler code to increment the count associated with | |
775 | the basic block number BLOCKNO. Not sure how to do this on pyrs. */ | |
776 | #define BLOCK_PROFILER(FILE, BLOCKNO) \ | |
777 | fprintf (FILE, "\taddw", 4 * BLOCKNO) | |
778 | #endif /* don't do basic_block profiling yet */ | |
779 | ||
780 | /* When returning from a function, the stack pointer does not matter | |
781 | (as long as there is a frame pointer). */ | |
782 | ||
783 | /* This should return non-zero when we really set up a frame pointer. | |
784 | Otherwise, GCC is directed to preserve sp by returning zero. */ | |
785 | extern int current_function_pretend_args_size; | |
786 | extern int current_function_args_size; | |
787 | extern int current_function_calls_alloca; | |
788 | #define EXIT_IGNORE_STACK \ | |
789 | (get_frame_size () + current_function_pretend_args_size \ | |
790 | + current_function_args_size != 0 \ | |
791 | || current_function_calls_alloca) \ | |
792 | ||
e97f2dc6 RS |
793 | /* Store in the variable DEPTH the initial difference between the |
794 | frame pointer reg contents and the stack pointer reg contents, | |
795 | as of the start of the function body. This depends on the layout | |
796 | of the fixed parts of the stack frame and on how registers are saved. | |
797 | ||
798 | On the Pyramid, FRAME_POINTER_REQUIRED is always 1, so the definition | |
799 | of this macro doesn't matter. But it must be defined. */ | |
800 | ||
801 | #define INITIAL_FRAME_POINTER_OFFSET(DEPTH) (DEPTH) = 0; | |
014cfee8 RS |
802 | \f |
803 | /*** Addressing modes, and classification of registers for them. ***/ | |
804 | ||
805 | /* #define HAVE_POST_INCREMENT */ /* pyramid has none of these */ | |
806 | /* #define HAVE_POST_DECREMENT */ | |
807 | ||
808 | /* #define HAVE_PRE_DECREMENT */ | |
809 | /* #define HAVE_PRE_INCREMENT */ | |
810 | ||
811 | /* Macros to check register numbers against specific register classes. */ | |
812 | ||
813 | /* These assume that REGNO is a hard or pseudo reg number. | |
814 | They give nonzero only if REGNO is a hard reg of the suitable class | |
815 | or a pseudo reg currently allocated to a suitable hard reg. | |
816 | Since they use reg_renumber, they are safe only once reg_renumber | |
817 | has been allocated, which happens in local-alloc.c. */ | |
818 | ||
819 | /* All registers except gr0 OK as index or base registers. */ | |
820 | ||
821 | #define REGNO_OK_FOR_BASE_P(regno) \ | |
8129e7a4 | 822 | ((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0) |
014cfee8 RS |
823 | |
824 | #define REGNO_OK_FOR_INDEX_P(regno) \ | |
13a07c71 | 825 | ((unsigned) (regno) - 1 < FIRST_PSEUDO_REGISTER - 1 \ |
8129e7a4 | 826 | || reg_renumber[regno] > 0) |
014cfee8 RS |
827 | |
828 | /* Maximum number of registers that can appear in a valid memory address. */ | |
829 | ||
830 | #define MAX_REGS_PER_ADDRESS 2 /* check MAX_REGS_PER_ADDRESS */ | |
831 | ||
832 | /* 1 if X is an rtx for a constant that is a valid address. */ | |
833 | ||
6eff269e BK |
834 | #define CONSTANT_ADDRESS_P(X) \ |
835 | (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \ | |
836 | || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \ | |
837 | || GET_CODE (X) == HIGH) | |
014cfee8 RS |
838 | |
839 | /* Nonzero if the constant value X is a legitimate general operand. | |
840 | It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */ | |
841 | ||
842 | #define LEGITIMATE_CONSTANT_P(X) 1 | |
843 | ||
844 | /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx | |
845 | and check its validity for a certain class. | |
846 | We have two alternate definitions for each of them. | |
847 | The usual definition accepts all pseudo regs; the other rejects | |
848 | them unless they have been allocated suitable hard regs. | |
849 | The symbol REG_OK_STRICT causes the latter definition to be used. | |
850 | ||
851 | Most source files want to accept pseudo regs in the hope that | |
852 | they will get allocated to the class that the insn wants them to be in. | |
853 | Source files for reload pass need to be strict. | |
854 | After reload, it makes no difference, since pseudo regs have | |
855 | been eliminated by then. */ | |
856 | ||
857 | #ifndef REG_OK_STRICT | |
858 | ||
859 | /* Nonzero if X is a hard reg that can be used as an index | |
860 | or if it is a pseudo reg. */ | |
13a07c71 | 861 | #define REG_OK_FOR_INDEX_P(X) (REGNO (X) > 0) |
014cfee8 RS |
862 | /* Nonzero if X is a hard reg that can be used as a base reg |
863 | or if it is a pseudo reg. */ | |
864 | #define REG_OK_FOR_BASE_P(X) 1 | |
865 | ||
866 | #else | |
867 | ||
868 | /* Nonzero if X is a hard reg that can be used as an index. */ | |
869 | #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X)) | |
870 | /* Nonzero if X is a hard reg that can be used as a base reg. */ | |
871 | #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X)) | |
872 | ||
873 | #endif | |
874 | \f | |
875 | /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression | |
876 | that is a valid memory address for an instruction. | |
877 | The MODE argument is the machine mode for the MEM expression | |
878 | that wants to use this address. | |
879 | ||
880 | The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS, | |
881 | except for CONSTANT_ADDRESS_P which is actually machine-independent. */ | |
882 | ||
883 | ||
13a07c71 | 884 | /* Go to ADDR if X is indexable -- i.e., neither indexed nor offset. */ |
014cfee8 RS |
885 | #define GO_IF_INDEXABLE_ADDRESS(X, ADDR) \ |
886 | { register rtx xfoob = (X); \ | |
887 | if ((CONSTANT_ADDRESS_P (xfoob)) \ | |
888 | || (GET_CODE (xfoob) == REG && (REG_OK_FOR_BASE_P (xfoob)))) \ | |
889 | goto ADDR; \ | |
890 | } | |
891 | ||
892 | ||
893 | /* Go to label ADDR if X is a valid address that doesn't use indexing. | |
894 | This is so if X is either a simple address, or the contents of a register | |
895 | plus an offset. | |
896 | This macro also gets used in output-pyramid.h in the function that | |
897 | recognizes non-indexed operands. */ | |
898 | ||
899 | #define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \ | |
900 | { \ | |
901 | if (GET_CODE (X) == REG) \ | |
902 | goto ADDR; \ | |
903 | GO_IF_INDEXABLE_ADDRESS (X, ADDR); \ | |
904 | if (GET_CODE (X) == PLUS) \ | |
905 | { /* Handle offset(reg) represented with offset on left */ \ | |
906 | if (CONSTANT_ADDRESS_P (XEXP (X, 0))) \ | |
907 | { if (GET_CODE (XEXP (X, 1)) == REG \ | |
908 | && REG_OK_FOR_BASE_P (XEXP (X, 1))) \ | |
909 | goto ADDR; \ | |
910 | } \ | |
911 | /* Handle offset(reg) represented with offset on right */ \ | |
912 | if (CONSTANT_ADDRESS_P (XEXP (X, 1))) \ | |
913 | { if (GET_CODE (XEXP (X, 0)) == REG \ | |
914 | && REG_OK_FOR_BASE_P (XEXP (X, 0))) \ | |
915 | goto ADDR; \ | |
916 | } \ | |
917 | } \ | |
918 | } | |
919 | ||
920 | /* 1 if PROD is either a reg or a reg times a valid offset multiplier | |
921 | (ie, 2, 4, or 8). | |
922 | This macro's expansion uses the temporary variables xfoo0 and xfoo1 | |
923 | that must be declared in the surrounding context. */ | |
924 | #define INDEX_TERM_P(PROD, MODE) \ | |
925 | ((GET_CODE (PROD) == REG && REG_OK_FOR_BASE_P (PROD)) \ | |
926 | || (GET_CODE (PROD) == MULT \ | |
927 | && \ | |
928 | (xfoo0 = XEXP (PROD, 0), xfoo1 = XEXP (PROD, 1), \ | |
929 | ((GET_CODE (xfoo0) == CONST_INT \ | |
930 | && (INTVAL (xfoo0) == 1 \ | |
931 | || INTVAL (xfoo0) == 2 \ | |
932 | || INTVAL (xfoo0) == 4 \ | |
933 | || INTVAL (xfoo0) == 8) \ | |
934 | && GET_CODE (xfoo1) == REG \ | |
935 | && REG_OK_FOR_INDEX_P (xfoo1)) \ | |
936 | || \ | |
937 | (GET_CODE (xfoo1) == CONST_INT \ | |
938 | && (INTVAL (xfoo1) == 1 \ | |
939 | || INTVAL (xfoo1) == 2 \ | |
940 | || INTVAL (xfoo1) == 4 \ | |
941 | || INTVAL (xfoo1) == 8) \ | |
942 | && GET_CODE (xfoo0) == REG \ | |
943 | && REG_OK_FOR_INDEX_P (xfoo0)))))) | |
944 | ||
945 | ||
946 | #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ | |
947 | { register rtx xone, xtwo, xfoo0, xfoo1; \ | |
948 | GO_IF_NONINDEXED_ADDRESS (X, ADDR); \ | |
13a07c71 | 949 | if (GET_CODE (X) == PLUS) \ |
014cfee8 RS |
950 | { \ |
951 | /* Handle <address>[index] represented with index-sum outermost */\ | |
952 | xone = XEXP (X, 0); \ | |
953 | xtwo = XEXP (X, 1); \ | |
954 | if (INDEX_TERM_P (xone, MODE)) \ | |
955 | { GO_IF_INDEXABLE_ADDRESS (xtwo, ADDR); } \ | |
956 | /* Handle <address>[index] represented with index-sum innermost */\ | |
957 | if (INDEX_TERM_P (xtwo, MODE)) \ | |
958 | { GO_IF_INDEXABLE_ADDRESS (xone, ADDR); } \ | |
959 | } \ | |
960 | } | |
961 | ||
962 | /* Try machine-dependent ways of modifying an illegitimate address | |
963 | to be legitimate. If we find one, return the new, valid address. | |
964 | This macro is used in only one place: `memory_address' in explow.c. | |
965 | ||
966 | OLDX is the address as it was before break_out_memory_refs was called. | |
967 | In some cases it is useful to look at this to decide what needs to be done. | |
968 | ||
969 | MODE and WIN are passed so that this macro can use | |
970 | GO_IF_LEGITIMATE_ADDRESS. | |
971 | ||
972 | It is always safe for this macro to do nothing. It exists to recognize | |
973 | opportunities to optimize the output. | |
974 | ||
975 | --> FIXME: We haven't yet figured out what optimizations are useful | |
976 | --> on Pyramids. */ | |
977 | ||
978 | #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {} | |
979 | ||
980 | /* Go to LABEL if ADDR (a legitimate address expression) | |
981 | has an effect that depends on the machine mode it is used for. | |
982 | There don't seem to be any such modes on pyramids. */ | |
983 | #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) | |
984 | \f | |
985 | /*** Miscellaneous Parameters ***/ | |
986 | ||
987 | /* Specify the machine mode that this machine uses | |
988 | for the index in the tablejump instruction. */ | |
989 | #define CASE_VECTOR_MODE SImode | |
990 | ||
991 | /* Define this if the tablejump instruction expects the table | |
992 | to contain offsets from the address of the table. | |
993 | Do not define this if the table should contain absolute addresses. */ | |
994 | /*#define CASE_VECTOR_PC_RELATIVE*/ | |
995 | ||
996 | /* Specify the tree operation to be used to convert reals to integers. */ | |
997 | #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR | |
998 | ||
999 | /* This is the kind of divide that is easiest to do in the general case. | |
1000 | It's just a guess. I have no idea of insn cost on pyrs. */ | |
1001 | #define EASY_DIV_EXPR TRUNC_DIV_EXPR | |
1002 | ||
1003 | /* Define this as 1 if `char' should by default be signed; else as 0. */ | |
1004 | #define DEFAULT_SIGNED_CHAR 1 | |
1005 | ||
1006 | /* This flag, if defined, says the same insns that convert to a signed fixnum | |
1007 | also convert validly to an unsigned one. */ | |
1008 | /* This is untrue for pyramid. The cvtdw instruction generates a trap | |
1009 | for input operands that are out-of-range for a signed int. */ | |
1010 | /* #define FIXUNS_TRUNC_LIKE_FIX_TRUNC */ | |
1011 | ||
1012 | /* Define this macro if the preprocessor should silently ignore | |
1013 | '#sccs' directives. */ | |
1014 | /* #define SCCS_DIRECTIVE */ | |
1015 | ||
1016 | /* Define this macro if the preprocessor should silently ignore | |
1017 | '#ident' directives. */ | |
1018 | /* #define IDENT_DIRECTIVE */ | |
1019 | ||
1020 | /* Max number of bytes we can move from memory to memory | |
1021 | in one reasonably fast instruction. */ | |
1022 | #define MOVE_MAX 8 | |
1023 | ||
1024 | /* Define this if zero-extension is slow (more than one real instruction). */ | |
1025 | /* #define SLOW_ZERO_EXTEND */ | |
1026 | ||
1027 | /* number of bits in an 'int' on target machine */ | |
1028 | #define INT_TYPE_SIZE 32 | |
1029 | ||
1030 | /* 1 if byte access requires more than one instruction */ | |
1031 | #define SLOW_BYTE_ACCESS 0 | |
1032 | ||
d969caf8 RK |
1033 | /* Define this to be nonzero if shift instructions ignore all but the low-order |
1034 | few bits. */ | |
1035 | #define SHIFT_COUNT_TRUNCATED 1 | |
014cfee8 RS |
1036 | |
1037 | /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits | |
1038 | is done just by pretending it is already truncated. */ | |
1039 | #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 | |
1040 | ||
1041 | /* Define this macro if it is as good or better to call a constant | |
1042 | function address than to call an address kept in a register. */ | |
1043 | /* #define NO_FUNCTION_CSE */ | |
1044 | ||
1045 | /* When a prototype says `char' or `short', really pass an `int'. */ | |
1046 | #define PROMOTE_PROTOTYPES | |
1047 | ||
1048 | /* There are no flag store insns on a pyr. */ | |
1049 | /* #define STORE_FLAG_VALUE */ | |
1050 | ||
1051 | /* Specify the machine mode that pointers have. | |
1052 | After generation of rtl, the compiler makes no further distinction | |
1053 | between pointers and any other objects of this machine mode. */ | |
1054 | #define Pmode SImode | |
1055 | ||
1056 | /* A function address in a call instruction | |
1057 | is a byte address (for indexing purposes) | |
1058 | so give the MEM rtx a byte's mode. */ | |
1059 | #define FUNCTION_MODE QImode | |
1060 | ||
1061 | /* Compute the cost of computing a constant rtl expression RTX | |
1062 | whose rtx-code is CODE. The body of this macro is a portion | |
1063 | of a switch statement. If the code is computed here, | |
1064 | return it with a return statement. Otherwise, break from the switch. */ | |
1065 | ||
3bb22aee | 1066 | #define CONST_COSTS(RTX,CODE,OUTER_CODE) \ |
014cfee8 RS |
1067 | case CONST_INT: \ |
1068 | if (CONST_OK_FOR_LETTER_P (INTVAL (RTX),'I')) return 0; \ | |
1069 | case CONST: \ | |
1070 | case LABEL_REF: \ | |
1071 | case SYMBOL_REF: \ | |
1072 | return 4; \ | |
1073 | case CONST_DOUBLE: \ | |
1074 | return 6; | |
e97f2dc6 RS |
1075 | |
1076 | /* A flag which says to swap the operands of certain insns | |
1077 | when they are output. */ | |
1078 | extern int swap_operands; | |
014cfee8 RS |
1079 | \f |
1080 | /*** Condition Code Information ***/ | |
1081 | ||
1082 | /* Tell final.c how to eliminate redundant test instructions. */ | |
1083 | ||
1084 | /* Here we define machine-dependent flags and fields in cc_status | |
1085 | (see `conditions.h'). No extra ones are needed for the pyr. */ | |
1086 | ||
1087 | /* Store in cc_status the expressions | |
1088 | that the condition codes will describe | |
1089 | after execution of an instruction whose pattern is EXP. | |
1090 | Do not alter them if the instruction would not alter the cc's. */ | |
1091 | ||
1092 | /* This is a very simple definition of NOTICE_UPDATE_CC. | |
1093 | Many cases can be optimized, to improve condition code usage. | |
1094 | Maybe we should handle this entirely in the md, since it complicated | |
1095 | to describe the way pyr sets cc. */ | |
1096 | ||
1097 | #define TRULY_UNSIGNED_COMPARE_P(X) \ | |
1098 | (X == GEU || X == GTU || X == LEU || X == LTU) | |
1099 | #define CC_VALID_FOR_UNSIGNED 2 | |
1100 | ||
1101 | #define CC_STATUS_MDEP_INIT cc_status.mdep = 0 | |
1102 | ||
1103 | #define NOTICE_UPDATE_CC(EXP, INSN) \ | |
1104 | notice_update_cc(EXP, INSN) | |
1105 | \f | |
1106 | /*** Output of Assembler Code ***/ | |
1107 | ||
1108 | /* Output at beginning of assembler file. */ | |
1109 | ||
1110 | #define ASM_FILE_START(FILE) \ | |
1111 | fprintf (FILE, ((TARGET_UNIX_ASM)? "" : "#NO_APP\n")); | |
1112 | ||
1113 | /* Output to assembler file text saying following lines | |
1114 | may contain character constants, extra white space, comments, etc. */ | |
1115 | ||
1116 | #define ASM_APP_ON ((TARGET_UNIX_ASM) ? "" : "#APP\n") | |
1117 | ||
1118 | /* Output to assembler file text saying following lines | |
1119 | no longer contain unusual constructs. */ | |
1120 | ||
1121 | #define ASM_APP_OFF ((TARGET_UNIX_ASM) ? "" : "#NO_APP\n") | |
1122 | ||
1123 | /* Output before read-only data. */ | |
1124 | ||
1125 | #define TEXT_SECTION_ASM_OP ".text" | |
1126 | ||
1127 | /* Output before writable data. */ | |
1128 | ||
1129 | #define DATA_SECTION_ASM_OP ".data" | |
1130 | ||
1131 | /* How to refer to registers in assembler output. | |
1132 | This sequence is indexed by compiler's hard-register-number (see above). */ | |
1133 | ||
1134 | #define REGISTER_NAMES \ | |
1135 | {"gr0", "gr1", "gr2", "gr3", "gr4", "gr5", "gr6", "gr7", "gr8", \ | |
1136 | "gr9", "gr10", "gr11", "logpsw", "cfp", "sp", "pc", \ | |
1137 | "pr0", "pr1", "pr2", "pr3", "pr4", "pr5", "pr6", "pr7", \ | |
1138 | "pr8", "pr9", "pr10", "pr11", "pr12", "pr13", "pr14", "pr15", \ | |
1139 | "lr0", "lr1", "lr2", "lr3", "lr4", "lr5", "lr6", "lr7", \ | |
1140 | "lr8", "lr9", "lr10", "lr11", "lr12", "lr13", "lr14", "lr15", \ | |
1141 | "tr0", "tr1", "tr2", "tr3", "tr4", "tr5", "tr6", "tr7", \ | |
1142 | "tr8", "tr9", "tr10", "tr11", "tr12", "tr13", "tr14", "tr15"} | |
1143 | ||
1144 | /* How to renumber registers for dbx and gdb. */ | |
1145 | ||
1146 | #define DBX_REGISTER_NUMBER(REGNO) (REGNO) | |
1147 | ||
1148 | /* Our preference is for dbx rather than sdb. | |
1149 | Yours may be different. */ | |
1150 | #define DBX_DEBUGGING_INFO | |
1151 | /* #define SDB_DEBUGGING_INFO */ | |
1152 | ||
1153 | /* Don't use the `xsfoo;' construct in DBX output; this system | |
1154 | doesn't support it. */ | |
1155 | ||
1156 | #define DBX_NO_XREFS 1 | |
1157 | ||
1158 | /* Do not break .stabs pseudos into continuations. */ | |
1159 | ||
1160 | #define DBX_CONTIN_LENGTH 0 | |
1161 | ||
1162 | /* This is the char to use for continuation (in case we need to turn | |
1163 | continuation back on). */ | |
1164 | ||
1165 | #define DBX_CONTIN_CHAR '?' | |
1166 | ||
1167 | /* This is how to output the definition of a user-level label named NAME, | |
1168 | such as the label on a static function or variable NAME. */ | |
1169 | ||
1170 | #define ASM_OUTPUT_LABEL(FILE,NAME) \ | |
1171 | do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0) | |
1172 | ||
1173 | /* This is how to output a command to make the user-level label named NAME | |
1174 | defined for reference from other files. */ | |
1175 | ||
1176 | #define ASM_GLOBALIZE_LABEL(FILE,NAME) \ | |
1177 | do { fputs (".globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0) | |
1178 | ||
1179 | /* This is how to output a reference to a user-level label named NAME. */ | |
1180 | ||
1181 | #define ASM_OUTPUT_LABELREF(FILE,NAME) \ | |
1182 | fprintf (FILE, "_%s", NAME); | |
1183 | ||
1184 | /* This is how to output an internal numbered label where | |
1185 | PREFIX is the class of label and NUM is the number within the class. */ | |
1186 | ||
1187 | #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ | |
1188 | fprintf (FILE, "%s%d:\n", PREFIX, NUM) | |
1189 | ||
1190 | /* This is how to store into the string LABEL | |
1191 | the symbol_ref name of an internal numbered label where | |
1192 | PREFIX is the class of label and NUM is the number within the class. | |
1193 | This is suitable for output with `assemble_name'. */ | |
1194 | ||
1195 | #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ | |
1196 | sprintf (LABEL, "*%s%d", PREFIX, NUM) | |
1197 | ||
1198 | /* This is how to output an assembler line defining a `double' constant. */ | |
1199 | ||
1200 | #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \ | |
1201 | fprintf (FILE, "\t.double 0d%.20e\n", (VALUE)) | |
1202 | ||
1203 | /* This is how to output an assembler line defining a `float' constant. */ | |
1204 | ||
1205 | #define ASM_OUTPUT_FLOAT(FILE,VALUE) \ | |
1206 | fprintf (FILE, "\t.float 0f%.20e\n", (VALUE)) | |
1207 | ||
1208 | /* This is how to output an assembler line defining an `int' constant. */ | |
1209 | ||
1210 | #define ASM_OUTPUT_INT(FILE,VALUE) \ | |
1211 | ( fprintf (FILE, "\t.word "), \ | |
1212 | output_addr_const (FILE, (VALUE)), \ | |
1213 | fprintf (FILE, "\n")) | |
1214 | ||
1215 | /* Likewise for `char' and `short' constants. */ | |
1216 | ||
1217 | #define ASM_OUTPUT_SHORT(FILE,VALUE) \ | |
1218 | ( fprintf (FILE, "\t.half "), \ | |
1219 | output_addr_const (FILE, (VALUE)), \ | |
1220 | fprintf (FILE, "\n")) | |
1221 | ||
1222 | #define ASM_OUTPUT_CHAR(FILE,VALUE) \ | |
1223 | ( fprintf (FILE, "\t.byte "), \ | |
1224 | output_addr_const (FILE, (VALUE)), \ | |
1225 | fprintf (FILE, "\n")) | |
1226 | ||
1227 | /* This is how to output an assembler line for a numeric constant byte. */ | |
1228 | ||
1229 | #define ASM_OUTPUT_BYTE(FILE,VALUE) \ | |
1230 | fprintf (FILE, "\t.byte 0x%x\n", (VALUE)) | |
1231 | ||
1232 | /* This is how to output an insn to push a register on the stack. | |
1233 | It need not be very fast code. */ | |
1234 | ||
1235 | #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \ | |
1236 | fprintf (FILE, "\tsubw $4,sp\n\tmovw %s,(sp)\n", reg_names[REGNO]) | |
1237 | ||
1238 | /* This is how to output an insn to pop a register from the stack. | |
1239 | It need not be very fast code. */ | |
1240 | ||
1241 | #define ASM_OUTPUT_REG_POP(FILE,REGNO) \ | |
1242 | fprintf (FILE, "\tmovw (sp),%s\n\taddw $4,sp\n", reg_names[REGNO]) | |
1243 | ||
1244 | /* Store in OUTPUT a string (made with alloca) containing | |
1245 | an assembler-name for a local static variable named NAME. | |
1246 | LABELNO is an integer which is different for each call. */ | |
1247 | ||
1248 | #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ | |
1249 | ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \ | |
1250 | sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO))) | |
1251 | ||
1252 | /* This is how to output an element of a case-vector that is absolute. */ | |
1253 | ||
1254 | #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ | |
1255 | fprintf (FILE, "\t.word L%d\n", VALUE) | |
1256 | ||
1257 | /* This is how to output an element of a case-vector that is relative. */ | |
1258 | ||
1259 | ||
1260 | #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \ | |
1261 | fprintf (FILE, "\t.word L%d-L%d\n", VALUE, REL) | |
1262 | ||
1263 | /* This is how to output an assembler line | |
1264 | that says to advance the location counter | |
1265 | to a multiple of 2**LOG bytes. | |
1266 | ||
1267 | On Pyramids, the text segment must always be word aligned. | |
1268 | On Pyramids, .align takes only args between 2 and 5. | |
1269 | */ | |
1270 | ||
1271 | #define ASM_OUTPUT_ALIGN(FILE,LOG) \ | |
1272 | fprintf (FILE, "\t.align %d\n", (LOG) < 2 ? 2 : (LOG)) | |
1273 | ||
1274 | #define ASM_OUTPUT_SKIP(FILE,SIZE) \ | |
1275 | fprintf (FILE, "\t.space %u\n", (SIZE)) | |
1276 | ||
1277 | /* This says how to output an assembler line | |
1278 | to define a global common symbol. */ | |
1279 | ||
1280 | #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ | |
1281 | ( fputs (".comm ", (FILE)), \ | |
1282 | assemble_name ((FILE), (NAME)), \ | |
1283 | fprintf ((FILE), ",%u\n", (ROUNDED))) | |
1284 | ||
1285 | /* This says how to output an assembler line | |
1286 | to define a local common symbol. */ | |
1287 | ||
1288 | #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ | |
1289 | ( fputs (".lcomm ", (FILE)), \ | |
1290 | assemble_name ((FILE), (NAME)), \ | |
1291 | fprintf ((FILE), ",%u\n", (ROUNDED))) | |
1292 | ||
1293 | /* Define the parentheses used to group arithmetic operations | |
1294 | in assembler code. */ | |
1295 | ||
1296 | #define ASM_OPEN_PAREN "(" | |
1297 | #define ASM_CLOSE_PAREN ")" | |
1298 | ||
1299 | /* Define results of standard character escape sequences. */ | |
1300 | #define TARGET_BELL 007 | |
1301 | #define TARGET_BS 010 | |
1302 | #define TARGET_TAB 011 | |
1303 | #define TARGET_NEWLINE 012 | |
1304 | #define TARGET_VT 013 | |
1305 | #define TARGET_FF 014 | |
1306 | #define TARGET_CR 015 | |
1307 | ||
1308 | /* Print operand X (an rtx) in assembler syntax to file FILE. | |
1309 | CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified. | |
1310 | For `%' followed by punctuation, CODE is the punctuation and X is null. | |
1311 | On the Pyr, we support the conventional CODE characters: | |
1312 | ||
1313 | 'f' for float insn (print a CONST_DOUBLE as a float rather than in hex) | |
1314 | which are never used. */ | |
1315 | ||
1316 | /* FIXME : should be more robust with CONST_DOUBLE. */ | |
1317 | ||
1318 | #define PRINT_OPERAND(FILE, X, CODE) \ | |
1319 | { if (GET_CODE (X) == REG) \ | |
1320 | fprintf (FILE, "%s", reg_names [REGNO (X)]); \ | |
1321 | \ | |
1322 | else if (GET_CODE (X) == MEM) \ | |
1323 | output_address (XEXP (X, 0)); \ | |
1324 | \ | |
1325 | else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode) \ | |
1326 | { union { double d; int i[2]; } u; \ | |
1327 | union { float f; int i; } u1; \ | |
1328 | u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \ | |
1329 | u1.f = u.d; \ | |
1330 | if (CODE == 'f') \ | |
1331 | fprintf (FILE, "$0f%.0e", u1.f); \ | |
1332 | else \ | |
1333 | fprintf (FILE, "$0x%x", u1.i); } \ | |
1334 | \ | |
b030b8c2 | 1335 | else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode) \ |
014cfee8 RS |
1336 | { union { double d; int i[2]; } u; \ |
1337 | u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \ | |
1338 | fprintf (FILE, "$0d%.20e", u.d); } \ | |
1339 | \ | |
1340 | else if (CODE == 'N') \ | |
1341 | switch (GET_CODE (X)) \ | |
1342 | { \ | |
1343 | case EQ: fputs ("eq", FILE); break; \ | |
1344 | case NE: fputs ("ne", FILE); break; \ | |
1345 | case GT: \ | |
1346 | case GTU: fputs ("gt", FILE); break; \ | |
1347 | case LT: \ | |
1348 | case LTU: fputs ("lt", FILE); break; \ | |
1349 | case GE: \ | |
1350 | case GEU: fputs ("ge", FILE); break; \ | |
1351 | case LE: \ | |
1352 | case LEU: fputs ("le", FILE); break; \ | |
1353 | } \ | |
1354 | \ | |
1355 | else if (CODE == 'C') \ | |
1356 | switch (GET_CODE (X)) \ | |
1357 | { \ | |
1358 | case EQ: fputs ("ne", FILE); break; \ | |
1359 | case NE: fputs ("eq", FILE); break; \ | |
1360 | case GT: \ | |
1361 | case GTU: fputs ("le", FILE); break; \ | |
1362 | case LT: \ | |
1363 | case LTU: fputs ("ge", FILE); break; \ | |
1364 | case GE: \ | |
1365 | case GEU: fputs ("lt", FILE); break; \ | |
1366 | case LE: \ | |
1367 | case LEU: fputs ("gt", FILE); break; \ | |
1368 | } \ | |
1369 | \ | |
1370 | else if (CODE == 'R') \ | |
1371 | switch (GET_CODE (X)) \ | |
1372 | { \ | |
1373 | case EQ: fputs ("eq", FILE); break; \ | |
1374 | case NE: fputs ("ne", FILE); break; \ | |
1375 | case GT: \ | |
1376 | case GTU: fputs ("lt", FILE); break; \ | |
1377 | case LT: \ | |
1378 | case LTU: fputs ("gt", FILE); break; \ | |
1379 | case GE: \ | |
1380 | case GEU: fputs ("le", FILE); break; \ | |
1381 | case LE: \ | |
1382 | case LEU: fputs ("ge", FILE); break; \ | |
1383 | } \ | |
1384 | \ | |
1385 | else { putc ('$', FILE); output_addr_const (FILE, X); } \ | |
1386 | } | |
1387 | ||
1388 | /* Print a memory operand whose address is ADDR, on file FILE. */ | |
1389 | /* This is horrendously complicated. */ | |
1390 | #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \ | |
1391 | { \ | |
1392 | register rtx reg1, reg2, breg, ireg; \ | |
1393 | register rtx addr = ADDR; \ | |
1394 | rtx offset, scale; \ | |
1395 | retry: \ | |
1396 | switch (GET_CODE (addr)) \ | |
1397 | { \ | |
1398 | case MEM: \ | |
1399 | fprintf (stderr, "bad Mem "); debug_rtx (addr); \ | |
1400 | addr = XEXP (addr, 0); \ | |
1401 | abort (); \ | |
1402 | case REG: \ | |
1403 | fprintf (FILE, "(%s)", reg_names [REGNO (addr)]); \ | |
1404 | break; \ | |
1405 | case PLUS: \ | |
1406 | reg1 = 0; reg2 = 0; \ | |
1407 | ireg = 0; breg = 0; \ | |
1408 | offset = 0; \ | |
1409 | if (CONSTANT_ADDRESS_P (XEXP (addr, 0)) \ | |
1410 | || GET_CODE (XEXP (addr, 0)) == MEM) \ | |
1411 | { \ | |
1412 | offset = XEXP (addr, 0); \ | |
1413 | addr = XEXP (addr, 1); \ | |
1414 | } \ | |
1415 | else if (CONSTANT_ADDRESS_P (XEXP (addr, 1)) \ | |
1416 | || GET_CODE (XEXP (addr, 1)) == MEM) \ | |
1417 | { \ | |
1418 | offset = XEXP (addr, 1); \ | |
1419 | addr = XEXP (addr, 0); \ | |
1420 | } \ | |
1421 | if (GET_CODE (addr) != PLUS) ; \ | |
1422 | else if (GET_CODE (XEXP (addr, 0)) == MULT) \ | |
1423 | { \ | |
1424 | reg1 = XEXP (addr, 0); \ | |
1425 | addr = XEXP (addr, 1); \ | |
1426 | } \ | |
1427 | else if (GET_CODE (XEXP (addr, 1)) == MULT) \ | |
1428 | { \ | |
1429 | reg1 = XEXP (addr, 1); \ | |
1430 | addr = XEXP (addr, 0); \ | |
1431 | } \ | |
1432 | else if (GET_CODE (XEXP (addr, 0)) == REG) \ | |
1433 | { \ | |
1434 | reg1 = XEXP (addr, 0); \ | |
1435 | addr = XEXP (addr, 1); \ | |
1436 | } \ | |
1437 | else if (GET_CODE (XEXP (addr, 1)) == REG) \ | |
1438 | { \ | |
1439 | reg1 = XEXP (addr, 1); \ | |
1440 | addr = XEXP (addr, 0); \ | |
1441 | } \ | |
1442 | if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT) \ | |
1443 | { \ | |
1444 | if (reg1 == 0) \ | |
1445 | reg1 = addr; \ | |
1446 | else \ | |
1447 | reg2 = addr; \ | |
1448 | addr = 0; \ | |
1449 | } \ | |
1450 | if (offset != 0) \ | |
1451 | { \ | |
1452 | if (addr != 0) { \ | |
1453 | fprintf (stderr, "\nBad addr "); debug_rtx (addr); \ | |
1454 | abort ();} \ | |
1455 | addr = offset; \ | |
1456 | } \ | |
1457 | if (reg1 != 0 && GET_CODE (reg1) == MULT) \ | |
1458 | { breg = reg2; ireg = reg1; } \ | |
1459 | else if (reg2 != 0 && GET_CODE (reg2) == MULT) \ | |
1460 | { breg = reg1; ireg = reg2; } \ | |
1461 | else if (reg2 != 0 || GET_CODE (addr) == MEM) \ | |
1462 | { breg = reg2; ireg = reg1; } \ | |
1463 | else \ | |
1464 | { breg = reg1; ireg = reg2; } \ | |
1465 | if (addr != 0) \ | |
1466 | output_address (offset); \ | |
1467 | if (breg != 0) \ | |
1468 | { if (GET_CODE (breg) != REG) \ | |
1469 | { \ | |
1470 | fprintf (stderr, "bad Breg"); debug_rtx (addr); \ | |
1471 | abort (); \ | |
1472 | } \ | |
1473 | fprintf (FILE, "(%s)", reg_names[REGNO (breg)]); } \ | |
1474 | if (ireg != 0) \ | |
1475 | { \ | |
1476 | if (GET_CODE (ireg) == MULT) \ | |
1477 | { \ | |
1478 | scale = XEXP (ireg, 1); \ | |
1479 | ireg = XEXP (ireg, 0); \ | |
1480 | if (GET_CODE (ireg) != REG) \ | |
1481 | { register rtx tem; \ | |
1482 | tem = ireg; ireg = scale; scale = tem; \ | |
1483 | } \ | |
1484 | if (GET_CODE (ireg) != REG) { \ | |
1485 | fprintf (stderr, "bad idx "); debug_rtx (addr); \ | |
1486 | abort (); } \ | |
1487 | if ((GET_CODE (scale) == CONST_INT) && (INTVAL(scale) >= 1))\ | |
1488 | fprintf (FILE, "[%s*0x%x]", reg_names[REGNO (ireg)], \ | |
1489 | INTVAL(scale)); \ | |
1490 | else \ | |
1491 | fprintf (FILE, "[%s*1]", reg_names[REGNO (ireg)]); \ | |
1492 | } \ | |
1493 | else if (GET_CODE (ireg) == REG) \ | |
1494 | fprintf (FILE, "[%s*1]", reg_names[REGNO (ireg)]); \ | |
1495 | else \ | |
1496 | { \ | |
1497 | fprintf (stderr, "Not indexed at all!"); debug_rtx (addr);\ | |
1498 | abort (); \ | |
1499 | } \ | |
1500 | } \ | |
1501 | break; \ | |
1502 | default: \ | |
1503 | output_addr_const (FILE, addr); \ | |
1504 | } \ | |
1505 | } |