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