|
|
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:
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: /* 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. */
30: #define TARGET_VERSION fprintf (stderr, " (spur)");
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:
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:
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}, \
57: {"expand-shifts", 2}, \
58: {"lib-shifts", -2}, \
59: {"long-jumps", 4}, \
60: {"short-jumps", -4}, \
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:
1.1.1.4 ! root 290: #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
! 291: ((C) == 'G' && CONST_DOUBLE_LOW ((VALUE)) == 0 \
! 292: && CONST_DOUBLE_HIGH ((VALUE)) == 0)
1.1 root 293:
294: /* Given an rtx X being reloaded into a reg required to be
295: in class CLASS, return the class of reg to actually use.
296: In general this is just CLASS; but on some machines
297: in some cases it is preferable to use a more restrictive class. */
298: #define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
299:
300: /* Return the maximum number of consecutive registers
301: needed to represent mode MODE in a register of class CLASS. */
302: /* On SPUR, this is the size of MODE in words,
303: except in the FP regs, where a single reg is always enough. */
304: #define CLASS_MAX_NREGS(CLASS, MODE) \
305: ((CLASS) == FP_REGS ? 1 \
306: : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
307:
308: /* Stack layout; function entry, exit and calling. */
309:
310: /* Define this if pushing a word on the stack
311: makes the stack pointer a smaller address. */
312: #define STACK_GROWS_DOWNWARD
313:
314: /* Define this if the nominal address of the stack frame
315: is at the high-address end of the local variables;
316: that is, each additional local variable allocated
317: goes at a more negative offset in the frame. */
318: #define FRAME_GROWS_DOWNWARD
319:
320: /* Offset within stack frame to start allocating local variables at.
321: If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
322: first local allocated. Otherwise, it is the offset to the BEGINNING
323: of the first local allocated. */
324: #define STARTING_FRAME_OFFSET 0
325:
326: /* If we generate an insn to push BYTES bytes,
327: this says how many the stack pointer really advances by.
328: On SPUR, don't define this because there are no push insns. */
329: /* #define PUSH_ROUNDING(BYTES) */
330:
331: /* Offset of first parameter from the argument pointer register value. */
332: #define FIRST_PARM_OFFSET(FNDECL) 0
333:
334: /* Value is 1 if returning from a function call automatically
335: pops the arguments described by the number-of-args field in the call.
336: FUNTYPE is the data type of the function (as a tree),
337: or for a library call it is an identifier node for the subroutine name. */
338:
339: #define RETURN_POPS_ARGS(FUNTYPE) 0
340:
341: /* Define how to find the value returned by a function.
342: VALTYPE is the data type of the value (as a tree).
343: If the precise function being called is known, FUNC is its FUNCTION_DECL;
344: otherwise, FUNC is 0. */
345:
346: /* On SPUR the value is found in the second "output" register. */
347:
348: #define FUNCTION_VALUE(VALTYPE, FUNC) \
349: gen_rtx (REG, TYPE_MODE (VALTYPE), 27)
350:
351: /* But the called function leaves it in the second "input" register. */
352:
353: #define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \
354: gen_rtx (REG, TYPE_MODE (VALTYPE), 11)
355:
356: /* Define how to find the value returned by a library function
357: assuming the value has mode MODE. */
358:
359: #define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, 27)
360:
361: /* 1 if N is a possible register number for a function value
362: as seen by the caller.
363: On SPUR, the first "output" reg is the only register thus used. */
364:
365: #define FUNCTION_VALUE_REGNO_P(N) ((N) == 27)
366:
367: /* 1 if N is a possible register number for function argument passing.
368: On SPUR, these are the "output" registers. */
369:
370: #define FUNCTION_ARG_REGNO_P(N) ((N) < 32 && (N) > 26)
371:
372: /* Define a data type for recording info about an argument list
373: during the scan of that argument list. This data type should
374: hold all necessary information about the function itself
375: and about the args processed so far, enough to enable macros
376: such as FUNCTION_ARG to determine where the next arg should go.
377:
378: On SPUR, this is a single integer, which is a number of words
379: of arguments scanned so far (including the invisible argument,
380: if any, which holds the structure-value-address).
381: Thus 5 or more means all following args should go on the stack. */
382:
383: #define CUMULATIVE_ARGS int
384:
385: /* Initialize a variable CUM of type CUMULATIVE_ARGS
386: for a call to a function whose data type is FNTYPE.
387: For a library call, FNTYPE is 0.
388:
389: On SPUR, the offset normally starts at 0, but starts at 4 bytes
390: when the function gets a structure-value-address as an
391: invisible first argument. */
392:
393: #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE) \
1.1.1.2 root 394: ((CUM) = ((FNTYPE) != 0 && aggregate_value_p ((FNTYPE))))
1.1 root 395:
396: /* Update the data in CUM to advance over an argument
397: of mode MODE and data type TYPE.
398: (TYPE is null for libcalls where that information may not be available.) */
399:
400: #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
401: ((CUM) += ((MODE) != BLKmode \
402: ? (GET_MODE_SIZE (MODE) + 3) / 4 \
403: : (int_size_in_bytes (TYPE) + 3) / 4))
404:
405: /* Determine where to put an argument to a function.
406: Value is zero to push the argument on the stack,
407: or a hard register in which to store the argument.
408:
409: MODE is the argument's machine mode.
410: TYPE is the data type of the argument (as a tree).
411: This is null for libcalls where that information may
412: not be available.
413: CUM is a variable of type CUMULATIVE_ARGS which gives info about
414: the preceding args and about the function being called.
415: NAMED is nonzero if this argument is a named parameter
416: (otherwise it is an extra parameter matching an ellipsis). */
417:
418: /* On SPUR the first five words of args are normally in registers
419: and the rest are pushed. But any arg that won't entirely fit in regs
1.1.1.3 root 420: is pushed. Also, any non-word-aligned structure is pushed. */
1.1 root 421:
422: #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
423: (5 >= ((CUM) \
424: + ((MODE) == BLKmode \
425: ? (int_size_in_bytes (TYPE) + 3) / 4 \
426: : (GET_MODE_SIZE (MODE) + 3) / 4)) \
1.1.1.3 root 427: && ((MODE) != BLKmode || (TYPE_ALIGN ((TYPE)) % 32 == 0)) \
1.1 root 428: ? gen_rtx (REG, (MODE), 27 + (CUM)) \
429: : 0)
430:
431: /* Define where a function finds its arguments.
432: This is different from FUNCTION_ARG because of register windows. */
433:
434: #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
435: (5 >= ((CUM) \
436: + ((MODE) == BLKmode \
437: ? (int_size_in_bytes (TYPE) + 3) / 4 \
438: : (GET_MODE_SIZE (MODE) + 3) / 4)) \
1.1.1.3 root 439: && ((MODE) != BLKmode || (TYPE_ALIGN ((TYPE)) % 32 == 0)) \
1.1 root 440: ? gen_rtx (REG, (MODE), 11 + (CUM)) \
441: : 0)
442:
443: /* For an arg passed partly in registers and partly in memory,
444: this is the number of registers used.
445: For args passed entirely in registers or entirely in memory, zero. */
446:
447: #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
448:
449: /* This macro generates the assembly code for function entry.
450: FILE is a stdio stream to output the code to.
451: SIZE is an int: how many units of temporary storage to allocate.
452: Refer to the array `regs_ever_live' to determine which registers
453: to save; `regs_ever_live[I]' is nonzero if register number I
454: is ever used in the function. This macro is responsible for
455: knowing which registers should not be saved even if used. */
456:
457: /* On spur, move-double insns between fpu and cpu need an 8-byte block
458: of memory. If any fpu reg is used in the function, we allocate
459: such a block here, at the bottom of the frame, just in case it's needed. */
460:
461: #define FUNCTION_PROLOGUE(FILE, SIZE) \
462: { \
463: extern char call_used_regs[]; \
464: extern int current_function_pretend_args_size; \
465: int fsize = ((SIZE) + 7) & ~7; \
466: int nregs, i, fp_used = 0; \
467: for (i = 32, nregs = 0; i < FIRST_PSEUDO_REGISTER; i++) \
468: { \
469: if (regs_ever_live[i] && ! call_used_regs[i]) \
470: nregs++; \
471: if (regs_ever_live[i]) fp_used = 1; \
472: } \
473: if (fp_used) fsize += 8; \
474: fprintf (FILE, "0:\trd_special r24,pc\n"); \
475: fprintf (FILE, "\tand r24,r24,$~0x3\n"); \
476: fprintf (FILE, "\tadd_nt r25,r4,$%d\n", \
477: - current_function_pretend_args_size); \
478: if (fsize + nregs != 0 || current_function_pretend_args_size > 0)\
479: { \
480: int n = - fsize - nregs * 16; \
481: if (n >= -8192) \
482: fprintf (FILE, "\tadd_nt r4,r25,$%d\n", n); \
483: else \
484: { \
485: fprintf (FILE, "\tadd_nt r4,r25,$-8192\n"); \
486: n += 8192; \
487: while (n < -8192) \
488: fprintf (FILE, "\tadd_nt r4,r4,$-8192\n"), n += 8192; \
489: if (n != 0) \
490: fprintf (FILE, "\tadd_nt r4,r4,$%d\n", n); \
491: } \
492: } \
493: for (i = 32, nregs = 0; i < FIRST_PSEUDO_REGISTER; i++) \
494: if (regs_ever_live[i] && ! call_used_regs[i]) \
495: { \
496: fprintf (FILE, "\tst_ext1 %s,r4,$%d\n", \
497: reg_names[i], 8 * nregs++); \
498: fprintf (FILE, "\tst_ext2 %s,r4,$%d\n", \
499: reg_names[i], 8 * nregs++); \
500: } \
501: }
502:
503: /* Output assembler code to FILE to increment profiler label # LABELNO
504: for profiling a function entry. */
505:
506: #define FUNCTION_PROFILER(FILE, LABELNO) \
507: abort ();
508:
509: /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
510: the stack pointer does not matter. The value is tested only in
511: functions that have frame pointers.
512: No definition is equivalent to always zero. */
513:
514: extern int may_call_alloca;
515: extern int current_function_pretend_args_size;
516:
517: #define EXIT_IGNORE_STACK \
518: (get_frame_size () != 0 \
519: || may_call_alloca || current_function_pretend_args_size)
520:
521: /* This macro generates the assembly code for function exit,
522: on machines that need it. If FUNCTION_EPILOGUE is not defined
523: then individual return instructions are generated for each
524: return statement. Args are same as for FUNCTION_PROLOGUE.
525:
526: The function epilogue should not depend on the current stack pointer!
527: It should use the frame pointer only. This is mandatory because
528: of alloca; we also take advantage of it to omit stack adjustments
529: before returning. */
530:
531: #define FUNCTION_EPILOGUE(FILE, SIZE) \
532: { \
533: extern char call_used_regs[]; \
534: extern int may_call_alloca; \
535: extern int current_function_pretend_args_size; \
536: int fsize = ((SIZE) + 7) & ~7; \
537: int nregs, i, fp_used = 0; \
538: for (i = 32, nregs = 0; i < FIRST_PSEUDO_REGISTER; i++) \
539: { \
540: if (regs_ever_live[i] && ! call_used_regs[i]) \
541: nregs++; \
542: if (regs_ever_live[i]) fp_used = 1; \
543: } \
544: if (fp_used) fsize += 8; \
545: if (nregs != 0) \
546: { \
547: fprintf (FILE, "\tadd_nt r4,r25,$%d\n", - fsize - nregs * 16); \
548: for (i = 32, nregs = 0; i < FIRST_PSEUDO_REGISTER; i++) \
549: if (regs_ever_live[i] && ! call_used_regs[i]) \
550: { \
551: fprintf (FILE, "\tld_ext1 %s,r4,$%d\n\tnop\n", \
552: reg_names[i], 8 * nregs++); \
553: fprintf (FILE, "\tld_ext2 %s,r4,$%d\n\tnop\n", \
554: reg_names[i], 8 * nregs++); \
555: } \
556: } \
557: if (fsize != 0 || nregs != 0 || may_call_alloca \
558: || current_function_pretend_args_size > 0) \
559: fprintf (FILE, "\tadd_nt r4,r25,$%d\n", \
560: current_function_pretend_args_size); \
561: fprintf (FILE, "\treturn r10,$8\n\tnop\n"); \
562: }
563:
564: /* If the memory address ADDR is relative to the frame pointer,
565: correct it to be relative to the stack pointer instead.
566: This is for when we don't use a frame pointer.
567: ADDR should be a variable name. */
568:
569: #define FIX_FRAME_POINTER_ADDRESS(ADDR,DEPTH) abort ();
570:
571: /* Addressing modes, and classification of registers for them. */
572:
573: /* #define HAVE_POST_INCREMENT */
574: /* #define HAVE_POST_DECREMENT */
575:
576: /* #define HAVE_PRE_DECREMENT */
577: /* #define HAVE_PRE_INCREMENT */
578:
579: /* Macros to check register numbers against specific register classes. */
580:
581: /* These assume that REGNO is a hard or pseudo reg number.
582: They give nonzero only if REGNO is a hard reg of the suitable class
583: or a pseudo reg currently allocated to a suitable hard reg.
584: Since they use reg_renumber, they are safe only once reg_renumber
585: has been allocated, which happens in local-alloc.c. */
586:
587: #define REGNO_OK_FOR_INDEX_P(REGNO) \
588: ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)
589: #define REGNO_OK_FOR_BASE_P(REGNO) \
590: ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)
591: #define REGNO_OK_FOR_FP_P(REGNO) \
592: (((REGNO) ^ 0x20) < 14 || (unsigned) (reg_renumber[REGNO] ^ 0x20) < 14)
593:
594: /* Now macros that check whether X is a register and also,
595: strictly, whether it is in a specified class.
596:
597: These macros are specific to the SPUR, and may be used only
598: in code for printing assembler insns and in conditions for
599: define_optimization. */
600:
601: /* 1 if X is an fp register. */
602:
603: #define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
604:
605: /* Maximum number of registers that can appear in a valid memory address. */
606:
607: #define MAX_REGS_PER_ADDRESS 2
608:
609: /* Recognize any constant value that is a valid address. */
610:
611: #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)
612:
613: /* Nonzero if the constant value X is a legitimate general operand.
614: It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
615:
616: #define LEGITIMATE_CONSTANT_P(X) \
617: ((GET_CODE (X) == CONST_INT \
618: && (unsigned) (INTVAL (X) + 0x2000) < 0x4000)\
619: || (GET_CODE (X) == SYMBOL_REF && (X)->unchanging))
620:
621: /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
622: and check its validity for a certain class.
623: We have two alternate definitions for each of them.
624: The usual definition accepts all pseudo regs; the other rejects
625: them unless they have been allocated suitable hard regs.
626: The symbol REG_OK_STRICT causes the latter definition to be used.
627:
628: Most source files want to accept pseudo regs in the hope that
629: they will get allocated to the class that the insn wants them to be in.
630: Source files for reload pass need to be strict.
631: After reload, it makes no difference, since pseudo regs have
632: been eliminated by then. */
633:
634: #ifndef REG_OK_STRICT
635:
636: /* Nonzero if X is a hard reg that can be used as an index
637: or if it is a pseudo reg. */
638: #define REG_OK_FOR_INDEX_P(X) (((unsigned) REGNO (X)) - 32 >= 14)
639: /* Nonzero if X is a hard reg that can be used as a base reg
640: or if it is a pseudo reg. */
641: #define REG_OK_FOR_BASE_P(X) (((unsigned) REGNO (X)) - 32 >= 14)
642:
643: #else
644:
645: /* Nonzero if X is a hard reg that can be used as an index. */
646: #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
647: /* Nonzero if X is a hard reg that can be used as a base reg. */
648: #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
649:
650: #endif
651:
652: /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
653: that is a valid memory address for an instruction.
654: The MODE argument is the machine mode for the MEM expression
655: that wants to use this address.
656:
657: On SPUR, the actual legitimate addresses must be REG+SMALLINT or REG+REG.
658: Actually, REG+REG is not legitimate for stores, so
659: it is obtained only by combination on loads.
660: We can treat a SYMBOL_REF as legitimate if it is part of this
661: function's constant-pool, because such addresses can actually
662: be output as REG+SMALLINT. */
663:
664: #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
665: { if (GET_CODE (X) == REG \
666: && REG_OK_FOR_BASE_P (X)) \
667: goto ADDR; \
668: if (GET_CODE (X) == SYMBOL_REF && (X)->unchanging) \
669: goto ADDR; \
670: if (GET_CODE (X) == PLUS \
671: && GET_CODE (XEXP (X, 0)) == REG \
672: && REG_OK_FOR_BASE_P (XEXP (X, 0))) \
673: { \
674: if (GET_CODE (XEXP (X, 1)) == CONST_INT \
675: && INTVAL (XEXP (X, 1)) >= -0x2000 \
676: && INTVAL (XEXP (X, 1)) < 0x2000) \
677: goto ADDR; \
678: } \
679: }
680:
681: /* Try machine-dependent ways of modifying an illegitimate address
682: to be legitimate. If we find one, return the new, valid address.
683: This macro is used in only one place: `memory_address' in explow.c.
684:
685: OLDX is the address as it was before break_out_memory_refs was called.
686: In some cases it is useful to look at this to decide what needs to be done.
687:
688: MODE and WIN are passed so that this macro can use
689: GO_IF_LEGITIMATE_ADDRESS.
690:
691: It is always safe for this macro to do nothing. It exists to recognize
692: opportunities to optimize the output. */
693:
694: /* On SPUR, change REG+N into REG+REG, and REG+(X*Y) into REG+REG. */
695:
696: #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
697: { if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 1))) \
698: (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
699: copy_to_mode_reg (SImode, XEXP (X, 1))); \
700: if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 0))) \
701: (X) = gen_rtx (PLUS, SImode, XEXP (X, 1), \
702: copy_to_mode_reg (SImode, XEXP (X, 0))); \
703: if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == MULT) \
704: (X) = gen_rtx (PLUS, SImode, XEXP (X, 1), \
705: force_operand (XEXP (X, 0), 0)); \
706: if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == MULT) \
707: (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
708: force_operand (XEXP (X, 1), 0)); \
709: if (memory_address_p (MODE, X)) \
710: goto WIN; }
711:
712: /* Go to LABEL if ADDR (a legitimate address expression)
713: has an effect that depends on the machine mode it is used for.
714: On the SPUR this is never true. */
715:
716: #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
717:
718: /* Specify the machine mode that this machine uses
719: for the index in the tablejump instruction. */
720: #define CASE_VECTOR_MODE SImode
721:
722: /* Define this if the tablejump instruction expects the table
723: to contain offsets from the address of the table.
724: Do not define this if the table should contain absolute addresses. */
725: /* #define CASE_VECTOR_PC_RELATIVE */
726:
727: /* Specify the tree operation to be used to convert reals to integers. */
728: #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
729:
730: /* This is the kind of divide that is easiest to do in the general case. */
731: #define EASY_DIV_EXPR TRUNC_DIV_EXPR
732:
733: /* Define this as 1 if `char' should by default be signed; else as 0. */
734: #define DEFAULT_SIGNED_CHAR 0
735:
736: /* Max number of bytes we can move from memory to memory
737: in one reasonably fast instruction. */
738: #define MOVE_MAX 4
739:
740: /* Nonzero if access to memory by bytes is slow and undesirable. */
741: #define SLOW_BYTE_ACCESS 1
742:
743: /* This is BSD, so it wants DBX format. */
744: #define DBX_DEBUGGING_INFO
745:
746: /* Do not break .stabs pseudos into continuations. */
747: #define DBX_CONTIN_LENGTH 0
748:
749: /* Don't try to use the `x' type-cross-reference character in DBX data.
750: Also has the consequence of putting each struct, union or enum
751: into a separate .stabs, containing only cross-refs to the others. */
752: #define DBX_NO_XREFS
753:
754: /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
755: is done just by pretending it is already truncated. */
756: #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
757:
758: /* Specify the machine mode that pointers have.
759: After generation of rtl, the compiler makes no further distinction
760: between pointers and any other objects of this machine mode. */
761: #define Pmode SImode
762:
763: /* A function address in a call instruction
764: is a byte address (for indexing purposes)
765: so give the MEM rtx a byte's mode. */
766: #define FUNCTION_MODE SImode
767:
768: /* Define this if addresses of constant functions
769: shouldn't be put through pseudo regs where they can be cse'd.
770: Desirable on machines where ordinary constants are expensive
771: but a CALL with constant address is cheap. */
772: #define NO_FUNCTION_CSE
773:
774: /* Compute the cost of computing a constant rtl expression RTX
775: whose rtx-code is CODE. The body of this macro is a portion
776: of a switch statement. If the code is computed here,
777: return it with a return statement. Otherwise, break from the switch. */
778:
779: #define CONST_COSTS(RTX,CODE) \
780: case CONST_INT: \
781: if (INTVAL (RTX) < 0x2000 && INTVAL (RTX) >= -0x2000) return 1; \
782: case CONST: \
783: case LABEL_REF: \
784: case SYMBOL_REF: \
785: return 2; \
786: case CONST_DOUBLE: \
787: return 4;
788:
789: /* Tell final.c how to eliminate redundant test instructions. */
790:
791: /* Here we define machine-dependent flags and fields in cc_status
792: (see `conditions.h'). */
793:
794: /* (None are needed on SPUR.) */
795:
796: /* Store in cc_status the expressions
797: that the condition codes will describe
798: after execution of an instruction whose pattern is EXP.
799: Do not alter them if the instruction would not alter the cc's. */
800:
801: /* The SPUR does not really have a condition code. */
802:
803: #define NOTICE_UPDATE_CC(EXP, INSN) \
804: { CC_STATUS_INIT; }
805:
806: /* Control the assembler format that we output. */
807:
808: /* Output at beginning of assembler file. */
809:
810: #define ASM_FILE_START(FILE)
811:
812: /* Output to assembler file text saying following lines
813: may contain character constants, extra white space, comments, etc. */
814:
815: #define ASM_APP_ON ""
816:
817: /* Output to assembler file text saying following lines
818: no longer contain unusual constructs. */
819:
820: #define ASM_APP_OFF ""
821:
822: /* Output before read-only data. */
823:
824: #define TEXT_SECTION_ASM_OP ".text"
825:
826: /* Output before writable data. */
827:
828: #define DATA_SECTION_ASM_OP ".data"
829:
830: /* How to refer to registers in assembler output.
831: This sequence is indexed by compiler's hard-register-number (see above). */
832:
833: #define REGISTER_NAMES \
834: {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", \
835: "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", \
836: "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", \
837: "r30", "r31", \
838: "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", \
839: "f10", "f11", "f12", "f13", "f14" }
840:
841: /* How to renumber registers for dbx and gdb. */
842:
843: #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
844:
845: /* This is how to output the definition of a user-level label named NAME,
846: such as the label on a static function or variable NAME. */
847:
848: #define ASM_OUTPUT_LABEL(FILE,NAME) \
849: do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
850:
851: /* This is how to output a command to make the user-level label named NAME
852: defined for reference from other files. */
853:
854: #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
855: do { fputs (".globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
856:
857: /* This is how to output a reference to a user-level label named NAME.
858: `assemble_name' uses this. */
859:
860: #define ASM_OUTPUT_LABELREF(FILE,NAME) \
861: fprintf (FILE, "_%s", NAME)
862:
863: /* This is how to output an internal numbered label where
864: PREFIX is the class of label and NUM is the number within the class. */
865:
866: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
867: fprintf (FILE, "%s%d:\n", PREFIX, NUM)
868:
869: /* This is how to store into the string LABEL
870: the symbol_ref name of an internal numbered label where
871: PREFIX is the class of label and NUM is the number within the class.
872: This is suitable for output with `assemble_name'. */
873:
874: #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
875: sprintf (LABEL, "*%s%d", PREFIX, NUM)
876:
877: /* This is how to output an assembler line defining a `double' constant. */
878:
879: #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
880: fprintf (FILE, "\t.double %.20e\n", (VALUE))
881:
882: /* This is how to output an assembler line defining a `float' constant. */
883:
884: #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
885: fprintf (FILE, "\t.single %.12e\n", (VALUE))
886:
887: /* This is how to output an assembler line defining an `int' constant. */
888:
889: #define ASM_OUTPUT_INT(FILE,VALUE) \
890: ( fprintf (FILE, "\t.long "), \
891: output_addr_const (FILE, (VALUE)), \
892: fprintf (FILE, "\n"))
893:
894: /* Likewise for `char' and `short' constants. */
895:
896: #define ASM_OUTPUT_SHORT(FILE,VALUE) \
897: ( fprintf (FILE, "\t.word "), \
898: output_addr_const (FILE, (VALUE)), \
899: fprintf (FILE, "\n"))
900:
901: #define ASM_OUTPUT_CHAR(FILE,VALUE) \
902: ( fprintf (FILE, "\t.byte "), \
903: output_addr_const (FILE, (VALUE)), \
904: fprintf (FILE, "\n"))
905:
906: /* This is how to output an assembler line for a numeric constant byte. */
907:
908: #define ASM_OUTPUT_BYTE(FILE,VALUE) \
909: fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
910:
911: /* This is how to output code to push a register on the stack.
912: It need not be very fast code. */
913:
914: #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
915: fprintf (FILE, "\tadd_nt r4,r4,$-4\n\tst_32 %s,r4,$0\n", reg_names[REGNO])
916:
917: /* This is how to output an insn to pop a register from the stack.
918: It need not be very fast code. */
919:
920: #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
921: fprintf (FILE, "\tld_32 %s,r4,$0\n\tadd_nt r4,r4,$4\n", reg_names[REGNO])
922:
923: /* This is how to output an element of a case-vector that is absolute. */
924:
925: #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
926: fprintf (FILE, "\t.long L%d\n", VALUE)
927:
928: /* This is how to output an element of a case-vector that is relative.
929: (SPUR does not use such vectors,
930: but we must define this macro anyway.) */
931:
932: #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
933: fprintf (FILE, "\t.word L%d-L%d\n", VALUE, REL)
934:
935: /* This is how to output an assembler line
936: that says to advance the location counter
937: to a multiple of 2**LOG bytes. */
938:
939: #define ASM_OUTPUT_ALIGN(FILE,LOG) \
940: if ((LOG) != 0) \
941: fprintf (FILE, "\t.align %d\n", (LOG))
942:
943: #define ASM_OUTPUT_SKIP(FILE,SIZE) \
1.1.1.3 root 944: fprintf (FILE, "\t.space %u\n", (SIZE))
1.1 root 945:
946: /* This says how to output an assembler line
947: to define a global common symbol. */
948:
949: #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
950: ( fputs (".comm ", (FILE)), \
951: assemble_name ((FILE), (NAME)), \
1.1.1.3 root 952: fprintf ((FILE), ",%u\n", (ROUNDED)))
1.1 root 953:
954: /* This says how to output an assembler line
955: to define a local common symbol. */
956:
957: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
958: ( fputs (".lcomm ", (FILE)), \
959: assemble_name ((FILE), (NAME)), \
1.1.1.3 root 960: fprintf ((FILE), ",%u\n", (ROUNDED)))
1.1 root 961:
962: /* Store in OUTPUT a string (made with alloca) containing
963: an assembler-name for a local static variable named NAME.
964: LABELNO is an integer which is different for each call. */
965:
966: #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
967: ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
968: sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
969:
970: /* Define the parentheses used to group arithmetic operations
971: in assembler code. */
972:
973: #define ASM_OPEN_PAREN "("
974: #define ASM_CLOSE_PAREN ")"
975:
976: /* Define results of standard character escape sequences. */
977: #define TARGET_BELL 007
978: #define TARGET_BS 010
979: #define TARGET_TAB 011
980: #define TARGET_NEWLINE 012
981: #define TARGET_VT 013
982: #define TARGET_FF 014
983: #define TARGET_CR 015
984:
985: /* Print operand X (an rtx) in assembler syntax to file FILE.
986: CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
987: For `%' followed by punctuation, CODE is the punctuation and X is null.
988:
989: On SPUR, the CODE can be `r', meaning this is a register-only operand
990: and an immediate zero should be represented as `r0'. */
991:
992: #define PRINT_OPERAND(FILE, X, CODE) \
993: { if (GET_CODE (X) == REG) \
994: fprintf (FILE, "%s", reg_names[REGNO (X)]); \
995: else if (GET_CODE (X) == MEM) \
996: output_address (XEXP (X, 0)); \
997: else if (GET_CODE (X) == CONST_DOUBLE) \
998: abort (); \
999: else if ((CODE) == 'r' && (X) == const0_rtx) \
1000: fprintf (FILE, "r0"); \
1001: else { putc ('$', FILE); output_addr_const (FILE, X); }}
1002:
1003: /* Print a memory address as an operand to reference that memory location. */
1004:
1005: #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
1006: { register rtx base, index = 0; \
1007: int offset = 0; \
1008: register rtx addr = ADDR; \
1009: if (GET_CODE (addr) == REG) \
1010: { \
1011: fprintf (FILE, "%s,$0", reg_names[REGNO (addr)]); \
1012: } \
1013: else if (GET_CODE (addr) == PLUS) \
1014: { \
1015: if (GET_CODE (XEXP (addr, 0)) == CONST_INT) \
1016: offset = INTVAL (XEXP (addr, 0)), base = XEXP (addr, 1);\
1017: else if (GET_CODE (XEXP (addr, 1)) == CONST_INT) \
1018: offset = INTVAL (XEXP (addr, 1)), base = XEXP (addr, 0);\
1019: else \
1020: base = XEXP (addr, 0), index = XEXP (addr, 1); \
1021: fprintf (FILE, "%s,", reg_names[REGNO (base)]); \
1022: if (index == 0) \
1023: fprintf (FILE, "$%d", offset); \
1024: else \
1025: fprintf (FILE, "%s,", reg_names[REGNO (index)]); \
1026: } \
1027: else \
1028: { \
1029: fprintf (FILE, "r24,$("); \
1030: output_addr_const (FILE, addr); \
1031: fprintf (FILE, "-0b)"); \
1032: } \
1033: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.