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