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