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