|
|
1.1 root 1: /* Definitions of target machine for GNU compiler, for SPUR chip.
2: Copyright (C) 1988 Free Software Foundation, Inc.
3:
4: This file is part of GNU CC.
5:
1.1.1.7 ! root 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:
1.1 root 11: GNU CC is distributed in the hope that it will be useful,
1.1.1.7 ! root 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. */
1.1 root 19:
20:
21: /* Note that some other tm- files include this one and then override
22: many of the definitions that relate to assembler syntax. */
23:
24:
25: /* Names to predefine in the preprocessor for this target machine. */
26:
27: #define CPP_PREDEFINES "-Dspur"
28:
29: /* Print subsidiary information on the compiler version in use. */
1.1.1.6 root 30: #define TARGET_VERSION fprintf (stderr, " (spur)");
1.1 root 31:
32: /* Run-time compilation parameters selecting different hardware subsets.
33:
34: On the SPUR, we don't yet need any. */
35:
36: extern int target_flags;
37:
38: /* Nonzero if we should generate code to use the fpu. */
39: #define TARGET_FPU (target_flags & 1)
40:
1.1.1.5 root 41: /* Nonzero if we should expand constant shifts into series of shift
42: instructions. */
43: #define TARGET_EXPAND_SHIFTS (target_flags & 2)
44:
45: /* Nonzero if we should generate long jumps for compares. */
46: #define TARGET_LONG_JUMPS (target_flags & 4)
47:
1.1 root 48: /* Macro to define tables used to set the flags.
49: This is a list in braces of pairs in braces,
50: each pair being { "NAME", VALUE }
51: where VALUE is the bits to set or minus the bits to clear.
52: An empty string NAME is used to identify the default VALUE. */
53:
54: #define TARGET_SWITCHES \
55: { {"fpu", 1}, \
56: {"soft-float", -1}, \
1.1.1.5 root 57: {"expand-shifts", 2}, \
58: {"lib-shifts", -2}, \
59: {"long-jumps", 4}, \
60: {"short-jumps", -4}, \
1.1 root 61: { "", TARGET_DEFAULT}}
62:
63: #define TARGET_DEFAULT 0
64:
65: /* target machine storage layout */
66:
67: /* Define this if most significant bit is lowest numbered
68: in instructions that operate on numbered bit-fields.
69: This is a moot question on the SPUR due to the lack of bit-field insns. */
70: /* #define BITS_BIG_ENDIAN */
71:
72: /* Define this if most significant byte of a word is the lowest numbered. */
73: /* That is not true on SPUR. */
74: /* #define BYTES_BIG_ENDIAN */
75:
76: /* Define this if most significant word of a multiword number is numbered. */
77: /* For SPUR we can decide arbitrarily
78: since there are no machine instructions for them. */
79: /* #define WORDS_BIG_ENDIAN */
80:
81: /* number of bits in an addressible storage unit */
82: #define BITS_PER_UNIT 8
83:
84: /* Width in bits of a "word", which is the contents of a machine register.
85: Note that this is not necessarily the width of data type `int';
86: if using 16-bit ints on a 68000, this would still be 32.
87: But on a machine with 16-bit registers, this would be 16. */
88: #define BITS_PER_WORD 32
89:
90: /* Width of a word, in units (bytes). */
91: #define UNITS_PER_WORD 4
92:
93: /* Width in bits of a pointer.
94: See also the macro `Pmode' defined below. */
95: #define POINTER_SIZE 32
96:
97: /* Allocation boundary (in *bits*) for storing pointers in memory. */
98: #define POINTER_BOUNDARY 32
99:
100: /* Allocation boundary (in *bits*) for storing arguments in argument list. */
101: #define PARM_BOUNDARY 64
102:
103: /* Boundary (in *bits*) on which stack pointer should be aligned. */
104: #define STACK_BOUNDARY 64
105:
106: /* Allocation boundary (in *bits*) for the code of a function. */
107: #define FUNCTION_BOUNDARY 32
108:
109: /* Alignment of field after `int : 0' in a structure. */
110: #define EMPTY_FIELD_BOUNDARY 32
111:
112: /* Every structure's size must be a multiple of this. */
113: #define STRUCTURE_SIZE_BOUNDARY 32
114:
115: /* No data type wants to be aligned rounder than this. */
116: #define BIGGEST_ALIGNMENT 64
117:
118: /* Define this if move instructions will actually fail to work
119: when given unaligned data. */
120: #define STRICT_ALIGNMENT
121:
122: /* Standard register usage. */
123:
124: /* Number of actual hardware registers.
125: The hardware registers are assigned numbers for the compiler
126: from 0 to just below FIRST_PSEUDO_REGISTER.
127: All registers that the compiler knows about must be given numbers,
128: even those that are not normally considered general registers.
129:
130: SPUR has 32 fullword registers and 15 floating point registers. */
131:
132: #define FIRST_PSEUDO_REGISTER 47
133:
134: /* 1 for registers that have pervasive standard uses
135: and are not available for the register allocator.
136: On SPUR, this includes all the global registers
137: and the callee return address register. */
138: #define FIXED_REGISTERS \
139: {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
140: 1, 0, 0, 0, 0, 0, \
141: 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, \
142: 1, 0, 0, 0, 0, 0, \
143: 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
144:
145: /* 1 for registers not available across function calls.
146: These must include the FIXED_REGISTERS and also any
147: registers that can be used without being saved.
148: The latter must include the registers where values are returned
149: and the register where structure-value addresses are passed.
150: Aside from that, you can include as many other registers as you like. */
151: #define CALL_USED_REGISTERS \
152: {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
153: 1, 0, 0, 0, 0, 0, \
154: 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, \
155: 1, 1, 1, 1, 1, 1, \
156: 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0}
157:
158: /* Return number of consecutive hard regs needed starting at reg REGNO
159: to hold something of mode MODE.
160: This is ordinarily the length in words of a value of mode MODE
161: but can be less for certain modes in special long registers.
162:
163: On SPUR, ordinary registers hold 32 bits worth;
164: a single floating point register is always enough for
165: anything that can be stored in them at all. */
166: #define HARD_REGNO_NREGS(REGNO, MODE) \
167: ((REGNO) >= 32 ? 1 \
168: : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
169:
170: /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
171: On SPUR, the cpu registers can hold any mode but the float registers
172: can hold only SFmode or DFmode. And they can't hold anything if use
173: of hardware floating point is disabled. */
174: #define HARD_REGNO_MODE_OK(REGNO, MODE) \
175: (((REGNO) < 32 && (GET_MODE_SIZE (MODE) <= 4 || (REGNO) < 31)) \
176: || (TARGET_FPU && ((MODE) == SFmode || (MODE) == DFmode)))
177:
178: /* Value is 1 if it is a good idea to tie two pseudo registers
179: when one has mode MODE1 and one has mode MODE2.
180: If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
181: for any hard reg, then this must be 0 for correct output. */
182: #define MODES_TIEABLE_P(MODE1, MODE2) \
183: (((MODE1) == SFmode || (MODE1) == DFmode) \
184: == ((MODE2) == SFmode || (MODE2) == DFmode))
185:
186: /* Specify the registers used for certain standard purposes.
187: The values of these macros are register numbers. */
188:
189: /* SPUR pc isn't overloaded on a register that the compiler knows about. */
190: /* #define PC_REGNUM */
191:
192: /* Register to use for pushing function arguments. */
193: #define STACK_POINTER_REGNUM 4
194:
195: /* Base register for access to local variables of the function. */
196: #define FRAME_POINTER_REGNUM 25
197:
198: /* Value should be nonzero if functions must have frame pointers.
199: Zero means the frame pointer need not be set up (and parms
200: may be accessed via the stack pointer) in functions that seem suitable.
201: This is computed in `reload', in reload1.c. */
202: #define FRAME_POINTER_REQUIRED 1
203:
204: /* Base register for access to arguments of the function. */
205: #define ARG_POINTER_REGNUM 25
206:
207: /* Register in which static-chain is passed to a function. */
208: /* ??? */
209: #define STATIC_CHAIN_REGNUM 8
210:
211: /* Register in which address to store a structure value
212: is passed to a function. */
213: #define STRUCT_VALUE_REGNUM 27
214: #define STRUCT_VALUE_INCOMING_REGNUM 11
215:
216: /* Define the classes of registers for register constraints in the
217: machine description. Also define ranges of constants.
218:
219: One of the classes must always be named ALL_REGS and include all hard regs.
220: If there is more than one class, another class must be named NO_REGS
221: and contain no registers.
222:
223: The name GENERAL_REGS must be the name of a class (or an alias for
224: another name such as ALL_REGS). This is the class of registers
225: that is allowed by "g" or "r" in a register constraint.
226: Also, registers outside this class are allocated only when
227: instructions express preferences for them.
228:
229: The classes must be numbered in nondecreasing order; that is,
230: a larger-numbered class must never be contained completely
231: in a smaller-numbered class.
232:
233: For any two classes, it is very desirable that there be another
234: class that represents their union. */
235:
236: /* The 68000 has two kinds of registers, hence four classes. */
237:
238: enum reg_class { NO_REGS, GENERAL_REGS, FP_REGS, ALL_REGS, LIM_REG_CLASSES };
239:
240: #define N_REG_CLASSES (int) LIM_REG_CLASSES
241:
242: /* Give names of register classes as strings for dump file. */
243:
244: #define REG_CLASS_NAMES \
245: {"NO_REGS", "GENERAL_REGS", "FP_REGS", "ALL_REGS" }
246:
247: /* Define which registers fit in which classes.
248: This is an initializer for a vector of HARD_REG_SET
249: of length N_REG_CLASSES. */
250:
251: #define REG_CLASS_CONTENTS {{0, 0}, {-1, 0}, {0, 0x7fff}, {-1, 0x7fff}}
252:
253: /* The same information, inverted:
254: Return the class number of the smallest class containing
255: reg number REGNO. This could be a conditional expression
256: or could index an array. */
257:
258: #define REGNO_REG_CLASS(REGNO) \
259: ((REGNO) >= 32 ? FP_REGS : GENERAL_REGS)
260:
261: /* The class value for index registers, and the one for base regs. */
262: #define INDEX_REG_CLASS GENERAL_REGS
263: #define BASE_REG_CLASS GENERAL_REGS
264:
265: /* Get reg_class from a letter such as appears in the machine description. */
266:
267: #define REG_CLASS_FROM_LETTER(C) \
268: ((C) == 'f' ? FP_REGS : NO_REGS)
269:
270: /* The letters I, J, K, L and M in a register constraint string
271: can be used to stand for particular ranges of immediate operands.
272: This macro defines what the ranges are.
273: C is the letter, and VALUE is a constant value.
274: Return 1 if VALUE is in the range specified by C.
275:
276: For SPUR, `I' is used for the range of constants an insn
277: can actually contain.
278: `J' is used for the range which is just zero (since that is R0).
279: `K' is used for the 5-bit operand of a compare insns. */
280:
281: #define CONST_OK_FOR_LETTER_P(VALUE, C) \
282: ((C) == 'I' ? (unsigned) ((VALUE) + 0x2000) < 0x4000 \
283: : (C) == 'J' ? (VALUE) == 0 \
284: : (C) == 'K' ? (unsigned) (VALUE) < 0x20 \
285: : 0)
286:
287: /* Similar, but for floating constants, and defining letters G and H.
288: Here VALUE is the CONST_DOUBLE rtx itself. */
289:
290: #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
291: ((C) == 'G' && XINT (VALUE, 0) == 0 && XINT (VALUE, 1) == 0)
292:
293: /* Given an rtx X being reloaded into a reg required to be
294: in class CLASS, return the class of reg to actually use.
295: In general this is just CLASS; but on some machines
296: in some cases it is preferable to use a more restrictive class. */
297: #define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
298:
299: /* Return the maximum number of consecutive registers
300: needed to represent mode MODE in a register of class CLASS. */
301: /* On SPUR, this is the size of MODE in words,
302: except in the FP regs, where a single reg is always enough. */
303: #define CLASS_MAX_NREGS(CLASS, MODE) \
304: ((CLASS) == FP_REGS ? 1 \
305: : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
306:
307: /* Stack layout; function entry, exit and calling. */
308:
309: /* Define this if pushing a word on the stack
310: makes the stack pointer a smaller address. */
311: #define STACK_GROWS_DOWNWARD
312:
313: /* Define this if the nominal address of the stack frame
314: is at the high-address end of the local variables;
315: that is, each additional local variable allocated
316: goes at a more negative offset in the frame. */
317: #define FRAME_GROWS_DOWNWARD
318:
319: /* Offset within stack frame to start allocating local variables at.
320: If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
321: first local allocated. Otherwise, it is the offset to the BEGINNING
322: of the first local allocated. */
323: #define STARTING_FRAME_OFFSET 0
324:
325: /* If we generate an insn to push BYTES bytes,
326: this says how many the stack pointer really advances by.
327: On SPUR, don't define this because there are no push insns. */
328: /* #define PUSH_ROUNDING(BYTES) */
329:
330: /* Offset of first parameter from the argument pointer register value. */
1.1.1.4 root 331: #define FIRST_PARM_OFFSET(FNDECL) 0
1.1 root 332:
333: /* Value is 1 if returning from a function call automatically
334: pops the arguments described by the number-of-args field in the call.
335: FUNTYPE is the data type of the function (as a tree),
336: or for a library call it is an identifier node for the subroutine name. */
337:
338: #define RETURN_POPS_ARGS(FUNTYPE) 0
339:
340: /* Define how to find the value returned by a function.
341: VALTYPE is the data type of the value (as a tree).
342: If the precise function being called is known, FUNC is its FUNCTION_DECL;
343: otherwise, FUNC is 0. */
344:
345: /* On SPUR the value is found in the second "output" register. */
346:
347: #define FUNCTION_VALUE(VALTYPE, FUNC) \
348: gen_rtx (REG, TYPE_MODE (VALTYPE), 27)
349:
350: /* But the called function leaves it in the second "input" register. */
351:
352: #define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \
353: gen_rtx (REG, TYPE_MODE (VALTYPE), 11)
354:
355: /* Define how to find the value returned by a library function
356: assuming the value has mode MODE. */
357:
358: #define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, 27)
359:
360: /* 1 if N is a possible register number for a function value
361: as seen by the caller.
362: On SPUR, the first "output" reg is the only register thus used. */
363:
364: #define FUNCTION_VALUE_REGNO_P(N) ((N) == 27)
365:
366: /* 1 if N is a possible register number for function argument passing.
367: On SPUR, these are the "output" registers. */
368:
369: #define FUNCTION_ARG_REGNO_P(N) ((N) < 32 && (N) > 26)
370:
371: /* Define a data type for recording info about an argument list
372: during the scan of that argument list. This data type should
373: hold all necessary information about the function itself
374: and about the args processed so far, enough to enable macros
375: such as FUNCTION_ARG to determine where the next arg should go.
376:
377: On SPUR, this is a single integer, which is a number of words
378: of arguments scanned so far (including the invisible argument,
379: if any, which holds the structure-value-address).
380: Thus 5 or more means all following args should go on the stack. */
381:
382: #define CUMULATIVE_ARGS int
383:
384: /* Initialize a variable CUM of type CUMULATIVE_ARGS
385: for a call to a function whose data type is FNTYPE.
386: For a library call, FNTYPE is 0.
387:
388: On SPUR, the offset normally starts at 0, but starts at 4 bytes
389: when the function gets a structure-value-address as an
390: invisible first argument. */
391:
392: #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE) \
393: ((CUM) = ((FNTYPE) != 0 && TYPE_MODE (TREE_TYPE (FNTYPE)) == BLKmode))
394:
395: /* Update the data in CUM to advance over an argument
396: of mode MODE and data type TYPE.
397: (TYPE is null for libcalls where that information may not be available.) */
398:
399: #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
400: ((CUM) += ((MODE) != BLKmode \
401: ? (GET_MODE_SIZE (MODE) + 3) / 4 \
402: : (int_size_in_bytes (TYPE) + 3) / 4))
403:
404: /* Determine where to put an argument to a function.
405: Value is zero to push the argument on the stack,
406: or a hard register in which to store the argument.
407:
408: MODE is the argument's machine mode.
409: TYPE is the data type of the argument (as a tree).
410: This is null for libcalls where that information may
411: not be available.
412: CUM is a variable of type CUMULATIVE_ARGS which gives info about
413: the preceding args and about the function being called.
414: NAMED is nonzero if this argument is a named parameter
415: (otherwise it is an extra parameter matching an ellipsis). */
416:
417: /* On SPUR the first five words of args are normally in registers
418: and the rest are pushed. But any arg that won't entirely fit in regs
419: is pushed. */
420:
421: #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
422: (5 >= ((CUM) \
423: + ((MODE) == BLKmode \
424: ? (int_size_in_bytes (TYPE) + 3) / 4 \
425: : (GET_MODE_SIZE (MODE) + 3) / 4)) \
426: ? gen_rtx (REG, (MODE), 27 + (CUM)) \
427: : 0)
428:
429: /* Define where a function finds its arguments.
430: This is different from FUNCTION_ARG because of register windows. */
431:
432: #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
433: (5 >= ((CUM) \
434: + ((MODE) == BLKmode \
435: ? (int_size_in_bytes (TYPE) + 3) / 4 \
436: : (GET_MODE_SIZE (MODE) + 3) / 4)) \
437: ? gen_rtx (REG, (MODE), 11 + (CUM)) \
438: : 0)
439:
440: /* For an arg passed partly in registers and partly in memory,
441: this is the number of registers used.
442: For args passed entirely in registers or entirely in memory, zero. */
443:
444: #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
445:
446: /* This macro generates the assembly code for function entry.
447: FILE is a stdio stream to output the code to.
448: SIZE is an int: how many units of temporary storage to allocate.
449: Refer to the array `regs_ever_live' to determine which registers
450: to save; `regs_ever_live[I]' is nonzero if register number I
451: is ever used in the function. This macro is responsible for
452: knowing which registers should not be saved even if used. */
453:
454: /* On spur, move-double insns between fpu and cpu need an 8-byte block
455: of memory. If any fpu reg is used in the function, we allocate
456: such a block here, at the bottom of the frame, just in case it's needed. */
457:
458: #define FUNCTION_PROLOGUE(FILE, SIZE) \
459: { \
460: static char *reg_names[] = REGISTER_NAMES; \
461: extern char call_used_regs[]; \
462: extern int current_function_pretend_args_size; \
463: int fsize = ((SIZE) + 7) & ~7; \
464: int nregs, i, fp_used = 0; \
465: for (i = 32, nregs = 0; i < FIRST_PSEUDO_REGISTER; i++) \
466: { \
467: if (regs_ever_live[i] && ! call_used_regs[i]) \
468: nregs++; \
469: if (regs_ever_live[i]) fp_used = 1; \
470: } \
471: if (fp_used) fsize += 8; \
472: fprintf (FILE, "0:\trd_special r24,pc\n"); \
1.1.1.5 root 473: fprintf (FILE, "\tand r24,r24,$~0x3\n"); \
1.1 root 474: fprintf (FILE, "\tadd_nt r25,r4,$%d\n", \
475: - current_function_pretend_args_size); \
1.1.1.5 root 476: if (fsize + nregs != 0 || current_function_pretend_args_size > 0)\
477: { \
478: int n = - fsize - nregs * 16; \
479: if (n >= -8192) \
480: fprintf (FILE, "\tadd_nt r4,r25,$%d\n", n); \
481: else \
482: { \
483: fprintf (FILE, "\tadd_nt r4,r25,$-8192\n"); \
484: n += 8192; \
485: while (n < -8192) \
486: fprintf (FILE, "\tadd_nt r4,r4,$-8192\n"), n += 8192; \
487: if (n != 0) \
488: fprintf (FILE, "\tadd_nt r4,r4,$%d\n", n); \
489: } \
490: } \
1.1 root 491: for (i = 32, nregs = 0; i < FIRST_PSEUDO_REGISTER; i++) \
492: if (regs_ever_live[i] && ! call_used_regs[i]) \
493: { \
494: fprintf (FILE, "\tst_ext1 %s,r4,$%d\n", \
495: reg_names[i], 8 * nregs++); \
496: fprintf (FILE, "\tst_ext2 %s,r4,$%d\n", \
497: reg_names[i], 8 * nregs++); \
498: } \
499: }
500:
501: /* Output assembler code to FILE to increment profiler label # LABELNO
502: for profiling a function entry. */
503:
504: #define FUNCTION_PROFILER(FILE, LABELNO) \
505: abort ();
506:
507: /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
508: the stack pointer does not matter. The value is tested only in
509: functions that have frame pointers.
510: No definition is equivalent to always zero. */
511:
512: extern int may_call_alloca;
513: extern int current_function_pretend_args_size;
514:
515: #define EXIT_IGNORE_STACK \
516: (get_frame_size () != 0 \
517: || may_call_alloca || current_function_pretend_args_size)
518:
519: /* This macro generates the assembly code for function exit,
520: on machines that need it. If FUNCTION_EPILOGUE is not defined
521: then individual return instructions are generated for each
522: return statement. Args are same as for FUNCTION_PROLOGUE.
523:
524: The function epilogue should not depend on the current stack pointer!
525: It should use the frame pointer only. This is mandatory because
526: of alloca; we also take advantage of it to omit stack adjustments
527: before returning. */
528:
529: #define FUNCTION_EPILOGUE(FILE, SIZE) \
530: { \
531: static char *reg_names[] = REGISTER_NAMES; \
532: extern char call_used_regs[]; \
533: extern int may_call_alloca; \
534: extern int current_function_pretend_args_size; \
535: int fsize = ((SIZE) + 7) & ~7; \
536: int nregs, i, fp_used = 0; \
537: for (i = 32, nregs = 0; i < FIRST_PSEUDO_REGISTER; i++) \
538: { \
539: if (regs_ever_live[i] && ! call_used_regs[i]) \
540: nregs++; \
541: if (regs_ever_live[i]) fp_used = 1; \
542: } \
543: if (fp_used) fsize += 8; \
544: if (nregs != 0) \
545: { \
546: fprintf (FILE, "\tadd_nt r4,r25,$%d\n", - fsize - nregs * 16); \
547: for (i = 32, nregs = 0; i < FIRST_PSEUDO_REGISTER; i++) \
548: if (regs_ever_live[i] && ! call_used_regs[i]) \
549: { \
550: fprintf (FILE, "\tld_ext1 %s,r4,$%d\n\tnop\n", \
551: reg_names[i], 8 * nregs++); \
552: fprintf (FILE, "\tld_ext2 %s,r4,$%d\n\tnop\n", \
553: reg_names[i], 8 * nregs++); \
554: } \
555: } \
556: if (fsize != 0 || nregs != 0 || may_call_alloca \
557: || current_function_pretend_args_size > 0) \
558: fprintf (FILE, "\tadd_nt r4,r25,$%d\n", \
559: current_function_pretend_args_size); \
560: fprintf (FILE, "\treturn r10,$8\n\tnop\n"); \
561: }
562:
563: /* If the memory address ADDR is relative to the frame pointer,
564: correct it to be relative to the stack pointer instead.
565: This is for when we don't use a frame pointer.
566: ADDR should be a variable name. */
567:
568: #define FIX_FRAME_POINTER_ADDRESS(ADDR,DEPTH) abort ();
569:
570: /* Addressing modes, and classification of registers for them. */
571:
572: /* #define HAVE_POST_INCREMENT */
573: /* #define HAVE_POST_DECREMENT */
574:
575: /* #define HAVE_PRE_DECREMENT */
576: /* #define HAVE_PRE_INCREMENT */
577:
578: /* Macros to check register numbers against specific register classes. */
579:
580: /* These assume that REGNO is a hard or pseudo reg number.
581: They give nonzero only if REGNO is a hard reg of the suitable class
582: or a pseudo reg currently allocated to a suitable hard reg.
583: Since they use reg_renumber, they are safe only once reg_renumber
584: has been allocated, which happens in local-alloc.c. */
585:
586: #define REGNO_OK_FOR_INDEX_P(REGNO) \
587: ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)
588: #define REGNO_OK_FOR_BASE_P(REGNO) \
589: ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)
590: #define REGNO_OK_FOR_FP_P(REGNO) \
591: (((REGNO) ^ 0x20) < 14 || (unsigned) (reg_renumber[REGNO] ^ 0x20) < 14)
592:
593: /* Now macros that check whether X is a register and also,
594: strictly, whether it is in a specified class.
595:
596: These macros are specific to the SPUR, and may be used only
597: in code for printing assembler insns and in conditions for
598: define_optimization. */
599:
600: /* 1 if X is an fp register. */
601:
602: #define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
603:
604: /* Maximum number of registers that can appear in a valid memory address. */
605:
606: #define MAX_REGS_PER_ADDRESS 2
607:
608: /* Recognize any constant value that is a valid address. */
609:
610: #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)
611:
612: /* Nonzero if the constant value X is a legitimate general operand.
613: It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
614:
615: #define LEGITIMATE_CONSTANT_P(X) \
616: ((GET_CODE (X) == CONST_INT \
617: && (unsigned) (INTVAL (X) + 0x2000) < 0x4000)\
618: || (GET_CODE (X) == SYMBOL_REF && (X)->unchanging))
619:
620: /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
621: and check its validity for a certain class.
622: We have two alternate definitions for each of them.
623: The usual definition accepts all pseudo regs; the other rejects
624: them unless they have been allocated suitable hard regs.
625: The symbol REG_OK_STRICT causes the latter definition to be used.
626:
627: Most source files want to accept pseudo regs in the hope that
628: they will get allocated to the class that the insn wants them to be in.
629: Source files for reload pass need to be strict.
630: After reload, it makes no difference, since pseudo regs have
631: been eliminated by then. */
632:
633: #ifndef REG_OK_STRICT
634:
635: /* Nonzero if X is a hard reg that can be used as an index
636: or if it is a pseudo reg. */
637: #define REG_OK_FOR_INDEX_P(X) (((unsigned) REGNO (X)) - 32 >= 14)
638: /* Nonzero if X is a hard reg that can be used as a base reg
639: or if it is a pseudo reg. */
640: #define REG_OK_FOR_BASE_P(X) (((unsigned) REGNO (X)) - 32 >= 14)
641:
642: #else
643:
644: /* Nonzero if X is a hard reg that can be used as an index. */
645: #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
646: /* Nonzero if X is a hard reg that can be used as a base reg. */
647: #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
648:
649: #endif
650:
651: /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
652: that is a valid memory address for an instruction.
653: The MODE argument is the machine mode for the MEM expression
654: that wants to use this address.
655:
1.1.1.5 root 656: On SPUR, the actual legitimate addresses must be REG+SMALLINT or REG+REG.
657: Actually, REG+REG is not legitimate for stores, so
658: it is obtained only by combination on loads.
659: We can treat a SYMBOL_REF as legitimate if it is part of this
1.1 root 660: function's constant-pool, because such addresses can actually
661: be output as REG+SMALLINT. */
662:
663: #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
664: { if (GET_CODE (X) == REG \
665: && REG_OK_FOR_BASE_P (X)) \
666: goto ADDR; \
667: if (GET_CODE (X) == SYMBOL_REF && (X)->unchanging) \
668: goto ADDR; \
669: if (GET_CODE (X) == PLUS \
670: && GET_CODE (XEXP (X, 0)) == REG \
671: && REG_OK_FOR_BASE_P (XEXP (X, 0))) \
672: { \
673: if (GET_CODE (XEXP (X, 1)) == CONST_INT \
674: && INTVAL (XEXP (X, 1)) >= -0x2000 \
675: && INTVAL (XEXP (X, 1)) < 0x2000) \
676: goto ADDR; \
677: } \
678: }
679:
680: /* Try machine-dependent ways of modifying an illegitimate address
681: to be legitimate. If we find one, return the new, valid address.
682: This macro is used in only one place: `memory_address' in explow.c.
683:
684: OLDX is the address as it was before break_out_memory_refs was called.
685: In some cases it is useful to look at this to decide what needs to be done.
686:
687: MODE and WIN are passed so that this macro can use
688: GO_IF_LEGITIMATE_ADDRESS.
689:
690: It is always safe for this macro to do nothing. It exists to recognize
691: opportunities to optimize the output. */
692:
693: /* On SPUR, change REG+N into REG+REG, and REG+(X*Y) into REG+REG. */
694:
695: #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
696: { if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 1))) \
697: (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
698: copy_to_mode_reg (SImode, XEXP (X, 1))); \
699: if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 0))) \
700: (X) = gen_rtx (PLUS, SImode, XEXP (X, 1), \
701: copy_to_mode_reg (SImode, XEXP (X, 0))); \
702: if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == MULT) \
703: (X) = gen_rtx (PLUS, SImode, XEXP (X, 1), \
704: force_operand (XEXP (X, 0), 0)); \
705: if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == MULT) \
706: (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
707: force_operand (XEXP (X, 1), 0)); \
708: if (memory_address_p (MODE, X)) \
709: goto WIN; }
710:
711: /* Go to LABEL if ADDR (a legitimate address expression)
712: has an effect that depends on the machine mode it is used for.
713: On the SPUR this is never true. */
714:
715: #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
716:
717: /* Specify the machine mode that this machine uses
718: for the index in the tablejump instruction. */
719: #define CASE_VECTOR_MODE SImode
720:
721: /* Define this if the tablejump instruction expects the table
722: to contain offsets from the address of the table.
723: Do not define this if the table should contain absolute addresses. */
724: /* #define CASE_VECTOR_PC_RELATIVE */
725:
726: /* Specify the tree operation to be used to convert reals to integers. */
727: #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
728:
729: /* This is the kind of divide that is easiest to do in the general case. */
730: #define EASY_DIV_EXPR TRUNC_DIV_EXPR
731:
732: /* Define this as 1 if `char' should by default be signed; else as 0. */
733: #define DEFAULT_SIGNED_CHAR 0
734:
735: /* Max number of bytes we can move from memory to memory
736: in one reasonably fast instruction. */
737: #define MOVE_MAX 4
738:
739: /* Nonzero if access to memory by bytes is slow and undesirable. */
740: #define SLOW_BYTE_ACCESS 1
741:
1.1.1.2 root 742: /* This is BSD, so it wants DBX format. */
743: #define DBX_DEBUGGING_INFO
744:
1.1 root 745: /* Do not break .stabs pseudos into continuations. */
746: #define DBX_CONTIN_LENGTH 0
747:
748: /* Don't try to use the `x' type-cross-reference character in DBX data.
749: Also has the consequence of putting each struct, union or enum
750: into a separate .stabs, containing only cross-refs to the others. */
751: #define DBX_NO_XREFS
752:
753: /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
754: is done just by pretending it is already truncated. */
755: #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
756:
757: /* Specify the machine mode that pointers have.
758: After generation of rtl, the compiler makes no further distinction
759: between pointers and any other objects of this machine mode. */
760: #define Pmode SImode
761:
762: /* A function address in a call instruction
763: is a byte address (for indexing purposes)
764: so give the MEM rtx a byte's mode. */
765: #define FUNCTION_MODE SImode
766:
767: /* Define this if addresses of constant functions
768: shouldn't be put through pseudo regs where they can be cse'd.
769: Desirable on machines where ordinary constants are expensive
770: but a CALL with constant address is cheap. */
771: #define NO_FUNCTION_CSE
772:
773: /* Compute the cost of computing a constant rtl expression RTX
774: whose rtx-code is CODE. The body of this macro is a portion
775: of a switch statement. If the code is computed here,
776: return it with a return statement. Otherwise, break from the switch. */
777:
778: #define CONST_COSTS(RTX,CODE) \
779: case CONST_INT: \
780: if (INTVAL (RTX) < 0x2000 && INTVAL (RTX) >= -0x2000) return 1; \
781: case CONST: \
782: case LABEL_REF: \
783: case SYMBOL_REF: \
784: return 2; \
785: case CONST_DOUBLE: \
786: return 4;
787:
788: /* Tell final.c how to eliminate redundant test instructions. */
789:
790: /* Here we define machine-dependent flags and fields in cc_status
791: (see `conditions.h'). */
792:
793: /* (None are needed on SPUR.) */
794:
795: /* Store in cc_status the expressions
796: that the condition codes will describe
797: after execution of an instruction whose pattern is EXP.
798: Do not alter them if the instruction would not alter the cc's. */
799:
800: /* The SPUR does not really have a condition code. */
801:
1.1.1.5 root 802: #define NOTICE_UPDATE_CC(EXP, INSN) \
1.1 root 803: { CC_STATUS_INIT; }
804:
805: /* Control the assembler format that we output. */
806:
807: /* Output at beginning of assembler file. */
808:
1.1.1.2 root 809: #define ASM_FILE_START(FILE)
1.1 root 810:
811: /* Output to assembler file text saying following lines
812: may contain character constants, extra white space, comments, etc. */
813:
814: #define ASM_APP_ON ""
815:
816: /* Output to assembler file text saying following lines
817: no longer contain unusual constructs. */
818:
819: #define ASM_APP_OFF ""
820:
821: /* Output before read-only data. */
822:
823: #define TEXT_SECTION_ASM_OP ".text"
824:
825: /* Output before writable data. */
826:
827: #define DATA_SECTION_ASM_OP ".data"
828:
829: /* How to refer to registers in assembler output.
830: This sequence is indexed by compiler's hard-register-number (see above). */
831:
832: #define REGISTER_NAMES \
833: {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", \
834: "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", \
835: "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", \
836: "r30", "r31", \
837: "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", \
838: "f10", "f11", "f12", "f13", "f14" }
839:
840: /* How to renumber registers for dbx and gdb. */
841:
842: #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
843:
844: /* This is how to output the definition of a user-level label named NAME,
845: such as the label on a static function or variable NAME. */
846:
847: #define ASM_OUTPUT_LABEL(FILE,NAME) \
848: do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
849:
850: /* This is how to output a command to make the user-level label named NAME
851: defined for reference from other files. */
852:
853: #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
854: do { fputs (".globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
855:
856: /* This is how to output a reference to a user-level label named NAME.
857: `assemble_name' uses this. */
858:
859: #define ASM_OUTPUT_LABELREF(FILE,NAME) \
860: fprintf (FILE, "_%s", NAME)
861:
862: /* This is how to output an internal numbered label where
863: PREFIX is the class of label and NUM is the number within the class. */
864:
865: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
866: fprintf (FILE, "%s%d:\n", PREFIX, NUM)
867:
868: /* This is how to store into the string LABEL
869: the symbol_ref name of an internal numbered label where
870: PREFIX is the class of label and NUM is the number within the class.
871: This is suitable for output with `assemble_name'. */
872:
873: #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
874: sprintf (LABEL, "*%s%d", PREFIX, NUM)
875:
876: /* This is how to output an assembler line defining a `double' constant. */
877:
878: #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
879: fprintf (FILE, "\t.double %.20e\n", (VALUE))
880:
881: /* This is how to output an assembler line defining a `float' constant. */
882:
883: #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
884: fprintf (FILE, "\t.single %.12e\n", (VALUE))
885:
886: /* This is how to output an assembler line defining an `int' constant. */
887:
888: #define ASM_OUTPUT_INT(FILE,VALUE) \
889: ( fprintf (FILE, "\t.long "), \
890: output_addr_const (FILE, (VALUE)), \
891: fprintf (FILE, "\n"))
892:
893: /* Likewise for `char' and `short' constants. */
894:
895: #define ASM_OUTPUT_SHORT(FILE,VALUE) \
896: ( fprintf (FILE, "\t.word "), \
897: output_addr_const (FILE, (VALUE)), \
898: fprintf (FILE, "\n"))
899:
900: #define ASM_OUTPUT_CHAR(FILE,VALUE) \
901: ( fprintf (FILE, "\t.byte "), \
902: output_addr_const (FILE, (VALUE)), \
903: fprintf (FILE, "\n"))
904:
905: /* This is how to output an assembler line for a numeric constant byte. */
906:
907: #define ASM_OUTPUT_BYTE(FILE,VALUE) \
908: fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
909:
1.1.1.5 root 910: /* This is how to output code to push a register on the stack.
911: It need not be very fast code. */
912:
913: #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
914: fprintf (FILE, "\tadd_nt r4,r4,$-4\n\tst_32 %s,r4,$0\n", reg_names[REGNO])
915:
916: /* This is how to output an insn to pop a register from the stack.
917: It need not be very fast code. */
918:
919: #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
920: fprintf (FILE, "\tld_32 %s,r4,$0\n\tadd_nt r4,r4,$4\n", reg_names[REGNO])
921:
1.1 root 922: /* This is how to output an element of a case-vector that is absolute. */
923:
924: #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
925: fprintf (FILE, "\t.long L%d\n", VALUE)
926:
927: /* This is how to output an element of a case-vector that is relative.
928: (SPUR does not use such vectors,
929: but we must define this macro anyway.) */
930:
931: #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
932: fprintf (FILE, "\t.word L%d-L%d\n", VALUE, REL)
933:
934: /* This is how to output an assembler line
935: that says to advance the location counter
936: to a multiple of 2**LOG bytes. */
937:
938: #define ASM_OUTPUT_ALIGN(FILE,LOG) \
939: if ((LOG) != 0) \
940: fprintf (FILE, "\t.align %d\n", (LOG))
941:
942: #define ASM_OUTPUT_SKIP(FILE,SIZE) \
943: fprintf (FILE, "\t.space %d\n", (SIZE))
944:
945: /* This says how to output an assembler line
946: to define a global common symbol. */
947:
1.1.1.3 root 948: #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
1.1 root 949: ( fputs (".comm ", (FILE)), \
950: assemble_name ((FILE), (NAME)), \
1.1.1.3 root 951: fprintf ((FILE), ",%d\n", (ROUNDED)))
1.1 root 952:
953: /* This says how to output an assembler line
954: to define a local common symbol. */
955:
1.1.1.3 root 956: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
1.1 root 957: ( fputs (".lcomm ", (FILE)), \
958: assemble_name ((FILE), (NAME)), \
1.1.1.3 root 959: fprintf ((FILE), ",%d\n", (ROUNDED)))
1.1 root 960:
961: /* Store in OUTPUT a string (made with alloca) containing
962: an assembler-name for a local static variable named NAME.
963: LABELNO is an integer which is different for each call. */
964:
965: #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
966: ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
967: sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
968:
969: /* Define the parentheses used to group arithmetic operations
970: in assembler code. */
971:
972: #define ASM_OPEN_PAREN "("
973: #define ASM_CLOSE_PAREN ")"
974:
975: /* Define results of standard character escape sequences. */
976: #define TARGET_BELL 007
977: #define TARGET_BS 010
978: #define TARGET_TAB 011
979: #define TARGET_NEWLINE 012
980: #define TARGET_VT 013
981: #define TARGET_FF 014
982: #define TARGET_CR 015
983:
984: /* Print operand X (an rtx) in assembler syntax to file FILE.
985: CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
986: For `%' followed by punctuation, CODE is the punctuation and X is null.
987:
988: On SPUR, the CODE can be `r', meaning this is a register-only operand
989: and an immediate zero should be represented as `r0'. */
990:
991: #define PRINT_OPERAND(FILE, X, CODE) \
992: { if (GET_CODE (X) == REG) \
993: fprintf (FILE, "%s", reg_name [REGNO (X)]); \
994: else if (GET_CODE (X) == MEM) \
995: output_address (XEXP (X, 0)); \
996: else if (GET_CODE (X) == CONST_DOUBLE) \
997: abort (); \
998: else if ((CODE) == 'r' && (X) == const0_rtx) \
999: fprintf (FILE, "r0"); \
1000: else { putc ('$', FILE); output_addr_const (FILE, X); }}
1001:
1002: /* Print a memory address as an operand to reference that memory location. */
1003:
1004: #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
1005: { register rtx base, index = 0; \
1006: int offset = 0; \
1007: register rtx addr = ADDR; \
1008: if (GET_CODE (addr) == REG) \
1009: { \
1010: fprintf (FILE, "%s,$0", reg_name [REGNO (addr)]); \
1011: } \
1012: else if (GET_CODE (addr) == PLUS) \
1013: { \
1014: if (GET_CODE (XEXP (addr, 0)) == CONST_INT) \
1015: offset = INTVAL (XEXP (addr, 0)), base = XEXP (addr, 1);\
1016: else if (GET_CODE (XEXP (addr, 1)) == CONST_INT) \
1017: offset = INTVAL (XEXP (addr, 1)), base = XEXP (addr, 0);\
1018: else \
1019: base = XEXP (addr, 0), index = XEXP (addr, 1); \
1020: fprintf (FILE, "%s,", reg_name [REGNO (base)]); \
1021: if (index == 0) \
1022: fprintf (FILE, "$%d", offset); \
1023: else \
1024: fprintf (FILE, "%s,", reg_name [REGNO (index)]); \
1025: } \
1026: else \
1027: { \
1028: fprintf (FILE, "r24,$("); \
1029: output_addr_const (FILE, addr); \
1030: fprintf (FILE, "-0b)"); \
1031: } \
1032: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.