|
|
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 distributed in the hope that it will be useful,
7: but WITHOUT ANY WARRANTY. No author or distributor
8: accepts responsibility to anyone for the consequences of using it
9: or for whether it serves any particular purpose or works at all,
10: unless he says so in writing. Refer to the GNU CC General Public
11: License for full details.
12:
13: Everyone is granted permission to copy, modify and redistribute
14: GNU CC, but only under the conditions described in the
15: GNU CC General Public License. A copy of this license is
16: supposed to have been given to you along with GNU CC so you
17: can know your rights and responsibilities. It should be in a
18: file named COPYING. Among other things, the copyright notice
19: and this notice must be preserved on all copies. */
20:
21:
22: /* Note that some other tm- files include this one and then override
23: many of the definitions that relate to assembler syntax. */
24:
25:
26: /* Names to predefine in the preprocessor for this target machine. */
27:
28: #define CPP_PREDEFINES "-Dspur"
29:
30: /* Print subsidiary information on the compiler version in use. */
1.1.1.6 ! root 31: #define TARGET_VERSION fprintf (stderr, " (spur)");
1.1 root 32:
33: /* Run-time compilation parameters selecting different hardware subsets.
34:
35: On the SPUR, we don't yet need any. */
36:
37: extern int target_flags;
38:
39: /* Nonzero if we should generate code to use the fpu. */
40: #define TARGET_FPU (target_flags & 1)
41:
1.1.1.5 root 42: /* Nonzero if we should expand constant shifts into series of shift
43: instructions. */
44: #define TARGET_EXPAND_SHIFTS (target_flags & 2)
45:
46: /* Nonzero if we should generate long jumps for compares. */
47: #define TARGET_LONG_JUMPS (target_flags & 4)
48:
1.1 root 49: /* Macro to define tables used to set the flags.
50: This is a list in braces of pairs in braces,
51: each pair being { "NAME", VALUE }
52: where VALUE is the bits to set or minus the bits to clear.
53: An empty string NAME is used to identify the default VALUE. */
54:
55: #define TARGET_SWITCHES \
56: { {"fpu", 1}, \
57: {"soft-float", -1}, \
1.1.1.5 root 58: {"expand-shifts", 2}, \
59: {"lib-shifts", -2}, \
60: {"long-jumps", 4}, \
61: {"short-jumps", -4}, \
1.1 root 62: { "", TARGET_DEFAULT}}
63:
64: #define TARGET_DEFAULT 0
65:
66: /* target machine storage layout */
67:
68: /* Define this if most significant bit is lowest numbered
69: in instructions that operate on numbered bit-fields.
70: This is a moot question on the SPUR due to the lack of bit-field insns. */
71: /* #define BITS_BIG_ENDIAN */
72:
73: /* Define this if most significant byte of a word is the lowest numbered. */
74: /* That is not true on SPUR. */
75: /* #define BYTES_BIG_ENDIAN */
76:
77: /* Define this if most significant word of a multiword number is numbered. */
78: /* For SPUR we can decide arbitrarily
79: since there are no machine instructions for them. */
80: /* #define WORDS_BIG_ENDIAN */
81:
82: /* number of bits in an addressible storage unit */
83: #define BITS_PER_UNIT 8
84:
85: /* Width in bits of a "word", which is the contents of a machine register.
86: Note that this is not necessarily the width of data type `int';
87: if using 16-bit ints on a 68000, this would still be 32.
88: But on a machine with 16-bit registers, this would be 16. */
89: #define BITS_PER_WORD 32
90:
91: /* Width of a word, in units (bytes). */
92: #define UNITS_PER_WORD 4
93:
94: /* Width in bits of a pointer.
95: See also the macro `Pmode' defined below. */
96: #define POINTER_SIZE 32
97:
98: /* Allocation boundary (in *bits*) for storing pointers in memory. */
99: #define POINTER_BOUNDARY 32
100:
101: /* Allocation boundary (in *bits*) for storing arguments in argument list. */
102: #define PARM_BOUNDARY 64
103:
104: /* Boundary (in *bits*) on which stack pointer should be aligned. */
105: #define STACK_BOUNDARY 64
106:
107: /* Allocation boundary (in *bits*) for the code of a function. */
108: #define FUNCTION_BOUNDARY 32
109:
110: /* Alignment of field after `int : 0' in a structure. */
111: #define EMPTY_FIELD_BOUNDARY 32
112:
113: /* Every structure's size must be a multiple of this. */
114: #define STRUCTURE_SIZE_BOUNDARY 32
115:
116: /* No data type wants to be aligned rounder than this. */
117: #define BIGGEST_ALIGNMENT 64
118:
119: /* Define this if move instructions will actually fail to work
120: when given unaligned data. */
121: #define STRICT_ALIGNMENT
122:
123: /* Standard register usage. */
124:
125: /* Number of actual hardware registers.
126: The hardware registers are assigned numbers for the compiler
127: from 0 to just below FIRST_PSEUDO_REGISTER.
128: All registers that the compiler knows about must be given numbers,
129: even those that are not normally considered general registers.
130:
131: SPUR has 32 fullword registers and 15 floating point registers. */
132:
133: #define FIRST_PSEUDO_REGISTER 47
134:
135: /* 1 for registers that have pervasive standard uses
136: and are not available for the register allocator.
137: On SPUR, this includes all the global registers
138: and the callee return address register. */
139: #define FIXED_REGISTERS \
140: {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
141: 1, 0, 0, 0, 0, 0, \
142: 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, \
143: 1, 0, 0, 0, 0, 0, \
144: 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
145:
146: /* 1 for registers not available across function calls.
147: These must include the FIXED_REGISTERS and also any
148: registers that can be used without being saved.
149: The latter must include the registers where values are returned
150: and the register where structure-value addresses are passed.
151: Aside from that, you can include as many other registers as you like. */
152: #define CALL_USED_REGISTERS \
153: {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
154: 1, 0, 0, 0, 0, 0, \
155: 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, \
156: 1, 1, 1, 1, 1, 1, \
157: 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0}
158:
159: /* Return number of consecutive hard regs needed starting at reg REGNO
160: to hold something of mode MODE.
161: This is ordinarily the length in words of a value of mode MODE
162: but can be less for certain modes in special long registers.
163:
164: On SPUR, ordinary registers hold 32 bits worth;
165: a single floating point register is always enough for
166: anything that can be stored in them at all. */
167: #define HARD_REGNO_NREGS(REGNO, MODE) \
168: ((REGNO) >= 32 ? 1 \
169: : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
170:
171: /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
172: On SPUR, the cpu registers can hold any mode but the float registers
173: can hold only SFmode or DFmode. And they can't hold anything if use
174: of hardware floating point is disabled. */
175: #define HARD_REGNO_MODE_OK(REGNO, MODE) \
176: (((REGNO) < 32 && (GET_MODE_SIZE (MODE) <= 4 || (REGNO) < 31)) \
177: || (TARGET_FPU && ((MODE) == SFmode || (MODE) == DFmode)))
178:
179: /* Value is 1 if it is a good idea to tie two pseudo registers
180: when one has mode MODE1 and one has mode MODE2.
181: If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
182: for any hard reg, then this must be 0 for correct output. */
183: #define MODES_TIEABLE_P(MODE1, MODE2) \
184: (((MODE1) == SFmode || (MODE1) == DFmode) \
185: == ((MODE2) == SFmode || (MODE2) == DFmode))
186:
187: /* Specify the registers used for certain standard purposes.
188: The values of these macros are register numbers. */
189:
190: /* SPUR pc isn't overloaded on a register that the compiler knows about. */
191: /* #define PC_REGNUM */
192:
193: /* Register to use for pushing function arguments. */
194: #define STACK_POINTER_REGNUM 4
195:
196: /* Base register for access to local variables of the function. */
197: #define FRAME_POINTER_REGNUM 25
198:
199: /* Value should be nonzero if functions must have frame pointers.
200: Zero means the frame pointer need not be set up (and parms
201: may be accessed via the stack pointer) in functions that seem suitable.
202: This is computed in `reload', in reload1.c. */
203: #define FRAME_POINTER_REQUIRED 1
204:
205: /* Base register for access to arguments of the function. */
206: #define ARG_POINTER_REGNUM 25
207:
208: /* Register in which static-chain is passed to a function. */
209: /* ??? */
210: #define STATIC_CHAIN_REGNUM 8
211:
212: /* Register in which address to store a structure value
213: is passed to a function. */
214: #define STRUCT_VALUE_REGNUM 27
215: #define STRUCT_VALUE_INCOMING_REGNUM 11
216:
217: /* Define the classes of registers for register constraints in the
218: machine description. Also define ranges of constants.
219:
220: One of the classes must always be named ALL_REGS and include all hard regs.
221: If there is more than one class, another class must be named NO_REGS
222: and contain no registers.
223:
224: The name GENERAL_REGS must be the name of a class (or an alias for
225: another name such as ALL_REGS). This is the class of registers
226: that is allowed by "g" or "r" in a register constraint.
227: Also, registers outside this class are allocated only when
228: instructions express preferences for them.
229:
230: The classes must be numbered in nondecreasing order; that is,
231: a larger-numbered class must never be contained completely
232: in a smaller-numbered class.
233:
234: For any two classes, it is very desirable that there be another
235: class that represents their union. */
236:
237: /* The 68000 has two kinds of registers, hence four classes. */
238:
239: enum reg_class { NO_REGS, GENERAL_REGS, FP_REGS, ALL_REGS, LIM_REG_CLASSES };
240:
241: #define N_REG_CLASSES (int) LIM_REG_CLASSES
242:
243: /* Give names of register classes as strings for dump file. */
244:
245: #define REG_CLASS_NAMES \
246: {"NO_REGS", "GENERAL_REGS", "FP_REGS", "ALL_REGS" }
247:
248: /* Define which registers fit in which classes.
249: This is an initializer for a vector of HARD_REG_SET
250: of length N_REG_CLASSES. */
251:
252: #define REG_CLASS_CONTENTS {{0, 0}, {-1, 0}, {0, 0x7fff}, {-1, 0x7fff}}
253:
254: /* The same information, inverted:
255: Return the class number of the smallest class containing
256: reg number REGNO. This could be a conditional expression
257: or could index an array. */
258:
259: #define REGNO_REG_CLASS(REGNO) \
260: ((REGNO) >= 32 ? FP_REGS : GENERAL_REGS)
261:
262: /* The class value for index registers, and the one for base regs. */
263: #define INDEX_REG_CLASS GENERAL_REGS
264: #define BASE_REG_CLASS GENERAL_REGS
265:
266: /* Get reg_class from a letter such as appears in the machine description. */
267:
268: #define REG_CLASS_FROM_LETTER(C) \
269: ((C) == 'f' ? FP_REGS : NO_REGS)
270:
271: /* The letters I, J, K, L and M in a register constraint string
272: can be used to stand for particular ranges of immediate operands.
273: This macro defines what the ranges are.
274: C is the letter, and VALUE is a constant value.
275: Return 1 if VALUE is in the range specified by C.
276:
277: For SPUR, `I' is used for the range of constants an insn
278: can actually contain.
279: `J' is used for the range which is just zero (since that is R0).
280: `K' is used for the 5-bit operand of a compare insns. */
281:
282: #define CONST_OK_FOR_LETTER_P(VALUE, C) \
283: ((C) == 'I' ? (unsigned) ((VALUE) + 0x2000) < 0x4000 \
284: : (C) == 'J' ? (VALUE) == 0 \
285: : (C) == 'K' ? (unsigned) (VALUE) < 0x20 \
286: : 0)
287:
288: /* Similar, but for floating constants, and defining letters G and H.
289: Here VALUE is the CONST_DOUBLE rtx itself. */
290:
291: #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
292: ((C) == 'G' && XINT (VALUE, 0) == 0 && XINT (VALUE, 1) == 0)
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. */
1.1.1.4 root 332: #define FIRST_PARM_OFFSET(FNDECL) 0
1.1 root 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) \
394: ((CUM) = ((FNTYPE) != 0 && TYPE_MODE (TREE_TYPE (FNTYPE)) == BLKmode))
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
420: is pushed. */
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)) \
427: ? gen_rtx (REG, (MODE), 27 + (CUM)) \
428: : 0)
429:
430: /* Define where a function finds its arguments.
431: This is different from FUNCTION_ARG because of register windows. */
432:
433: #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
434: (5 >= ((CUM) \
435: + ((MODE) == BLKmode \
436: ? (int_size_in_bytes (TYPE) + 3) / 4 \
437: : (GET_MODE_SIZE (MODE) + 3) / 4)) \
438: ? gen_rtx (REG, (MODE), 11 + (CUM)) \
439: : 0)
440:
441: /* For an arg passed partly in registers and partly in memory,
442: this is the number of registers used.
443: For args passed entirely in registers or entirely in memory, zero. */
444:
445: #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
446:
447: /* This macro generates the assembly code for function entry.
448: FILE is a stdio stream to output the code to.
449: SIZE is an int: how many units of temporary storage to allocate.
450: Refer to the array `regs_ever_live' to determine which registers
451: to save; `regs_ever_live[I]' is nonzero if register number I
452: is ever used in the function. This macro is responsible for
453: knowing which registers should not be saved even if used. */
454:
455: /* On spur, move-double insns between fpu and cpu need an 8-byte block
456: of memory. If any fpu reg is used in the function, we allocate
457: such a block here, at the bottom of the frame, just in case it's needed. */
458:
459: #define FUNCTION_PROLOGUE(FILE, SIZE) \
460: { \
461: static char *reg_names[] = REGISTER_NAMES; \
462: extern char call_used_regs[]; \
463: extern int current_function_pretend_args_size; \
464: int fsize = ((SIZE) + 7) & ~7; \
465: int nregs, i, fp_used = 0; \
466: for (i = 32, nregs = 0; i < FIRST_PSEUDO_REGISTER; i++) \
467: { \
468: if (regs_ever_live[i] && ! call_used_regs[i]) \
469: nregs++; \
470: if (regs_ever_live[i]) fp_used = 1; \
471: } \
472: if (fp_used) fsize += 8; \
473: fprintf (FILE, "0:\trd_special r24,pc\n"); \
1.1.1.5 root 474: fprintf (FILE, "\tand r24,r24,$~0x3\n"); \
1.1 root 475: fprintf (FILE, "\tadd_nt r25,r4,$%d\n", \
476: - current_function_pretend_args_size); \
1.1.1.5 root 477: if (fsize + nregs != 0 || current_function_pretend_args_size > 0)\
478: { \
479: int n = - fsize - nregs * 16; \
480: if (n >= -8192) \
481: fprintf (FILE, "\tadd_nt r4,r25,$%d\n", n); \
482: else \
483: { \
484: fprintf (FILE, "\tadd_nt r4,r25,$-8192\n"); \
485: n += 8192; \
486: while (n < -8192) \
487: fprintf (FILE, "\tadd_nt r4,r4,$-8192\n"), n += 8192; \
488: if (n != 0) \
489: fprintf (FILE, "\tadd_nt r4,r4,$%d\n", n); \
490: } \
491: } \
1.1 root 492: for (i = 32, nregs = 0; i < FIRST_PSEUDO_REGISTER; i++) \
493: if (regs_ever_live[i] && ! call_used_regs[i]) \
494: { \
495: fprintf (FILE, "\tst_ext1 %s,r4,$%d\n", \
496: reg_names[i], 8 * nregs++); \
497: fprintf (FILE, "\tst_ext2 %s,r4,$%d\n", \
498: reg_names[i], 8 * nregs++); \
499: } \
500: }
501:
502: /* Output assembler code to FILE to increment profiler label # LABELNO
503: for profiling a function entry. */
504:
505: #define FUNCTION_PROFILER(FILE, LABELNO) \
506: abort ();
507:
508: /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
509: the stack pointer does not matter. The value is tested only in
510: functions that have frame pointers.
511: No definition is equivalent to always zero. */
512:
513: extern int may_call_alloca;
514: extern int current_function_pretend_args_size;
515:
516: #define EXIT_IGNORE_STACK \
517: (get_frame_size () != 0 \
518: || may_call_alloca || current_function_pretend_args_size)
519:
520: /* This macro generates the assembly code for function exit,
521: on machines that need it. If FUNCTION_EPILOGUE is not defined
522: then individual return instructions are generated for each
523: return statement. Args are same as for FUNCTION_PROLOGUE.
524:
525: The function epilogue should not depend on the current stack pointer!
526: It should use the frame pointer only. This is mandatory because
527: of alloca; we also take advantage of it to omit stack adjustments
528: before returning. */
529:
530: #define FUNCTION_EPILOGUE(FILE, SIZE) \
531: { \
532: static char *reg_names[] = REGISTER_NAMES; \
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:
1.1.1.5 root 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
1.1 root 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:
1.1.1.2 root 743: /* This is BSD, so it wants DBX format. */
744: #define DBX_DEBUGGING_INFO
745:
1.1 root 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:
1.1.1.5 root 803: #define NOTICE_UPDATE_CC(EXP, INSN) \
1.1 root 804: { CC_STATUS_INIT; }
805:
806: /* Control the assembler format that we output. */
807:
808: /* Output at beginning of assembler file. */
809:
1.1.1.2 root 810: #define ASM_FILE_START(FILE)
1.1 root 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:
1.1.1.5 root 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:
1.1 root 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) \
944: fprintf (FILE, "\t.space %d\n", (SIZE))
945:
946: /* This says how to output an assembler line
947: to define a global common symbol. */
948:
1.1.1.3 root 949: #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
1.1 root 950: ( fputs (".comm ", (FILE)), \
951: assemble_name ((FILE), (NAME)), \
1.1.1.3 root 952: fprintf ((FILE), ",%d\n", (ROUNDED)))
1.1 root 953:
954: /* This says how to output an assembler line
955: to define a local common symbol. */
956:
1.1.1.3 root 957: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
1.1 root 958: ( fputs (".lcomm ", (FILE)), \
959: assemble_name ((FILE), (NAME)), \
1.1.1.3 root 960: fprintf ((FILE), ",%d\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_name [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_name [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_name [REGNO (base)]); \
1022: if (index == 0) \
1023: fprintf (FILE, "$%d", offset); \
1024: else \
1025: fprintf (FILE, "%s,", reg_name [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.